Skip to content

Commit

Permalink
Merge pull request #7384 from dchopra001/directCallFixes
Browse files Browse the repository at this point in the history
Direct call fixes for JITServer on Power
  • Loading branch information
ymanton authored Oct 24, 2019
2 parents 113a282 + c1f8a4e commit 1104ed7
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions runtime/compiler/p/codegen/J9PPCInstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ uint8_t *TR::PPCDepImmSymInstruction::generateBinaryEncoding()
TR::ResolvedMethodSymbol *sym = getSymbolReference()->getSymbol()->getResolvedMethodSymbol();
TR_ResolvedMethod *resolvedMethod = sym == NULL ? NULL : sym->getResolvedMethod();
TR::LabelSymbol *label = getSymbolReference()->getSymbol()->getLabelSymbol();
bool callToSelf = resolvedMethod != NULL && resolvedMethod->isSameMethod(comp->getCurrentMethod()) && !comp->isDLT();

if (cg()->hasCodeCacheSwitched())
{
Expand Down Expand Up @@ -90,7 +91,7 @@ uint8_t *TR::PPCDepImmSymInstruction::generateBinaryEncoding()
}
}

if (resolvedMethod != NULL && resolvedMethod->isSameMethod(comp->getCurrentMethod()) && !comp->isDLT())
if (callToSelf)
{
uint8_t *jitTojitStart = cg()->getCodeStart();
jitTojitStart += ((*(int32_t *)(jitTojitStart - 4)) >> 16) & 0x0000ffff;
Expand Down Expand Up @@ -135,10 +136,20 @@ uint8_t *TR::PPCDepImmSymInstruction::generateBinaryEncoding()
}
}

if (cg()->comp()->compileRelocatableCode() && label == NULL)
if ((cg()->comp()->compileRelocatableCode() || cg()->comp()->isOutOfProcessCompilation()) &&
label == NULL &&
!callToSelf)
{
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(cursor,(uint8_t *)getSymbolReference(),TR_HelperAddress, cg()),
__FILE__, __LINE__, getNode());
if (sym && !sym->isHelper() && resolvedMethod)
{
cg()->addProjectSpecializedRelocation(cursor, (uint8_t *)getSymbolReference()->getMethodAddress(), NULL, TR_MethodCallAddress,
__FILE__, __LINE__, getNode());
}
else
{
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(cursor,(uint8_t *)getSymbolReference(),TR_HelperAddress, cg()),
__FILE__, __LINE__, getNode());
}
}
}
else
Expand Down

0 comments on commit 1104ed7

Please sign in to comment.