コード例 #1
0
  public static void compileIRStatement(IRStatement statement, IRBytecodeContext context) {
    if (statement == null) {
      return;
    }

    context.setLineNumber(statement.getLineNumber());
    if (statement instanceof IRAssignmentStatement) {
      IRAssignmentStatementCompiler.compile((IRAssignmentStatement) statement, context);
    } else if (statement instanceof IRFieldSetStatement) {
      IRFieldSetStatementCompiler.compile((IRFieldSetStatement) statement, context);
    } else if (statement instanceof IRIfStatement) {
      IRIfStatementCompiler.compile((IRIfStatement) statement, context);
    } else if (statement instanceof IRMethodCallStatement) {
      IRMethodCallStatementCompiler.compile((IRMethodCallStatement) statement, context);
    } else if (statement instanceof IRNewStatement) {
      IRNewStatementCompiler.compile((IRNewStatement) statement, context);
    } else if (statement instanceof IRNoOpStatement) {
      // Do nothing
    } else if (statement instanceof IRReturnStatement) {
      IRReturnStatementCompiler.compile((IRReturnStatement) statement, context);
    } else if (statement instanceof IRStatementList) {
      IRStatementListCompiler.compile((IRStatementList) statement, context);
    } else if (statement instanceof IRArrayStoreStatement) {
      IRArrayStoreStatementCompiler.compile((IRArrayStoreStatement) statement, context);
    } else if (statement instanceof IRThrowStatement) {
      IRThrowStatementCompiler.compile((IRThrowStatement) statement, context);
    } else if (statement instanceof IRForEachStatement) {
      IRForEachStatementCompiler.compile((IRForEachStatement) statement, context);
    } else if (statement instanceof IRWhileStatement) {
      IRWhileStatementCompiler.compile((IRWhileStatement) statement, context);
    } else if (statement instanceof IRDoWhileStatement) {
      IRDoWhileStatementCompiler.compile((IRDoWhileStatement) statement, context);
    } else if (statement instanceof IRBreakStatement) {
      IRBreakStatementCompiler.compile((IRBreakStatement) statement, context);
    } else if (statement instanceof IRContinueStatement) {
      IRContinueStatementCompiler.compile((IRContinueStatement) statement, context);
    } else if (statement instanceof IRTryCatchFinallyStatement) {
      IRTryCatchFinallyStatementCompiler.compile((IRTryCatchFinallyStatement) statement, context);
    } else if (statement instanceof IRMonitorLockAcquireStatement) {
      IRMonitorLockAcquireCompiler.compile((IRMonitorLockAcquireStatement) statement, context);
    } else if (statement instanceof IRMonitorLockReleaseStatement) {
      IRMonitorLockReleaseCompiler.compile((IRMonitorLockReleaseStatement) statement, context);
    } else if (statement instanceof IRSyntheticStatement) {
      IRSyntheticStatementCompiler.compile((IRSyntheticStatement) statement, context);
    } else if (statement instanceof IRSwitchStatement) {
      IRSwitchStatementCompiler.compile((IRSwitchStatement) statement, context);
    } else if (statement instanceof IREvalStatement) {
      IREvalStatementCompiler.compile((IREvalStatement) statement, context);
    } else {
      throw new IllegalArgumentException("Unrecognized statement of type " + statement.getClass());
    }
  }
コード例 #2
0
  private void inlineLocalFinallyStmt(IRStatement tryOrCatchStmt, Label labelEnd) {
    MethodVisitor mv = _context.getMv();

    if (tryOrCatchStmt.getLeastSignificantTerminalStatement() == null) {
      if (hasFinally()) {
        _finallyPartitioner.inlineFinally();
        NamedLabel endLabel =
            new NamedLabel("EndFinally" + _finallyPartitioner.getFinallyEnds().size());
        _context.visitLabel(endLabel);
        _finallyPartitioner.endInlineFinally(endLabel);
      }

      // Also jump to end of finally
      mv.visitJumpInsn(Opcodes.GOTO, labelEnd);
    }
  }