private void initParentCount(int[] parentCount) { parentCount[0] = 1; // first stmt always have one parent for (DexStmtNode p : insnList) { Op op = p.op; if (op == null) { if (p.__index < parentCount.length - 1) { // not the last label parentCount[p.__index + 1]++; } } else { if (op.canBranch()) { parentCount[indexOf(((JumpStmtNode) p).label)]++; } if (op.canSwitch()) { BaseSwitchStmtNode switchStmtNode = (BaseSwitchStmtNode) p; for (DexLabel label : switchStmtNode.labels) { parentCount[indexOf(label)]++; } } if (op.canContinue()) { parentCount[p.__index + 1]++; } } } }
String op(Op op) { return op.name(); }
private void initExceptionHandlers(DexCodeNode dexCodeNode, BitSet[] exBranch, BitSet handlers) { if (dexCodeNode.tryStmts != null) { for (TryCatchNode tcb : dexCodeNode.tryStmts) { target.traps.add(new Trap(getLabel(tcb.start), getLabel(tcb.end), getLabels(tcb.handler), tcb.type)); for (DexLabel h : tcb.handler) { handlers.set(indexOf(h)); } int endIndex = indexOf(tcb.end); for (int p = indexOf(tcb.start) + 1; p < endIndex; p++) { DexStmtNode stmt = insnList.get(p); if (stmt.op != null && stmt.op.canThrow()) { BitSet x = exBranch[p]; if (x == null) { x = exBranch[p] = new BitSet(insnList.size()); } for (DexLabel h : tcb.handler) { int hIndex = indexOf(h); x.set(hIndex); parentCount[hIndex]++; } } } } } }
} else { Op op = node.op; if (op.canContinue()) { q.add(index + 1); if (op.canBranch()) { JumpStmtNode jump = (JumpStmtNode) node; q.add(indexOf(jump.label)); if (op.canSwitch()) { for (DexLabel dexLabel : ((BaseSwitchStmtNode) node).labels) { q.add(indexOf(dexLabel));
String op(Op op) { return op.name(); }
if (op.canBranch()) { JumpStmtNode jump = (JumpStmtNode) p; int targetIndex = indexOf(jump.label); merge(tmp, targetIndex); if (op.canSwitch()) { BaseSwitchStmtNode switchStmtNode = (BaseSwitchStmtNode) p; for (DexLabel label : switchStmtNode.labels) { if (op.canContinue()) { stack.push(insnList.get(index + 1)); merge(tmp, index + 1);
if (op.canBranch()) { switch (op.format) { case kFmt10t: if (op.canSwitch()) { if (canContinue && op.canContinue()) { if (op == Op.NOP) { switch (insns[u1offset + 1]) {
if (op.canBranch()) { switch (op.format) { case kFmt10t: if (op.canSwitch()) { if (canContinue && op.canContinue()) { if (op == Op.NOP) { switch (insns[u1offset + 1]) {