use of org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlock in project JikesRVM by JikesRVM.
the class GenerationContextTest method checkCodeOrderForRethrowBlock.
private void checkCodeOrderForRethrowBlock(GenerationContext gc, BasicBlock prologue, BasicBlock epilogue, ExceptionHandlerBasicBlock rethrow) {
BasicBlock firstBlockInCodeOrder = gc.getCfg().firstInCodeOrder();
assertTrue(firstBlockInCodeOrder.equals(prologue));
BasicBlock secondBlockInCodeOrder = firstBlockInCodeOrder.nextBasicBlockInCodeOrder();
assertTrue(secondBlockInCodeOrder.equals(rethrow));
BasicBlock lastBlockInCodeOrder = secondBlockInCodeOrder.nextBasicBlockInCodeOrder();
assertTrue(lastBlockInCodeOrder.equals(epilogue));
assertNull(lastBlockInCodeOrder.nextBasicBlockInCodeOrder());
}
use of org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlock in project JikesRVM by JikesRVM.
the class GenerationContextTest method assertThatUnlockAndRethrowBlockIsCorrect.
private void assertThatUnlockAndRethrowBlockIsCorrect(GenerationContext gc, InlineSequence inlineSequence, BasicBlock prologue, Operand lockObject, BasicBlock epilogue) {
ExceptionHandlerBasicBlockBag ehbb = gc.getEnclosingHandlers();
Enumeration<BasicBlock> enumerator = ehbb.enumerator();
ExceptionHandlerBasicBlock rethrow = (ExceptionHandlerBasicBlock) enumerator.nextElement();
assertThat(enumerator.hasMoreElements(), is(false));
assertThatRethrowBlockIsCorrect(inlineSequence, lockObject, rethrow);
checkCodeOrderForRethrowBlock(gc, prologue, epilogue, rethrow);
assertTrue(rethrow.mayThrowUncaughtException());
assertTrue(rethrow.canThrowExceptions());
OutEdgeEnumeration outEdges = rethrow.outEdges();
boolean leadsToExit = false;
while (outEdges.hasMoreElements()) {
GraphEdge nextElement = outEdges.nextElement();
BasicBlock target = (BasicBlock) nextElement.to();
if (target == gc.getCfg().exit()) {
leadsToExit = true;
}
}
assertTrue(leadsToExit);
assertSame(rethrow, gc.getUnlockAndRethrow());
ExceptionHandlerBasicBlockBag ehbbb = gc.getEnclosingHandlers();
assertNull(ehbbb.getCaller());
assertThatEnclosingHandlersContainRethrow(rethrow, ehbbb);
}
Aggregations