Closed Bug 1508560 Opened 6 years ago Closed 5 years ago

Remaining anyref-related stubs work

Categories

(Core :: JavaScript: WebAssembly, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: lth, Assigned: lth)

References

Details

There are several cases in WasmStubs.cpp that crash on encountering AnyRef; these must be implemented properly.
This will also entail removing "temporarilyUnsupportedAnyRef()" everywhere.
See Also: → 1532556
Assignee: nobody → lhansen
Status: NEW → ASSIGNED
Priority: P2 → P3

(Notes to self)

I guess the JS->Wasm and Wasm->JS and Wasm->wasm paths are independent here, more or less.

For the JS->Wasm path, MCallOptimize inserts explicit conversion nodes, pretty much mirroring what the slow path in WasmInstance::callExport does. Generalized to anyref it would also insert an UnboxAnyRef at the return path when appropriate, which callExport also does. But there's still stub code (GenerateJitEntry) that massages input values, which is a little surprising, and then adapts to the register and stack conventions of wasm and makes the call. So maybe this is for general jit code calling wasm but when types or other information are unknown.

For the Wasm->JS path, we have callImport_anyref and its workhorse callImport (in WasmInstance.cpp); these lead directly up into the stubs territory and there's a lot of hair here.

For the Wasm->Wasm path there isn't much magic going on that we have to worry about, the call goes straight through on a fast path and there's neither boxing nor unboxing.

(Generally speaking, temporarilyUnsupportedAnyRef() should become either temporarilyUnsupportedRef() -- since we'll handle anyref properly but not other reftypes, which are complicated in a different way in that they don't require boxing/unboxing but they do require type checks -- or possibly it could be specialized into various functions that guard against optimization along various call paths, since i64 is also unsupported on the js<->wasm boundary at the moment. Though probably not for long.)

See Also: → 1581572

This has been fixed, actually; there's optimization work remaining, but that's adequately covered by bug 1532556, or can be spun off from it.

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.