/** * Returns the scope into which code is being inlined. */ public IRScope getInlineHostScope() { return callerCFG.getScope(); }
/** * Returns the scope into which code is being inlined. */ public IRScope getInlineHostScope() { return callerCFG.getScope(); }
public CFGInliner(FullInterpreterContext fullInterpreterContext) { this.fullInterpreterContext = fullInterpreterContext; this.cfg = fullInterpreterContext.getCFG(); this.hostScope = cfg.getScope(); }
public InlineCloneInfo cloneForInliningClosure(IRScope scopeBeingInlined) { InlineCloneInfo clone = new InlineCloneInfo(hostCFG, hostCFG.getScope(), scopeBeingInlined); clone.call = this.call; clone.callArgs = this.callArgs; clone.callReceiver = this.callReceiver; return clone; }
public InlineCloneInfo cloneForInliningClosure(IRScope scopeBeingInlined) { InlineCloneInfo clone = new InlineCloneInfo(hostCFG, hostCFG.getScope(), scopeBeingInlined); clone.call = this.call; clone.callArgs = this.callArgs; clone.callReceiver = this.callReceiver; return clone; }
public CFGInliner(FullInterpreterContext fullInterpreterContext) { this.fullInterpreterContext = fullInterpreterContext; this.cfg = fullInterpreterContext.getCFG(); this.hostScope = cfg.getScope(); }
public Operand getCallClosure() { return call.getClosureArg(callerCFG.getScope().getManager().getNil()); }
public Operand getCallClosure() { return call.getClosureArg(callerCFG.getScope().getManager().getNil()); }
public BasicBlock(CFG c, Label l) { label = l; cfg = c; id = c.getNextBBID(); instrs = new ArrayList<Instr>(); if (RubyInstanceConfig.IR_COMPILER_DEBUG || RubyInstanceConfig.IR_VISUALIZER) { IRManager irManager = cfg.getScope().getManager(); InstructionsListener listener = irManager.getInstructionsListener(); if (listener != null) { instrs = new InstructionsListenerDecorator(instrs, listener); } } instrsArray = null; isRescueEntry = false; }
public BasicBlock(CFG c, Label l) { label = l; cfg = c; id = c.getNextBBID(); instrs = new ArrayList<Instr>(); if (RubyInstanceConfig.IR_COMPILER_DEBUG || RubyInstanceConfig.IR_VISUALIZER) { IRManager irManager = cfg.getScope().getManager(); InstructionsListener listener = irManager.getInstructionsListener(); if (listener != null) { instrs = new InstructionsListenerDecorator(instrs, listener); } } instrsArray = null; isRescueEntry = false; }
public IGVCFGVisitor(CFG cfg, PrintStream writer, String name) { this.writer = writer; listener = (IGVInstrListener) cfg.getScope().getManager().getInstructionsListener(); CFG(cfg, name); listener.reset(); }
public IGVCFGVisitor(CFG cfg, PrintStream writer, String name) { this.writer = writer; listener = (IGVInstrListener) cfg.getScope().getManager().getInstructionsListener(); CFG(cfg, name); listener.reset(); }
public InlineCloneInfo(CallBase call, CFG c, Variable callReceiver, IRScope scopeBeingInlined) { super( c.getScope()); this.isClosure = false; this.hostCFG = c; this.call = call; this.callArgs = call.getCallArgs(); this.callReceiver = callReceiver; this.canMapArgsStatically = !containsSplat(callArgs); this.argsArray = this.canMapArgsStatically ? null : getHostScope().createTemporaryVariable(); this.scopeBeingInlined = scopeBeingInlined; synchronized(globalInlineCount) { this.inlineVarPrefix = new ByteList(("%in" + globalInlineCount + "_").getBytes()); globalInlineCount++; } }
public InlineCloneInfo(CallBase call, CFG c, Variable callReceiver, IRScope scopeBeingInlined) { super( c.getScope()); this.isClosure = false; this.hostCFG = c; this.call = call; this.callArgs = call.getCallArgs(); this.callReceiver = callReceiver; this.canMapArgsStatically = !containsSplat(callArgs); this.argsArray = this.canMapArgsStatically ? null : getHostScope().createTemporaryVariable(); this.scopeBeingInlined = scopeBeingInlined; synchronized(globalInlineCount) { this.inlineVarPrefix = new ByteList(("%in" + globalInlineCount + "_").getBytes()); globalInlineCount++; } }
public void addGlobalEnsureBB(BasicBlock geb) { assert globalEnsureBB == null: "CFG for scope " + getScope() + " already has a global ensure block."; addBasicBlock(geb); addEdge(geb, getExitBB(), EdgeType.EXIT); for (BasicBlock b: getBasicBlocks()) { if (b != geb && !bbIsProtected(b) && b != getEntryBB()) { addEdge(b, geb, EdgeType.EXCEPTION); setRescuerBB(b, geb); } } globalEnsureBB = geb; }
public void addGlobalEnsureBB(BasicBlock geb) { assert globalEnsureBB == null: "CFG for scope " + getScope() + " already has a global ensure block."; globalEnsureBB = geb; addEdge(geb, getExitBB(), EdgeType.EXIT); for (BasicBlock b: getBasicBlocks()) { if (b != geb && !bbIsProtected(b)) { addEdge(b, geb, EdgeType.EXCEPTION); setRescuerBB(b, geb); setEnsurerBB(b, geb); } } // We are not creating a global exception region and adding it to the list of // exc. regions because in graph form, we dont know what the "last BB" is. // That requires a linearized form of the CFG's bbs. So, the JIT can add // a special case for this global exception block since it has access to the // linearized form. }
public void addGlobalEnsureBB(BasicBlock geb) { assert globalEnsureBB == null: "CFG for scope " + getScope() + " already has a global ensure block."; addBasicBlock(geb); addEdge(geb, getExitBB(), EdgeType.EXIT); for (BasicBlock b: getBasicBlocks()) { if (b != geb && !bbIsProtected(b) && b != getEntryBB()) { addEdge(b, geb, EdgeType.EXCEPTION); setRescuerBB(b, geb); } } globalEnsureBB = geb; }
public void addGlobalEnsureBB(BasicBlock geb) { assert globalEnsureBB == null: "CFG for scope " + getScope() + " already has a global ensure block."; globalEnsureBB = geb; addEdge(geb, getExitBB(), EdgeType.EXIT); for (BasicBlock b: getBasicBlocks()) { if (b != geb && !bbIsProtected(b)) { addEdge(b, geb, EdgeType.EXCEPTION); setRescuerBB(b, geb); setEnsurerBB(b, geb); } } // We are not creating a global exception region and adding it to the list of // exc. regions because in graph form, we dont know what the "last BB" is. // That requires a linearized form of the CFG's bbs. So, the JIT can add // a special case for this global exception block since it has access to the // linearized form. }
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; }