use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.
the class ArithmeticVM method LXOR.
/**
* @see http
* ://java.sun.com/docs/books/jvms/second_edition/html/Instructions2
* .doc8.html#lxor
*/
@Override
public void LXOR() {
IntegerValue right = env.topFrame().operandStack.popBv64();
IntegerValue left = env.topFrame().operandStack.popBv64();
long left_concrete_value = ((Long) left.getConcreteValue()).longValue();
long right_concrete_value = ((Long) right.getConcreteValue()).longValue();
if (!left.containsSymbolicVariable()) {
left = ExpressionFactory.buildNewIntegerConstant(left_concrete_value);
}
if (!right.containsSymbolicVariable()) {
right = ExpressionFactory.buildNewIntegerConstant(right_concrete_value);
}
long con = left_concrete_value ^ right_concrete_value;
IntegerValue intExpr = new IntegerBinaryExpression(left, Operator.IXOR, right, (long) con);
env.topFrame().operandStack.pushBv64(intExpr);
}
use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.
the class ArithmeticVM method L2F.
@Override
public void L2F() {
IntegerValue integerExpr = env.topFrame().operandStack.popBv64();
long longValue = ((Long) integerExpr.getConcreteValue()).longValue();
RealValue realExpr;
float concreteValue = (float) longValue;
if (!integerExpr.containsSymbolicVariable()) {
realExpr = ExpressionFactory.buildNewRealConstant(concreteValue);
} else {
realExpr = new IntegerToRealCast(integerExpr, (double) concreteValue);
}
env.topFrame().operandStack.pushFp32(realExpr);
}
use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.
the class ArithmeticVM method IDIV.
/**
* a/b
*
* if (b==0) throw exception; // clear stack, push exception else actual
* division // compute, push result
*
* @see http
* ://java.sun.com/docs/books/jvms/second_edition/html/Instructions2
* .doc6.html#idiv
*/
@Override
public void IDIV(int rhsValue) {
// consume all operands in stack
IntegerValue right = env.topFrame().operandStack.popBv32();
IntegerValue left = env.topFrame().operandStack.popBv32();
if (zeroViolation(right, rhsValue))
return;
int left_concrete_value = ((Long) left.getConcreteValue()).intValue();
int right_concrete_value = ((Long) right.getConcreteValue()).intValue();
if (!left.containsSymbolicVariable()) {
left = ExpressionFactory.buildNewIntegerConstant(left_concrete_value);
}
if (!right.containsSymbolicVariable()) {
right = ExpressionFactory.buildNewIntegerConstant(right_concrete_value);
}
int con = left_concrete_value / right_concrete_value;
IntegerValue intExpr = ExpressionFactory.div(left, right, (long) con);
env.topFrame().operandStack.pushBv32(intExpr);
}
use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.
the class ArithmeticVM method IOR.
/**
* bitwise OR
*
* http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.
* doc6.html#ior
*/
@Override
public void IOR() {
IntegerValue right = env.topFrame().operandStack.popBv32();
IntegerValue left = env.topFrame().operandStack.popBv32();
int left_concrete_value = ((Long) left.getConcreteValue()).intValue();
int right_concrete_value = ((Long) right.getConcreteValue()).intValue();
if (!left.containsSymbolicVariable()) {
left = ExpressionFactory.buildNewIntegerConstant(left_concrete_value);
}
if (!right.containsSymbolicVariable()) {
right = ExpressionFactory.buildNewIntegerConstant(right_concrete_value);
}
int con = left_concrete_value | right_concrete_value;
IntegerValue intExpr = new IntegerBinaryExpression(left, Operator.IOR, right, (long) con);
env.topFrame().operandStack.pushBv32(intExpr);
}
use of org.evosuite.symbolic.expr.bv.IntegerValue 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);
}
Aggregations