Skip to content

Commit

Permalink
Fix recursive inlining of PInvoke stubs (dotnet/coreclr#18737)
Browse files Browse the repository at this point in the history
PInvoke stubs can be inlined into a regular methods in CoreRT. PInvoke transition
has to be inlined as well when that happens. Otherwise, there is a risk of recursive
inlining in corner cases.

Commit migrated from dotnet/coreclr@55023b7
  • Loading branch information
jkotas authored Jul 1, 2018
1 parent 7353f04 commit 9fcc15f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/coreclr/src/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6112,9 +6112,9 @@ void Compiler::impCheckForPInvokeCall(
return;
}

// PInvoke CALL in IL stubs must be inlined on CoreRT. Skip the ambient conditions checks and
// profitability checks
if (!(opts.jitFlags->IsSet(JitFlags::JIT_FLAG_IL_STUB) && IsTargetAbi(CORINFO_CORERT_ABI)))
// Legal PInvoke CALL in PInvoke IL stubs must be inlined to avoid infinite recursive
// inlining in CoreRT. Skip the ambient conditions checks and profitability checks.
if (!IsTargetAbi(CORINFO_CORERT_ABI) || (info.compFlags & CORINFO_FLG_PINVOKE) == 0)
{
if (!impCanPInvokeInline())
{
Expand Down

0 comments on commit 9fcc15f

Please sign in to comment.