public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, DynamicScope evalScope, Block block, String backtraceName) { if (IRRuntimeHelpers.isDebug()) { LOG.info("CFG:\n" + cfg()); } try { context.pushScope(evalScope); // Since IR introduces additional local vars, we may need to grow the dynamic scope. // To do that, IREvalScript has to tell the dyn-scope how many local vars there are. // Since the same static scope (the scope within which the eval string showed up) // might be shared by multiple eval-scripts, we cannot 'setIRScope(this)' once and // forget about it. We need to set this right before we are ready to grow the // dynamic scope local var space. ((IRStaticScope)getStaticScope()).setIRScope(this); evalScope.growIfNeeded(); // FIXME: Do not push new empty arg array in every time return Interpreter.INTERPRET_EVAL(context, self, this, clazz, new IRubyObject[] {}, backtraceName, block, null); } finally { context.popScope(); } }
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, DynamicScope evalScope, Block block, String backtraceName) { if (IRRuntimeHelpers.isDebug()) { LOG.info("CFG:\n" + cfg()); } try { context.pushScope(evalScope); // Since IR introduces additional local vars, we may need to grow the dynamic scope. // To do that, IREvalScript has to tell the dyn-scope how many local vars there are. // Since the same static scope (the scope within which the eval string showed up) // might be shared by multiple eval-scripts, we cannot 'setIRScope(this)' once and // forget about it. We need to set this right before we are ready to grow the // dynamic scope local var space. ((IRStaticScope)getStaticScope()).setIRScope(this); evalScope.growIfNeeded(); // FIXME: Do not push new empty arg array in every time return Interpreter.INTERPRET_EVAL(context, self, this, clazz, new IRubyObject[] {}, backtraceName, block, null); } finally { context.popScope(); } }
public static IRubyObject interpretCommonEval(Ruby runtime, String file, int lineNumber, String backtraceName, RootNode rootNode, IRubyObject self, Block block) { // SSS FIXME: Is this required here since the IR version cannot change from eval-to-eval? This is much more of a global setting. boolean is_1_9 = runtime.is1_9(); if (is_1_9) IRBuilder.setRubyVersion("1.9"); StaticScope ss = rootNode.getStaticScope(); IRScope containingIRScope = getEvalContainerScope(runtime, ss); IREvalScript evalScript = IRBuilder.createIRBuilder(runtime, runtime.getIRManager()).buildEvalRoot(ss, containingIRScope, file, lineNumber, rootNode); evalScript.prepareForInterpretation(false); // evalScript.runCompilerPass(new CallSplitter()); ThreadContext context = runtime.getCurrentContext(); runBeginEndBlocks(evalScript.getBeginBlocks(), context, self, null); // FIXME: No temp vars yet right? IRubyObject rv = evalScript.call(context, self, evalScript.getStaticScope().getModule(), rootNode.getScope(), block, backtraceName); runBeginEndBlocks(evalScript.getEndBlocks(), context, self, null); // FIXME: No temp vars right? return rv; }
public static IRubyObject interpretCommonEval(Ruby runtime, String file, int lineNumber, String backtraceName, RootNode rootNode, IRubyObject self, Block block) { // SSS FIXME: Is this required here since the IR version cannot change from eval-to-eval? This is much more of a global setting. boolean is_1_9 = runtime.is1_9(); if (is_1_9) IRBuilder.setRubyVersion("1.9"); StaticScope ss = rootNode.getStaticScope(); IRScope containingIRScope = getEvalContainerScope(runtime, ss); IREvalScript evalScript = IRBuilder.createIRBuilder(runtime, runtime.getIRManager()).buildEvalRoot(ss, containingIRScope, file, lineNumber, rootNode); evalScript.prepareForInterpretation(false); // evalScript.runCompilerPass(new CallSplitter()); ThreadContext context = runtime.getCurrentContext(); runBeginEndBlocks(evalScript.getBeginBlocks(), context, self, null); // FIXME: No temp vars yet right? IRubyObject rv = evalScript.call(context, self, evalScript.getStaticScope().getModule(), rootNode.getScope(), block, backtraceName); runBeginEndBlocks(evalScript.getEndBlocks(), context, self, null); // FIXME: No temp vars right? return rv; }