Skip to content

Commit 861668c

Browse files
authored
Merge pull request eclipse-openj9#20814 from 0xdaryl/nocomp
Eliminate some uses of TR::comp() in favour of cheaper alternatives
2 parents 9838ac7 + 26977ca commit 861668c

File tree

7 files changed

+17
-19
lines changed

7 files changed

+17
-19
lines changed

runtime/compiler/codegen/CodeGenGPU.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,7 +2082,7 @@ J9::CodeGenerator::findExtraParms(
20822082
"can only access a field of this object\n");
20832083

20842084
// TODO: handle duplicate names from different classes
2085-
TR_SharedMemoryField field = sharedMemory->find(TR::comp(), node->getSymbolReference());
2085+
TR_SharedMemoryField field = sharedMemory->find(self()->comp(), node->getSymbolReference());
20862086

20872087
if (field.getSize() == 0)
20882088
numExtraParms++;
@@ -2296,13 +2296,13 @@ J9::CodeGenerator::dumpNVVMIR(
22962296

22972297
ir.print("\ndefine %s @test%d(", getTypeName(_gpuReturnType), gpuPtxCount);
22982298

2299-
CS2::ArrayOf<gpuParameter, TR::Allocator> gpuParameterMap(TR::comp()->allocator());
2299+
CS2::ArrayOf<gpuParameter, TR::Allocator> gpuParameterMap(self()->comp()->allocator());
23002300
CS2::ArrayOf<TR::CodeGenerator::gpuMapElement, TR::Allocator>::Cursor ait(_gpuSymbolMap);
23012301

23022302
for (ait.SetToFirst(); ait.Valid(); ait.SetToNext())
23032303
{
23042304
if (!ait->_hostSymRef) continue;
2305-
traceMsg(TR::comp(), "hostSymRef #%d parmSlot %d\n", (int)ait, ait->_parmSlot);
2305+
traceMsg(self()->comp(), "hostSymRef #%d parmSlot %d\n", (int)ait, ait->_parmSlot);
23062306

23072307
if (ait->_parmSlot != -1)
23082308
{

runtime/compiler/codegen/J9AheadOfTimeCompile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ J9::AheadOfTimeCompile::initializeCommonAOTRelocationHeader(TR::IteratedExternal
14131413
uint8_t *
14141414
J9::AheadOfTimeCompile::dumpRelocationHeaderData(uint8_t *cursor, bool isVerbose)
14151415
{
1416-
TR::Compilation *comp = TR::comp();
1416+
TR::Compilation *comp = self()->comp();
14171417
TR_RelocationRuntime *reloRuntime = comp->reloRuntime();
14181418
TR_RelocationTarget *reloTarget = reloRuntime->reloTarget();
14191419

runtime/compiler/optimizer/J9ValuePropagation.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,6 @@ J9::ValuePropagation::isValue(TR::VPConstraint *constraint, TR_OpaqueClassBlock
696696
return type->isFixedClass() ? TR_no : TR_maybe;
697697
}
698698

699-
TR::Compilation *comp = TR::comp();
700699
clazz = type->getClass();
701700

702701
// No need to check array class type because array classes should be marked as having identity.
@@ -707,7 +706,7 @@ J9::ValuePropagation::isValue(TR::VPConstraint *constraint, TR_OpaqueClassBlock
707706

708707
// Is the type either an abstract class or an interface (i.e., not a
709708
// concrete class)? If so, it might be a value type.
710-
if (!TR::Compiler->cls.isConcreteClass(comp, clazz))
709+
if (!TR::Compiler->cls.isConcreteClass(comp(), clazz))
711710
{
712711
return TR_maybe;
713712
}

runtime/compiler/optimizer/JProfilingValue.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,9 +940,9 @@ TR_JProfilingValue::incrementMemory(TR::Compilation *comp, TR::DataType counterT
940940
* \param value Value to store in const.
941941
*/
942942
TR::Node *
943-
TR_JProfilingValue::systemConst(TR::Node *example, uint64_t value)
943+
TR_JProfilingValue::systemConst(TR::Compilation *comp, TR::Node *example, uint64_t value)
944944
{
945-
TR::ILOpCodes constOp = TR::comp()->target().is64Bit() ? TR::lconst : TR::iconst;
945+
TR::ILOpCodes constOp = comp->target().is64Bit() ? TR::lconst : TR::iconst;
946946
return TR::Node::create(example, constOp, 0, value);
947947
}
948948

runtime/compiler/optimizer/JProfilingValue.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,18 @@ class TR_JProfilingValue : public TR::Optimization
5656
void cleanUpAndAddProfilingCandidates();
5757
/**
5858
* Examines node to identify profiling candidate and add place holder calls for profiling it.
59-
* This routine checks node and it's children for mainly two type of nodes.
59+
* This routine checks node and it's children for mainly two type of nodes.
6060
* 1. Virtual Call
6161
* 2. instanceOf/checkcast/checkcastAndNULLCHK
6262
* In these case, it adds placeholder call to profiler the VFT Pointer.
63-
*
63+
*
6464
* @param node to examine for profiling candidate
6565
* @param cursor A TreeTop Pointer containing the node
6666
* @param alreadyProfiledValues A BitVector containing information about already profiled nodes in Extended Basic Blocks
6767
* @param checklist A Node checklist to make sure while recursively examining node, we do not examine node multiple times.
6868
*/
6969
void performOnNode(TR::Node *node, TR::TreeTop *cursor, TR_BitVector *alreadyProfiledValues, TR::NodeChecklist *checklist);
70-
70+
7171
static bool addProfilingTrees(
7272
TR::Compilation *comp,
7373
TR::TreeTop *insertionPoint,
@@ -76,7 +76,7 @@ class TR_JProfilingValue : public TR::Optimization
7676
bool addNullCheck = false,
7777
bool extendBlocks = true,
7878
bool trace = false);
79-
79+
8080
private:
8181
static TR::Node *computeHash(TR::Compilation *comp, TR_AbstractHashTableProfilerInfo *table, TR::Node *value, TR::Node *baseAddr);
8282

@@ -94,7 +94,7 @@ class TR_JProfilingValue : public TR::Optimization
9494
static TR::Node *incrementMemory(TR::Compilation *comp, TR::DataType counterType, TR::Node *address);
9595
static TR::Node *copyGlRegDeps(TR::Compilation *comp, TR::Node *origGlRegDeps);
9696
static TR::Node *effectiveAddress(TR::DataType dataType, TR::Node *base, TR::Node *index = NULL, TR::Node *offset = NULL);
97-
static TR::Node *systemConst(TR::Node *example, uint64_t value);
97+
static TR::Node *systemConst(TR::Compilation *comp, TR::Node *example, uint64_t value);
9898
static TR::Node *convertType(TR::Node *index, TR::DataType dataType, bool zeroExtend = true);
9999
};
100100

runtime/compiler/x/codegen/J9TreeEvaluator.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2738,9 +2738,8 @@ TR::Register *J9::X86::TreeEvaluator::ZEROCHKEvaluator(TR::Node *node, TR::CodeG
27382738
}
27392739

27402740

2741-
bool isConditionCodeSetForCompare(TR::Node *node, bool *jumpOnOppositeCondition)
2741+
bool isConditionCodeSetForCompare(TR::Node *node, bool *jumpOnOppositeCondition, TR::Compilation *comp)
27422742
{
2743-
TR::Compilation *comp = TR::comp();
27442743
// Disable. Need to re-think how we handle overflow cases.
27452744
//
27462745
static char *disableNoCompareEFlags = feGetEnv("TR_disableNoCompareEFlags");
@@ -2870,7 +2869,7 @@ TR::Register *J9::X86::TreeEvaluator::BNDCHKEvaluator(TR::Node *node, TR::CodeGe
28702869
}
28712870
else
28722871
{
2873-
if (!isConditionCodeSetForCompare(node, &jumpOnOppositeCondition))
2872+
if (!isConditionCodeSetForCompare(node, &jumpOnOppositeCondition, cg->comp()))
28742873
{
28752874
node->swapChildren();
28762875
TR::TreeEvaluator::compareIntegersForOrder(node, cg);
@@ -2883,7 +2882,7 @@ TR::Register *J9::X86::TreeEvaluator::BNDCHKEvaluator(TR::Node *node, TR::CodeGe
28832882
}
28842883
else
28852884
{
2886-
if (!isConditionCodeSetForCompare(node, &jumpOnOppositeCondition))
2885+
if (!isConditionCodeSetForCompare(node, &jumpOnOppositeCondition, cg->comp()))
28872886
{
28882887
TR::TreeEvaluator::compareIntegersForOrder(node, cg);
28892888
instr = generateLabelInstruction(TR::InstOpCode::JBE4, node, boundCheckFailureLabel, cg);

runtime/compiler/z/codegen/J9TreeEvaluator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10453,7 +10453,7 @@ genHeapAlloc(TR::Node * node, TR::Instruction *& iCursor, bool isVariableLen, TR
1045310453
TR::Register * addressReg = srm->findOrCreateScratchRegister();
1045410454
iCursor = generateRRInstruction(cg, TR::InstOpCode::getLoadRegOpCode(), node, addressReg, resReg, iCursor);
1045510455

10456-
if (TR::comp()->target().is64Bit())
10456+
if (comp->target().is64Bit())
1045710457
{
1045810458
iCursor = generateRSInstruction(cg, TR::InstOpCode::SRAG, node, loopIterRegsiter, lengthReg, 8, iCursor);
1045910459
}
@@ -14853,4 +14853,4 @@ J9::Z::TreeEvaluator::inlineOnSpinWait(TR::Node *node, TR::CodeGenerator *cg)
1485314853
// Check omr/include_core/AtomicSupport.hpp for the JNI implementation.
1485414854
TR::Instruction* cursor = new (cg->trHeapMemory()) TR::S390NOPInstruction(TR::InstOpCode::NOP, 2, node, cg);
1485514855
return NULL;
14856-
}
14856+
}

0 commit comments

Comments
 (0)