@@ -206,9 +206,9 @@ static size_t CreateDispatchTokenForMethod(MethodDesc* pMD)
206206void InvokeManagedMethod (ManagedMethodParam *pParam);
207207void InvokeUnmanagedMethod (MethodDesc *targetMethod, int8_t *pArgs, int8_t *pRet, PCODE callTarget);
208208void InvokeCalliStub (CalliStubParam* pParam);
209- void InvokeUnmanagedCalli (PCODE ftn, void * cookie, int8_t *pArgs, int8_t *pRet);
209+ void InvokeUnmanagedCalli (PCODE ftn, InterpreterCalliCookie cookie, int8_t *pArgs, int8_t *pRet);
210210void InvokeDelegateInvokeMethod (DelegateInvokeMethodParam* pParam);
211- void * GetCookieForCalliSig (MetaSig metaSig, MethodDesc *pContextMD);
211+ InterpreterCalliCookie GetCookieForCalliSig (MetaSig metaSig, MethodDesc *pContextMD);
212212extern " C" PCODE CID_VirtualOpenDelegateDispatch (TransitionBlock * pTransitionBlock);
213213
214214// Filter to ignore SEH exceptions representing C++ exceptions.
@@ -287,7 +287,7 @@ void InvokeUnmanagedMethodWithTransition(UnmanagedMethodWithTransitionParam *pPa
287287}
288288
289289NOINLINE
290- void InvokeUnmanagedCalliWithTransition (PCODE ftn, void * cookie, int8_t *stack, InterpMethodContextFrame *pFrame, int8_t *pArgs, int8_t *pRet)
290+ void InvokeUnmanagedCalliWithTransition (PCODE ftn, InterpreterCalliCookie cookie, int8_t *stack, InterpMethodContextFrame *pFrame, int8_t *pArgs, int8_t *pRet)
291291{
292292 CONTRACTL
293293 {
@@ -349,15 +349,15 @@ static CallStubHeader *UpdateCallStubForMethod(MethodDesc *pMD, PCODE target)
349349 header->SetTarget (target);
350350 }
351351
352- if (pMD->SetCallStub (header))
352+ if (pMD->SetCalliCookie (header))
353353 {
354354 amTracker.SuppressRelease ();
355355 }
356356 else
357357 {
358358 // We have lost the race for generating the header, use the one that was generated by another thread
359359 // and let the amTracker release the memory of the one we generated.
360- header = pMD->GetCallStub ();
360+ header = pMD->GetCalliCookie ();
361361 }
362362
363363 return header;
@@ -408,7 +408,7 @@ void InvokeManagedMethod(ManagedMethodParam* pParam)
408408 PCODE target = pParam->target ;
409409 Object** pContinuationRet = pParam->pContinuationRet ;
410410
411- CallStubHeader *pHeader = pParam->pMD ->GetCallStub ();
411+ CallStubHeader *pHeader = pParam->pMD ->GetCalliCookie ();
412412 if (pHeader == NULL )
413413 {
414414 pHeader = UpdateCallStubForMethod (pMD, target == (PCODE )NULL ? pMD->GetMultiCallableAddrOfCode (CORINFO_ACCESS_ANY ) : target);
@@ -467,7 +467,7 @@ void InvokeDelegateInvokeMethod(DelegateInvokeMethodParam* pParam)
467467 PCODE target = pParam->target ;
468468 Object** pContinuationRet = pParam->pContinuationRet ;
469469
470- CallStubHeader *stubHeaderTemplate = pMDDelegateInvoke->GetCallStub ();
470+ CallStubHeader *stubHeaderTemplate = pMDDelegateInvoke->GetCalliCookie ();
471471 if (stubHeaderTemplate == NULL )
472472 {
473473 stubHeaderTemplate = UpdateCallStubForMethod (pMDDelegateInvoke, (PCODE )pMDDelegateInvoke->GetMultiCallableAddrOfCode (CORINFO_ACCESS_ANY ));
@@ -490,7 +490,7 @@ void InvokeDelegateInvokeMethod(DelegateInvokeMethodParam* pParam)
490490 pHeader->Invoke (pHeader->Routines , pArgs, pRet, pHeader->TotalStackSize , pContinuationRet);
491491}
492492
493- void InvokeUnmanagedCalli (PCODE ftn, void * cookie, int8_t *pArgs, int8_t *pRet)
493+ void InvokeUnmanagedCalli (PCODE ftn, InterpreterCalliCookie cookie, int8_t *pArgs, int8_t *pRet)
494494{
495495 CONTRACTL
496496 {
@@ -549,7 +549,7 @@ void InvokeCalliStub(CalliStubParam* pParam)
549549 pHeader->Invoke (pHeader->Routines , pArgs, pRet, pHeader->TotalStackSize , pContinuationRet);
550550}
551551
552- void * GetCookieForCalliSig (MetaSig metaSig, MethodDesc *pContextMD)
552+ InterpreterCalliCookie GetCookieForCalliSig (MetaSig metaSig, MethodDesc *pContextMD)
553553{
554554 STANDARD_VM_CONTRACT ;
555555
@@ -3162,7 +3162,7 @@ void InterpExecMethod(InterpreterFrame *pInterpreterFrame, InterpMethodContextFr
31623162 int32_t calliCookie = ip[4 ];
31633163 int32_t flags = ip[5 ];
31643164
3165- void * cookie = pMethod->pDataItems [calliCookie];
3165+ InterpreterCalliCookie cookie = (InterpreterCalliCookie) pMethod->pDataItems [calliCookie];
31663166 ip += 6 ;
31673167
31683168 // Save current execution state for when we return from called method
@@ -3206,8 +3206,15 @@ void InterpExecMethod(InterpreterFrame *pInterpreterFrame, InterpMethodContextFr
32063206 if (PortableEntryPoint::PrefersInterpreterEntryPoint (calliFunctionPointer) || !PortableEntryPoint::HasNativeEntryPoint (calliFunctionPointer))
32073207 goto CALL_INTERP_METHOD ;
32083208
3209- MetaSig sig (targetMethod);
3210- cookie = GetCookieForCalliSig (sig, NULL );
3209+ cookie = targetMethod->GetCalliCookie ();
3210+ if (cookie == NULL )
3211+ {
3212+ MetaSig sig (targetMethod);
3213+ cookie = GetCookieForCalliSig (sig, NULL );
3214+ _ASSERTE (cookie != NULL );
3215+ targetMethod->SetCalliCookie (cookie);
3216+ cookie = targetMethod->GetCalliCookie ();
3217+ }
32113218#endif // FEATURE_PORTABLE_ENTRYPOINTS
32123219 frameNeedsTailcallUpdate = false ;
32133220 CalliStubParam param = { calliFunctionPointer, cookie, callArgsAddress, returnValueAddress, pInterpreterFrame->GetContinuationPtr () };
0 commit comments