/** * Get the control flow graph */ public CFG getCFG() { return problem.scope.getCFG(); }
/** * Get the control flow graph */ public CFG getCFG() { return problem.scope.getCFG(); }
@Override public Object previouslyRun(IRScope scope) { return scope.getCFG(); }
@Override public Object execute(IRScope scope, Object... data) { processCFG(scope.getCFG()); return null; }
@Override public Object execute(IRScope scope, Object... data) { processCFG(scope.getCFG()); return null; }
/** * Generate an ordered list of flow graph nodes in a forward or backward order depending * on direction. */ protected LinkedList<U> generateWorkList() { LinkedList<U> wl = new LinkedList<>(); Iterator<BasicBlock> it = direction == DF_Direction.FORWARD ? scope.getCFG().getReversePostOrderTraverser() : scope.getCFG().getPostOrderTraverser(); while (it.hasNext()) { wl.add(getFlowGraphNode(it.next())); } return wl; }
/** * Generate an ordered list of flow graph nodes in a forward or backward order depending * on direction. */ protected LinkedList<U> generateWorkList() { LinkedList<U> wl = new LinkedList<>(); Iterator<BasicBlock> it = direction == DF_Direction.FORWARD ? scope.getCFG().getReversePostOrderTraverser() : scope.getCFG().getPostOrderTraverser(); while (it.hasNext()) { wl.add(getFlowGraphNode(it.next())); } return wl; }
public FlowGraphNode(T problem, BasicBlock basicBlock) { this.problem = problem; this.basicBlock = basicBlock; // Cache the rescuer node for easy access rescuer = problem.getScope().getCFG().getRescuerBBFor(basicBlock); }
private void buildFlowGraph() { flowGraphNodes = new LinkedList<>(); basicBlockToFlowGraph = new HashMap<>(); for (BasicBlock bb: scope.getCFG().getBasicBlocks()) { U fgNode = buildFlowGraphNode(bb); fgNode.init(); fgNode.buildDataFlowVars(); flowGraphNodes.add(fgNode); basicBlockToFlowGraph.put(bb, fgNode); } } }
public FlowGraphNode(T problem, BasicBlock basicBlock) { this.problem = problem; this.basicBlock = basicBlock; // Cache the rescuer node for easy access rescuer = problem.getScope().getCFG().getRescuerBBFor(basicBlock); }
public U getEntryNode() { return getFlowGraphNode(scope.getCFG().getEntryBB()); }
public U getExitNode() { return getFlowGraphNode(scope.getCFG().getExitBB()); }
public Map<BasicBlock, Label> buildJVMExceptionTable() { Map<BasicBlock, Label> map = new HashMap<>(1); for (BasicBlock bb: fullInterpreterContext.getLinearizedBBList()) { BasicBlock rescueBB = getCFG().getRescuerBBFor(bb); if (rescueBB != null) { map.put(bb, rescueBB.getLabel()); } } // SSS FIXME: This could be optimized by compressing entries for adjacent BBs that have identical handlers // This could be optimized either during generation or as another pass over the table. But, if the JVM // does that already, do we need to bother with it? return map; }
public U getEntryNode() { return getFlowGraphNode(scope.getCFG().getEntryBB()); }
private void buildFlowGraph() { flowGraphNodes = new LinkedList<>(); basicBlockToFlowGraph = new HashMap<>(); for (BasicBlock bb: scope.getCFG().getBasicBlocks()) { U fgNode = buildFlowGraphNode(bb); fgNode.init(); fgNode.buildDataFlowVars(); flowGraphNodes.add(fgNode); basicBlockToFlowGraph.put(bb, fgNode); } } }
public void compute_MOP_Solution() { if (isEmpty()) return; // Don't bother to compute soln if we have no facts available. // 1. Initialize work list based on flow direction to make processing efficient! LinkedList<U> workList = generateWorkList(); // 2. Initialize a bitset with a flag set for all basic blocks int numNodes = scope.getCFG().getMaxNodeID(); BitSet bbSet = new BitSet(1+numNodes); bbSet.flip(0, numNodes); // set all bits from default of 0 to 1 (enebo: could we invert this in algo?) // 3. Iteratively compute data flow info while (!workList.isEmpty()) { workList.removeFirst().computeDataFlowInfo(workList, bbSet); } }
@Override public Object execute(IRScope scope, Object... data) { CFG cfg = (CFG) data[0]; try { buildDominatorTree(cfg, cfg.postOrderList(), cfg.getMaxNodeID()); } catch (Exception e) { LOG.debug("Caught exception building dom tree for {}", scope.getCFG()); } return null; }
@Override public Object execute(IRScope scope, Object... data) { CFG cfg = (CFG) data[0]; try { buildDominatorTree(cfg, cfg.postOrderList(), cfg.getMaxNodeID()); } catch (Exception e) { LOG.debug("Caught exception building dom tree for {}", scope.getCFG()); } return null; }
private void printInlineDebugPrologue(IRScope scopeToInline, CallBase call) { LOG.info("---------------------------------- PROLOGUE (start) --------"); LOG.info("Looking for: " + call.getCallSiteId() + ":\n > " + call + "\n"); printInlineCFG(cfg, "host of inline"); LOG.info("method to inline cfg:\n" + scopeToInline.getCFG().toStringGraph()); LOG.info("method to inline instrs:\n" + scopeToInline.getCFG().toStringInstrs()); LOG.info("---------------------------------- PROLOGUE (end) -----------"); }
private void printInlineDebugPrologue(IRScope scopeToInline, CallBase call) { LOG.info("---------------------------------- PROLOGUE (start) --------"); LOG.info("Looking for: " + call.getCallSiteId() + ":\n > " + call + "\n"); printInlineCFG(cfg, "host of inline"); LOG.info("method to inline cfg:\n" + scopeToInline.getCFG().toStringGraph()); LOG.info("method to inline instrs:\n" + scopeToInline.getCFG().toStringInstrs()); LOG.info("---------------------------------- PROLOGUE (end) -----------"); }