Example #1
0
  private static void catchBody(
      BytecodeContext bc,
      GeneratorAdapter adapter,
      Catch ct,
      int pe,
      int lRef,
      boolean caugth,
      boolean store)
      throws BytecodeException {
    // pc.setCatch(pe,true);
    adapter.loadArg(0);
    adapter.loadLocal(pe);
    adapter.push(caugth);
    adapter.push(store);
    adapter.invokeVirtual(Types.PAGE_CONTEXT, TagTry.SET_CATCH3);

    // ref=
    ct.name.writeOut(bc, Expression.MODE_REF);
    adapter.storeLocal(lRef);

    adapter.loadLocal(lRef);
    adapter.loadArg(0);
    adapter.loadLocal(pe); // (...,pe.getCatchBlock(pc))
    adapter.loadArg(0);
    adapter.invokeVirtual(Types.PAGE_EXCEPTION, GET_CATCH_BLOCK);
    adapter.invokeInterface(Types.REFERENCE, SET);
    adapter.pop();

    ct.body.writeOut(bc);
  }
Example #2
0
  private void _writeOutFinally(BytecodeContext bc, int lRef) throws BytecodeException {
    // ref.remove(pc);
    // Reference r=null;
    GeneratorAdapter adapter = bc.getAdapter();

    // if(fcf!=null &&
    // fcf.getAfterFinalGOTOLabel()!=null)ASMUtil.visitLabel(adapter,fcf.getFinalEntryLabel());
    ExpressionUtil.visitLine(bc, finallyLine);

    // if (reference != null)
    //    reference.removeEL(pagecontext);
    Label removeEnd = new Label();
    adapter.loadLocal(lRef);
    adapter.ifNull(removeEnd);
    adapter.loadLocal(lRef);
    adapter.loadArg(0);
    adapter.invokeInterface(Types.REFERENCE, REMOVE_EL);
    adapter.pop();
    adapter.visitLabel(removeEnd);

    if (finallyBody != null) finallyBody.writeOut(bc); // finally
    /*if(fcf!=null){
    	Label l = fcf.getAfterFinalGOTOLabel();
    	if(l!=null)adapter.visitJumpInsn(Opcodes.GOTO, l);
    }*/
  }
Example #3
0
 public static void pop(GeneratorAdapter adapter, Type type) {
   if (type.equals(Types.DOUBLE_VALUE)) adapter.pop2();
   else if (type.equals(Types.VOID)) ;
   else adapter.pop();
 }
Example #4
0
 /**
  * @param adapter
  * @param expr
  * @param mode
  */
 public static void pop(GeneratorAdapter adapter, Expression expr, int mode) {
   if (mode == Expression.MODE_VALUE && (expr instanceof ExprDouble)) adapter.pop2();
   else adapter.pop();
 }