saulecabrera opened PR #10998 from saulecabrera:winch-use-masm-with-scratch to bytecodealliance:main:
This commit is a follow-up to
https://github.com/bytecodealliance/wasmtime/pull/10989; it migrates all the uses of the scratch register to useMasm::with_scratch. This commit also updates the tests that can fail / are ignored, since many of the bugs were introduced by accidental clobbers to scratch registers.Even though this change doesn't introduce any functional changes, the disassembly changes in aarch64 are due to the usage of x17 as an extra scratch registers. The updates in x64 dissembly are related to offset changes.
<!--
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
-->
saulecabrera submitted PR review.
saulecabrera created PR review comment:
Oh this is wrong, it's using the wrong scratch type. I'll take a look.
saulecabrera updated PR #10998.
saulecabrera updated PR #10998.
saulecabrera submitted PR review.
saulecabrera created PR review comment:
saulecabrera edited PR #10998:
This commit is a follow-up to
https://github.com/bytecodealliance/wasmtime/pull/10989; it migrates all the uses of the scratch register to useMasm::with_scratch. This commit also updates the tests that can fail / are ignored, since many of the bugs were introduced by accidental clobbers to scratch registers.Even though this change doesn't introduce any functional changes, the disassembly changes in aarch64 are due to the usage of x17 as an extra scratch registers.
<!--
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
-->
alexcrichton submitted PR review:
Very nice :+1:
alexcrichton created PR review comment:
WDYT about something like:
trait MacroAssembler { fn with_scratch_ty(&mut self, reg_class: RegClass); fn with_scratch<T: ScratchType>(...) { self.with_scratch_ty(T::reg_class(), ...) } }to avoid macros? That way assemblers would implement
with_scratch_tyunder the hood andwith_scratchas-is today would become a convenience over that method
saulecabrera updated PR #10998.
saulecabrera created PR review comment:
Yeah, makes sense to me, I'll update.
saulecabrera submitted PR review.
saulecabrera updated PR #10998.
saulecabrera updated PR #10998.
saulecabrera has marked PR #10998 as ready for review.
saulecabrera requested cfallin for a review on PR #10998.
saulecabrera requested wasmtime-compiler-reviewers for a review on PR #10998.
saulecabrera requested wasmtime-core-reviewers for a review on PR #10998.
saulecabrera requested pchickey for a review on PR #10998.
saulecabrera submitted PR review.
saulecabrera created PR review comment:
Got rid of the macro, but ended with a slightly different version than what you proposed, mainly because I think it make sense to have the wrapper derive the register class and delegate to
Masm::with_scratch<T,_>, which is what I was trying to solve for.
saulecabrera updated PR #10998.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
:+1:
alexcrichton merged PR #10998.
Last updated: Dec 06 2025 at 07:03 UTC