Search in sources :

Example 61 with IntegerValue

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

the class SymbolicFunctionVM method CALLER_STACK_PARAM.

@Override
public void CALLER_STACK_PARAM(int nr, int calleeLocalsIndex, boolean conc_arg) {
    if (functionUnderExecution != null) {
        IntegerValue symb_arg = getIntegerExprFromStack(nr);
        functionUnderExecution.setParam(nr, conc_arg, symb_arg);
        beforeExecuteFunction(nr);
    }
}
Also used : IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue)

Example 62 with IntegerValue

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

the class ArithmeticVM method IINC.

/**
 * Increment i-th local (int) variable by constant (int) value
 *
 * http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.
 * doc6.html#iinc
 */
@Override
public void IINC(int i, int value) {
    IntegerConstant right = ExpressionFactory.buildNewIntegerConstant(value);
    IntegerValue left = env.topFrame().localsTable.getBv32Local(i);
    int left_concrete_value = ((Long) left.getConcreteValue()).intValue();
    int right_concrete_value = value;
    if (!left.containsSymbolicVariable()) {
        left = ExpressionFactory.buildNewIntegerConstant(left_concrete_value);
    }
    int con = left_concrete_value + right_concrete_value;
    IntegerValue intExpr = ExpressionFactory.add(left, right, (long) con);
    env.topFrame().localsTable.setBv32Local(i, intExpr);
}
Also used : IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) IntegerConstant(org.evosuite.symbolic.expr.bv.IntegerConstant) IntegerConstraint(org.evosuite.symbolic.expr.IntegerConstraint)

Example 63 with IntegerValue

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

the class ArithmeticVM method LADD.

/**
 * http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.
 * doc8.html#ladd
 */
@Override
public void LADD() {
    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 = ExpressionFactory.add(left, right, (long) con);
    env.topFrame().operandStack.pushBv64(intExpr);
}
Also used : IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue)

Example 64 with IntegerValue

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

the class ArithmeticVM method F2I.

@Override
public void F2I() {
    RealValue realExpr = env.topFrame().operandStack.popFp32();
    float doubleValue = ((Double) realExpr.getConcreteValue()).floatValue();
    IntegerValue intExpr;
    int concreteValue = (int) doubleValue;
    if (!realExpr.containsSymbolicVariable()) {
        intExpr = ExpressionFactory.buildNewIntegerConstant(concreteValue);
    } else {
        intExpr = new RealToIntegerCast(realExpr, (long) concreteValue);
    }
    env.topFrame().operandStack.pushBv32(intExpr);
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue) IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) RealToIntegerCast(org.evosuite.symbolic.expr.bv.RealToIntegerCast) IntegerConstraint(org.evosuite.symbolic.expr.IntegerConstraint)

Example 65 with IntegerValue

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

the class ArithmeticVM method D2L.

@Override
public void D2L() {
    RealValue realExpr = env.topFrame().operandStack.popFp64();
    double doubleValue = ((Double) realExpr.getConcreteValue()).doubleValue();
    IntegerValue intExpr;
    long concreteValue = (long) doubleValue;
    if (!realExpr.containsSymbolicVariable()) {
        intExpr = ExpressionFactory.buildNewIntegerConstant(concreteValue);
    } else {
        intExpr = new RealToIntegerCast(realExpr, concreteValue);
    }
    env.topFrame().operandStack.pushBv64(intExpr);
}
Also used : RealValue(org.evosuite.symbolic.expr.fp.RealValue) IntegerValue(org.evosuite.symbolic.expr.bv.IntegerValue) RealToIntegerCast(org.evosuite.symbolic.expr.bv.RealToIntegerCast)

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