Skip to content

Commit

Permalink
Merge pull request #7102 from fjeremic/deprecate-split
Browse files Browse the repository at this point in the history
Deprecate splitWarmAndColdBlocksPhase
  • Loading branch information
0xdaryl committed Sep 18, 2019
2 parents 10ba6a6 + 081d0ed commit 12ef37b
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 154 deletions.
1 change: 0 additions & 1 deletion runtime/compiler/codegen/CodeGenPhaseToPerform.hpp
Expand Up @@ -41,7 +41,6 @@
LowerTreesPhase,
InsertDebugCountersPhase,
CompressedReferenceRematerializationPhase,
SplitWarmAndColdBlocksPhase,
AllocateLinkageRegisters,

IdentifyUnneededByteConvsPhase,
Expand Down
8 changes: 0 additions & 8 deletions runtime/compiler/codegen/J9CodeGenPhase.cpp
Expand Up @@ -118,12 +118,6 @@ J9::CodeGenPhase::performCompressedReferenceRematerializationPhase(TR::CodeGener
cg->compressedReferenceRematerialization();
}

void
J9::CodeGenPhase::performSplitWarmAndColdBlocksPhase(TR::CodeGenerator * cg, TR::CodeGenPhase *)
{
cg->splitWarmAndColdBlocks();
}

const char *
J9::CodeGenPhase::getName()
{
Expand All @@ -145,8 +139,6 @@ J9::CodeGenPhase::getName(TR::CodeGenPhase::PhaseValue phase)
return "InsertEpilogueYieldPoints";
case CompressedReferenceRematerializationPhase:
return "CompressedReferenceRematerialization";
case SplitWarmAndColdBlocksPhase:
return "SplitWarmAndColdBlocks";
case IdentifyUnneededByteConvsPhase:
return "IdentifyUnneededByteConvsPhase";
case LateSequentialConstantStoreSimplificationPhase:
Expand Down
1 change: 0 additions & 1 deletion runtime/compiler/codegen/J9CodeGenPhase.hpp
Expand Up @@ -53,7 +53,6 @@ class OMR_EXTENSIBLE CodeGenPhase: public OMR::CodeGenPhaseConnector
static void performMoveUpArrayLengthStoresPhase(TR::CodeGenerator * cg, TR::CodeGenPhase *);
static void performInsertEpilogueYieldPointsPhase(TR::CodeGenerator * cg, TR::CodeGenPhase *);
static void performCompressedReferenceRematerializationPhase(TR::CodeGenerator * cg, TR::CodeGenPhase *);
static void performSplitWarmAndColdBlocksPhase(TR::CodeGenerator * cg, TR::CodeGenPhase *);
static void performIdentifyUnneededByteConvsPhase(TR::CodeGenerator * cg, TR::CodeGenPhase *);
static void performLateSequentialConstantStoreSimplificationPhase(TR::CodeGenerator * cg, TR::CodeGenPhase *);

Expand Down
1 change: 0 additions & 1 deletion runtime/compiler/codegen/J9CodeGenPhaseEnum.hpp
Expand Up @@ -35,7 +35,6 @@
MoveUpArrayLengthStoresPhase,
InsertEpilogueYieldPointsPhase,
CompressedReferenceRematerializationPhase,
SplitWarmAndColdBlocksPhase,
IdentifyUnneededByteConvsPhase,
LateSequentialConstantStoreSimplificationPhase, // all
LastJ9Phase = LateSequentialConstantStoreSimplificationPhase,
1 change: 0 additions & 1 deletion runtime/compiler/codegen/J9CodeGenPhaseFunctionTable.hpp
Expand Up @@ -34,6 +34,5 @@
TR::CodeGenPhase::performMoveUpArrayLengthStoresPhase, //MoveUpArrayLengthStoresPhase
TR::CodeGenPhase::performInsertEpilogueYieldPointsPhase, //InsertEpilogueYieldPointsPhase
TR::CodeGenPhase::performCompressedReferenceRematerializationPhase,
TR::CodeGenPhase::performSplitWarmAndColdBlocksPhase,
TR::CodeGenPhase::performIdentifyUnneededByteConvsPhase, //IdentifyUnneededByteConvsPhase
TR::CodeGenPhase::performLateSequentialConstantStoreSimplificationPhase, //LateSequentialConstantStoreSimplificationPhase
137 changes: 0 additions & 137 deletions runtime/compiler/codegen/J9CodeGenerator.cpp
Expand Up @@ -2266,143 +2266,6 @@ J9::CodeGenerator::doInstructionSelection()
diagnostic("</selection>\n");
}


// J9, Z
//
// This can surely be done more efficiently. Walk the CFG and go block by block
// rather than iterating through TreeTops looking for BBStarts.
//
void
J9::CodeGenerator::splitWarmAndColdBlocks()
{
if (!self()->allowSplitWarmAndColdBlocks() || self()->comp()->compileRelocatableCode())
{
return;
}

TR::Block * block = NULL;
TR::TreeTop * tt;
TR::Node * node;
TR::Block * firstColdBlock = NULL, * firstColdExtendedBlock = NULL;

for (tt = self()->comp()->getStartTree(); tt; tt = tt->getNextTreeTop())
{
node = tt->getNode();

if (node->getOpCodeValue() == TR::BBStart)
{
block = node->getBlock();

// If this is the first cold block, remember where the warm blocks ended.
// If it is a warm block and cold blocks have already been found, they
// are treated as warm.
//
if (block->isCold())
{
if (!firstColdBlock)
firstColdBlock = block;
}
else
{
firstColdBlock = NULL;
firstColdExtendedBlock = NULL;
}

if (!block->isExtensionOfPreviousBlock())
{
if (firstColdBlock && !firstColdExtendedBlock)
{
if (!block->getPrevBlock() ||
!block->getPrevBlock()->canFallThroughToNextBlock())
firstColdExtendedBlock = block;
else
firstColdBlock = NULL;
}
}
}
}

// Mark the split point between warm and cold blocks, so they can be
// allocated in different code sections.
//
TR::Block *lastWarmBlock;
if (firstColdExtendedBlock)
{
lastWarmBlock = firstColdExtendedBlock->getPrevBlock();
if (!lastWarmBlock)
{
// All the blocks are cold: insert a new goto block ahead of real blocks
lastWarmBlock = TR::TransformUtil::insertNewFirstBlockForCompilation(self()->comp());
}
}
else
{
// All the blocks are warm - the split point is between the last
// instruction and the snippets.
//
lastWarmBlock = block;
}

// If the last tree in the last warm block is not a TR::Goto, insert a goto tree
// at the end of the block.
// If there is a following block the goto will branch to it so that when the
// code is split any fall-through will go to the right place.
// If there is no following block the goto will branch to the first block; in
// this case the goto should never be reached, it is there only to
// make sure that the instruction following the last real treetop will be in
// warm code, so if it is a helper call (e.g. for a throw) the return address
// is in this method's code.
//
if (lastWarmBlock->getNumberOfRealTreeTops() == 0)
tt = lastWarmBlock->getEntry();
else
tt = lastWarmBlock->getLastRealTreeTop();

node = tt->getNode();

if (!(node->getOpCode().isGoto() || node->getOpCode().isJumpWithMultipleTargets() || node->getOpCode().isReturn()))
{
// Find the block to be branched to
//
TR::TreeTop * targetTreeTop = lastWarmBlock->getExit()->getNextTreeTop();
if (targetTreeTop)
{
// Branch to following block. Make sure it is not marked as an
// extension block so that it will get a label generated.
//
targetTreeTop->getNode()->getBlock()->setIsExtensionOfPreviousBlock(false);
}
else
{
// Branch to the first block. This will not be marked as an extension
// block.
targetTreeTop = self()->comp()->getStartBlock()->getEntry();
}

// Generate the goto and insert it into the end of the last warm block.
//
TR::TreeTop *gotoTreeTop = TR::TreeTop::create(self()->comp(), TR::Node::create(node, TR::Goto, 0, targetTreeTop));

// Move reg deps from BBEnd to goto
//
TR::Node *bbEnd = lastWarmBlock->getExit()->getNode();
if (bbEnd->getNumChildren() > 0)
{
TR::Node *glRegDeps = bbEnd->getChild(0);

gotoTreeTop->getNode()->setNumChildren(1);
gotoTreeTop->getNode()->setChild(0, glRegDeps);

bbEnd->setChild(0,NULL);
bbEnd->setNumChildren(0);
}

tt->insertAfter(gotoTreeTop);
}

}


void
J9::CodeGenerator::populateOSRBuffer()
{
Expand Down
2 changes: 0 additions & 2 deletions runtime/compiler/codegen/J9CodeGenerator.hpp
Expand Up @@ -101,8 +101,6 @@ class OMR_EXTENSIBLE CodeGenerator : public OMR::CodeGeneratorConnector

void insertEpilogueYieldPoints();

void splitWarmAndColdBlocks(); // J9 & Z

void allocateLinkageRegisters();

void fixUpProfiledInterfaceGuardTest();
Expand Down
1 change: 0 additions & 1 deletion runtime/compiler/z/codegen/CodeGenPhaseToPerform.hpp
Expand Up @@ -42,7 +42,6 @@
LowerTreesPhase,
InsertDebugCountersPhase,
CompressedReferenceRematerializationPhase,
SplitWarmAndColdBlocksPhase,
AllocateLinkageRegisters,

markLoadAsZeroOrSignExtension,
Expand Down
2 changes: 0 additions & 2 deletions runtime/compiler/z/codegen/J9CodeGenerator.hpp
Expand Up @@ -231,8 +231,6 @@ class OMR_EXTENSIBLE CodeGenerator : public J9::CodeGenerator
bool canCopyWithOneOrTwoInstrs(char *lit, size_t size);
bool inlineSmallLiteral(size_t srcSize, char *srcLiteral, size_t destSize, bool trace);

bool allowSplitWarmAndColdBlocks() { return true; }

#if defined(J9VM_JIT_FREE_SYSTEM_STACK_POINTER)
/** \brief
* Determines whether the JIT supports freeing up the system stack pointer (SSP) for register allocation.
Expand Down

0 comments on commit 12ef37b

Please sign in to comment.