Skip to content

Commit

Permalink
x86: make critical asserts fatal
Browse files Browse the repository at this point in the history
Signed-off-by: Bradley Wood <[email protected]>
  • Loading branch information
BradleyWood committed May 5, 2023
1 parent 33d5efb commit cf7b216
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/x/codegen/OMRMemoryReference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ OMR::X86::MemoryReference::assignRegisters(
{
// Note: a MemRef can be used only once -- if you want to reuse make a copy using
// generateX86MemoryReference(OMR::X86::MemoryReference &, intptr_t, TR::CodeGenerator *cg).
TR_ASSERT(!_baseRegister->getRealRegister(),"_baseRegister is a Real Register already, are you reusing a Memory Reference?");
TR_ASSERT_FATAL(!_baseRegister->getRealRegister(),"_baseRegister is a Real Register already, are you reusing a Memory Reference?");
assignedBaseRegister = assignGPRegister(currentInstruction, _baseRegister, TR_WordReg, cg);
}

Expand Down Expand Up @@ -1581,7 +1581,7 @@ OMR::X86::MemoryReference::generateBinaryEncoding(

if (baseRegisterNumber == TR::RealRegister::vfp)
{
TR_ASSERT(cg->machine()->getRealRegister(baseRegisterNumber)->getAssignedRealRegister(),
TR_ASSERT_FATAL(cg->machine()->getRealRegister(baseRegisterNumber)->getAssignedRealRegister(),
"virtual frame pointer must be assigned before binary encoding!\n");

base = toRealRegister(cg->machine()->
Expand All @@ -1598,7 +1598,7 @@ OMR::X86::MemoryReference::generateBinaryEncoding(
}

displacement = self()->getDisplacement();
TR_ASSERT(IS_32BIT_SIGNED(displacement), "64-bit displacement should have been replaced in TR_AMD64MemoryReference::generateBinaryEncoding");
TR_ASSERT_FATAL(IS_32BIT_SIGNED(displacement), "64-bit displacement should have been replaced in TR_AMD64MemoryReference::generateBinaryEncoding");

if (!isForceWideDisplacement() && isEvex && (displacement % displacementDivisor) == 0 && IS_8BIT_SIGNED(displacement / displacementDivisor))
{
Expand Down
5 changes: 5 additions & 0 deletions compiler/x/codegen/OMRMemoryReference.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,14 @@ class OMR_EXTENSIBLE MemoryReference : public OMR::MemoryReference
//
TR::Register *baseRegister;
if (toRealRegister(_baseRegister)->getRegisterNumber() == TR::RealRegister::vfp)
{
baseRegister = toRealRegister(_baseRegister)->getAssignedRealRegister();
TR_ASSERT_FATAL(baseRegister, "virtual frame pointer must be assigned before binary encoding!\n");
}
else
{
baseRegister = _baseRegister;
}
rxbBits |= toRealRegister(baseRegister)->rexBits(TR::RealRegister::REX_B, false);
}
if (_indexRegister)
Expand Down

0 comments on commit cf7b216

Please sign in to comment.