localToDefsBits = new BitSet[body.getLocalCount()]; localToUsesBits = new BitSet[body.getLocalCount()];
/** * Reassigns the local numbers such that a dense bit set can be created over them */ public void pack() { int n = body.getLocalCount(); locals = new Local[n]; oldNumbers = new int[n]; n = 0; for (Local local : body.getLocals()) { locals[n] = local; oldNumbers[n] = local.getNumber(); local.setNumber(n++); } }
Map<Type, List<Local>> typeToLocals = new DeterministicHashMap(OrigBody.getLocalCount() * 2 + 1, 0.7f);
localToLocals = new HashMap<Local, Set<Local>>(body.getLocalCount() * 2 + 1, 0.7f);
localToGroup = new HashMap<Local, Object>(body.getLocalCount() * 2 + 1, 0.7f); groupToColorCount = new HashMap<Object, Integer>(body.getLocalCount() * 2 + 1, 0.7f); localToColor = new HashMap<Local, Integer>(body.getLocalCount() * 2 + 1, 0.7f);
Map<Type, List<Local>> typeToLocals = new DeterministicHashMap<Type, List<Local>>(body.getLocalCount() * 2 + 1, 0.7f);
protected void handleClass(PrintWriter out, SootClass c) { for (SootMethod m : c.getMethods()) { if (!m.isConcrete()) { continue; } Body b = m.retrieveActiveBody(); Local[] sortedLocals = b.getLocals().toArray(new Local[b.getLocalCount()]); Arrays.sort(sortedLocals, new StringComparator<Local>()); for (Local l : sortedLocals) { out.println("V " + m + l); if (l.getType() instanceof RefLikeType) { Set<Type> types = pa.reachingObjects(l).possibleTypes(); Type[] sortedTypes = types.toArray(new Type[types.size()]); Arrays.sort(sortedTypes, new StringComparator<Type>()); for (Type type : sortedTypes) { out.println("T " + type); } } } } } }
Map<Local, Object> localToGroup = new DeterministicHashMap<Local, Object>(body.getLocalCount() * 2 + 1, 0.7f); Map<Object, Integer> groupToColorCount = new HashMap<Object, Integer>(body.getLocalCount() * 2 + 1, 0.7f); Map<Local, Integer> localToColor = new HashMap<Local, Integer>(body.getLocalCount() * 2 + 1, 0.7f); Map<Local, Local> localToNewLocal; localToNewLocal = new HashMap<Local, Local>(body.getLocalCount() * 2 + 1, 0.7f); Map<GroupIntPair, Local> groupIntToLocal = new HashMap<GroupIntPair, Local>(body.getLocalCount() * 2 + 1, 0.7f);
Local newArrL = new JimpleLocal("$u" + (b.getLocalCount() + 1), ArrayType.v(rf, 1)); b.getLocals().add(newArrL); JAssignStmt newArr = new JAssignStmt(newArrL, new JNewArrayExpr(rf, IntConstant.v(parms.size())));
Local newLocal = Jimple.v().newLocal("sc" + body.getLocalCount(), constant.getType()); body.getLocals().add(newLocal); body.getUnits().insertBefore(Jimple.v().newAssignStmt(newLocal, constant), u);
List<Local> keep = new ArrayList<Local>(body.getLocalCount()); for (Local local : locals) { int lno = local.getNumber();
@Override public Local[] load(SootMethod method) throws Exception { if (!method.isConcrete() || !method.hasActiveBody()) return new Local[0]; List<Local> lcs = new ArrayList<Local>(method.getActiveBody().getLocalCount()); for (Unit u : method.getActiveBody().getUnits()) if (u instanceof AssignStmt) { AssignStmt assignStmt = (AssignStmt) u; if (assignStmt.getLeftOp() instanceof Local) lcs.add((Local) assignStmt.getLeftOp()); } return lcs.toArray(new Local[lcs.size()]); } });
localToLocals = new HashMap<Local, ArraySet>(body.getLocalCount() * 2 + 1, 0.7f);
localToLocals = new HashMap<Local, ArraySet>(body.getLocalCount() * 2 + 1, 0.7f);
new DeterministicHashMap(body.getLocalCount() * 2 + 1, 0.7f);
new DeterministicHashMap(body.getLocalCount() * 2 + 1, 0.7f);
G.v().out.println("[" + body.getMethod().getName() + "] Packing locals..."); Map<Local, Object> localToGroup = new DeterministicHashMap(body.getLocalCount() * 2 + 1, 0.7f); Map<Object, Integer> groupToColorCount = new HashMap<Object, Integer>(body.getLocalCount() * 2 + 1, 0.7f); Map<Local, Integer> localToColor = new HashMap<Local, Integer>(body.getLocalCount() * 2 + 1, 0.7f); Map localToNewLocal; localToNewLocal = new HashMap(body.getLocalCount() * 2 + 1, 0.7f); Map groupIntToLocal = new HashMap(body.getLocalCount() * 2 + 1, 0.7f);
G.v().out.println("[" + body.getMethod().getName() + "] Packing locals..."); Map<Local, Object> localToGroup = new DeterministicHashMap(body.getLocalCount() * 2 + 1, 0.7f); Map<Object, Integer> groupToColorCount = new HashMap<Object, Integer>(body.getLocalCount() * 2 + 1, 0.7f); Map<Local, Integer> localToColor = new HashMap<Local, Integer>(body.getLocalCount() * 2 + 1, 0.7f); Map localToNewLocal; localToNewLocal = new HashMap(body.getLocalCount() * 2 + 1, 0.7f); Map groupIntToLocal = new HashMap(body.getLocalCount() * 2 + 1, 0.7f);
Map<Local, ArrayList> localToDefList = new HashMap<Local, ArrayList>(g.getBody().getLocalCount() * 2 + 1, 0.7f); localToIntPair = new HashMap<Local, IntPair>(g.getBody().getLocalCount() * 2 + 1, 0.7f); Map<Local, FlowSet> localToKillSet = new HashMap<Local, FlowSet>(g.getBody().getLocalCount() * 2 + 1, 0.7f); localToPreserveSet = new HashMap<Local, BoundedFlowSet>(g.getBody().getLocalCount() * 2 + 1, 0.7f);
Map<Local, ArrayList> localToDefList = new HashMap<Local, ArrayList>(g.getBody().getLocalCount() * 2 + 1, 0.7f); localToIntPair = new HashMap<Local, IntPair>(g.getBody().getLocalCount() * 2 + 1, 0.7f); Map<Local, FlowSet> localToKillSet = new HashMap<Local, FlowSet>(g.getBody().getLocalCount() * 2 + 1, 0.7f); localToPreserveSet = new HashMap<Local, BoundedFlowSet>(g.getBody().getLocalCount() * 2 + 1, 0.7f);