Exemplo n.º 1
0
Arquivo: DMUL.java Projeto: null3/jpf
  public Instruction execute(SystemState ss, KernelState ks, ThreadInfo th) {
    StackFrame sf = th.getTopFrame();

    RealExpression sym_v1 = (RealExpression) sf.getLongOperandAttr();
    double v1 = Types.longToDouble(th.longPop());
    RealExpression sym_v2 = (RealExpression) sf.getLongOperandAttr();
    double v2 = Types.longToDouble(th.longPop());

    double r = v1 * v2;

    if (sym_v1 == null && sym_v2 == null) th.longPush(Types.doubleToLong(r));
    else th.longPush(0);

    RealExpression result = null;
    if (sym_v2 != null) {
      if (sym_v1 != null) result = sym_v2._mul(sym_v1);
      else // v1 is concrete
      result = sym_v2._mul(v1);
    } else if (sym_v1 != null) result = sym_v1._mul(v2);

    sf.setLongOperandAttr(result);

    // System.out.println("Execute DMUL: "+ sf.getLongOperandAttr());

    return getNext(th);
  }
Exemplo n.º 2
0
  public Instruction execute(SystemState ss, KernelState ks, ThreadInfo th) {
    long v1 = th.longPop();
    long v2 = th.longPop();

    th.push(conditionValue(v1, v2), false);

    return getNext(th);
  }
Exemplo n.º 3
0
  public Instruction execute(SystemState ss, KernelState ks, ThreadInfo th) {
    long v1 = th.longPop();
    long v2 = th.longPop();

    if (v1 == 0) {
      return th.createAndThrowException("java.lang.ArithmeticException", "division by zero");
    }

    th.longPush(v2 % v1);

    return getNext(th);
  }