Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 60ae03f

Browse files
authored
Merge pull request #6204 from AndyAyersMS/ModelPolicyDepthCheck
Inliner: add depth check to ModelPolicy
2 parents 801c837 + 7e6a05e commit 60ae03f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/jit/inlinepolicy.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,6 +1964,19 @@ void ModelPolicy::NoteInt(InlineObservation obs, int value)
19641964
{
19651965
// Callee too big, not a candidate
19661966
SetNever(InlineObservation::CALLEE_TOO_MUCH_IL);
1967+
return;
1968+
}
1969+
1970+
// Safeguard against overly deep inlines
1971+
if (obs == InlineObservation::CALLSITE_DEPTH)
1972+
{
1973+
unsigned depthLimit = m_RootCompiler->m_inlineStrategy->GetMaxInlineDepth();
1974+
1975+
if (m_Depth > depthLimit)
1976+
{
1977+
SetFailure(InlineObservation::CALLSITE_IS_TOO_DEEP);
1978+
return;
1979+
}
19671980
}
19681981
}
19691982

0 commit comments

Comments
 (0)