Skip to content

Commit ccc7390

Browse files
authored
Merge pull request #20242 from jdmpapin/mh-osr-arg-stash-0.48
(0.48) Stash all invokedynamic and invokehandle arguments for OSR
2 parents 5bc9391 + 05654ea commit ccc7390

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

runtime/compiler/ilgen/Walker.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,9 +1630,6 @@ TR_J9ByteCodeIlGenerator::stashArgumentsForOSR(TR_J9ByteCode byteCode)
16301630

16311631
TR::MethodSymbol *symbol = symRef->getSymbol()->castToMethodSymbol();
16321632
int32_t numArgs = symbol->getMethod()->numberOfExplicitParameters() + (symbol->isStatic() ? 0 : 1);
1633-
// For OpenJDK MH implementation, some args for invokedynamic/invokehandle (details below)
1634-
// that are already pushed to stack must not be stashed
1635-
int32_t numArgsToNotStash = 0;
16361633

16371634
#if defined(J9VM_OPT_OPENJDK_METHODHANDLE)
16381635
// If the transition target is invokehandle/invokedynamic, the arguments to be
@@ -1671,6 +1668,7 @@ TR_J9ByteCodeIlGenerator::stashArgumentsForOSR(TR_J9ByteCode byteCode)
16711668
// Notice that we always generate a resolved call, thus we use unresolvedInCP to tell
16721669
// us whether the side table entry is resolved
16731670
//
1671+
int32_t numArgsToNotStash = 0;
16741672
if (byteCode == J9BCinvokedynamic ||
16751673
byteCode == J9BCinvokehandle)
16761674
{
@@ -1684,10 +1682,10 @@ TR_J9ByteCodeIlGenerator::stashArgumentsForOSR(TR_J9ByteCode byteCode)
16841682
if (trace())
16851683
traceMsg(comp(), "Original num args for invokedynamic/handle: %d, num args to not stash for OSR: %d, stack size: %d\n", numArgs, numArgsToNotStash, _stack->size());
16861684
}
1687-
#endif
1685+
16881686
numArgs -= numArgsToNotStash;
1689-
// For OpenJDK MethodHandle implementation, there may be items on stack that we need to exclude
1690-
int32_t adjustedStackSize = _stack->size() - numArgsToNotStash;
1687+
#endif
1688+
16911689
TR_OSRMethodData *osrMethodData =
16921690
comp()->getOSRCompilationData()->findOrCreateOSRMethodData(comp()->getCurrentInlinedSiteIndex(), _methodSymbol);
16931691
osrMethodData->ensureArgInfoAt(_bcIndex, numArgs);
@@ -1696,10 +1694,10 @@ TR_J9ByteCodeIlGenerator::stashArgumentsForOSR(TR_J9ByteCode byteCode)
16961694
// It is necessary to walk the whole stack to determine the slot numbers
16971695
int32_t slot = 0;
16981696
int arg = 0;
1699-
for (int32_t i = 0; i < adjustedStackSize; ++i)
1697+
for (int32_t i = 0; i < _stack->size(); ++i)
17001698
{
17011699
TR::Node * n = _stack->element(i);
1702-
if (adjustedStackSize - numArgs <= i)
1700+
if (_stack->size() - numArgs <= i)
17031701
{
17041702
TR::SymbolReference * symRef = symRefTab()->findOrCreatePendingPushTemporary(_methodSymbol, slot, getDataType(n));
17051703
osrMethodData->addArgInfo(_bcIndex, arg, symRef->getReferenceNumber());

0 commit comments

Comments
 (0)