use of soot.jimple.MonitorStmt in project soot by Sable.
the class DexPrinter method toInstructions.
private void toInstructions(Collection<Unit> units, StmtVisitor stmtV, Set<Unit> trapReferences) {
// Collect all constant arguments to monitor instructions and
// pre-alloocate their registers
Set<ClassConstant> monitorConsts = new HashSet<ClassConstant>();
for (Unit u : units) {
if (u instanceof MonitorStmt) {
MonitorStmt monitorStmt = (MonitorStmt) u;
if (monitorStmt.getOp() instanceof ClassConstant) {
monitorConsts.add((ClassConstant) monitorStmt.getOp());
}
}
}
boolean monitorAllocsMade = false;
for (Unit u : units) {
if (!monitorAllocsMade && !monitorConsts.isEmpty() && !(u instanceof IdentityStmt)) {
stmtV.preAllocateMonitorConsts(monitorConsts);
monitorAllocsMade = true;
}
stmtV.beginNewStmt((Stmt) u);
u.apply(stmtV);
}
stmtV.finalizeInstructions(trapReferences);
}
use of soot.jimple.MonitorStmt in project soot by Sable.
the class MonitorConverter method convert.
public void convert(DavaBody body) {
for (AugmentedStmt mas : body.get_MonitorFacts()) {
MonitorStmt ms = (MonitorStmt) mas.get_Stmt();
body.addToImportList("soot.dava.toolkits.base.DavaMonitor.DavaMonitor");
ArrayList arg = new ArrayList();
arg.add(ms.getOp());
if (ms instanceof EnterMonitorStmt)
mas.set_Stmt(new GInvokeStmt(new DVirtualInvokeExpr(new DStaticInvokeExpr(v.makeRef(), new ArrayList()), enter.makeRef(), arg, new HashSet<Object>())));
else
mas.set_Stmt(new GInvokeStmt(new DVirtualInvokeExpr(new DStaticInvokeExpr(v.makeRef(), new ArrayList()), exit.makeRef(), arg, new HashSet<Object>())));
}
}
Aggregations