Skip to content

Wasm R2R: push this before retbuf in InterpToR2R thunk args#129356

Open
AndyAyersMS wants to merge 1 commit into
dotnet:mainfrom
AndyAyersMS:fix-wasm-interp-to-r2r-thunk-arg-order
Open

Wasm R2R: push this before retbuf in InterpToR2R thunk args#129356
AndyAyersMS wants to merge 1 commit into
dotnet:mainfrom
AndyAyersMS:fix-wasm-interp-to-r2r-thunk-arg-order

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

The thunk pushed retbuf before this, but the JIT (lvaInitArgs) and WasmR2RToInterpreterThunk both expect (, [this], [retbuf], ...). Swap the two if-blocks so interp -> R2R calls match. Fixes #129347 (NRE / pMT->Validate assert for Synchronized + struct return).

The thunk pushed retbuf before this, but the JIT (lvaInitArgs)
and WasmR2RToInterpreterThunk both expect (, [this], [retbuf], ...).
Swap the two if-blocks so interp -> R2R calls match. Fixes dotnet#129347
(NRE / pMT->Validate assert for Synchronized + struct return).
Copilot AI review requested due to automatic review settings June 12, 2026 23:46
@github-actions github-actions Bot added the area-crossgen2-coreclr only use for closed issues label Jun 12, 2026
@AndyAyersMS

Copy link
Copy Markdown
Member Author

@davidwrighton PTAL
fyi @dotnet/wasm-contrib

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes the Wasm interpreter→R2R thunk argument ordering so that generated call_indirect argument stacks match the calling convention expected by the JIT (Compiler::lvaInitArgs) and the reverse thunk (WasmR2RToInterpreterThunkNode), specifically placing this before retbuf.

Changes:

  • Reorders the interpreter→R2R thunk argument pushes from ($sp, [retbuf], [this], ...) to ($sp, [this], [retbuf], ...).
  • Updates the inline documentation to reflect the corrected parameter order and align it with the JIT / reverse-thunk assumptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-crossgen2-coreclr only use for closed issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wasm / R2R: struct-returning instance method via field reference asserts in dispatch helper

3 participants