Skip to content

Commit d137962

Browse files
authored
Merge pull request #8259 from nbhuiyan/inl-not-sane-fix
Correctly handle direct callees after Not_Sane target removals
2 parents d1971f6 + 9f0e734 commit d137962

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

compiler/optimizer/Inliner.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4226,6 +4226,20 @@ TR_CallSite *TR_InlinerBase::findAndUpdateCallSiteInGraph(TR_CallStack *callStac
42264226
if (findDirectCallSiteTarget(comp(), callsite, this)) {
42274227
// Can't do a partial inline anymore as the blocks are wrong.
42284228
callsite->getTarget(0)->_isPartialInliningCandidate = false;
4229+
// The new target bypasses the normal applyPolicyToTargets()
4230+
// path (since getSymbolAndFindInlineTargets() is called with
4231+
// findNewTargets=false below). Apply the
4232+
// TR_DontInlineUnloadableMethods check explicitly here to
4233+
// prevent attempts to create bonds during physical inlining.
4234+
// Note: the full applyPolicyToTargets() cannot be called here
4235+
// because it invokes exceedsSizeThreshold(), which accesses
4236+
// block information that is no longer valid at this point.
4237+
TR_CallTarget *newTarget = callsite->getTarget(0);
4238+
if (comp()->getOption(TR_DontInlineUnloadableMethods)
4239+
&& !callsite->_retainedMethods->willRemainLoaded(newTarget->_calleeMethod)) {
4240+
tracer()->insertCounter(Unloadable_Callee, callsite->_callNodeTreeTop);
4241+
callsite->removecalltarget(0, tracer(), Unloadable_Callee);
4242+
}
42294243
}
42304244
}
42314245
}

0 commit comments

Comments
 (0)