Skip to content

Commit

Permalink
Merge pull request #2435 from ymanton/ext-relocs
Browse files Browse the repository at this point in the history
Use OMR Compiler's renamed ExternalRelocation APIs
  • Loading branch information
fjeremic committed Jul 20, 2018
2 parents 565ebfa + 139f6b9 commit 2663a82
Show file tree
Hide file tree
Showing 33 changed files with 130 additions and 130 deletions.
4 changes: 2 additions & 2 deletions runtime/compiler/arm/codegen/ARMAOTRelocation.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2016 IBM Corp. and others
* Copyright (c) 2000, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -30,7 +30,7 @@ void TR::ARMPairedRelocation::mapRelocation(TR::CodeGenerator *cg)

if (TR::comp()->getOption(TR_AOT))
{
cg->addAOTRelocation(
cg->addExternalRelocation(
new (cg->trHeapMemory()) TR::ExternalOrderedPair32BitRelocation(
getSourceInstruction()->getBinaryEncoding(),
NULL,
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/arm/codegen/ARMHelperCallSnippet.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2016 IBM Corp. and others
* Copyright (c) 2000, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -53,7 +53,7 @@ uint8_t *TR::ARMHelperCallSnippet::emitSnippetBody()
*(int32_t *)buffer = 0xea000000 | ((distance >> 2)& 0x00ffffff);
if (_restartLabel != NULL)
*(int32_t *)buffer |= 0x01000000;
cg()->addAOTRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
buffer,
(uint8_t *)getDestination(),
TR_HelperAddress, cg()), __FILE__, __LINE__, getNode());
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/arm/codegen/ARMRecompilationSnippet.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2016 IBM Corp. and others
* Copyright (c) 2000, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -151,7 +151,7 @@ uint8_t *TR::ARMEDORecompilationSnippet::emitSnippetBody()
// b distance
*(int32_t *)buffer = 0x48000000 | (distance & 0x03ffffff);
cg()->addAOTRelocation(new TR::ExternalRelocation(buffer,
cg()->addExternalRelocation(new TR::ExternalRelocation(buffer,
(uint8_t *)induceRecompilationSymRef,
TR_HelperAddress), __FILE, __LINE__, getNode());
buffer += ARM_INSTRUCTION_LENGTH;
Expand Down
20 changes: 10 additions & 10 deletions runtime/compiler/arm/codegen/CallSnippet.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2016 IBM Corp. and others
* Copyright (c) 2000, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -268,7 +268,7 @@ uint8_t *TR::ARMCallSnippet::emitSnippetBody()

// Store the code cache RA
*(int32_t *)cursor = (intptr_t)getCallRA();
cg()->addAOTRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cursor,
NULL,
TR_AbsoluteMethodAddress, cg()), __FILE__, __LINE__, getNode());
Expand All @@ -281,7 +281,7 @@ uint8_t *TR::ARMCallSnippet::emitSnippetBody()
if (comp->getOption(TR_EnableHCR))
{
cg()->jitAddPicToPatchOnClassRedefinition((void*)-1, (void *)cursor, true);
cg()->addAOTRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation((uint8_t *)cursor, NULL,(uint8_t *)needsFullSizeRuntimeAssumption,
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation((uint8_t *)cursor, NULL,(uint8_t *)needsFullSizeRuntimeAssumption,
TR_HCR, cg()),__FILE__, __LINE__,
getNode());
}
Expand All @@ -291,7 +291,7 @@ uint8_t *TR::ARMCallSnippet::emitSnippetBody()
*(int32_t *)cursor = (uintptr_t)methodSymbol->getMethodAddress();
if (comp->getOption(TR_EnableHCR))
cg()->jitAddPicToPatchOnClassRedefinition((void *)methodSymbol->getMethodAddress(), (void *)cursor);
cg()->addAOTRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(cursor, (uint8_t *)methodSymRef,
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(cursor, (uint8_t *)methodSymRef,
getNode() ? (uint8_t *)getNode()->getInlinedSiteIndex() : (uint8_t *)-1,
TR_MethodObject, cg()),
__FILE__, __LINE__, callNode);
Expand All @@ -301,7 +301,7 @@ uint8_t *TR::ARMCallSnippet::emitSnippetBody()
recordInfo->data2 = (uintptr_t)(getNode() ? (uint8_t *)getNode()->getInlinedSiteIndex() : (uint8_t *)-1);
recordInfo->data3 = (uintptr_t)fixedSequence1;
cg()->addAOTRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cursor,
(uint8_t *)recordInfo,
TR_MethodObject, cg()), __FILE__, __LINE__, getNode());
Expand Down Expand Up @@ -376,7 +376,7 @@ uint8_t *TR::ARMUnresolvedCallSnippet::emitSnippetBody()
traceMsg(comp, "</relocatableDataTrampolinesCG>\n");
}

cg()->addAOTRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cursor,
*(uint8_t **)cursor,
getNode() ? (uint8_t *)getNode()->getInlinedSiteIndex() : (uint8_t *)-1,
Expand Down Expand Up @@ -408,7 +408,7 @@ uint8_t *TR::ARMVirtualUnresolvedSnippet::emitSnippetBody()

// Store the code cache RA
*(int32_t *)cursor = (intptr_t)getReturnLabel()->getCodeLocation();
cg()->addAOTRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cursor,
NULL,
TR_AbsoluteMethodAddress, cg()), __FILE__, __LINE__, getNode());
Expand All @@ -417,7 +417,7 @@ uint8_t *TR::ARMVirtualUnresolvedSnippet::emitSnippetBody()
// CP
*(int32_t *)cursor = (intptr_t)methodSymRef->getOwningMethod(comp)->constantPool();

cg()->addAOTRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cursor,
*(uint8_t **)cursor,
getNode() ? (uint8_t *)getNode()->getInlinedSiteIndex() : (uint8_t *)-1,
Expand Down Expand Up @@ -451,15 +451,15 @@ uint8_t *TR::ARMInterfaceCallSnippet::emitSnippetBody()

// Store the code cache RA
*(int32_t *)cursor = (intptr_t)getReturnLabel()->getCodeLocation();
cg()->addAOTRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cursor,
NULL,
TR_AbsoluteMethodAddress, cg()), __FILE__, __LINE__, getNode());
cursor += 4;

*(int32_t *)cursor = (intptr_t)methodSymRef->getOwningMethod(cg()->comp())->constantPool();

cg()->addAOTRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cursor,
*(uint8_t **)cursor,
getNode() ? (uint8_t *)getNode()->getInlinedSiteIndex() : (uint8_t *)-1,
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/arm/codegen/J9AheadOfTimeCompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ void J9::ARM::AheadOfTimeCompile::processRelocations()
relocation->mapRelocation(self()->cg());
}

for (auto aotIterator = self()->cg()->getAOTRelocationList().begin(); aotIterator != self()->cg()->getAOTRelocationList().end(); ++aotIterator)
for (auto aotIterator = self()->cg()->getExternalRelocationList().begin(); aotIterator != self()->cg()->getExternalRelocationList().end(); ++aotIterator)
{
(*aotIterator)->addAOTRelocation(self()->cg());
(*aotIterator)->addExternalRelocation(self()->cg());
}

for (r = self()->getAOTRelocationTargets().getFirst();
Expand Down
6 changes: 3 additions & 3 deletions runtime/compiler/arm/codegen/J9UnresolvedDataSnippet.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2016 IBM Corp. and others
* Copyright (c) 2000, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -81,7 +81,7 @@ J9::ARM::UnresolvedDataSnippet::emitSnippetBody()
cursor += 4;

*(int32_t *)cursor = (intptr_t)getAddressOfDataReference(); // Code Cache RA
cg()->addAOTRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cursor,
NULL,
TR_AbsoluteMethodAddress, cg()), __FILE__, __LINE__, getNode());
Expand All @@ -102,7 +102,7 @@ J9::ARM::UnresolvedDataSnippet::emitSnippetBody()
cursor += 4;

*(int32_t *)cursor = (intptr_t)getDataSymbolReference()->getOwningMethod(cg()->comp())->constantPool(); // CP
cg()->addAOTRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cg()->addExternalRelocation(new (cg()->trHeapMemory()) TR::ExternalRelocation(
cursor,
*(uint8_t **)cursor,
getNode() ? (uint8_t *)getNode()->getInlinedSiteIndex() : (uint8_t *)-1,
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/codegen/J9AheadOfTimeCompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ J9::AheadOfTimeCompile::dumpRelocationData()
traceMsg(self()->comp(), "\n\nRelocation Record Generation Info\n");
traceMsg(self()->comp(), "%-35s %-32s %-5s %-9s %-10s %-8s\n", "Type", "File", "Line","Offset(M)","Offset(PC)", "Node");

TR::list<TR::Relocation*>& aotRelocations = self()->comp()->cg()->getAOTRelocationList();
TR::list<TR::Relocation*>& aotRelocations = self()->comp()->cg()->getExternalRelocationList();
//iterate over aotRelocations
if (!aotRelocations.empty())
{
Expand Down
20 changes: 10 additions & 10 deletions runtime/compiler/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2599,7 +2599,7 @@ J9::CodeGenerator::processRelocations()
case TR_CheckMethodEnter:
case TR_CheckMethodExit:
case TR_HCR:
self()->addAOTRelocation(new (self()->trHeapMemory()) TR::ExternalRelocation((uint8_t *)(*it)->getLocation(),
self()->addExternalRelocation(new (self()->trHeapMemory()) TR::ExternalRelocation((uint8_t *)(*it)->getLocation(),
(uint8_t *)(*it)->getDestination(),
type, self()),
__FILE__, __LINE__, NULL);
Expand Down Expand Up @@ -2657,7 +2657,7 @@ J9::CodeGenerator::processRelocations()

TR_ASSERT(siteIndex < (int32_t) self()->comp()->getNumInlinedCallSites(), "did not find AOTClassInfo %p method in inlined site table", *info);

self()->addAOTRelocation(new (self()->trHeapMemory()) TR::ExternalRelocation(NULL,
self()->addExternalRelocation(new (self()->trHeapMemory()) TR::ExternalRelocation(NULL,
(uint8_t *)(intptr_t)siteIndex,
(uint8_t *)(*info),
(*info)->_reloKind, self()),
Expand All @@ -2678,7 +2678,7 @@ J9::CodeGenerator::processRelocations()

while (currentSite)
{
self()->addAOTRelocation(new (self()->trHeapMemory()) TR::ExternalRelocation(currentSite->location,
self()->addExternalRelocation(new (self()->trHeapMemory()) TR::ExternalRelocation(currentSite->location,
currentSite->destination,
currentSite->guard,
currentSite->reloType, self()),
Expand All @@ -2693,7 +2693,7 @@ J9::CodeGenerator::processRelocations()
self()->getAheadOfTimeCompile()->processRelocations();
}

for (auto aotIterator = self()->getAOTRelocationList().begin(); aotIterator != self()->getAOTRelocationList().end(); ++aotIterator)
for (auto aotIterator = self()->getExternalRelocationList().begin(); aotIterator != self()->getExternalRelocationList().end(); ++aotIterator)
{
// Traverse the AOT/external labels
(*aotIterator)->apply(self());
Expand All @@ -2704,26 +2704,26 @@ void J9::CodeGenerator::addProjectSpecializedRelocation(uint8_t *location, uint8
TR_ExternalRelocationTargetKind kind, char *generatingFileName, uintptr_t generatingLineNumber, TR::Node *node)
{
(target2 == NULL) ?
self()->addAOTRelocation(new (self()->trHeapMemory()) TR::ExternalRelocation(location, target, kind, self()),
self()->addExternalRelocation(new (self()->trHeapMemory()) TR::ExternalRelocation(location, target, kind, self()),
generatingFileName, generatingLineNumber, node) :
self()->addAOTRelocation(new (self()->trHeapMemory()) TR::ExternalRelocation(location, target, target2, kind, self()),
self()->addExternalRelocation(new (self()->trHeapMemory()) TR::ExternalRelocation(location, target, target2, kind, self()),
generatingFileName, generatingLineNumber, node);
}

void J9::CodeGenerator::addProjectSpecializedRelocation(TR::Instruction *instr, uint8_t *target, uint8_t *target2,
TR_ExternalRelocationTargetKind kind, char *generatingFileName, uintptr_t generatingLineNumber, TR::Node *node)
{
(target2 == NULL) ?
self()->addAOTRelocation(new (self()->trHeapMemory()) TR::BeforeBinaryEncodingExternalRelocation(instr, target, kind, self()),
self()->addExternalRelocation(new (self()->trHeapMemory()) TR::BeforeBinaryEncodingExternalRelocation(instr, target, kind, self()),
generatingFileName, generatingLineNumber, node) :
self()->addAOTRelocation(new (self()->trHeapMemory()) TR::BeforeBinaryEncodingExternalRelocation(instr, target, target2, kind, self()),
self()->addExternalRelocation(new (self()->trHeapMemory()) TR::BeforeBinaryEncodingExternalRelocation(instr, target, target2, kind, self()),
generatingFileName, generatingLineNumber, node);
}

void J9::CodeGenerator::addProjectSpecializedPairRelocation(uint8_t *location, uint8_t *location2, uint8_t *target,
TR_ExternalRelocationTargetKind kind, char *generatingFileName, uintptr_t generatingLineNumber, TR::Node *node)
{
self()->addAOTRelocation(new (self()->trHeapMemory()) TR::ExternalOrderedPair32BitRelocation(location, location2, target, kind, self()),
self()->addExternalRelocation(new (self()->trHeapMemory()) TR::ExternalOrderedPair32BitRelocation(location, location2, target, kind, self()),
generatingFileName, generatingLineNumber, node);
}

Expand All @@ -2733,7 +2733,7 @@ J9::CodeGenerator::jitAddUnresolvedAddressMaterializationToPatchOnClassRedefinit
TR_J9VMBase *fej9 = (TR_J9VMBase *)(self()->fe());
if (self()->comp()->compileRelocatableCode())
{
self()->addAOTRelocation(new (self()->trHeapMemory()) TR::ExternalRelocation((uint8_t *)firstInstruction, 0, TR_HCR, self()),
self()->addExternalRelocation(new (self()->trHeapMemory()) TR::ExternalRelocation((uint8_t *)firstInstruction, 0, TR_HCR, self()),
__FILE__,__LINE__, NULL);
}
else
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/env/VMJ9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4844,7 +4844,7 @@ TR_J9VMBase::needsInvokeExactJ2IThunk(TR::Node *callNode, TR::Compilation *comp)
|| method->isArchetypeSpecimen()))
{
if (isAOT_DEPRECATED_DO_NOT_USE()) // While we're here... we need an AOT relocation for this call
comp->cg()->addAOTRelocation(new (comp->trHeapMemory()) TR::ExternalRelocation(NULL, (uint8_t *)callNode, (uint8_t *)methodSymbol->getMethod()->signatureChars(), TR_J2IThunks, comp->cg()), __FILE__, __LINE__, callNode);
comp->cg()->addExternalRelocation(new (comp->trHeapMemory()) TR::ExternalRelocation(NULL, (uint8_t *)callNode, (uint8_t *)methodSymbol->getMethod()->signatureChars(), TR_J2IThunks, comp->cg()), __FILE__, __LINE__, callNode);

// We need a j2i thunk when this call executes, in case the target MH has
// no invokeExact thunk yet.
Expand Down
Loading

0 comments on commit 2663a82

Please sign in to comment.