This commit is contained in:
Andy Ayers 2025-07-30 22:32:48 +08:00 committed by GitHub
commit 81b4b94d2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 8 deletions

View File

@ -7887,6 +7887,14 @@ void Compiler::impMarkInlineCandidateHelper(GenTreeCall* call,
return;
}
if (call->IsUnmanaged())
{
// We must have IL to inline.
//
inlineResult->NoteFatal(InlineObservation::CALLEE_IS_UNMANAGED);
return;
}
// Inlining candidate determination needs to honor only IL tail prefix.
// Inlining takes precedence over implicit tail call optimization (if the call is not directly recursive).
if (call->IsTailPrefixedCall())
@ -8068,6 +8076,10 @@ void Compiler::impMarkInlineCandidateHelper(GenTreeCall* call,
if (methAttr & CORINFO_FLG_PINVOKE)
{
// We should have already ruled out cases where we can directly call the unamanged method.
//
assert(!call->IsUnmanaged());
if (!impCanPInvokeInlineCallSite(compCurBB))
{
inlineResult->NoteFatal(InlineObservation::CALLSITE_PINVOKE_EH);
@ -8093,14 +8105,6 @@ void Compiler::impMarkInlineCandidateHelper(GenTreeCall* call,
inlineResult->NoteFatal(InlineObservation::CALLSITE_IS_WITHIN_FILTER);
return;
}
// Do not inline pinvoke stubs with EH.
//
if ((methAttr & CORINFO_FLG_PINVOKE) != 0)
{
inlineResult->NoteFatal(InlineObservation::CALLEE_HAS_EH);
return;
}
}
// The old value should be null OR this call should be a guarded devirtualization candidate.

View File

@ -42,6 +42,7 @@ INLINE_OBSERVATION(IS_ARRAY_METHOD, bool, "is array method",
INLINE_OBSERVATION(IS_JIT_NOINLINE, bool, "noinline per JitNoinline", FATAL, CALLEE)
INLINE_OBSERVATION(IS_NOINLINE, bool, "noinline per IL/cached result", FATAL, CALLEE)
INLINE_OBSERVATION(IS_SYNCHRONIZED, bool, "is synchronized", FATAL, CALLEE)
INLINE_OBSERVATION(IS_UNMANAGED, bool, "is unmanaged code", FATAL, CALLEE)
INLINE_OBSERVATION(IS_VM_NOINLINE, bool, "noinline per VM", FATAL, CALLEE)
INLINE_OBSERVATION(LACKS_RETURN, bool, "no return opcode", FATAL, CALLEE)
INLINE_OBSERVATION(LDFLD_NEEDS_HELPER, bool, "ldfld needs helper", FATAL, CALLEE)