Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions src/coreclr/vm/interpexec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,20 @@ MethodDesc* GetTargetPInvokeMethodDesc(PCODE target)
return NULL;
}

static NOINLINE CallStubHeader *InvokeManagedMethodHelper(MethodDesc *pMD, PCODE target)
{
CONTRACTL
{
THROWS;
MODE_ANY;
PRECONDITION(CheckPointer(pMD));
}
CONTRACTL_END

GCX_PREEMP();
return UpdateCallStubForMethod(pMD, target == (PCODE)NULL ? pMD->GetMultiCallableAddrOfCode(CORINFO_ACCESS_ANY) : target);
}

void InvokeManagedMethod(MethodDesc *pMD, int8_t *pArgs, int8_t *pRet, PCODE target, Object** pContinuationRet)
{
CONTRACTL
Expand All @@ -426,7 +440,7 @@ void InvokeManagedMethod(MethodDesc *pMD, int8_t *pArgs, int8_t *pRet, PCODE tar
CallStubHeader *pHeader = pMD->GetCalliCookie();
if (pHeader == NULL)
{
pHeader = UpdateCallStubForMethod(pMD, target == (PCODE)NULL ? pMD->GetMultiCallableAddrOfCode(CORINFO_ACCESS_ANY) : target);
pHeader = InvokeManagedMethodHelper(pMD, target);
}

if (target != (PCODE)NULL)
Expand Down Expand Up @@ -463,6 +477,20 @@ void InvokeUnmanagedMethod(MethodDesc *targetMethod, int8_t *pArgs, int8_t *pRet
InvokeManagedMethod(targetMethod, pArgs, pRet, callTarget, NULL);
}

static NOINLINE CallStubHeader *InvokeDelegateInvokeMethodHelper(MethodDesc *pMDDelegateInvoke)
{
CONTRACTL
{
THROWS;
MODE_ANY;
PRECONDITION(CheckPointer(pMDDelegateInvoke));
}
CONTRACTL_END

GCX_PREEMP();
return UpdateCallStubForMethod(pMDDelegateInvoke, (PCODE)pMDDelegateInvoke->GetMultiCallableAddrOfCode(CORINFO_ACCESS_ANY));
}

void InvokeDelegateInvokeMethod(MethodDesc *pMDDelegateInvoke, int8_t *pArgs, int8_t *pRet, PCODE target, Object** pContinuationRet)
{
CONTRACTL
Expand All @@ -478,7 +506,7 @@ void InvokeDelegateInvokeMethod(MethodDesc *pMDDelegateInvoke, int8_t *pArgs, in
CallStubHeader *stubHeaderTemplate = pMDDelegateInvoke->GetCalliCookie();
if (stubHeaderTemplate == NULL)
{
stubHeaderTemplate = UpdateCallStubForMethod(pMDDelegateInvoke, (PCODE)pMDDelegateInvoke->GetMultiCallableAddrOfCode(CORINFO_ACCESS_ANY));
stubHeaderTemplate = InvokeDelegateInvokeMethodHelper(pMDDelegateInvoke);
}
Comment thread
davidwrighton marked this conversation as resolved.

// CallStubHeaders encode their destination addresses in the Routines array, so they need to be
Expand Down
Loading