Skip to content
Draft
Show file tree
Hide file tree
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
17 changes: 10 additions & 7 deletions src/coreclr/vm/interpexec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,21 +287,23 @@ void InvokeUnmanagedMethodWithTransition(UnmanagedMethodWithTransitionParam *pPa
}

NOINLINE
void InvokeUnmanagedCalliWithTransition(PCODE ftn, InterpreterCalliCookie cookie, int8_t *stack, InterpMethodContextFrame *pFrame, int8_t *pArgs, int8_t *pRet)
void InvokeUnmanagedCalliWithTransition(UnmanagedCalliWithTransitionParam *pParam)
{
CONTRACTL
{
THROWS;
MODE_COOPERATIVE;
PRECONDITION(CheckPointer((void*)ftn));
PRECONDITION(CheckPointer(cookie));
PRECONDITION(CheckPointer((void*)pParam->ftn));
PRECONDITION(CheckPointer(pParam->cookie));
}
CONTRACTL_END

InterpMethodContextFrame *pFrame = pParam->pFrame;

InlinedCallFrame inlinedCallFrame;
inlinedCallFrame.m_pCallerReturnAddress = (TADDR)pFrame->ip;
inlinedCallFrame.m_pCallSiteSP = pFrame;
inlinedCallFrame.m_pCalleeSavedFP = (TADDR)stack;
inlinedCallFrame.m_pCalleeSavedFP = (TADDR)pParam->stack;
inlinedCallFrame.m_pThread = GetThread();
inlinedCallFrame.m_Datum = NULL;
inlinedCallFrame.Push();
Expand All @@ -310,10 +312,10 @@ void InvokeUnmanagedCalliWithTransition(PCODE ftn, InterpreterCalliCookie cookie
#ifdef PROFILING_SUPPORTED
if (CORProfilerTrackTransitions() && !pFrame->startIp->Method->methodHnd->IsILStub() && !pFrame->startIp->Method->methodHnd->IsPInvoke())
{
ProfilerManagedToUnmanagedTransitionMD(pFrame->startIp->Method->methodHnd, COR_PRF_TRANSITION_CALL);
ProfilerManagedToUnmanagedTransitionMD(pParam->pFrame->startIp->Method->methodHnd, COR_PRF_TRANSITION_CALL);
}
#endif
InvokeUnmanagedCalli(ftn, cookie, pArgs, pRet);
InvokeUnmanagedCalli(pParam->ftn, pParam->cookie, pParam->pArgs, pParam->pRet);
#ifdef PROFILING_SUPPORTED
if (CORProfilerTrackTransitions() && !pFrame->startIp->Method->methodHnd->IsILStub() && !pFrame->startIp->Method->methodHnd->IsPInvoke())
{
Expand Down Expand Up @@ -3180,7 +3182,8 @@ void InterpExecMethod(InterpreterFrame *pInterpreterFrame, InterpMethodContextFr
}
else
{
InvokeUnmanagedCalliWithTransition(calliFunctionPointer, cookie, stack, pFrame, callArgsAddress, returnValueAddress);
UnmanagedCalliWithTransitionParam param = { calliFunctionPointer, cookie, stack, pFrame, callArgsAddress, returnValueAddress };
InvokeUnmanagedCalliWithTransition(&param);
}
}
#ifndef FEATURE_PORTABLE_ENTRYPOINTS
Expand Down
12 changes: 11 additions & 1 deletion src/coreclr/vm/interpexec.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ struct CalliStubParam
int8_t *pRet;
Object** pContinuationRet;
};
#endif // FEATURE_INTERPRETER

struct DelegateInvokeMethodParam
{
Expand All @@ -162,6 +161,17 @@ struct UnmanagedMethodWithTransitionParam
PCODE callTarget;
};

struct UnmanagedCalliWithTransitionParam
{
PCODE ftn;
InterpreterCalliCookie cookie;
int8_t *stack;
InterpMethodContextFrame *pFrame;
int8_t *pArgs;
int8_t *pRet;
};
#endif // FEATURE_INTERPRETER

void InterpDispatchCache_ReclaimAll();
void InterpDispatchCache_ClearForLoaderAllocator(LoaderAllocator* pLoaderAllocator);

Expand Down
Loading