@Nonnull static public Set<Integer> getLoopExitBranches(Method method, MethodGen methodGen) { XMethod xmethod = XFactory.createXMethod(methodGen); if (cachedLoopExits().containsKey(xmethod)) { Set<Integer> result = cachedLoopExits().get(xmethod); if (result == null) { AnalysisContext.logError("Null cachedLoopExits for " + xmethod, new NullPointerException()); assert false; return Collections.<Integer> emptySet(); } return result; } Code code = method.getCode(); if (code == null) { assert false; return Collections.<Integer> emptySet(); } byte[] instructionList = code.getCode(); Set<Integer> result = new HashSet<>(); for (int i = 0; i < instructionList.length; i++) { if (checkForBranchExit(instructionList, i)) { result.add(i); } } if (result.size() == 0) { result = Collections.<Integer> emptySet(); } cachedLoopExits().put(xmethod, result); return result; }
@Nonnull static public Set<Integer> getLoopExitBranches(Method method, MethodGen methodGen) { XMethod xmethod = XFactory.createXMethod(methodGen); if (cachedLoopExits().containsKey(xmethod)) { Set<Integer> result = cachedLoopExits().get(xmethod); if (result == null) { AnalysisContext.logError("Null cachedLoopExits for " + xmethod, new NullPointerException()); assert false; return Collections.<Integer> emptySet(); } return result; } Code code = method.getCode(); if (code == null) { assert false; return Collections.<Integer> emptySet(); } byte[] instructionList = code.getCode(); Set<Integer> result = new HashSet<Integer>(); for (int i = 0; i < instructionList.length; i++) { if (checkForBranchExit(instructionList, i)) { result.add(i); } } if (result.size() == 0) { result = Collections.<Integer> emptySet(); } cachedLoopExits().put(xmethod, result); return result; }