Skip to content

Commit

Permalink
Move requiresAtomicPatching to Instruction
Browse files Browse the repository at this point in the history
Signed-off-by: Shivam Mittal <[email protected]>
  • Loading branch information
shivammittal99 committed Dec 14, 2017
1 parent 67b90a3 commit 0b5e712
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 0 additions & 6 deletions compiler/codegen/OMRCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2693,12 +2693,6 @@ OMR::CodeGenerator::sizeOfInstructionToBePatched(TR::Instruction *vgdnop)
return 0;
}

bool
OMR::CodeGenerator::requiresAtomicPatching(TR::Instruction *vgdnop)
{
return !(vgdnop->getNode() && vgdnop->getNode()->isStopTheWorldGuard());
}

int32_t
OMR::CodeGenerator::sizeOfInstructionToBePatchedHCRGuard(TR::Instruction *vgdnop)
{
Expand Down
1 change: 0 additions & 1 deletion compiler/codegen/OMRCodeGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,6 @@ class OMR_EXTENSIBLE CodeGenerator
// Code patching
//
// Used to find out whether there is an appropriate instruction space as vgdnop space
bool requiresAtomicPatching(TR::Instruction *vgdnop);
int32_t sizeOfInstructionToBePatched(TR::Instruction *vgdnop);
int32_t sizeOfInstructionToBePatchedHCRGuard(TR::Instruction *vgdnop);
// Used to find which instruction is an appropriate instruction space as vgdnop space
Expand Down
6 changes: 6 additions & 0 deletions compiler/codegen/OMRInstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ Instruction::useRegister(TR::Register *reg)
reg->incOutOfLineUseCount();
}

bool
Instruction::requiresAtomicPatching()
{
return !(self()->getNode() && self()->getNode()->isStopTheWorldGuard());
}

bool
Instruction::isMergeableGuard()
{
Expand Down
3 changes: 2 additions & 1 deletion compiler/codegen/OMRInstruction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,12 @@ class OMR_EXTENSIBLE Instruction
int32_t getRegisterSaveDescription() { return _registerSaveDescription; }
int32_t setRegisterSaveDescription(int32_t v) { return (_registerSaveDescription = v); }

bool requiresAtomicPatching();

int32_t getMaxPatchableInstructionLength() { return 0; } // no virt

bool isMergeableGuard();


protected:

uint8_t *_binaryEncodingBuffer;
Expand Down
4 changes: 2 additions & 2 deletions compiler/x/codegen/X86BinaryEncoding.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, 2017 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 @@ -848,7 +848,7 @@ uint8_t *TR::X86VirtualGuardNOPInstruction::generateBinaryEncoding()
}

// guards that do not require atomic patching have a more relaxed sizing constraing since they are only patched while all threads are stopped
bool requiresAtomicPatching = cg()->requiresAtomicPatching(this);
bool requiresAtomicPatching = this->requiresAtomicPatching();
uint8_t next = requiresAtomicPatching ?
cg()->sizeOfInstructionToBePatched(this) :
cg()->sizeOfInstructionToBePatchedHCRGuard(this);
Expand Down

0 comments on commit 0b5e712

Please sign in to comment.