Search in sources :

Example 16 with ExceptionHandlerBasicBlock

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());
}
Also used : BasicBlock(org.jikesrvm.compilers.opt.ir.BasicBlock) ExceptionHandlerBasicBlock(org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlock)

Example 17 with ExceptionHandlerBasicBlock

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);
}
Also used : OutEdgeEnumeration(org.jikesrvm.compilers.opt.util.SpaceEffGraphNode.OutEdgeEnumeration) BasicBlock(org.jikesrvm.compilers.opt.ir.BasicBlock) ExceptionHandlerBasicBlock(org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlock) ExceptionHandlerBasicBlock(org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlock) GraphEdge(org.jikesrvm.compilers.opt.util.GraphEdge) ExceptionHandlerBasicBlockBag(org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlockBag)

Aggregations

ExceptionHandlerBasicBlock (org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlock)17 BasicBlock (org.jikesrvm.compilers.opt.ir.BasicBlock)16 ExceptionHandlerBasicBlockBag (org.jikesrvm.compilers.opt.ir.ExceptionHandlerBasicBlockBag)6 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)5 HashSet (java.util.HashSet)2 TypeReference (org.jikesrvm.classloader.TypeReference)2 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)2 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)2 TypeOperand (org.jikesrvm.compilers.opt.ir.operand.TypeOperand)2 OutEdgeEnumeration (org.jikesrvm.compilers.opt.util.SpaceEffGraphNode.OutEdgeEnumeration)2 RVMMethod (org.jikesrvm.classloader.RVMMethod)1 GenerationContext (org.jikesrvm.compilers.opt.bc2ir.GenerationContext)1 OsrPoint (org.jikesrvm.compilers.opt.ir.OsrPoint)1 RegSpillListElement (org.jikesrvm.compilers.opt.ir.RegSpillListElement)1 Register (org.jikesrvm.compilers.opt.ir.Register)1 PhysicalRegisterSet (org.jikesrvm.compilers.opt.ir.ia32.PhysicalRegisterSet)1 AddressConstantOperand (org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand)1 BasicBlockOperand (org.jikesrvm.compilers.opt.ir.operand.BasicBlockOperand)1 BranchProfileOperand (org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand)1 ClassConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ClassConstantOperand)1