Sorry, I found the answer. I forgot that the thunk is a call to
the Prestub. That call pushes the "return address" onto the stack.
The "return address" happens to be the MethodDesc pointer. Clever!

Thanks,
Nam

Nam Tran wrote:
>
> I'm trying to understand the details of how the Prestub and the
> JIT backpatch work.
>
> On x86, the PrestubFrame looks like:
>
>        +...    stack-based args for real method
>        +12     return address
>        +8      m_Datum (MethodDesc*)
>        +4      m_Next
> ESI--->+0      the frame vptr
>        +...    negative space stuff
>
> I can see that the call to the Prestub from _CallDescWorkerInternal
> (asm) pushes the return address, then the Prestub prolog pushes
> m_Next and the frame vptr.
>
> But I can't see where the MethodDesc* is pushed into ESI+8. But then
> PreStubWorker() can get the MethodDesc* from the PrestubMethodFrame
> object (previous ESI) just fine. What am I missing here?
>
> Thanks,
> Nam

Reply via email to