public void addBasicBlock(BasicBlock bb) { graph.findOrCreateVertexFor(bb); // adds vertex to graph bbMap.put(bb.getLabel(), bb); // Reset so later dataflow analyses get all basic blocks postOrderList = null; }
public void removeBB(BasicBlock b) { graph.removeVertexFor(b); bbMap.remove(b.getLabel()); rescuerMap.remove(b); ensurerMap.remove(b); // SSS FIXME: Patch up rescued regions as well?? }
private void setupLabelPCs(HashMap<Label, Integer> labelIPCMap) { for (BasicBlock b: linearizedBBList) { Label l = b.getLabel(); l.setTargetPC(labelIPCMap.get(l)); } }
public void removeBB(BasicBlock b) { if (b == globalEnsureBB) globalEnsureBB = null; graph.removeVertexFor(b); bbMap.remove(b.getLabel()); rescuerMap.remove(b); }
public void removeBB(BasicBlock b) { graph.removeVertexFor(b); bbMap.remove(b.getLabel()); rescuerMap.remove(b); ensurerMap.remove(b); // SSS FIXME: Patch up rescued regions as well?? }
public void removeBB(BasicBlock b) { if (b == globalEnsureBB) globalEnsureBB = null; graph.removeVertexFor(b); bbMap.remove(b.getLabel()); rescuerMap.remove(b); }
public void addBasicBlock(BasicBlock bb) { graph.findOrCreateVertexFor(bb); // adds vertex to graph bbMap.put(bb.getLabel(), bb); // Reset so later dataflow analyses get all basic blocks postOrderList = null; }
private void setupLabelPCs(HashMap<Label, Integer> labelIPCMap) { for (BasicBlock b: linearizedBBList) { Label l = b.getLabel(); l.setTargetPC(labelIPCMap.get(l)); } }
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 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; }
private static void addJumpIfNextNotDestination(CFG cfg, BasicBlock next, Instr lastInstr, BasicBlock current) { Iterator<BasicBlock> outs = cfg.getOutgoingDestinations(current).iterator(); BasicBlock target = outs.hasNext() ? outs.next() : null; if (target != null && !outs.hasNext()) { if ((target != next) && ((lastInstr == null) || !lastInstr.getOperation().transfersControl())) { current.addInstr(new JumpInstr(target.getLabel())); } } }
private static void addJumpIfNextNotDestination(CFG cfg, BasicBlock next, Instr lastInstr, BasicBlock current) { Iterator<BasicBlock> outs = cfg.getOutgoingDestinations(current).iterator(); BasicBlock target = outs.hasNext() ? outs.next() : null; if (target != null && !outs.hasNext()) { if ((target != next) && ((lastInstr == null) || !lastInstr.getOperation().transfersControl())) { current.addInstr(new JumpInstr(target.getLabel())); } } }
private static void addJumpIfNextNotDestination(CFG cfg, BasicBlock next, Instr lastInstr, BasicBlock current) { Iterator<BasicBlock> outs = cfg.getOutgoingDestinations(current).iterator(); BasicBlock target = outs.hasNext() ? outs.next() : null; if (target != null && !outs.hasNext()) { if ((target != next) && ((lastInstr == null) || !lastInstr.getOperation().transfersControl())) { current.addInstr(new JumpInstr(target.getLabel())); } } }
private static void addJumpIfNextNotDestination(CFG cfg, BasicBlock next, Instr lastInstr, BasicBlock current) { Iterator<BasicBlock> outs = cfg.getOutgoingDestinations(current).iterator(); BasicBlock target = outs.hasNext() ? outs.next() : null; if (target != null && !outs.hasNext()) { if ((target != next) && ((lastInstr == null) || !lastInstr.getOperation().transfersControl())) { current.addInstr(new JumpInstr(target.getLabel())); } } }
public BasicBlock getOrCreateRenamedBB(BasicBlock bb) { BasicBlock renamedBB = getRenamedBB(bb); if (renamedBB == null) { renamedBB = new BasicBlock(hostCFG, getRenamedLabel(bb.getLabel())); if (bb.isRescueEntry()) renamedBB.markRescueEntryBB(); bbRenameMap.put(bb, renamedBB); } return renamedBB; }
public BasicBlock getOrCreateRenamedBB(BasicBlock bb) { BasicBlock renamedBB = getRenamedBB(bb); if (renamedBB == null) { renamedBB = new BasicBlock(hostCFG, getRenamedLabel(bb.getLabel())); if (bb.isRescueEntry()) renamedBB.markRescueEntryBB(); bbRenameMap.put(bb, renamedBB); } return renamedBB; }
public BasicBlock getOrCreateRenamedBB(BasicBlock bb) { BasicBlock renamedBB = getRenamedBB(bb); if (renamedBB == null) { renamedBB = new BasicBlock(this.callerCFG, getRenamedLabel(bb.getLabel())); if (bb.isRescueEntry()) renamedBB.markRescueEntryBB(); bbRenameMap.put(bb, renamedBB); } return renamedBB; }
private void printInlineSplitBBs(BasicBlock beforeBB, BasicBlock afterBB) { LOG.info("---------------------------------- SPLIT BB (start) --------"); LOG.info("Before:" + beforeBB.getLabel()); LOG.info(beforeBB.toStringInstrs()); LOG.info("After:" + afterBB.getLabel()); LOG.info(afterBB.toStringInstrs()); printInlineCFG(cfg, ""); LOG.info("---------------------------------- SPLIT BB (end) -----------"); }
private void printInlineSplitBBs(BasicBlock beforeBB, BasicBlock afterBB) { LOG.info("---------------------------------- SPLIT BB (start) --------"); LOG.info("Before:" + beforeBB.getLabel()); LOG.info(beforeBB.toStringInstrs()); LOG.info("After:" + afterBB.getLabel()); LOG.info(afterBB.toStringInstrs()); printInlineCFG(cfg, ""); LOG.info("---------------------------------- SPLIT BB (end) -----------"); }
public FullInterpreterContext duplicate() { try { CFG newCFG = cfg.clone(new SimpleCloneInfo(getScope(), false, true), getScope()); BasicBlock[] newLinearizedBBList = new BasicBlock[linearizedBBList.length]; for (int i = 0; i < linearizedBBList.length; i++) { newLinearizedBBList[i] = newCFG.getBBForLabel(linearizedBBList[i].getLabel()); } return new FullInterpreterContext(getScope(), newCFG, newLinearizedBBList); } catch (Throwable t) { t.printStackTrace(); return null; } }