int () { List<JsrRecord> lstJsrAll = new ArrayList<>(); // get all jsr ranges for (Entry<BasicBlock, BasicBlock> ent : subroutines.entrySet()) { BasicBlock jsr = ent.getKey(); BasicBlock ret = ent.getValue(); lstJsrAll.add(new JsrRecord(jsr, getJsrRange(jsr, ret), ret)); } // sort ranges // FIXME: better sort order List<JsrRecord> lstJsr = new ArrayList<>(); for (JsrRecord arr : lstJsrAll) { int i = 0; for (; i < lstJsr.size(); i++) { JsrRecord arrJsr = lstJsr.get(i); if (arrJsr.range.contains(arr.jsr)) { break; } } lstJsr.add(i, arr); } // find the first intersection for (int i = 0; i < lstJsr.size(); i++) { JsrRecord arr = lstJsr.get(i); Set<BasicBlock> set = arr.range; for (int j = i + 1; j < lstJsr.size(); j++) { JsrRecord arr1 = lstJsr.get(j); Set<BasicBlock> set1 = arr1.range; if (!set.contains(arr1.jsr) && !set1.contains(arr.jsr)) { // rang 0 doesn't contain entry 1 and vice versa Set<BasicBlock> setc = new HashSet<>(set); setc.retainAll(set1); if (!setc.isEmpty()) { splitJsrRange(arr.jsr, arr.ret, setc); return 1; } } } } return 0; }