Skip to content

Commit ecc436f

Browse files
committed
Forbid inlining of pinvoke methods with SuppressGCTransitionAttribute in MulticoreJit thread
1 parent 2e8f598 commit ecc436f

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/coreclr/vm/jitinterface.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10162,6 +10162,20 @@ bool CEEInfo::pInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SI
1016210162
#endif
1016310163
}
1016410164

10165+
PrepareCodeConfig *config = GetThread()->GetCurrentPrepareCodeConfig();
10166+
if (config != nullptr && config->IsForMulticoreJit())
10167+
{
10168+
bool suppressGCTransition = false;
10169+
CorInfoCallConvExtension unmanagedCallConv = getUnmanagedCallConv(method, callSiteSig, &suppressGCTransition);
10170+
10171+
if (suppressGCTransition)
10172+
{
10173+
// MultiCoreJit thread can't inline PInvoke with SuppressGCTransitionAttribute,
10174+
// because it can't be resolved in mcj thread
10175+
result = TRUE;
10176+
}
10177+
}
10178+
1016510179
EE_TO_JIT_TRANSITION();
1016610180

1016710181
return result;

0 commit comments

Comments
 (0)