Multi-value returns in Ion wasm compiler
Categories
(Core :: JavaScript: WebAssembly, enhancement, P2)
Tracking
()
People
(Reporter: wingo, Assigned: wingo)
References
Details
Multi-value function returns are mostly done in the baseline compiler (see bug 1603140). Now to be able to test things we should add support for the Ion compiler. However I am less sure how represent things.
There seem to be two separate issues: how to represent stack results, and how to represent register results.
For register results, we could change to make MWasmCall MIR node not define any values. Instead add MWasmRegisterResult that extracts a register result. We would simplify LIR to not have the various LWasmCall nodes specialized on return type, instead replacing with LIR representations of result values with fixed allocations.
The advantage would be that we preserve the ability to have multiple register results. The disadvantage is that it would be a bit of churn. We could leave it as-is and assert that there's only ever one register result.
For stack results, I guess a least-effort approach would be to add a MWasmStackResults node that indicates reserved stack space for results, and to pass this as a synthetic additional argument to MWasmCall instances, if there are stack results. Then after the call we can extract values as MWasmStackResult or so.
WDYT? *
[Y = y'all]
Assignee | ||
Comment 1•5 years ago
|
||
bbouvier mentions that for stack results, we can probably use whatever machinery is there for loading from the stack.
Assignee | ||
Comment 2•5 years ago
|
||
All done!
Description
•