/**
   * Generates JVM bytecode to evaluate this expression.
   *
   * @param code the bytecode sequence
   * @param discardValue discard the result of the evaluation ?
   */
  public void genCode(CodeSequence code, boolean discardValue) {
    setLineNumber(code);

    expr.genCode(code, false);
    code.plantInstruction(new PushLiteralInstruction(1));
    code.plantNoArgInstruction(opc_ixor);

    if (discardValue) {
      code.plantPopInstruction(type);
    }
  }
Esempio n. 2
0
  /**
   * Generates a sequence of bytescodes
   *
   * @param code the code list
   */
  public void genCode(CodeSequence code) {
    setLineNumber(code);

    if (expr != null) {
      expr.genCode(code, false);

      code.plantReturn(this);
      code.plantNoArgInstruction(expr.getType().getReturnOpcode());
    } else {
      code.plantReturn(this);
      code.plantNoArgInstruction(opc_return);
    }
  }
  /**
   * Generates JVM bytecode to evaluate this expression.
   *
   * @param code the bytecode sequence
   * @param discardValue discard the result of the evaluation ?
   */
  public void genCode(CodeSequence code, boolean discardValue) {
    setLineNumber(code);

    expr.genCode(code, false);
    if (type == CStdType.Long) {
      code.plantInstruction(new PushLiteralInstruction((long) -1));
      code.plantNoArgInstruction(opc_lxor);
    } else {
      code.plantInstruction(new PushLiteralInstruction((int) -1));
      code.plantNoArgInstruction(opc_ixor);
    }

    if (discardValue) {
      code.plantPopInstruction(getType());
    }
  }
Esempio n. 4
0
  /**
   * Generates JVM bytecode to evaluate this expression.
   *
   * @param code the bytecode sequence
   * @param discardValue discard the result of the evaluation ?
   */
  public void genCode(CodeSequence code, boolean discardValue) {
    setLineNumber(code);

    boolean forceNonVirtual = false;

    if (!method.isStatic()) {
      prefix.genCode(code, false);
      if (prefix instanceof JSuperExpression) {
        forceNonVirtual = true;
      }
    } else if (prefix != null) {
      prefix.genCode(code, true);
    }

    for (int i = 0; i < args.length; i++) {
      args[i].genCode(code, false);
    }

    method.genCode(code, forceNonVirtual);

    if (discardValue) {
      code.plantPopInstruction(getType());
    }
  }
Esempio n. 5
0
 /** Load the value from a local var (after finally) */
 public void store(CodeSequence code, JLocalVariable var) {
   code.plantLocalVar(expr.getType().getStoreOpcode(), var);
 }
Esempio n. 6
0
 /** Load the value from a local var (after finally) */
 public void load(CodeSequence code, JLocalVariable var) {
   code.plantLocalVar(expr.getType().getLoadOpcode(), var);
 }