예제 #1
0
 /**
  * Create a new exception handler BBLE (and exception handler basic block) for the specified
  * bytecode index and exception type.
  *
  * @param loc bytecode index
  * @param position inline sequence
  * @param eType exception type
  * @param temps the register pool to allocate exceptionObject from
  * @param exprStackSize max size of expression stack
  * @param cfg ControlFlowGraph into which the block will eventually be inserted
  */
 HandlerBlockLE(
     int loc,
     InlineSequence position,
     TypeOperand eType,
     GenericRegisterPool temps,
     int exprStackSize,
     ControlFlowGraph cfg) {
   super(loc);
   entryBlock = new ExceptionHandlerBasicBlock(SYNTH_CATCH_BCI, position, eType, cfg);
   block = new BasicBlock(loc, position, cfg);
   // NOTE: We intentionally use throwable rather than eType to avoid
   // having the complexity of having to regenerate the handler when a
   // new type of caught exception is added. Since we shouldn't care about
   // the performance of code in exception handling blocks, this
   // should be the right tradeoff.
   exceptionObject = temps.makeTemp(TypeReference.JavaLangThrowable);
   BC2IR.setGuardForRegOp(exceptionObject, new TrueGuardOperand()); // know not null
   high = loc;
   // Set up expression stack on entry to have the caught exception operand.
   stackState = new OperandStack(exprStackSize);
   stackState.push(exceptionObject);
   setStackKnown();
   // entry block contains instructions to transfer the caught
   // exception object to exceptionObject.
   Instruction s = Nullary.create(GET_CAUGHT_EXCEPTION, exceptionObject.copyD2D());
   entryBlock.appendInstruction(s);
   s.bcIndex = SYNTH_CATCH_BCI;
   entryBlock.insertOut(block);
 }
예제 #2
0
 byte mustCatchException(TypeReference et) {
   return entryBlock.mustCatchException(et);
 }
예제 #3
0
 void addCaughtException(TypeOperand et) {
   entryBlock.addCaughtException(et);
 }