alexcrichton opened PR #9666 from alexcrichton:remove-some-registers to bytecodealliance:main:
This commit fixes a minor mistake where regalloc was allowed to allocate "special registers" such as the stack pointer, the frame pointer, etc. These register shouldn't participate in general-purpose register allocation, so they're removed from the list of non-preferred registers when metadata is provided to regalloc2.
<!--
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 requested cfallin for a review on PR #9666.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #9666.
alexcrichton requested wasmtime-default-reviewers for a review on PR #9666.
cfallin submitted PR review:
Good catch!
cfallin created PR review comment:
Do we have constants for sp and fp? Can we define them like
SPECIAL_START + 0andSPECIAL_START + 1to ensure this stays in sync?
alexcrichton submitted PR review.
alexcrichton created PR review comment:
Does this test do what you're thinking?
cfallin submitted PR review.
cfallin created PR review comment:
That tests the other direction: it asserts that every register from
SPECIAL_STARTonward is special, but it doesn't test that every special register is beyondSPECIAL_START. I guess I'm suggesting a different way to define fp and sp, where we use the constant (plus a nonnegative offset) directly to have this by construction.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
Ah good point! The way these are defined in pulley is a bit special right now where each register is an
enum XReg { x0, ... sp, ... }for example. That's uniform across x/f/v registers so I'm wary to change that much. That being said I'll enhance the test to assert that everything beforeSPECIAL_STARTis non-special.
alexcrichton updated PR #9666.
cfallin submitted PR review.
cfallin submitted PR review.
cfallin created PR review comment:
Looks good!
cfallin has enabled auto merge for PR #9666.
alexcrichton has disabled auto merge for PR #9666.
alexcrichton has enabled auto merge for PR #9666.
alexcrichton merged PR #9666.
Last updated: Jan 09 2026 at 13:15 UTC