@@ -1630,9 +1630,6 @@ TR_J9ByteCodeIlGenerator::stashArgumentsForOSR(TR_J9ByteCode byteCode)
1630
1630
1631
1631
TR::MethodSymbol *symbol = symRef->getSymbol ()->castToMethodSymbol ();
1632
1632
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 ;
1636
1633
1637
1634
#if defined(J9VM_OPT_OPENJDK_METHODHANDLE)
1638
1635
// If the transition target is invokehandle/invokedynamic, the arguments to be
@@ -1671,6 +1668,7 @@ TR_J9ByteCodeIlGenerator::stashArgumentsForOSR(TR_J9ByteCode byteCode)
1671
1668
// Notice that we always generate a resolved call, thus we use unresolvedInCP to tell
1672
1669
// us whether the side table entry is resolved
1673
1670
//
1671
+ int32_t numArgsToNotStash = 0 ;
1674
1672
if (byteCode == J9BCinvokedynamic ||
1675
1673
byteCode == J9BCinvokehandle)
1676
1674
{
@@ -1684,10 +1682,10 @@ TR_J9ByteCodeIlGenerator::stashArgumentsForOSR(TR_J9ByteCode byteCode)
1684
1682
if (trace ())
1685
1683
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 ());
1686
1684
}
1687
- # endif
1685
+
1688
1686
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
+
1691
1689
TR_OSRMethodData *osrMethodData =
1692
1690
comp ()->getOSRCompilationData ()->findOrCreateOSRMethodData (comp ()->getCurrentInlinedSiteIndex (), _methodSymbol);
1693
1691
osrMethodData->ensureArgInfoAt (_bcIndex, numArgs);
@@ -1696,10 +1694,10 @@ TR_J9ByteCodeIlGenerator::stashArgumentsForOSR(TR_J9ByteCode byteCode)
1696
1694
// It is necessary to walk the whole stack to determine the slot numbers
1697
1695
int32_t slot = 0 ;
1698
1696
int arg = 0 ;
1699
- for (int32_t i = 0 ; i < adjustedStackSize ; ++i)
1697
+ for (int32_t i = 0 ; i < _stack-> size () ; ++i)
1700
1698
{
1701
1699
TR::Node * n = _stack->element (i);
1702
- if (adjustedStackSize - numArgs <= i)
1700
+ if (_stack-> size () - numArgs <= i)
1703
1701
{
1704
1702
TR::SymbolReference * symRef = symRefTab ()->findOrCreatePendingPushTemporary (_methodSymbol, slot, getDataType (n));
1705
1703
osrMethodData->addArgInfo (_bcIndex, arg, symRef->getReferenceNumber ());
0 commit comments