@@ -2854,14 +2854,19 @@ void InterpCompiler::EmitPushLdvirtftn(int thisVar, CORINFO_RESOLVED_TOKEN* pRes
28542854 m_pLastNewIns->info .pCallInfo ->pCallArgs = callArgs;
28552855}
28562856
2857- void InterpCompiler::EmitCalli (bool isTailCall, void * calliCookie, int callIFunctionPointerVar, CorInfoCallConv callConv )
2857+ void InterpCompiler::EmitCalli (bool isTailCall, void * calliCookie, int callIFunctionPointerVar, CORINFO_SIG_INFO* callSiteSig )
28582858{
28592859 AddIns (isTailCall ? INTOP_CALLI_TAIL : INTOP_CALLI);
28602860 m_pLastNewIns->data [0 ] = GetDataItemIndex (calliCookie);
28612861 // data[1] is set to 1 if the calli is calling a pinvoke, 0 otherwise
2862- m_pLastNewIns->data [1 ] = (callConv == CORINFO_CALLCONV_DEFAULT || callConv == CORINFO_CALLCONV_VARARG) ? 0 : 1 ;
2862+ bool suppressGCTransition = false ;
2863+ m_compHnd->getUnmanagedCallConv (nullptr , callSiteSig, &suppressGCTransition);
2864+ bool isPInvoke = (callSiteSig->callConv != CORINFO_CALLCONV_DEFAULT && callSiteSig->callConv != CORINFO_CALLCONV_VARARG);
2865+ bool isPInvokeMarshalled = isPInvoke && m_compHnd->pInvokeMarshalingRequired (NULL , callSiteSig);
2866+ m_pLastNewIns->data [1 ] = (suppressGCTransition ? (int32_t )CalliFlags::SuppressGCTransition : 0 ) |
2867+ (isPInvoke ? (int32_t )CalliFlags::PInvoke : 0 ) |
2868+ (isPInvokeMarshalled ? (int32_t )CalliFlags::PInvokeMarshalled : 0 );
28632869 m_pLastNewIns->SetSVars2 (CALL_ARGS_SVAR, callIFunctionPointerVar);
2864-
28652870}
28662871
28672872void InterpCompiler::EmitCall (CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool readonly, bool tailcall, bool newObj, bool isCalli)
@@ -3269,7 +3274,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re
32693274 }
32703275 else if (isCalli)
32713276 {
3272- EmitCalli (tailcall, calliCookie, callIFunctionPointerVar, callInfo.sig . getCallConv () );
3277+ EmitCalli (tailcall, calliCookie, callIFunctionPointerVar, & callInfo.sig );
32733278 }
32743279 else
32753280 {
@@ -3326,7 +3331,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re
33263331
33273332 calliCookie = m_compHnd->GetCookieForInterpreterCalliSig (&callInfo.sig );
33283333
3329- EmitCalli (tailcall, calliCookie, codePointerLookupResult, callInfo.sig . getCallConv () );
3334+ EmitCalli (tailcall, calliCookie, codePointerLookupResult, & callInfo.sig );
33303335 break ;
33313336 }
33323337 case CORINFO_VIRTUALCALL_VTABLE:
@@ -3359,7 +3364,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re
33593364
33603365 calliCookie = m_compHnd->GetCookieForInterpreterCalliSig (&callInfo.sig );
33613366
3362- EmitCalli (tailcall, calliCookie, synthesizedLdvirtftnPtrVar, callInfo.sig . getCallConv () );
3367+ EmitCalli (tailcall, calliCookie, synthesizedLdvirtftnPtrVar, & callInfo.sig );
33633368 }
33643369 else
33653370 {
0 commit comments