[Wasm RyuJIT] Insert r2r ind cell at the end of the args list instead of after 'this'#125669
[Wasm RyuJIT] Insert r2r ind cell at the end of the args list instead of after 'this'#125669kg merged 1 commit intodotnet:mainfrom
Conversation
…s' when morphing for wasm
|
The LIR for a call in |
|
cc @AndyAyersMS @SingleAccretion Not sure this is the right way to go about the fix. |
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
There was a problem hiding this comment.
Pull request overview
Adjusts CoreCLR JIT call-argument construction for WASM ReadyToRun indirect calls so the R2R indirection cell argument is appended at the end of the argument list (matching the expected LIR evaluation/stack order for the WASM backend).
Changes:
- For
TARGET_WASM, append theWellKnownArg::R2RIndirectionCellargument viaPushBackinstead of inserting it afterthis/first arg. - Keep existing behavior for non-WASM targets (still uses
InsertAfterThisOrFirst). - Clarify the
FEATURE_READYTORUN#endifcomment in this area.
You can also share your feedback on Copilot code review. Take the survey.
|
The indcell always being 0 is likely due to this: runtime/src/coreclr/jit/codegenwasm.cpp Lines 1405 to 1409 in 93ec72d |
AndyAyersMS
left a comment
There was a problem hiding this comment.
Let's take this and work on the broader change separately.
|
/ba-g wasm only change, red lanes are known failures with tracking issues |
Without this change, the generated arglist for a ftn call looks like
(sp) (indcell) (arg0) (arg1) ...when what we want is(sp) (arg0) (arg1) (indcell).With this it's possible to evaluate a recursive fibonacci as long as you prime the heap with the right ftn ptr, i.e.
For this test I have to write the ftn ptr
2at offset0in the heap because morph generates indcells that turn intoi32.const 0for some reason I've yet to identify. We can fix that later.