Skip to content

[Wasm] Fix FP-based stack slot lookup#128958

Open
kg wants to merge 1 commit into
dotnet:mainfrom
kg:wasm-gcissues-followup-1
Open

[Wasm] Fix FP-based stack slot lookup#128958
kg wants to merge 1 commit into
dotnet:mainfrom
kg:wasm-gcissues-followup-1

Conversation

@kg
Copy link
Copy Markdown
Member

@kg kg commented Jun 3, 2026

Depends on #128860 to matter

@kg kg added the arch-wasm WebAssembly architecture label Jun 3, 2026
Copilot AI review requested due to automatic review settings June 3, 2026 18:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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<...>::GetStackSlot that 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 GetWasmFramePointerFromStackPointer so gcinfodecoder.cpp can call the helper implemented in vm/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
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

@kg kg marked this pull request as ready for review June 3, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-VM-coreclr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants