Search in sources :

Example 26 with IntegerValue

use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.

the class ArithmeticVM method LUSHR.

/**
 * Stack=value1(int)|value2(long)
 *
 * Pops an integer and a long integer and from the stack. Shifts value2 (the
 * long integer) right by the amount indicated in the low six bits of value1
 * (an int). The long integer result is then pushed back onto the stack. The
 * value is shifted logically (ignoring the sign extension - useful for
 * unsigned values).
 */
@Override
public void LUSHR() {
    IntegerValue right_expr = (IntegerValue) env.topFrame().operandStack.popBv32();
    IntegerValue left_expr = (IntegerValue) env.topFrame().operandStack.popBv64();
    long left_concrete_value = ((Long) left_expr.getConcreteValue()).longValue();
    int right_concrete_value = ((Long) right_expr.getConcreteValue()).intValue();
    long concrete_value = left_concrete_value >>> (right_concrete_value & 0x001F);
    IntegerBinaryExpression intExpr = new IntegerBinaryExpression(left_expr, Operator.USHR, right_expr, (long) concrete_value);
    env.topFrame().operandStack.pushBv64(intExpr);
}
Also used : IntegerBinaryExpression(org.evosuite.symbolic.expr.bv.IntegerBinaryExpression) IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) IntegerConstraint(org.evosuite.symbolic.expr.IntegerConstraint)

Example 27 with IntegerValue

use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.

the class ArithmeticVM method INEG.

/**
 * http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.
 * doc6.html#ineg
 */
@Override
public void INEG() {
    IntegerValue param = env.topFrame().operandStack.popBv32();
    int param_concrete_value = ((Long) param.getConcreteValue()).intValue();
    if (!param.containsSymbolicVariable()) {
        param = ExpressionFactory.buildNewIntegerConstant(param_concrete_value);
    }
    int con = -param_concrete_value;
    IntegerValue intExpr = new IntegerUnaryExpression(param, Operator.NEG, (long) con);
    env.topFrame().operandStack.pushBv32(intExpr);
}
Also used : IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) IntegerUnaryExpression(org.evosuite.symbolic.expr.bv.IntegerUnaryExpression) IntegerConstraint(org.evosuite.symbolic.expr.IntegerConstraint)

Example 28 with IntegerValue

use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.

the class ArithmeticVM method IUSHR.

/**
 * Stack=value1(int)|value2(int)
 *
 * Pops two ints off the operand stack. Shifts value1 right by the amount
 * indicated in the five low bits of value2. The int result is then pushed
 * back onto the stack. value1 is shifted logically (ignoring the sign
 * extension - useful for unsigned values).
 */
@Override
public void IUSHR() {
    IntegerValue right_expr = (IntegerValue) env.topFrame().operandStack.popBv32();
    IntegerValue left_expr = (IntegerValue) env.topFrame().operandStack.popBv32();
    int left_concrete_value = ((Long) left_expr.getConcreteValue()).intValue();
    int right_concrete_value = ((Long) right_expr.getConcreteValue()).intValue();
    int concrete_value = left_concrete_value >>> (right_concrete_value & 0x001F);
    IntegerBinaryExpression intExpr = new IntegerBinaryExpression(left_expr, Operator.USHR, right_expr, (long) concrete_value);
    env.topFrame().operandStack.pushBv32(intExpr);
}
Also used : IntegerBinaryExpression(org.evosuite.symbolic.expr.bv.IntegerBinaryExpression) IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) IntegerConstraint(org.evosuite.symbolic.expr.IntegerConstraint)

Example 29 with IntegerValue

use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.

the class ArithmeticVM method LSHR.

/**
 * Stack=value1(int)|value2(long)
 *
 * Pops an int and a long integer from the stack. Shifts value2 (the long
 * integer) right by the amount indicated in the low six bits of value1 (an
 * int). The long integer result is then pushed back onto the stack. The
 * value is shifted arithmetically (preserving the sign extension).
 */
@Override
public void LSHR() {
    IntegerValue right_expr = (IntegerValue) env.topFrame().operandStack.popBv32();
    IntegerValue left_expr = (IntegerValue) env.topFrame().operandStack.popBv64();
    long left_concrete_value = ((Long) left_expr.getConcreteValue()).longValue();
    int right_concrete_value = ((Long) right_expr.getConcreteValue()).intValue();
    long concrete_value = left_concrete_value >> (right_concrete_value & 0x001F);
    IntegerBinaryExpression intExpr = new IntegerBinaryExpression(left_expr, Operator.SHL, right_expr, (long) concrete_value);
    env.topFrame().operandStack.pushBv64(intExpr);
}
Also used : IntegerBinaryExpression(org.evosuite.symbolic.expr.bv.IntegerBinaryExpression) IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) IntegerConstraint(org.evosuite.symbolic.expr.IntegerConstraint)

Example 30 with IntegerValue

use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.

the class ArithmeticVM method LSHL.

/**
 * Stack=value1(int)|value2(long)
 *
 * Pops a long integer and an int from the stack. Shifts value2 (the long
 * integer) left by the amount indicated in the low six bits of value1 (an
 * int). The long integer result is then pushed back onto the stack.
 */
@Override
public void LSHL() {
    IntegerValue right_expr = (IntegerValue) env.topFrame().operandStack.popBv32();
    IntegerValue left_expr = (IntegerValue) env.topFrame().operandStack.popBv64();
    long left_concrete_value = ((Long) left_expr.getConcreteValue()).longValue();
    int right_concrete_value = ((Long) right_expr.getConcreteValue()).intValue();
    long concrete_value = left_concrete_value << (right_concrete_value & 0x001F);
    IntegerBinaryExpression intExpr = new IntegerBinaryExpression(left_expr, Operator.SHL, right_expr, (long) concrete_value);
    env.topFrame().operandStack.pushBv64(intExpr);
}
Also used : IntegerBinaryExpression(org.evosuite.symbolic.expr.bv.IntegerBinaryExpression) IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) IntegerConstraint(org.evosuite.symbolic.expr.IntegerConstraint)

Aggregations

IntegerValue (org.evosuite.symbolic.expr.bv.IntegerValue)117 IntegerConstraint (org.evosuite.symbolic.expr.IntegerConstraint)48 ReferenceConstant (org.evosuite.symbolic.expr.ref.ReferenceConstant)32 ReferenceExpression (org.evosuite.symbolic.expr.ref.ReferenceExpression)27 RealValue (org.evosuite.symbolic.expr.fp.RealValue)22 IntegerBinaryExpression (org.evosuite.symbolic.expr.bv.IntegerBinaryExpression)14 Expression (org.evosuite.symbolic.expr.Expression)8 StringValue (org.evosuite.symbolic.expr.str.StringValue)8 IntegerConstant (org.evosuite.symbolic.expr.bv.IntegerConstant)7 Type (org.objectweb.asm.Type)7 RealToIntegerCast (org.evosuite.symbolic.expr.bv.RealToIntegerCast)6 IntegerToRealCast (org.evosuite.symbolic.expr.fp.IntegerToRealCast)6 IntegerUnaryExpression (org.evosuite.symbolic.expr.bv.IntegerUnaryExpression)5 PrimitiveExpression (org.evosuite.testcase.statements.PrimitiveExpression)4 ArrayList (java.util.ArrayList)3 CodeUnderTestException (org.evosuite.testcase.execution.CodeUnderTestException)3 Field (java.lang.reflect.Field)2 BigInteger (java.math.BigInteger)2 Vector (java.util.Vector)2 Constraint (org.evosuite.symbolic.expr.Constraint)2