private void removeInactiveBlocks(List<Block> inactiveBlocks) { for (Block inactiveBlock : inactiveBlocks) { for (Block block : blocks) { block.prune(inactiveBlock); } } blocks.removeAll(inactiveBlocks); }
private void prune() { List<Block> inactiveBlocks = new ArrayList<>(); boolean first = true; for (Block block : blocks) { if (!first && isInactive(block)) { inactiveBlocks.add(block); } first = false; } if (!inactiveBlocks.isEmpty()) { removeInactiveBlocks(inactiveBlocks); if (inactiveBlocks.contains(currentBlock)) { currentBlock = currentBlock.successors.iterator().next(); } int id = 0; for (Block block : blocks) { block.id = id; id += 1; } inactiveBlocks.removeAll(blocks); if (!inactiveBlocks.isEmpty()) { prune(); } } }
private void prune() { List<Block> inactiveBlocks = new ArrayList<>(); boolean first = true; for (Block block : blocks) { if (!first && isInactive(block)) { inactiveBlocks.add(block); } first = false; } if (!inactiveBlocks.isEmpty()) { removeInactiveBlocks(inactiveBlocks); if (inactiveBlocks.contains(currentBlock)) { currentBlock = currentBlock.successors.iterator().next(); } int id = 0; for (Block block : blocks) { block.id = id; id += 1; } inactiveBlocks.removeAll(blocks); if (!inactiveBlocks.isEmpty()) { prune(); } } }
private CFG(List<? extends Tree> trees, Symbol.MethodSymbol symbol, boolean ignoreBreakAndContinue) { methodSymbol = symbol; this.ignoreBreakAndContinue = ignoreBreakAndContinue; exitBlocks.add(createBlock()); currentBlock = createBlock(exitBlock()); outerTry = new TryStatement(); outerTry.successorBlock = exitBlocks.peek(); enclosingTry.add(outerTry); enclosedByCatch.push(false); build(trees); prune(); computePredecessors(blocks); }
private CFG(List<? extends Tree> trees, Symbol.MethodSymbol symbol, boolean ignoreBreakAndContinue) { methodSymbol = symbol; this.ignoreBreakAndContinue = ignoreBreakAndContinue; exitBlocks.add(createBlock()); currentBlock = createBlock(exitBlock()); outerTry = new TryStatement(); outerTry.successorBlock = exitBlocks.peek(); enclosingTry.add(outerTry); enclosedByCatch.push(false); build(trees); prune(); computePredecessors(blocks); }
private CFG(BlockTree tree, Symbol.MethodSymbol symbol) { methodSymbol = symbol; exitBlocks.add(createBlock()); currentBlock = createBlock(exitBlock()); for (StatementTree statementTree : Lists.reverse(tree.body())) { build(statementTree); } prune(); computePredecessors(blocks); }