use of org.evosuite.symbolic.expr.ref.ReferenceExpression in project evosuite by EvoSuite.
the class HeapVM method FASTORE.
@Override
public void FASTORE(Object conc_array, int conc_index) {
// get symbolic arguments
RealValue symb_value = env.topFrame().operandStack.popFp32();
IntegerValue symb_index = env.topFrame().operandStack.popBv32();
ReferenceExpression array_ref = env.topFrame().operandStack.popRef();
/* check reference initialization */
env.heap.initializeReference(conc_array, array_ref);
/* null-check */
if (nullReferenceViolation(array_ref, conc_array)) {
return;
}
/* negative index */
if (negativeIndexViolation(conc_index, symb_index)) {
return;
}
/* out of bound index */
ReferenceExpression symb_array = array_ref;
int conc_array_length = Array.getLength(conc_array);
IntegerValue symb_array_length = env.heap.getField("", ARRAY_LENGTH, conc_array, symb_array, conc_array_length);
if (indexTooBigViolation(conc_index, symb_index, conc_array_length, symb_array_length))
return;
env.heap.array_store(conc_array, symb_array, conc_index, symb_value);
}
use of org.evosuite.symbolic.expr.ref.ReferenceExpression in project evosuite by EvoSuite.
the class HeapVM method CALOAD.
@Override
public void CALOAD(Object conc_array, int conc_index) {
// pop symbolic arguments
IntegerValue symb_index = env.topFrame().operandStack.popBv32();
ReferenceExpression array_ref = env.topFrame().operandStack.popRef();
/* check reference initialization */
env.heap.initializeReference(conc_array, array_ref);
/* null-check */
if (nullReferenceViolation(array_ref, conc_array)) {
return;
}
/* negative index */
if (negativeIndexViolation(conc_index, symb_index)) {
return;
}
/* out of bound index */
ReferenceExpression symb_array = array_ref;
int conc_array_length = Array.getLength(conc_array);
IntegerValue symb_array_length = env.heap.getField("", ARRAY_LENGTH, conc_array, symb_array, conc_array_length);
if (indexTooBigViolation(conc_index, symb_index, conc_array_length, symb_array_length))
return;
char bv32 = Array.getChar(conc_array, conc_index);
IntegerValue c = env.heap.array_load(symb_array, conc_index, (long) bv32);
env.topFrame().operandStack.pushBv32(c);
}
use of org.evosuite.symbolic.expr.ref.ReferenceExpression in project evosuite by EvoSuite.
the class HeapVM method IASTORE.
/**
* Store the top operand stack value into an array
*
* http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.
* doc6.html#iastore
*/
@Override
public void IASTORE(Object conc_array, int conc_index) {
// pop arguments
IntegerValue symb_value = env.topFrame().operandStack.popBv32();
IntegerValue symb_index = env.topFrame().operandStack.popBv32();
ReferenceExpression array_ref = env.topFrame().operandStack.popRef();
/* check reference initialization */
env.heap.initializeReference(conc_array, array_ref);
/* null-check */
if (nullReferenceViolation(array_ref, conc_array)) {
return;
}
/* negative index */
if (negativeIndexViolation(conc_index, symb_index)) {
return;
}
/* out of bound index */
ReferenceExpression symb_array = array_ref;
int conc_array_length = Array.getLength(conc_array);
IntegerValue symb_array_length = env.heap.getField("", ARRAY_LENGTH, conc_array, symb_array, conc_array_length);
if (indexTooBigViolation(conc_index, symb_index, conc_array_length, symb_array_length))
return;
env.heap.array_store(conc_array, symb_array, conc_index, symb_value);
}
use of org.evosuite.symbolic.expr.ref.ReferenceExpression in project evosuite by EvoSuite.
the class HeapVM method ARRAYLENGTH.
@Override
public void ARRAYLENGTH(Object conc_array) {
/* get symbolic arguments */
ReferenceExpression array_ref = env.topFrame().operandStack.popRef();
/* check reference initialization */
env.heap.initializeReference(conc_array, array_ref);
/* null-check */
if (nullReferenceViolation(array_ref, conc_array)) {
return;
}
int conc_array_length = Array.getLength(conc_array);
ReferenceExpression symb_array_ref = (ReferenceExpression) array_ref;
IntegerValue symb_array_length = (IntegerValue) env.heap.getField("", ARRAY_LENGTH, conc_array, symb_array_ref, conc_array_length);
env.topFrame().operandStack.pushBv32(symb_array_length);
}
use of org.evosuite.symbolic.expr.ref.ReferenceExpression in project evosuite by EvoSuite.
the class HeapVM method CHECKCAST.
/**
* Explicit type cast:
*
* <pre>
* RefTypeX x = (RefTypeX) ref;
* </pre>
*
* null is treated as (can be cast to) any reference type. This is
* consistent with the null type being a subtype of every reference type.
* Note the different treatment in {@link #INSTANCEOF}.
*
* http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.
* doc2.html#checkcast
*/
@Override
public void CHECKCAST(Object conc_ref, String typeName) {
ReferenceExpression symb_ref = env.topFrame().operandStack.peekRef();
env.heap.initializeReference(conc_ref, symb_ref);
}
Aggregations