@Override public List<Integer> getBranches(GraphSource code) { List<Integer> ret = new ArrayList<>(); if (definition instanceof IfTypeIns) { ret.add(code.adr2pos(getTargetAddress())); if (!(definition instanceof JumpIns)) { ret.add(code.adr2pos(address + getBytesLength())); } } if (definition instanceof LookupSwitchIns) { ret.add(code.adr2pos(address + operands[0])); for (int k = 2; k < operands.length; k++) { ret.add(code.adr2pos(address + operands[k])); } } return ret; }
private boolean leadsTo( BaseLocalData localData, Graph gr, GraphSource code, GraphPart part, List<GraphPart> visited, List<Loop> loops) throws InterruptedException { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); } GraphPart tpart = gr.checkPart(null, localData, this, null); if (tpart == null) { return false; } if (tpart != this) { return tpart.leadsTo(localData, gr, code, part, visited, loops); } Loop currentLoop = null; for (Loop l : loops) { /*if(l.phase==0){ if(l.loopContinue==this){ l.leadsToMark = 1; next = l.loopBreak; currentLoop = l; continue; } }*/ if (l.phase == 1) { if (l.loopContinue == this) { return false; } if (l.loopPreContinue == this) { return false; } if (l.loopBreak == this) { // return false; //? } } } if (visited.contains(this)) { return false; } /*if (loops.contains(this)) { return false; }*/ visited.add(this); if (end < code.size() && code.get(end).isBranch() && (code.get(end).ignoredLoops())) { return false; } for (GraphPart p : nextParts) { if (p == part) { return true; } else { if (p.leadsTo(localData, gr, code, part, visited, loops)) { return true; } } } for (GraphPart p : throwParts) { if (p == part) { return true; } else { if (p.leadsTo(localData, gr, code, part, visited, loops)) { return true; } } } return false; }