[Wasm RyuJit] proper fix for register homing#123631
Conversation
|
@dotnet/jit-contrib PTAL |
|
Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib |
There was a problem hiding this comment.
Pull request overview
This PR implements a proper fix for register homing in Wasm RyuJit, building on PR #123569. The changes move frame pointer register allocation from a reactive approach (allocating when encountering local stack stores) to a proactive approach (allocating during candidate identification when any local has references), and adds validation to prevent invalid register usage.
Changes:
- Frame pointer register allocation is moved earlier in the register allocation pipeline to ensure it's available when needed
- Added validation in
WasmRegToIndexto assert that registers are valid before extracting their index - Removed unnecessary early return check in
genHomeRegisterParamsthat is now obsolete due to proactive allocation
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/jit/registeropswasm.cpp | Added assertion in WasmRegToIndex to validate that the register type is valid (not Invalid) before extracting the index |
| src/coreclr/jit/regallocwasm.cpp | Moved frame pointer register allocation from AllocateAndResolveNode to IdentifyCandidates, allocating proactively when any local has non-zero reference count |
| src/coreclr/jit/codegenwasm.cpp | Removed early return check for REG_NA stack pointer in genHomeRegisterParams, which is no longer needed with proactive allocation |
|
Lots of infra issues. Going to merge up and hope it gets better. |
|
/ba-g CI in rough shape, and this change is untestable wasm codegen |
Better fix for register homing in Wasm.
Thought I had pushed these to #123569, but did not.