public static void compile(IRIfStatement statement, IRBytecodeContext context) {
    MethodVisitor mv = context.getMv();

    IRBytecodeCompiler.compileIRExpression(statement.getExpression(), context);

    Label afterIf = new Label();
    mv.visitJumpInsn(Opcodes.IFEQ, afterIf);
    IRBytecodeCompiler.compileIRStatement(statement.getIfStatement(), context);
    if (statement.getElseStatement() != null) {
      Label afterElse = new Label();
      boolean bTerminal = statement.getLeastSignificantTerminalStatement() != null;
      if (!bTerminal) {
        mv.visitJumpInsn(Opcodes.GOTO, afterElse);
      }
      mv.visitLabel(afterIf);

      IRBytecodeCompiler.compileIRStatement(statement.getElseStatement(), context);

      if (!bTerminal) {
        mv.visitLabel(afterElse);
      }
    } else {
      mv.visitLabel(afterIf);
    }
  }
  public static void compile(IRTernaryExpression expression, IRBytecodeContext context) {
    // TODO - Gosu Perf - We could make this more efficient by inspecting the conditional expression
    // for common
    // patterns like equality expressions or other comparisons
    MethodVisitor mv = context.getMv();

    Label trueLabel = new Label();
    if (isComparisonToNull(expression.getTest())) {
      IRBytecodeCompiler.compileIRExpression(
          getNonNullEqualityOperand(expression.getTest()), context);
      mv.visitJumpInsn(
          getNullOpCode(expression.getTest()),
          trueLabel); // i.e. jump to trueLabel if the expression is equal to null
    } else {
      IRBytecodeCompiler.compileIRExpression(expression.getTest(), context);
      mv.visitJumpInsn(
          Opcodes.IFNE,
          trueLabel); // i.e. jump to trueLabel if the expression returned true and thus left a
                      // non-zero value on the stack
    }

    IRBytecodeCompiler.compileIRExpression(expression.getFalseValue(), context);
    Label falseLabel = new Label();
    mv.visitJumpInsn(Opcodes.GOTO, falseLabel);
    mv.visitLabel(trueLabel);
    IRBytecodeCompiler.compileIRExpression(expression.getTrueValue(), context);
    mv.visitLabel(falseLabel);
  }
  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);
    }
  }