use of org.evosuite.symbolic.expr.fp.RealValue in project evosuite by EvoSuite.
the class ArithmeticVM method DCMPL.
/**
* http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.
* doc3.html#dcmpop
*/
@Override
public void DCMPL() {
RealValue right = env.topFrame().operandStack.popFp64();
RealValue left = env.topFrame().operandStack.popFp64();
double left_concrete_value = (Double) left.getConcreteValue();
double right_concrete_value = (Double) right.getConcreteValue();
if (!left.containsSymbolicVariable()) {
left = ExpressionFactory.buildNewRealConstant(left_concrete_value);
}
if (!right.containsSymbolicVariable()) {
right = ExpressionFactory.buildNewRealConstant(right_concrete_value);
}
int concrete_value;
if (new Double(left_concrete_value).isNaN() || new Double(right_concrete_value).isNaN()) {
concrete_value = 1;
} else if (left_concrete_value == right_concrete_value) {
concrete_value = 0;
} else if (left_concrete_value > right_concrete_value) {
concrete_value = 1;
} else {
assert left_concrete_value < right_concrete_value;
concrete_value = -1;
}
RealComparison ret = new RealComparison(left, right, (long) concrete_value);
env.topFrame().operandStack.pushBv32(ret);
}
use of org.evosuite.symbolic.expr.fp.RealValue in project evosuite by EvoSuite.
the class ArithmeticVM method I2D.
/**
* http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.
* doc6.html#i2d
*/
@Override
public void I2D() {
IntegerValue integerExpr = env.topFrame().operandStack.popBv32();
int integerValue = ((Long) integerExpr.getConcreteValue()).intValue();
RealValue realExpr;
double concreteValue = (double) integerValue;
if (!integerExpr.containsSymbolicVariable()) {
realExpr = ExpressionFactory.buildNewRealConstant(concreteValue);
} else {
realExpr = new IntegerToRealCast(integerExpr, (double) concreteValue);
}
env.topFrame().operandStack.pushFp64(realExpr);
}
use of org.evosuite.symbolic.expr.fp.RealValue in project evosuite by EvoSuite.
the class ArithmeticVM method FMUL.
@Override
public void FMUL() {
RealValue right = env.topFrame().operandStack.popFp32();
RealValue left = env.topFrame().operandStack.popFp32();
float left_concrete_value = ((Double) left.getConcreteValue()).floatValue();
float right_concrete_value = ((Double) right.getConcreteValue()).floatValue();
if (!left.containsSymbolicVariable()) {
left = ExpressionFactory.buildNewRealConstant(left_concrete_value);
}
if (!right.containsSymbolicVariable()) {
right = ExpressionFactory.buildNewRealConstant(right_concrete_value);
}
float con = left_concrete_value * right_concrete_value;
RealValue realExpr = ExpressionFactory.mul(left, right, (double) con);
env.topFrame().operandStack.pushFp32(realExpr);
}
use of org.evosuite.symbolic.expr.fp.RealValue in project evosuite by EvoSuite.
the class ArithmeticVM method FREM.
@Override
public void FREM(float rhs) {
RealValue right = env.topFrame().operandStack.popFp32();
RealValue left = env.topFrame().operandStack.popFp32();
float left_concrete_value = ((Double) left.getConcreteValue()).floatValue();
float right_concrete_value = ((Double) right.getConcreteValue()).floatValue();
if (!left.containsSymbolicVariable()) {
left = ExpressionFactory.buildNewRealConstant(left_concrete_value);
}
if (!right.containsSymbolicVariable()) {
right = ExpressionFactory.buildNewRealConstant(right_concrete_value);
}
float con = left_concrete_value % right_concrete_value;
RealValue realExpr = ExpressionFactory.rem(left, right, (double) con);
env.topFrame().operandStack.pushFp32(realExpr);
}
use of org.evosuite.symbolic.expr.fp.RealValue in project evosuite by EvoSuite.
the class ArithmeticVM method DADD.
@Override
public void DADD() {
RealValue right = env.topFrame().operandStack.popFp64();
RealValue left = env.topFrame().operandStack.popFp64();
double left_concrete_value = ((Double) left.getConcreteValue()).doubleValue();
double right_concrete_value = ((Double) right.getConcreteValue()).doubleValue();
if (!left.containsSymbolicVariable()) {
left = ExpressionFactory.buildNewRealConstant(left_concrete_value);
}
if (!right.containsSymbolicVariable()) {
right = ExpressionFactory.buildNewRealConstant(right_concrete_value);
}
double con = left_concrete_value + right_concrete_value;
RealValue realExpr = ExpressionFactory.add(left, right, con);
env.topFrame().operandStack.pushFp64(realExpr);
}
Aggregations