Closed Bug 1603140 Opened 5 years ago Closed 5 years ago

Multi-value returns in baseline wasm compiler

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: wingo, Assigned: wingo)

References

Details

Attachments

(2 files)

The attached patch will start adding support for multi-value returns in the baseline wasm compiler.

This patch implements one half of support for multi-value returns in the
baseline compiler.

The idea is that when you have a function that has stack return values,
it will receive an additional synthetic argument: a pointer to the stack
results area. The layout of this area is the same as that understood by
BaseCompiler::pushBlockResults.

When compiling a function that has stack results, the stack result area
pointer will come in either in a register or on the stack. If it's on
the stack we record that offset and will load a pointer at that offset
when returning values. If the pointer is in a register, it gets spilled
to the stack after the spilled copies of previous register arguments.

When calling a function that has multiple return values, we bump the
stack pointer and pass an additional argument to the callee: the pointer
to that stack area. After the call, in the baseline compiler, it may be
that we need to shuffle any stack results down, because incoming
arguments are consumed by the call.

Note that support for actually returning multiple values is not yet
implemented in this patch; we're just adding infra. Also note that Ion
support isn't there yet either. However all tests pass, because no
FuncType that has more than one result gets past the validator.

Priority: -- → P2

This commit enables multi-value returns in baseline-to-baseline calls.

Pushed by ncsoregi@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/69e62c1d0d53 Multi-value returns in baseline wasm compiler r=lth

Backed out for bustage on WasmBaselineCompile.cpp

backout: https://hg.mozilla.org/integration/autoland/rev/e51924303b7b1ad280aca7eeded02b3fb690df4f

push: https://treeherder.mozilla.org/#/jobs?repo=autoland&group_state=expanded&revision=69e62c1d0d539a951f49e0ff967ae2392d161c2c&selectedJob=281382275

failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=281382275&repo=autoland&lineNumber=5198

[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - In file included from Unified_cpp_js_src_wasm0.cpp:11:
[task 2019-12-16T16:09:25.107Z] 16:09:25 ERROR - /builds/worker/workspace/build/src/js/src/wasm/WasmBaselineCompile.cpp:1730:10: error: no matching member function for call to 'movePtr'
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - masm.movePtr(sp_, dest);
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - ^
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - /builds/worker/workspace/build/src/js/src/jit/arm64/MacroAssembler-arm64.h:733:8: note: candidate function not viable: no known conversion from 'js::jit::RegisterOrSP' to 'js::jit::Register' for 1st argument
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - void movePtr(Register src, Register dest) {
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - ^
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - /builds/worker/workspace/build/src/js/src/jit/arm64/MacroAssembler-arm64.h:736:8: note: candidate function not viable: no known conversion from 'js::jit::RegisterOrSP' to 'js::jit::ImmWord' for 1st argument
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - void movePtr(ImmWord imm, Register dest) {
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - ^
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - /builds/worker/workspace/build/src/js/src/jit/arm64/MacroAssembler-arm64.h:739:8: note: candidate function not viable: no known conversion from 'js::jit::RegisterOrSP' to 'js::jit::ImmPtr' for 1st argument
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - void movePtr(ImmPtr imm, Register dest) {
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - ^
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - /builds/worker/workspace/build/src/js/src/jit/arm64/MacroAssembler-arm64.h:742:8: note: candidate function not viable: no known conversion from 'js::jit::RegisterOrSP' to 'wasm::SymbolicAddress' for 1st argument
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - void movePtr(wasm::SymbolicAddress imm, Register dest) {
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - ^
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - /builds/worker/workspace/build/src/js/src/jit/arm64/MacroAssembler-arm64.h:746:8: note: candidate function not viable: no known conversion from 'js::jit::RegisterOrSP' to 'js::jit::ImmGCPtr' for 1st argument
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - void movePtr(ImmGCPtr imm, Register dest) {
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - ^
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - /builds/worker/workspace/build/src/js/src/jit/MacroAssembler.h:3030:8: note: candidate function not viable: no known conversion from 'js::jit::RegisterOrSP' to 'js::jit::TrampolinePtr' for 1st argument
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - void movePtr(TrampolinePtr ptr, Register dest) {
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - ^
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - 1 error generated.
[task 2019-12-16T16:09:25.107Z] 16:09:25 ERROR - make[4]: *** [/builds/worker/workspace/build/src/config/rules.mk:738: Unified_cpp_js_src_wasm0.o] Error 1
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - make[4]: Leaving directory '/builds/worker/workspace/build/src/obj-firefox/js/src/wasm'
[task 2019-12-16T16:09:25.107Z] 16:09:25 ERROR - make[3]: *** [/builds/worker/workspace/build/src/config/recurse.mk:74: js/src/wasm/target-objects] Error 2
[task 2019-12-16T16:09:25.107Z] 16:09:25 INFO - make[3]: *** Waiting for unfinished jobs....

Flags: needinfo?(wingo)

There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:wingo, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(wingo)

Thanks for the landing and sheriffing, and apologies for the delay as I was on holidays. These patches do not need to land before the release, so I will hold off on relanding until after the branch.

Flags: needinfo?(wingo)
Pushed by apavel@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/63f89c300859 Multi-value returns in baseline wasm compiler r=lth
Pushed by nbeleuzu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/28e56e8fe2bb Multi-value returns in baseline wasm compiler r=lth
Flags: needinfo?(wingo)
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74

Reopening as there are patches yet to land. (Is there a phab flag to set to prevent the bug from being closed?)

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Pushed by ccoroiu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/14c9f19d716c Add multi-value return epilogue to baseline compiler r=lth
Keywords: leave-open

(In reply to Andy Wingo [:wingo] from comment #11)

Reopening as there are patches yet to land. (Is there a phab flag to set to prevent the bug from being closed?)

You need to set the leave-open keyword on the bugzilla bug.

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

Attachment

General

Created:
Updated:
Size: