private BasicBlock createBB(Label label, Stack<ExceptionRegion> nestedExceptionRegions) { BasicBlock basicBlock = new BasicBlock(this, label); addBasicBlock(basicBlock); if (!nestedExceptionRegions.empty()) nestedExceptionRegions.peek().addBB(basicBlock); return basicBlock; }
public BasicBlock splitAtInstruction(Instr splitPoint, Label newLabel, boolean includeSplitPointInstr) { BasicBlock newBB = new BasicBlock(cfg, newLabel); int idx = 0; int numInstrs = instrs.size(); boolean found = false; for (Instr i: instrs) { if (i == splitPoint) found = true; // Move instructions from split point into the new bb if (found) { if (includeSplitPointInstr || i != splitPoint) newBB.addInstr(i); } else { idx++; } } // Remove all instructions from current bb that were moved over. for (int j = 0; j < numInstrs-idx; j++) { instrs.remove(idx); } return newBB; }
private BasicBlock createBB(Label label, Stack<ExceptionRegion> nestedExceptionRegions) { BasicBlock basicBlock = new BasicBlock(this, label); addBasicBlock(basicBlock); if (!nestedExceptionRegions.empty()) nestedExceptionRegions.peek().addBB(basicBlock); return basicBlock; }
public BasicBlock splitAtInstruction(Instr splitPoint, Label newLabel, boolean includeSplitPointInstr) { BasicBlock newBB = new BasicBlock(cfg, newLabel); int idx = 0; int numInstrs = instrs.size(); boolean found = false; for (Instr i: instrs) { if (i == splitPoint) found = true; // Move instructions from split point into the new bb if (found) { if (includeSplitPointInstr || i != splitPoint) newBB.addInstr(i); } else { idx++; } } // Remove all instructions from current bb that were moved over. for (int j = 0; j < numInstrs-idx; j++) { instrs.remove(idx); } return newBB; }
private BasicBlock createBB(Label label, Stack<ExceptionRegion> nestedExceptionRegions) { BasicBlock basicBlock = new BasicBlock(this, label); addBasicBlock(basicBlock); if (label.isGlobalEnsureBlockLabel()) { globalEnsureBB = basicBlock; } if (!nestedExceptionRegions.empty()) nestedExceptionRegions.peek().addBB(basicBlock); return basicBlock; }
private BasicBlock createBB(Label label, Stack<ExceptionRegion> nestedExceptionRegions) { BasicBlock basicBlock = new BasicBlock(this, label); addBasicBlock(basicBlock); if (label.isGlobalEnsureBlockLabel()) { globalEnsureBB = basicBlock; } if (!nestedExceptionRegions.empty()) nestedExceptionRegions.peek().addBB(basicBlock); return basicBlock; }
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; }
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; }
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 splitAtInstruction(Site splitPoint, Label newLabel, boolean includeSplitPointInstr) { BasicBlock newBB = new BasicBlock(cfg, newLabel); int idx = 0; int numInstrs = instrs.size(); boolean found = false; for (Instr i: instrs) { // FIXME: once found we should not be continually checking for more should be in !found if (i instanceof Site && ((Site) i).getCallSiteId() == splitPoint.getCallSiteId()) found = true; // Move instructions from split point into the new bb if (found) { // FIXME: move includeSplit when found so we can remove consuing site id logic from here... if (includeSplitPointInstr || !(i instanceof Site) || ((Site) i).getCallSiteId() != splitPoint.getCallSiteId()) newBB.addInstr(i); } else { idx++; } } if (!found) throw new RuntimeException("Cound not find split point: " + splitPoint); // Remove all instructions from current bb that were moved over. for (int j = 0; j < numInstrs-idx; j++) { instrs.remove(idx); } return newBB; }
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 splitAtInstruction(Site splitPoint, Label newLabel, boolean includeSplitPointInstr) { BasicBlock newBB = new BasicBlock(cfg, newLabel); int idx = 0; int numInstrs = instrs.size(); boolean found = false; for (Instr i: instrs) { // FIXME: once found we should not be continually checking for more should be in !found if (i instanceof Site && ((Site) i).getCallSiteId() == splitPoint.getCallSiteId()) found = true; // Move instructions from split point into the new bb if (found) { // FIXME: move includeSplit when found so we can remove consuing site id logic from here... if (includeSplitPointInstr || !(i instanceof Site) || ((Site) i).getCallSiteId() != splitPoint.getCallSiteId()) newBB.addInstr(i); } else { idx++; } } if (!found) throw new RuntimeException("Cound not find split point: " + splitPoint); // Remove all instructions from current bb that were moved over. for (int j = 0; j < numInstrs-idx; j++) { instrs.remove(idx); } return newBB; }
BasicBlock bCloned = new BasicBlock(clone, b.getLabel().clone()); for (Instr i: b.getInstrs()) { Instr clonedInstr = i.cloneForBlockCloning(ii);
BasicBlock bCloned = new BasicBlock(clone, b.getLabel().clone()); for (Instr i: b.getInstrs()) { Instr clonedInstr = i.cloneForBlockCloning(ii);
BasicBlock geb = cfg.getGlobalEnsureBB(); if (geb == null) { geb = new BasicBlock(cfg, new Label("_GLOBAL_ENSURE_BLOCK")); Variable exc = getNewTemporaryVariable(); geb.addInstr(new ReceiveExceptionInstr(exc, false)); // No need to check type since it is not used before rethrowing
BasicBlock geb = cfg.getGlobalEnsureBB(); if (geb == null) { geb = new BasicBlock(cfg, new Label("_GLOBAL_ENSURE_BLOCK")); Variable exc = getNewTemporaryVariable(); geb.addInstr(new ReceiveExceptionInstr(exc, false)); // No need to check type since it is not used before rethrowing
public BasicBlock clone(CloneInfo info, CFG newCFG) { BasicBlock newBB = new BasicBlock(newCFG, info.getRenamedLabel(label)); boolean isClosureClone = info instanceof InlineCloneInfo && ((InlineCloneInfo) info).isClosure(); for (Instr instr: instrs) { Instr newInstr = instr.clone(info); // Inlining clones the original CFG/BBs and we want to maintain ipc since it is how // we find which instr we want (we clone original instr and ipc is our identity). //if (info instanceof SimpleCloneInfo && ((SimpleCloneInfo) info).shouldCloneIPC()) { // newInstr.setIPC(instr.getIPC()); // newInstr.setRPC(instr.getRPC()); //} // All call-derived types do not clone this field. Inliner clones original instrs // and we need this preserved to make sure we do not endless inline the same call. if (instr instanceof CallBase && ((CallBase) instr).inliningBlocked()) { ((CallBase) newInstr).blockInlining(); } if (newInstr != null) { // inliner may kill off unneeded instr newBB.addInstr(newInstr); if (isClosureClone && newInstr instanceof YieldInstr) { ((InlineCloneInfo) info).recordYieldSite(newBB, (YieldInstr) newInstr); } } } return newBB; }
public BasicBlock clone(CloneInfo info, CFG newCFG) { BasicBlock newBB = new BasicBlock(newCFG, info.getRenamedLabel(label)); boolean isClosureClone = info instanceof InlineCloneInfo && ((InlineCloneInfo) info).isClosure(); for (Instr instr: instrs) { Instr newInstr = instr.clone(info); // Inlining clones the original CFG/BBs and we want to maintain ipc since it is how // we find which instr we want (we clone original instr and ipc is our identity). //if (info instanceof SimpleCloneInfo && ((SimpleCloneInfo) info).shouldCloneIPC()) { // newInstr.setIPC(instr.getIPC()); // newInstr.setRPC(instr.getRPC()); //} // All call-derived types do not clone this field. Inliner clones original instrs // and we need this preserved to make sure we do not endless inline the same call. if (instr instanceof CallBase && ((CallBase) instr).inliningBlocked()) { ((CallBase) newInstr).blockInlining(); } if (newInstr != null) { // inliner may kill off unneeded instr newBB.addInstr(newInstr); if (isClosureClone && newInstr instanceof YieldInstr) { ((InlineCloneInfo) info).recordYieldSite(newBB, (YieldInstr) newInstr); } } } return newBB; }
private BasicBlock createPrologueBlock(CFG cfg) { BasicBlock entryBB = cfg.getEntryBB(); BasicBlock oldStart = cfg.getOutgoingDestinationOfType(entryBB, CFG.EdgeType.FALL_THROUGH); BasicBlock prologueBB = new BasicBlock(cfg, cfg.getScope().getNewLabel()); cfg.removeEdge(entryBB, oldStart); cfg.addBasicBlock(prologueBB); cfg.addEdge(entryBB, prologueBB, CFG.EdgeType.FALL_THROUGH); cfg.addEdge(prologueBB, oldStart, CFG.EdgeType.FALL_THROUGH); // If there's already a GEB, make sure we have an edge to it and use it to rescue these instrs if (cfg.getGlobalEnsureBB() != null) { BasicBlock geb = cfg.getGlobalEnsureBB(); cfg.addEdge(prologueBB, geb, CFG.EdgeType.EXCEPTION); cfg.setRescuerBB(prologueBB, geb); } return prologueBB; }
private BasicBlock createPrologueBlock(CFG cfg) { BasicBlock entryBB = cfg.getEntryBB(); BasicBlock oldStart = cfg.getOutgoingDestinationOfType(entryBB, CFG.EdgeType.FALL_THROUGH); BasicBlock prologueBB = new BasicBlock(cfg, cfg.getScope().getNewLabel()); cfg.removeEdge(entryBB, oldStart); cfg.addBasicBlock(prologueBB); cfg.addEdge(entryBB, prologueBB, CFG.EdgeType.FALL_THROUGH); cfg.addEdge(prologueBB, oldStart, CFG.EdgeType.FALL_THROUGH); // If there's already a GEB, make sure we have an edge to it and use it to rescue these instrs if (cfg.getGlobalEnsureBB() != null) { BasicBlock geb = cfg.getGlobalEnsureBB(); cfg.addEdge(prologueBB, geb, CFG.EdgeType.EXCEPTION); cfg.setRescuerBB(prologueBB, geb); } return prologueBB; }