Search in sources :

Example 1 with ObjectOpTag

use of soot.dexpler.tags.ObjectOpTag in project soot by Sable.

the class AputInstruction method jimplify.

@Override
public void jimplify(DexBody body) {
    if (!(instruction instanceof Instruction23x))
        throw new IllegalArgumentException("Expected Instruction23x but got: " + instruction.getClass());
    Instruction23x aPutInstr = (Instruction23x) instruction;
    int source = aPutInstr.getRegisterA();
    Local arrayBase = body.getRegisterLocal(aPutInstr.getRegisterB());
    Local index = body.getRegisterLocal(aPutInstr.getRegisterC());
    ArrayRef arrayRef = Jimple.v().newArrayRef(arrayBase, index);
    Local sourceValue = body.getRegisterLocal(source);
    AssignStmt assign = getAssignStmt(body, sourceValue, arrayRef);
    if (aPutInstr.getOpcode() == Opcode.APUT_OBJECT)
        assign.addTag(new ObjectOpTag());
    setUnit(assign);
    addTags(assign);
    body.add(assign);
    if (IDalvikTyper.ENABLE_DVKTYPER) {
        DalvikTyper.v().addConstraint(assign.getLeftOpBox(), assign.getRightOpBox());
        DalvikTyper.v().setType(arrayRef.getIndexBox(), IntType.v(), true);
    }
}
Also used : ArrayRef(soot.jimple.ArrayRef) AssignStmt(soot.jimple.AssignStmt) Local(soot.Local) Instruction23x(org.jf.dexlib2.iface.instruction.formats.Instruction23x) ObjectOpTag(soot.dexpler.tags.ObjectOpTag)

Example 2 with ObjectOpTag

use of soot.dexpler.tags.ObjectOpTag in project soot by Sable.

the class AgetInstruction method jimplify.

@Override
public void jimplify(DexBody body) throws InvalidDalvikBytecodeException {
    if (!(instruction instanceof Instruction23x))
        throw new IllegalArgumentException("Expected Instruction23x but got: " + instruction.getClass());
    Instruction23x aGetInstr = (Instruction23x) instruction;
    int dest = aGetInstr.getRegisterA();
    Local arrayBase = body.getRegisterLocal(aGetInstr.getRegisterB());
    Local index = body.getRegisterLocal(aGetInstr.getRegisterC());
    ArrayRef arrayRef = Jimple.v().newArrayRef(arrayBase, index);
    Local l = body.getRegisterLocal(dest);
    AssignStmt assign = Jimple.v().newAssignStmt(l, arrayRef);
    if (aGetInstr.getOpcode() == Opcode.AGET_OBJECT)
        assign.addTag(new ObjectOpTag());
    setUnit(assign);
    addTags(assign);
    body.add(assign);
    if (IDalvikTyper.ENABLE_DVKTYPER) {
        DalvikTyper.v().addConstraint(assign.getLeftOpBox(), assign.getRightOpBox());
        DalvikTyper.v().setType(arrayRef.getIndexBox(), IntType.v(), true);
    }
}
Also used : ArrayRef(soot.jimple.ArrayRef) AssignStmt(soot.jimple.AssignStmt) Local(soot.Local) Instruction23x(org.jf.dexlib2.iface.instruction.formats.Instruction23x) ObjectOpTag(soot.dexpler.tags.ObjectOpTag)

Aggregations

Instruction23x (org.jf.dexlib2.iface.instruction.formats.Instruction23x)2 Local (soot.Local)2 ObjectOpTag (soot.dexpler.tags.ObjectOpTag)2 ArrayRef (soot.jimple.ArrayRef)2 AssignStmt (soot.jimple.AssignStmt)2