[Wasm RyuJIT] Codegen for reverse pinvoke/unmanagedcallersonly#127751
[Wasm RyuJIT] Codegen for reverse pinvoke/unmanagedcallersonly#127751kg merged 4 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
This PR updates the WASM RyuJIT prolog to support methods where the WASM shadow stack pointer is not passed as an explicit argument (reverse P/Invoke / UnmanagedCallersOnly entrypoints), allowing the sample in the PR description to compile.
Changes:
- Introduces a WASM global index constant intended to represent the stack pointer global.
- Updates
CodeGen::genAllocLclFrameto initialize the SP local from a global when the SP “arg” is not actually a parameter (RPI case). - Keeps the existing SP-as-first-arg path for normal managed calling convention.
|
PTAL @dotnet/jit-contrib |
AndyAyersMS
left a comment
There was a problem hiding this comment.
I think we may run into some trouble when lvaWasmSpArg does not represent an arg.
In particular compMapILargNum and compMap2ILvarNum are not prepared to handle this case.
|
Will test with a more complex method and see if I can get things to fail. |
I couldn't come up with a way to get anything to fail so I tried these speculative fixes, do you think more is necessary? |
AndyAyersMS
left a comment
There was a problem hiding this comment.
I think that's what was needed for those two. Not sure if we do this sort of thing anywhere else.
I didn't see any other references to it that looked suspect, so I think we're good. |
Sufficient to compile