[Wasm] Fix FP-based stack slot lookup#128958
Open
kg wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the CoreCLR GC info decoder’s stack-slot address computation for WebAssembly so that GC_FRAMEREG_REL stack slots can be resolved even when the encoded “stack base register” ends up being REG_NA on wasm.
Changes:
- Add a wasm-only code path in
TGcInfoDecoder<...>::GetStackSlotthat derives the frame pointer from the current stack pointer and uses it to compute the stack slot address. - Add a wasm-only forward declaration for
GetWasmFramePointerFromStackPointersogcinfodecoder.cppcan call the helper implemented invm/wasm/helpers.cpp.
Comment on lines
+2195
to
+2199
| // Wasm is a bit strange and when we do SetStackBaseRegister(REG_FPBASE) | ||
| // what that actually does is set it to REG_NA, which currently has the value 2. | ||
| _ASSERTE( 2 == m_StackBaseRegister ); | ||
| // We have the stack pointer, use it to recover the frame pointer. | ||
| TADDR pFrameReg = GetWasmFramePointerFromStackPointer((TADDR)pRD->SP); |
Comment on lines
+2169
to
+2171
| #ifdef TARGET_WASM | ||
| TADDR GetWasmFramePointerFromStackPointer(TADDR sp); | ||
| #endif |
Contributor
|
Tagging subscribers to this area: @agocke |
davidwrighton
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #128860 to matter