@Override public Instr cloneForInlining(InlinerInfo ii) { return new ReturnInstr(returnValue.cloneForInlining(ii)); }
public static ReturnInstr decode(IRReaderDecoder d) { return new ReturnInstr(d.decodeOperand()); }
@Override public Instr cloneForInlining(InlinerInfo ii) { return new ReturnInstr(returnValue.cloneForInlining(ii)); }
public static ReturnInstr decode(IRReaderDecoder d) { return new ReturnInstr(d.decodeOperand()); }
private InterpreterContext buildLambdaInner(LambdaNode node) { prepareImplicitState(); // recv_self, add frame block, etc) addCurrentScopeAndModule(); // %current_scope/%current_module receiveBlockArgs(node); Operand closureRetVal = node.getBody() == null ? manager.getNil() : build(node.getBody()); // can be U_NIL if the node is an if node with returns in both branches. if (closureRetVal != U_NIL) addInstr(new ReturnInstr(closureRetVal)); handleBreakAndReturnsInLambdas(); return scope.allocateInterpreterContext(instructions); }
private InterpreterContext buildRootInner(RootNode rootNode) { needsCodeCoverage = rootNode.needsCoverage(); prepareImplicitState(); // recv_self, add frame block, etc) addCurrentScopeAndModule(); // %current_scope/%current_module // Build IR for the tree and return the result of the expression tree addInstr(new ReturnInstr(build(rootNode.getBodyNode()))); scope.computeScopeFlagsEarly(instructions); // Root scope can receive returns now, so we add non-local return logic if necessary (2.5+) if (scope.canReceiveNonlocalReturns()) handleNonlocalReturnInMethod(); return scope.allocateInterpreterContext(instructions); }
private InterpreterContext buildRootInner(RootNode rootNode) { needsCodeCoverage = rootNode.needsCoverage(); prepareImplicitState(); // recv_self, add frame block, etc) addCurrentScopeAndModule(); // %current_scope/%current_module // Build IR for the tree and return the result of the expression tree addInstr(new ReturnInstr(build(rootNode.getBodyNode()))); scope.computeScopeFlagsEarly(instructions); // Root scope can receive returns now, so we add non-local return logic if necessary (2.5+) if (scope.canReceiveNonlocalReturns()) handleNonlocalReturnInMethod(); return scope.allocateInterpreterContext(instructions); }
private InterpreterContext buildLambdaInner(LambdaNode node) { prepareImplicitState(); // recv_self, add frame block, etc) addCurrentScopeAndModule(); // %current_scope/%current_module receiveBlockArgs(node); Operand closureRetVal = node.getBody() == null ? manager.getNil() : build(node.getBody()); // can be U_NIL if the node is an if node with returns in both branches. if (closureRetVal != U_NIL) addInstr(new ReturnInstr(closureRetVal)); handleBreakAndReturnsInLambdas(); return scope.allocateInterpreterContext(instructions); }
public InterpreterContext buildEvalRoot(RootNode rootNode) { needsCodeCoverage = false; // Assuming there is no path into build eval root without actually being an eval. addInstr(manager.newLineNumber(scope.getLine())); prepareImplicitState(); // recv_self, add frame block, etc) addCurrentScopeAndModule(); // %current_scope/%current_module Operand returnValue = rootNode.getBodyNode() == null ? manager.getNil() : build(rootNode.getBodyNode()); addInstr(new ReturnInstr(returnValue)); return scope.allocateInterpreterContext(instructions); }
private InterpreterContext buildPrePostExeInner(Node body) { // Set up %current_scope and %current_module addInstr(new CopyInstr(scope.getCurrentScopeVariable(), CurrentScope.INSTANCE)); addInstr(new CopyInstr(scope.getCurrentModuleVariable(), SCOPE_MODULE[0])); build(body); // END does not have either explicit or implicit return, so we add one addInstr(new ReturnInstr(new Nil())); return scope.allocateInterpreterContext(instructions); }
@Override public Instr clone(CloneInfo info) { if (info instanceof SimpleCloneInfo) return new ReturnInstr(getReturnValue().cloneForInlining(info)); InlineCloneInfo ii = (InlineCloneInfo) info; if (ii.isClosure()) return new CopyInstr(ii.getYieldResult(), getReturnValue().cloneForInlining(ii)); Variable v = ii.getCallResultVariable(); return v == null ? null : new CopyInstr(v, getReturnValue().cloneForInlining(ii)); }
public InterpreterContext buildEvalRoot(RootNode rootNode) { needsCodeCoverage = false; // Assuming there is no path into build eval root without actually being an eval. addInstr(manager.newLineNumber(scope.getLine())); prepareImplicitState(); // recv_self, add frame block, etc) addCurrentScopeAndModule(); // %current_scope/%current_module Operand returnValue = rootNode.getBodyNode() == null ? manager.getNil() : build(rootNode.getBodyNode()); addInstr(new ReturnInstr(returnValue)); return scope.allocateInterpreterContext(instructions); }
@Override public Instr clone(CloneInfo info) { if (info instanceof SimpleCloneInfo) return new ReturnInstr(getReturnValue().cloneForInlining(info)); InlineCloneInfo ii = (InlineCloneInfo) info; if (ii.isClosure()) return new CopyInstr(ii.getYieldResult(), getReturnValue().cloneForInlining(ii)); Variable v = ii.getCallResultVariable(); return v == null ? null : new CopyInstr(v, getReturnValue().cloneForInlining(ii)); }
private InterpreterContext buildPrePostExeInner(Node body) { // Set up %current_scope and %current_module addInstr(new CopyInstr(scope.getCurrentScopeVariable(), CurrentScope.INSTANCE)); addInstr(new CopyInstr(scope.getCurrentModuleVariable(), SCOPE_MODULE[0])); build(body); // END does not have either explicit or implicit return, so we add one addInstr(new ReturnInstr(new Nil())); return scope.allocateInterpreterContext(instructions); }
private InterpreterContext buildForIterInner(ForNode forNode) { prepareImplicitState(); // recv_self, add frame block, etc) Node varNode = forNode.getVarNode(); if (varNode != null && varNode.getNodeType() != null) receiveBlockArgs(forNode); addCurrentScopeAndModule(); // %current_scope/%current_module addInstr(new LabelInstr(((IRClosure) scope).startLabel)); // Start label -- used by redo! // Build closure body and return the result of the closure Operand closureRetVal = forNode.getBodyNode() == null ? manager.getNil() : build(forNode.getBodyNode()); if (closureRetVal != U_NIL) { // can be null if the node is an if node with returns in both branches. addInstr(new ReturnInstr(closureRetVal)); } return scope.allocateInterpreterContext(instructions); }
private InterpreterContext buildForIterInner(ForNode forNode) { prepareImplicitState(); // recv_self, add frame block, etc) Node varNode = forNode.getVarNode(); if (varNode != null && varNode.getNodeType() != null) receiveBlockArgs(forNode); addCurrentScopeAndModule(); // %current_scope/%current_module addInstr(new LabelInstr(((IRClosure) scope).startLabel)); // Start label -- used by redo! // Build closure body and return the result of the closure Operand closureRetVal = forNode.getBodyNode() == null ? manager.getNil() : build(forNode.getBodyNode()); if (closureRetVal != U_NIL) { // can be null if the node is an if node with returns in both branches. addInstr(new ReturnInstr(closureRetVal)); } return scope.allocateInterpreterContext(instructions); }
public IREvalScript buildEvalRoot(StaticScope staticScope, IRScope containingScope, String file, int lineNumber, RootNode rootNode) { // Top-level script! IREvalScript script = new IREvalScript(manager, containingScope, file, lineNumber, staticScope); // Debug info: record line number script.addInstr(new LineNumberInstr(script, lineNumber)); // Set %current_scope = <current-scope> // Set %current_module = <current-module> script.addInstr(new CopyInstr(script.getCurrentScopeVariable(), new CurrentScope(script))); script.addInstr(new CopyInstr(script.getCurrentModuleVariable(), new ScopeModule(script))); // Build IR for the tree and return the result of the expression tree Operand rval = rootNode.getBodyNode() == null ? manager.getNil() : build(rootNode.getBodyNode(), script); script.addInstr(new ReturnInstr(rval)); return script; }
public IREvalScript buildEvalRoot(StaticScope staticScope, IRScope containingScope, String file, int lineNumber, RootNode rootNode) { // Top-level script! IREvalScript script = new IREvalScript(manager, containingScope, file, lineNumber, staticScope); // Debug info: record line number script.addInstr(new LineNumberInstr(script, lineNumber)); // Set %current_scope = <current-scope> // Set %current_module = <current-module> script.addInstr(new CopyInstr(script.getCurrentScopeVariable(), new CurrentScope(script))); script.addInstr(new CopyInstr(script.getCurrentModuleVariable(), new ScopeModule(script))); // Build IR for the tree and return the result of the expression tree Operand rval = rootNode.getBodyNode() == null ? manager.getNil() : build(rootNode.getBodyNode(), script); script.addInstr(new ReturnInstr(rval)); return script; }
public IRScope buildRoot(RootNode rootNode) { String file = rootNode.getPosition().getFile(); StaticScope staticScope = rootNode.getStaticScope(); // Top-level script! IRScriptBody script = new IRScriptBody(manager, "__file__", file, staticScope); script.addInstr(new ReceiveSelfInstr(script.getSelf())); // Set %current_scope = <current-scope> // Set %current_module = <current-module> script.addInstr(new CopyInstr(script.getCurrentScopeVariable(), new CurrentScope(script))); script.addInstr(new CopyInstr(script.getCurrentModuleVariable(), new ScopeModule(script))); // Build IR for the tree and return the result of the expression tree script.addInstr(new ReturnInstr(build(rootNode.getBodyNode(), script))); return script; }
public IRScope buildRoot(RootNode rootNode) { String file = rootNode.getPosition().getFile(); StaticScope staticScope = rootNode.getStaticScope(); // Top-level script! IRScriptBody script = new IRScriptBody(manager, "__file__", file, staticScope); script.addInstr(new ReceiveSelfInstr(script.getSelf())); // Set %current_scope = <current-scope> // Set %current_module = <current-module> script.addInstr(new CopyInstr(script.getCurrentScopeVariable(), new CurrentScope(script))); script.addInstr(new CopyInstr(script.getCurrentModuleVariable(), new ScopeModule(script))); // Build IR for the tree and return the result of the expression tree script.addInstr(new ReturnInstr(build(rootNode.getBodyNode(), script))); return script; }