elliottt opened PR #7934 from elliottt:trevor/winch-clobbers
to bytecodealliance:main
:
To prepare for moving the stack check into the function prologue, rework the macro assembler's interface to clobbers to ensure that the unwind info defines the prologue correctly on windows.
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
github-actions[bot] commented on PR #7934:
Subscribe to Label Action
cc @saulecabrera
<details>
This issue or pull request has been labeled: "winch"Thus the following users have been cc'd because of the following labels:
- saulecabrera: winch
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
elliottt updated PR #7934.
elliottt edited PR #7934:
To prepare for moving the stack check into the function prologue, rework the macro assembler's interface to clobbers to ensure that the unwind info defines the prologue correctly on windows. Though clobbers are only used in two trampolines, it's a nice interface to use the save/restore points to bracket the code between the prologue and epilogue.
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
elliottt has marked PR #7934 as ready for review.
elliottt requested abrown for a review on PR #7934.
elliottt requested wasmtime-compiler-reviewers for a review on PR #7934.
elliottt requested saulecabrera for a review on PR #7934.
elliottt edited PR #7934:
To prepare for moving the stack check into the function prologue, rework the macro assembler's interface to clobbers to ensure that the unwind info defines the prologue correctly on windows. Though clobbers are only used in two trampolines, it's a nice interface to use the save/restore points to bracket the code between the prologue and epilogue.
I made an additional change that's not strictly necessary in this PR: reserving the space for clobbers with
reserve_stack
, and then storing values, rather than calling push for each value. I opted to maintain 16-byte stack alignment in this case, despite winch fixing stack alignment up around calls, and this paid off in trampolines that require clobbers as they do one fewer push/pop combination.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
abrown submitted PR review.
abrown submitted PR review.
abrown created PR review comment:
Should we have something like:
debug_assert!(self.callee_saved_regs.is_empty()); self.masm.restore_clobbers(&[]);
elliottt submitted PR review.
elliottt created PR review comment:
That's a great idea, thanks Andrew!
elliottt updated PR #7934.
saulecabrera submitted PR review:
Thanks for re-structuring this, and sorry it took me a bit to get to it. I left a couple of small suggestions.
saulecabrera submitted PR review:
Thanks for re-structuring this, and sorry it took me a bit to get to it. I left a couple of small suggestions.
saulecabrera created PR review comment:
Would it make sense to use
ABI::word_bytes()
andABI::word_bytes() * 2
here?
saulecabrera created PR review comment:
Do we still want to keep this
debug_assert_eq
?
elliottt submitted PR review.
elliottt created PR review comment:
Ah on further thought (and after this assertion failed locally) we unconditionally populate the list of callee save regs, but then the wasm->native trampoline doesn't need to save any registers, as the winch abi does not have any callee saves. We could conditionally populate this based on the the way the
Trampoline
is compiled, but that feels like we're pushing an invariant out to the caller that would be better enforced through types: maybe the trampoline functions could also callfinalize()
, and take ownership ofself
to avoid potentially calling multiple strategies?
elliottt updated PR #7934.
elliottt submitted PR review.
elliottt created PR review comment:
I like that! I think it also gives good justification to uncommenting the debug assert you mentioned below, as now it's checking the connection between the
word_bytes()
andOperandSize::bytes()
results.
elliottt submitted PR review.
elliottt created PR review comment:
I think so, after the change above. I'll uncomment it :)
elliottt updated PR #7934.
elliottt updated PR #7934.
elliottt updated PR #7934.
elliottt merged PR #7934.
Last updated: Dec 23 2024 at 13:07 UTC