Implement wasm->js multi-value calls
Categories
(Core :: JavaScript: WebAssembly, enhancement, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox76 | --- | fixed |
People
(Reporter: wingo, Assigned: wingo)
References
Details
Attachments
(1 file)
The patch to be attached will let wasm modules import JS functions that return multiple values.
Spec here: https://webassembly.github.io/multi-value/js-api/index.html#exported-function-exotic-objects
Specifically, I paste some contents inline here:
To run a host function from the JavaScript object func, type functype, and list of WebAssembly values arguments, perform the following steps:
- Let
[parameters] → [results]
be functype. - Let ret be ? Call(func, undefined, jsArguments).
- If results is empty, return « ».
- Otherwise, if results’s size is 1, return « ? ToWebAssemblyValue(ret,
results[0]
) ». - Otherwise:
- Let method be ? GetMethod(ret, @@iterator).
- If method is undefined, throw a TypeError.
- Let values be ? IterableToList(ret, method).
- Let wasmValues be a new, empty list.
- If values and results do not have the same length, throw a TypeError.
- For each value and resultType in values and results, paired linearly, append ToWebAssemblyValue(value, resultType) to wasmValues.
- Return wasmValues.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
This patch implements calls from WebAssembly to JS, where the JS
function returns multiple values. The multiple values are returned as
an iterable.
Spec here:
https://webassembly.github.io/multi-value/js-api/index.html#exported-function-exotic-objects
Updated•5 years ago
|
Pushed by shindli@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5bd28470648f Implement wasm->js multi-value calls r=lth
Comment 3•5 years ago
|
||
Backed out changeset 5bd28470648f (Bug 1622828) for linux build bustages CLOSED TREE
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=295602693&repo=autoland&lineNumber=7125
Backout by shindli@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/746cfdd2c4d5 Backed out changeset 5bd28470648f for linux build bustages CLOSED TREE
Pushed by shindli@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5c02a3e6d56e Implement wasm->js multi-value calls r=lth
Comment 6•5 years ago
|
||
Backed out for build bustages.
Push with failure: https://treeherder.mozilla.org/#/jobs?repo=autoland&selectedJob=295618032&resultStatus=testfailed%2Cbusted%2Cexception&revision=5c02a3e6d56e78a513a67ad7c6119062c81a72a3
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=295618032&repo=autoland&lineNumber=4522
Backout: https://hg.mozilla.org/integration/autoland/rev/dc1c34d3f21b9a0ee12ac53c7db1a75804c21feb
Pushed by rgurzau@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4f66cfb5d2f2 Implement wasm->js multi-value calls r=lth
Assignee | ||
Updated•5 years ago
|
Comment 8•5 years ago
|
||
bugherder |
Description
•