Closed Bug 1730188 Opened 3 months ago Closed 3 months ago

Improve JS type reflection proposal

Categories

(Core :: Javascript: WebAssembly, task, P3)

task

Tracking

()

RESOLVED FIXED
94 Branch
Tracking Status
firefox94 --- fixed

People

(Reporter: rhunt, Assigned: rhunt)

References

Details

Attachments

(5 files)

Was re-reviewing this code and have some misc fixes.

  • OOM handling
  • WA.Function constructor has name of 'WasmFunction'
  • WA.Table.proto.type returns TableRepr and not RefType
  • WA.Function constructor asserts but doesn't check for non-WA.Function input

The name of WA.Function constructor is "WasmFunction", but should
be "Function".

We should report the precise RefType that a table has, not the
flattened TableRepr.

Depends on D125225

The type() method implementations didn't accurately report OOM's
upon allocation failure. A drive by fix was done to make the
ValTypesToArray method idiomatic and return the array instead of
defining it upon a properties array. Some potential rooting issues
were also addressed.

Depends on D125226

The input function to WA.Function is currently restricted to not
be an exported wasm function. This is being debated in the proposal,
but is currently being asserted in our code and so should be checked
for explicitly.

In addition, some OOM checking, standardized naming, and general
cleanup was added to WA.Function.

Depends on D125227

Module.imports/exports gives reflection of the imports and exports
of a module. We had a non-standard .signature property for function
types that is now superseded with the JS-type proposal [1].

The implementation of creating a type object for the various kinds
of definitions had to be refactored to be shared.

[1] https://github.com/WebAssembly/js-types/issues/19

Depends on D125228

Pushed by rhunt@eqrion.net:
https://hg.mozilla.org/integration/autoland/rev/64e7d6e00c8a
wasm: Fix WA.Function constructor name. r=lth
https://hg.mozilla.org/integration/autoland/rev/86b39494212e
wasm: Fix Table.type method to report type as RefType instead of TableRepr. r=lth
https://hg.mozilla.org/integration/autoland/rev/5c3b5a307381
wasm: Fix type() method implementations for OOM safety. r=lth
https://hg.mozilla.org/integration/autoland/rev/ff58a6be4b4d
wasm: Check input function to WA.Function constructor. r=lth
https://hg.mozilla.org/integration/autoland/rev/2bed6e1ca974
wasm: Extend import/export reflection with types. r=lth

Backed out for causing spidermonkey bustages on WasmJS.cpp

Flags: needinfo?(rhunt)

Forgot a DebugOnly<T> wrapper.

Flags: needinfo?(rhunt)
Pushed by rhunt@eqrion.net:
https://hg.mozilla.org/integration/autoland/rev/83fbc7aed06b
wasm: Fix WA.Function constructor name. r=lth
https://hg.mozilla.org/integration/autoland/rev/1309f4739dfc
wasm: Fix Table.type method to report type as RefType instead of TableRepr. r=lth
https://hg.mozilla.org/integration/autoland/rev/c072c96cc349
wasm: Fix type() method implementations for OOM safety. r=lth
https://hg.mozilla.org/integration/autoland/rev/435e207844d7
wasm: Check input function to WA.Function constructor. r=lth
https://hg.mozilla.org/integration/autoland/rev/91e0c6d26de8
wasm: Extend import/export reflection with types. r=lth
You need to log in before you can comment on or make changes to this bug.