Description
For some IL stubs with pinvokes in them the runtime passes a non-standard argument that the JIT must save in a known place. Currently this mechanism is different between 32 bit and 64 bit platforms. On 32 bit platforms the argument is stored by the JIT in the local stack frame at a known place:
runtime/src/coreclr/vm/frames.h
Lines 2850 to 2880 in b4765bd
On 64-bit platforms the argument is instead passed to the CORINFO_HELP_INIT_PINVOKE_FRAME
helper call.
We can unify these mechanisms in the way suggested by @jkotas here, by storing it directly inside the InlinedFrame
that the JIT already has special knowledge of. It will save us some special casing within the JIT and avoid the unnecessary store on 64-bit in many cases.