public List<BasicBlock> linearization() { depends(cfg()); assert linearizedBBList != null: "You have not run linearization"; return linearizedBBList; }
public List<BasicBlock> linearization() { depends(cfg()); assert linearizedBBList != null: "You have not run linearization"; return linearizedBBList; }
public FlowGraphNode(DataFlowProblem p, BasicBlock n) { problem = p; basicBlock = n; rescuer = problem.getScope().cfg().getRescuerBBFor(basicBlock); }
public FlowGraphNode(DataFlowProblem p, BasicBlock n) { problem = p; basicBlock = n; rescuer = problem.getScope().cfg().getRescuerBBFor(basicBlock); }
private void buildFlowGraph() { flowGraphNodes = new LinkedList<FlowGraphNode>(); basicBlockToFlowGraph = new HashMap<Integer, FlowGraphNode>(); for (BasicBlock bb: scope.cfg().getBasicBlocks()) { FlowGraphNode fgNode = buildFlowGraphNode(bb); fgNode.init(); fgNode.buildDataFlowVars(); flowGraphNodes.add(fgNode); basicBlockToFlowGraph.put(bb.getID(), fgNode); } } }
private void buildFlowGraph() { flowGraphNodes = new LinkedList<FlowGraphNode>(); basicBlockToFlowGraph = new HashMap<Integer, FlowGraphNode>(); for (BasicBlock bb: scope.cfg().getBasicBlocks()) { FlowGraphNode fgNode = buildFlowGraphNode(bb); fgNode.init(); fgNode.buildDataFlowVars(); flowGraphNodes.add(fgNode); basicBlockToFlowGraph.put(bb.getID(), fgNode); } } }
public void initSolnForNode() { LiveVariablesProblem p = (LiveVariablesProblem) problem; in = new BitSet(setSize); if (basicBlock == p.getScope().cfg().getExitBB()) { Collection<LocalVariable> lv = p.getVarsLiveOnScopeExit(); if (lv != null && !lv.isEmpty()) { for (Variable v: lv) { in.set(p.getDFVar(v).getId()); } } } // System.out.println("Init state for BB " + basicBlock.getID() + " is " + toString()); }
public void initSolnForNode() { LiveVariablesProblem p = (LiveVariablesProblem) problem; in = new BitSet(setSize); if (basicBlock == p.getScope().cfg().getExitBB()) { Collection<LocalVariable> lv = p.getVarsLiveOnScopeExit(); if (lv != null && !lv.isEmpty()) { for (Variable v: lv) { in.set(p.getDFVar(v).getId()); } } } // System.out.println("Init state for BB " + basicBlock.getID() + " is " + toString()); }
public void compute_MOP_Solution() { /** Are there are available data flow facts to run this problem? SSS FIXME: Silly optimization? */ if (!isEmpty()) { // 2. Initialize work list based on flow direction to make processing efficient! LinkedList<FlowGraphNode> workList = getInitialWorkList(); // 3. Initialize a bitset with a flag set for all basic blocks int numNodes = scope.cfg().getMaxNodeID(); BitSet bbSet = new BitSet(1+numNodes); bbSet.flip(0, numNodes); // 4. Iteratively compute data flow info while (!workList.isEmpty()) { workList.removeFirst().computeDataFlowInfo(workList, bbSet); } } }
public void initSolnForNode() { if (basicBlock == problem.getScope().cfg().getExitBB()) { inRequiredLoads = ((LoadLocalVarPlacementProblem) problem).getLoadsOnScopeExit(); } }
public void initSolnForNode() { if (basicBlock == problem.getScope().cfg().getExitBB()) { inRequiredLoads = ((LoadLocalVarPlacementProblem) problem).getLoadsOnScopeExit(); } }
public FlowGraphNode getExceptionTargetNode() { // If there is a rescue node, on exception, control goes to the rescuer bb. If not, it goes to the scope exit. return problem.getFlowGraphNode(rescuer == null ? problem.getScope().cfg().getExitBB() : rescuer); }
public int getRescuerPC(Instr excInstr) { depends(cfg()); for (BasicBlock b : linearizedBBList) { for (Instr i : b.getInstrs()) { if (i == excInstr) { BasicBlock rescuerBB = cfg().getRescuerBBFor(b); return (rescuerBB == null) ? -1 : rescuerBB.getLabel().getTargetPC(); } } } // SSS FIXME: Cannot happen! Throw runtime exception LOG.error("Fell through looking for rescuer ipc for " + excInstr); return -1; }
public int getRescuerPC(Instr excInstr) { depends(cfg()); for (BasicBlock b : linearizedBBList) { for (Instr i : b.getInstrs()) { if (i == excInstr) { BasicBlock rescuerBB = cfg().getRescuerBBFor(b); return (rescuerBB == null) ? -1 : rescuerBB.getLabel().getTargetPC(); } } } // SSS FIXME: Cannot happen! Throw runtime exception LOG.error("Fell through looking for rescuer ipc for " + excInstr); return -1; }
public FlowGraphNode getExceptionTargetNode() { // If there is a rescue node, on exception, control goes to the rescuer bb. If not, it goes to the scope exit. return problem.getFlowGraphNode(rescuer == null ? problem.getScope().cfg().getExitBB() : rescuer); }
@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.cfg()); } 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.cfg()); } return null; }
public int getEnsurerPC(Instr excInstr) { depends(cfg()); for (BasicBlock b : linearizedBBList) { for (Instr i : b.getInstrs()) { if (i == excInstr) { BasicBlock ensurerBB = cfg.getEnsurerBBFor(b); return (ensurerBB == null) ? -1 : ensurerBB.getLabel().getTargetPC(); } } } // SSS FIXME: Cannot happen! Throw runtime exception LOG.error("Fell through looking for ensurer ipc for " + excInstr); return -1; }
public void inlineMethod(IRScope method, RubyModule implClass, int classToken, BasicBlock basicBlock, CallBase call) { // Inline depends(cfg()); new CFGInliner(cfg).inlineMethod(method, implClass, classToken, basicBlock, call); // Reset state resetState(); // Re-run opts for (CompilerPass pass: getManager().getInliningCompilerPasses(this)) { pass.run(this); } }
public void inlineMethod(IRScope method, RubyModule implClass, int classToken, BasicBlock basicBlock, CallBase call) { // Inline depends(cfg()); new CFGInliner(cfg).inlineMethod(method, implClass, classToken, basicBlock, call); // Reset state resetState(); // Re-run opts for (CompilerPass pass: getManager().getInliningCompilerPasses(this)) { pass.run(this); } }