use of soot.toDex.instructions.Insn31t in project soot by Sable.
the class StmtVisitor method buildSwitchInsn.
private Insn buildSwitchInsn(Opcode opc, Value key, Stmt defaultTarget, SwitchPayload payload, Stmt stmt) {
Register keyReg = regAlloc.asImmediate(key, constantV);
Insn31t switchInsn = new Insn31t(opc, keyReg);
switchInsn.setPayload(payload);
payload.setSwitchInsn(switchInsn);
addInsn(switchInsn, stmt);
// switch instruction
return buildGotoInsn(defaultTarget);
}
use of soot.toDex.instructions.Insn31t in project soot by Sable.
the class StmtVisitor method buildArrayFillInsn.
private Insn buildArrayFillInsn(ArrayRef destRef, List<Value> values) {
Local array = (Local) destRef.getBase();
Register arrayReg = regAlloc.asLocal(array);
// Convert the list of values into a list of numbers
int elementSize = 0;
List<Number> numbers = new ArrayList<Number>(values.size());
for (Value val : values) {
if (val instanceof IntConstant) {
elementSize = Math.max(elementSize, 4);
numbers.add(((IntConstant) val).value);
} else if (val instanceof LongConstant) {
elementSize = Math.max(elementSize, 8);
numbers.add(((LongConstant) val).value);
} else if (val instanceof FloatConstant) {
elementSize = Math.max(elementSize, 4);
numbers.add(((FloatConstant) val).value);
} else if (val instanceof DoubleConstant) {
elementSize = Math.max(elementSize, 8);
numbers.add(((DoubleConstant) val).value);
} else
return null;
}
// For some local types, we know the size upfront
if (destRef.getType() instanceof BooleanType)
elementSize = 1;
else if (destRef.getType() instanceof ByteType)
elementSize = 1;
else if (destRef.getType() instanceof CharType)
elementSize = 2;
else if (destRef.getType() instanceof ShortType)
elementSize = 2;
else if (destRef.getType() instanceof IntType)
elementSize = 4;
else if (destRef.getType() instanceof FloatType)
elementSize = 4;
else if (destRef.getType() instanceof LongType)
elementSize = 8;
else if (destRef.getType() instanceof DoubleType)
elementSize = 8;
ArrayDataPayload payload = new ArrayDataPayload(elementSize, numbers);
payloads.add(payload);
Insn31t insn = new Insn31t(Opcode.FILL_ARRAY_DATA, arrayReg);
insn.setPayload(payload);
return insn;
}
Aggregations