@@ -2810,14 +2810,19 @@ void InterpCompiler::EmitPushLdvirtftn(int thisVar, CORINFO_RESOLVED_TOKEN* pRes
28102810 m_pLastNewIns->info .pCallInfo ->pCallArgs = callArgs;
28112811}
28122812
2813- void InterpCompiler::EmitCalli (bool isTailCall, void * calliCookie, int callIFunctionPointerVar, CorInfoCallConv callConv )
2813+ void InterpCompiler::EmitCalli (bool isTailCall, void * calliCookie, int callIFunctionPointerVar, CORINFO_SIG_INFO* callSiteSig )
28142814{
28152815 AddIns (isTailCall ? INTOP_CALLI_TAIL : INTOP_CALLI);
28162816 m_pLastNewIns->data [0 ] = GetDataItemIndex (calliCookie);
28172817 // data[1] is set to 1 if the calli is calling a pinvoke, 0 otherwise
2818- m_pLastNewIns->data [1 ] = (callConv == CORINFO_CALLCONV_DEFAULT || callConv == CORINFO_CALLCONV_VARARG) ? 0 : 1 ;
2818+ bool suppressGCTransition = false ;
2819+ m_compHnd->getUnmanagedCallConv (nullptr , callSiteSig, &suppressGCTransition);
2820+ bool isPInvoke = (callSiteSig->callConv != CORINFO_CALLCONV_DEFAULT && callSiteSig->callConv != CORINFO_CALLCONV_VARARG);
2821+ bool isPInvokeMarshalled = isPInvoke && m_compHnd->pInvokeMarshalingRequired (NULL , callSiteSig);
2822+ m_pLastNewIns->data [1 ] = (suppressGCTransition ? (int32_t )CalliFlags::SuppressGCTransition : 0 ) |
2823+ (isPInvoke ? (int32_t )CalliFlags::PInvoke : 0 ) |
2824+ (isPInvokeMarshalled ? (int32_t )CalliFlags::PInvokeMarshalled : 0 );
28192825 m_pLastNewIns->SetSVars2 (CALL_ARGS_SVAR, callIFunctionPointerVar);
2820-
28212826}
28222827
28232828void InterpCompiler::EmitCall (CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool readonly, bool tailcall, bool newObj, bool isCalli)
@@ -3225,7 +3230,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re
32253230 }
32263231 else if (isCalli)
32273232 {
3228- EmitCalli (tailcall, calliCookie, callIFunctionPointerVar, callInfo.sig . getCallConv () );
3233+ EmitCalli (tailcall, calliCookie, callIFunctionPointerVar, & callInfo.sig );
32293234 }
32303235 else
32313236 {
@@ -3282,7 +3287,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re
32823287
32833288 calliCookie = m_compHnd->GetCookieForInterpreterCalliSig (&callInfo.sig );
32843289
3285- EmitCalli (tailcall, calliCookie, codePointerLookupResult, callInfo.sig . getCallConv () );
3290+ EmitCalli (tailcall, calliCookie, codePointerLookupResult, & callInfo.sig );
32863291 break ;
32873292 }
32883293 case CORINFO_VIRTUALCALL_VTABLE:
@@ -3315,7 +3320,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re
33153320
33163321 calliCookie = m_compHnd->GetCookieForInterpreterCalliSig (&callInfo.sig );
33173322
3318- EmitCalli (tailcall, calliCookie, synthesizedLdvirtftnPtrVar, callInfo.sig . getCallConv () );
3323+ EmitCalli (tailcall, calliCookie, synthesizedLdvirtftnPtrVar, & callInfo.sig );
33193324 }
33203325 else
33213326 {
0 commit comments