public static boolean isRelevant(Unit q) { if(q instanceof JAssignStmt){ JAssignStmt as=(JAssignStmt)q; return SootUtilities.isFieldLoad(as)|| SootUtilities.isStoreInst(as) || SootUtilities.isNewStmt(as)|| SootUtilities.isLoadInst(as)|| SootUtilities.isFieldStore(as) || SootUtilities.isStaticGet(as)|| SootUtilities.isStaticPut(as) || SootUtilities.isInvoke(as) || SootUtilities.isNewArrayStmt(as); } return SootUtilities.isInvoke(q) || (q instanceof JReturnStmt || q instanceof JReturnVoidStmt)|| q instanceof MonitorStmt; }
private void process(Block bb, TIntArrayList locks, int ndx) { int k = ndx; Iterator<Unit> uit = bb.iterator(); while(uit.hasNext()){ Unit u = uit.next(); if (u instanceof MonitorStmt) { if (u instanceof JEnterMonitorStmt) { int lIdx = domL.indexOf(u); assert (lIdx >= 0); if (k > 0) { int lIdx2 = locks.get(k - 1); add(lIdx2, lIdx); } locks.add(lIdx); k++; } else { k--; } } } for (Object o : bb.getSuccs()) { Block bb2 = (Block) o; if (!visited.contains(bb2)) { visited.add(bb2); process(bb2, locks, k); } } }
private void process(Block bb, TIntArrayList locks, int ndx) { int k = ndx; Iterator<Unit> uit = bb.iterator(); while(uit.hasNext()){ Unit u = uit.next(); if (u instanceof MonitorStmt) { if (u instanceof JEnterMonitorStmt) { int lIdx = domL.indexOf(u); assert (lIdx >= 0); locks.add(lIdx); k++; } else { k--; } } else if (k > 0) { int pIdx = domP.indexOf(u); assert (pIdx >= 0); add(locks.get(k - 1), pIdx); } } for (Object o : bb.getSuccs()) { Block bb2 = (Block) o; if (!visited.contains(bb2)) { visited.add(bb2); process(bb2, locks, k); } } }
private Insn buildMonitorInsn(MonitorStmt stmt, Opcode opc) { Value lockValue = stmt.getOp(); constantV.setOrigStmt(stmt); Register lockReg = regAlloc.asImmediate(lockValue, constantV); return new Insn11x(opc, lockReg); }