Search in sources :

Example 16 with Unit

use of soot.Unit in project soot by Sable.

the class Walker method outANopStatement.

public void outANopStatement(ANopStatement node) {
    Unit u = Jimple.v().newNopStmt();
    mProductions.addLast(u);
}
Also used : Unit(soot.Unit)

Example 17 with Unit

use of soot.Unit in project soot by Sable.

the class Walker method outAEntermonitorStatement.

public void outAEntermonitorStatement(AEntermonitorStatement node) {
    Value op = (Value) mProductions.removeLast();
    Unit u = Jimple.v().newEnterMonitorStmt(op);
    mProductions.addLast(u);
}
Also used : Value(soot.Value) Unit(soot.Unit)

Example 18 with Unit

use of soot.Unit in project soot by Sable.

the class Walker method outALookupswitchStatement.

public void outALookupswitchStatement(ALookupswitchStatement node) {
    List<IntConstant> lookupValues = new ArrayList<IntConstant>();
    List<UnitBox> targets = new ArrayList<UnitBox>();
    UnitBox defaultTarget = null;
    if (node.getCaseStmt() != null) {
        int size = node.getCaseStmt().size();
        for (int i = 0; i < size; i++) {
            Object valueTargetPair = mProductions.removeLast();
            if (valueTargetPair instanceof UnitBox) {
                if (defaultTarget != null)
                    throw new RuntimeException("error: can't ;have more than 1 default stmt");
                defaultTarget = (UnitBox) valueTargetPair;
            } else {
                Object[] pair = (Object[]) valueTargetPair;
                lookupValues.add(0, (IntConstant) pair[0]);
                targets.add(0, (UnitBox) pair[1]);
            }
        }
    } else {
        throw new RuntimeException("error: switch stmt has no case stmts");
    }
    Value key = (Value) mProductions.removeLast();
    Unit switchStmt = Jimple.v().newLookupSwitchStmt(key, lookupValues, targets, defaultTarget);
    mProductions.addLast(switchStmt);
}
Also used : UnitBox(soot.UnitBox) ArrayList(java.util.ArrayList) Value(soot.Value) IntConstant(soot.jimple.IntConstant) Unit(soot.Unit)

Example 19 with Unit

use of soot.Unit in project soot by Sable.

the class Walker method outAGotoStatement.

public void outAGotoStatement(AGotoStatement node) {
    String targetLabel = (String) mProductions.removeLast();
    UnitBox box = Jimple.v().newStmtBox(null);
    Unit branch = Jimple.v().newGotoStmt(box);
    addBoxToPatch(targetLabel, box);
    mProductions.addLast(branch);
}
Also used : UnitBox(soot.UnitBox) Unit(soot.Unit)

Example 20 with Unit

use of soot.Unit in project soot by Sable.

the class Walker method outAInvokeStatement.

public void outAInvokeStatement(AInvokeStatement node) {
    Value op = (Value) mProductions.removeLast();
    Unit u = Jimple.v().newInvokeStmt(op);
    mProductions.addLast(u);
}
Also used : Value(soot.Value) Unit(soot.Unit)

Aggregations

Unit (soot.Unit)240 Local (soot.Local)77 Stmt (soot.jimple.Stmt)77 Value (soot.Value)74 ArrayList (java.util.ArrayList)65 AssignStmt (soot.jimple.AssignStmt)58 SootMethod (soot.SootMethod)47 Body (soot.Body)37 InvokeStmt (soot.jimple.InvokeStmt)35 Type (soot.Type)34 HashSet (java.util.HashSet)33 ValueBox (soot.ValueBox)33 InvokeExpr (soot.jimple.InvokeExpr)33 Trap (soot.Trap)32 RefType (soot.RefType)30 IdentityStmt (soot.jimple.IdentityStmt)28 HashMap (java.util.HashMap)27 IfStmt (soot.jimple.IfStmt)27 DefinitionStmt (soot.jimple.DefinitionStmt)25 List (java.util.List)23