Skip to content

Commit

Permalink
Merge pull request eclipse-omr#7083 from Akira1Saitoh/aarch64FixDirec…
Browse files Browse the repository at this point in the history
…tCallHelperTrampoline

AArch64: Fix helper trampoline lookup fo ARM64Trg1SymImmInstruction
  • Loading branch information
knn-k authored Aug 1, 2023
2 parents 5f4b6e5 + b52fe75 commit cbe1877
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions compiler/aarch64/codegen/ARM64BinaryEncoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ uint8_t *TR::ARM64ImmSymInstruction::generateBinaryEncoding()
{
TR::MethodSymbol *method = symRef->getSymbol()->getMethodSymbol();

if (method && method->isHelper() || cg()->callUsesHelperImplementation(symRef->getSymbol()))
if (method && method->isHelper())
{
intptr_t destination = (intptr_t)symRef->getMethodAddress();

Expand All @@ -192,15 +192,6 @@ uint8_t *TR::ARM64ImmSymInstruction::generateBinaryEncoding()
intptr_t distance = destination - (intptr_t)cursor;
insertImmediateField(toARM64Cursor(cursor), distance);
setAddrImmediate(destination);

cg()->addExternalRelocation(
TR::ExternalRelocation::create(
cursor,
(uint8_t *)symRef,
TR_HelperAddress, cg()),
__FILE__,
__LINE__,
getNode());
}
else
{
Expand All @@ -220,6 +211,20 @@ uint8_t *TR::ARM64ImmSymInstruction::generateBinaryEncoding()

intptr_t distance = destination - (intptr_t)cursor;
insertImmediateField(toARM64Cursor(cursor), distance);
}
if (method && method->isHelper() || cg()->callUsesHelperImplementation(symRef->getSymbol()))
{
cg()->addExternalRelocation(
TR::ExternalRelocation::create(
cursor,
(uint8_t *)symRef,
TR_HelperAddress, cg()),
__FILE__,
__LINE__,
getNode());
}
else
{
cg()->addProjectSpecializedRelocation(cursor, reinterpret_cast<uint8_t *>(getSymbolReference()->getMethodAddress()), NULL, TR_MethodCallAddress,
__FILE__, __LINE__, getNode());
}
Expand Down

0 comments on commit cbe1877

Please sign in to comment.