Skip to content

Commit

Permalink
Merge pull request eclipse-omr#2141 from shivammittal99/move_isStopTh…
Browse files Browse the repository at this point in the history
…eWorldGuard

Move isStopTheWorldGuard to OMR::Node
  • Loading branch information
0xdaryl authored Dec 14, 2017
2 parents 8e03e25 + 759b698 commit 8766ad6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
11 changes: 3 additions & 8 deletions compiler/codegen/OMRCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2559,15 +2559,10 @@ OMR::CodeGenerator::computeBlocksWithCalls()
From codegen/CodeGenerator.cpp to make the size of instructions to patch smarter.
**/

bool OMR::CodeGenerator::isStopTheWorldGuard(TR::Node *node)
{
return node->isHCRGuard() || node->isOSRGuard() || node->isBreakpointGuard();
}

bool OMR::CodeGenerator::mergeableGuard(TR::Instruction *guard)
{
static char *mergeOnlyHCRGuards = feGetEnv("TR_MergeOnlyHCRGuards");
return mergeOnlyHCRGuards ? self()->isStopTheWorldGuard(guard->getNode()) : guard->getNode()->isNopableInlineGuard();
return mergeOnlyHCRGuards ? guard->getNode()->isStopTheWorldGuard() : guard->getNode()->isNopableInlineGuard();
}

bool OMR::CodeGenerator::mergeableGuards(TR::Instruction *earlierGuard, TR::Instruction *laterGuard)
Expand All @@ -2576,7 +2571,7 @@ bool OMR::CodeGenerator::mergeableGuards(TR::Instruction *earlierGuard, TR::Inst
&& self()->mergeableGuard(laterGuard)
&& earlierGuard->getNode()->getBranchDestination()
== laterGuard->getNode()->getBranchDestination()
&& (!self()->isStopTheWorldGuard(earlierGuard->getNode()) || self()->isStopTheWorldGuard(laterGuard->getNode()));
&& (!earlierGuard->getNode()->isStopTheWorldGuard() || laterGuard->getNode()->isStopTheWorldGuard());
}

TR::Instruction *OMR::CodeGenerator::getVirtualGuardForPatching(TR::Instruction *vgdnop)
Expand Down Expand Up @@ -2700,7 +2695,7 @@ OMR::CodeGenerator::sizeOfInstructionToBePatched(TR::Instruction *vgdnop)
bool
OMR::CodeGenerator::requiresAtomicPatching(TR::Instruction *vgdnop)
{
return !(vgdnop->getNode() && self()->isStopTheWorldGuard(vgdnop->getNode()));
return !(vgdnop->getNode() && vgdnop->getNode()->isStopTheWorldGuard());
}

int32_t
Expand Down
2 changes: 0 additions & 2 deletions compiler/codegen/OMRCodeGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1180,8 +1180,6 @@ class OMR_EXTENSIBLE CodeGenerator
// currently can only return a value other than vgdnop for HCR guards
TR::Instruction* getVirtualGuardForPatching(TR::Instruction *vgdnop);

bool isStopTheWorldGuard(TR::Node *node);

void jitAddPicToPatchOnClassUnload(void *classPointer, void *addressToBePatched) {}
void jitAdd32BitPicToPatchOnClassUnload(void *classPointer, void *addressToBePatched) {}
void jitAddPicToPatchOnClassRedefinition(void *classPointer, void *addressToBePatched, bool unresolved = false) {}
Expand Down
6 changes: 5 additions & 1 deletion compiler/il/OMRNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7306,7 +7306,11 @@ OMR::Node::printIsMaxLoopIterationGuard()
return self()->isMaxLoopIterationGuard() ? "maxLoopIternGuard " : "";
}


bool
OMR::Node::isStopTheWorldGuard()
{
return self()->isHCRGuard() || self()->isOSRGuard() || self()->isBreakpointGuard();
}

bool
OMR::Node::isProfiledGuard()
Expand Down
2 changes: 2 additions & 0 deletions compiler/il/OMRNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,8 @@ class OMR_EXTENSIBLE Node
void setIsMaxLoopIterationGuard(bool v);
const char * printIsMaxLoopIterationGuard();

bool isStopTheWorldGuard();

bool isProfiledGuard();
void setIsProfiledGuard();
const char * printIsProfiledGuard();
Expand Down
2 changes: 1 addition & 1 deletion compiler/x/codegen/ControlFlowEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2486,7 +2486,7 @@ static bool virtualGuardHelper(TR::Node *node, TR::CodeGenerator *cg)

// Guards patched when the threads are stopped have no issues with multithreaded patching.
// therefore alignment is not required
if (TR::Compiler->target.isSMP() && !cg->isStopTheWorldGuard(node))
if (TR::Compiler->target.isSMP() && !node->isStopTheWorldGuard())
{
// the compiler is now capable of generating a train of vgnops all looking to patch the
// same point with different constraints. alignment is required before the delegated patch
Expand Down
2 changes: 1 addition & 1 deletion compiler/z/codegen/S390Instruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5810,7 +5810,7 @@ TR::S390VirtualGuardNOPInstruction::generateBinaryEncoding()
// in) if the patching occurs during GC pause times. The patching of up to 6-bytes is potentially
// not atomic.

bool performEmptyPatch = cg()->isStopTheWorldGuard(getNode()) || getNode()->isProfiledGuard();
bool performEmptyPatch = getNode()->isStopTheWorldGuard() || getNode()->isProfiledGuard();

// Stop the world guards that are merged with profiled guards never need to generate NOPs for patching because
// the profiled guard will generate the NOP branch to the same location the stop the world guard needs to branch
Expand Down

0 comments on commit 8766ad6

Please sign in to comment.