Skip to content

Commit

Permalink
Merge pull request #5225 from Leonardo2718/fixX86Dtor1
Browse files Browse the repository at this point in the history
Move code out of ~TR_OutlinedInstructionsGenerator(), preventing it from throwing
  • Loading branch information
andrewcraik authored May 22, 2020
2 parents c59b365 + 0214561 commit 6a829f9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion compiler/x/amd64/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2019 IBM Corp. and others
* Copyright (c) 2000, 2020 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 @@ -428,6 +428,7 @@ TR::Register *OMR::X86::AMD64::TreeEvaluator::dbits2lEvaluator(TR::Node *node, T
TR_OutlinedInstructionsGenerator og(slowPathLabel, node, cg);
generateRegImm64Instruction(MOV8RegImm64, node, treg, DOUBLE_NAN, cg);
generateLabelInstruction(JMP4, node, endLabel, cg);
og.endOutlinedInstructionSequence();
}

// Merge point
Expand Down
2 changes: 2 additions & 0 deletions compiler/x/codegen/FPTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,7 @@ TR::Register *OMR::X86::TreeEvaluator::f2iEvaluator(TR::Node *node, TR::CodeGene
cg);

generateLabelInstruction(JMP4, node, endLabel, cg);
og.endOutlinedInstructionSequence();
}

generateLabelInstruction(LABEL, node, endLabel, deps, cg);
Expand Down Expand Up @@ -1793,6 +1794,7 @@ TR::Register *OMR::X86::TreeEvaluator::fbits2iEvaluator(TR::Node *node, TR::Code
TR_OutlinedInstructionsGenerator og(slowPathLabel, node, cg);
generateRegImmInstruction( MOV4RegImm4, node, treg, FLOAT_NAN, cg);
generateLabelInstruction( JMP4, node, endLabel, cg);
og.endOutlinedInstructionSequence();
}

// Merge point
Expand Down
2 changes: 2 additions & 0 deletions compiler/x/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1796,6 +1796,7 @@ static void arrayCopy16BitPrimitive(TR::Node* node, TR::Register* dstReg, TR::Re
generateRepMovsInstruction(REPMOVSW, node, sizeReg, NULL, cg);
generateInstruction(CLD, node, cg);
generateLabelInstruction(JMP4, node, mainEndLabel, cg);
og.endOutlinedInstructionSequence();
}
}
generateLabelInstruction(LABEL, node, mainEndLabel, dependencies, cg);
Expand Down Expand Up @@ -1876,6 +1877,7 @@ static void arrayCopyDefault(TR::Node* node, uint8_t elementSize, TR::Register*
generateRepMovsInstruction(repmovs, node, sizeReg, NULL, cg);
generateInstruction(CLD, node, cg);
generateLabelInstruction(JMP4, node, mainEndLabel, cg);
og.endOutlinedInstructionSequence();
}

generateLabelInstruction(LABEL, node, mainEndLabel, dependencies, cg);
Expand Down
8 changes: 5 additions & 3 deletions compiler/x/codegen/OutlinedInstructions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ TR::Node *TR_OutlinedInstructions::createOutlinedCallNode(TR::Node *callNode, TR
}

TR_OutlinedInstructionsGenerator::TR_OutlinedInstructionsGenerator(TR::LabelSymbol* entryLabel, TR::Node* node, TR::CodeGenerator* cg)
: _hasEnded(false)
{
_oi = new (cg->trHeapMemory()) TR_OutlinedInstructions(entryLabel, cg);
_oi->setCallNode(node);
Expand All @@ -382,14 +383,15 @@ TR_OutlinedInstructionsGenerator::TR_OutlinedInstructionsGenerator(TR::LabelSymb
void
TR_OutlinedInstructionsGenerator::endOutlinedInstructionSequence()
{
/// TODO: Move cleanup code from destrdductor here
generateLabelInstruction(LABEL, _oi->_callNode, generateLabelSymbol(_oi->_cg), _oi->_cg);
_oi->swapInstructionListsWithCompilation();
_hasEnded = true;
}

TR_OutlinedInstructionsGenerator::~TR_OutlinedInstructionsGenerator()
{
if (!std::uncaught_exception())
{
generateLabelInstruction(LABEL, _oi->_callNode, generateLabelSymbol(_oi->_cg), _oi->_cg);
_oi->swapInstructionListsWithCompilation();
TR_ASSERT_FATAL(_hasEnded, "TR_OutlinedInstructionsGenerator object has gone out of scope before call to endOutlinedInstructionSequence().");
}
}
7 changes: 1 addition & 6 deletions compiler/x/codegen/OutlinedInstructions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,9 @@ class TR_OutlinedInstructionsGenerator
*/
void endOutlinedInstructionSequence();

/**
@brief Obtain the underlying TR_OutlinedInstructions.
*/
inline TR_OutlinedInstructions* obtain() { return _oi; }
inline TR_OutlinedInstructions* operator->() { return obtain(); }

private:
TR_OutlinedInstructions* _oi;
bool _hasEnded;
};

#endif

0 comments on commit 6a829f9

Please sign in to comment.