@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { InterpretedIRMethod bodyMethod = (InterpretedIRMethod)moduleBody.retrieve(context, self, currDynScope, temp); RubyModule implClass = bodyMethod.getImplementationClass(); // SSS FIXME: Rather than pass the block implicitly, should we add %block as another operand to ProcessModuleBody, DefineModule instrs? return bodyMethod.call(context, implClass, implClass, "", new IRubyObject[]{}, block); }
@Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { InterpretedIRMethod bodyMethod = (InterpretedIRMethod)moduleBody.retrieve(context, self, currDynScope, temp); RubyModule implClass = bodyMethod.getImplementationClass(); // SSS FIXME: Rather than pass the block implicitly, should we add %block as another operand to ProcessModuleBody, DefineModule instrs? return bodyMethod.call(context, implClass, implClass, "", new IRubyObject[]{}, block); }
public static IRubyObject interpret(Ruby runtime, Node rootNode, IRubyObject self) { if (runtime.is1_9()) IRBuilder.setRubyVersion("1.9"); IRScriptBody root = (IRScriptBody) IRBuilder.createIRBuilder(runtime, runtime.getIRManager()).buildRoot((RootNode) rootNode); // We get the live object ball rolling here. This give a valid value for the top // of this lexical tree. All new scope can then retrieve and set based on lexical parent. if (root.getStaticScope().getModule() == null) { // If an eval this may already be setup. root.getStaticScope().setModule(runtime.getObject()); } RubyModule currModule = root.getStaticScope().getModule(); // Scope state for root? IRStaticScopeFactory.newIRLocalScope(null).setModule(currModule); ThreadContext context = runtime.getCurrentContext(); try { runBeginEndBlocks(root.getBeginBlocks(), context, self, null); // FIXME: No temp vars yet...not needed? InterpretedIRMethod method = new InterpretedIRMethod(root, currModule); IRubyObject rv = method.call(context, self, currModule, "(root)", IRubyObject.NULL_ARRAY); runBeginEndBlocks(root.getEndBlocks(), context, self, null); // FIXME: No temp vars yet...not needed? if ((IRRuntimeHelpers.isDebug() || IRRuntimeHelpers.inProfileMode()) && interpInstrsCount > 10000) { LOG.info("-- Interpreted instructions: {}", interpInstrsCount); /* for (Operation o: opStats.keySet()) { System.out.println(o + " = " + opStats.get(o).count); } */ } return rv; } catch (IRBreakJump bj) { throw IRException.BREAK_LocalJumpError.getException(context.runtime); } }
public static IRubyObject interpret(Ruby runtime, Node rootNode, IRubyObject self) { if (runtime.is1_9()) IRBuilder.setRubyVersion("1.9"); IRScriptBody root = (IRScriptBody) IRBuilder.createIRBuilder(runtime, runtime.getIRManager()).buildRoot((RootNode) rootNode); // We get the live object ball rolling here. This give a valid value for the top // of this lexical tree. All new scope can then retrieve and set based on lexical parent. if (root.getStaticScope().getModule() == null) { // If an eval this may already be setup. root.getStaticScope().setModule(runtime.getObject()); } RubyModule currModule = root.getStaticScope().getModule(); // Scope state for root? IRStaticScopeFactory.newIRLocalScope(null).setModule(currModule); ThreadContext context = runtime.getCurrentContext(); try { runBeginEndBlocks(root.getBeginBlocks(), context, self, null); // FIXME: No temp vars yet...not needed? InterpretedIRMethod method = new InterpretedIRMethod(root, currModule); IRubyObject rv = method.call(context, self, currModule, "(root)", IRubyObject.NULL_ARRAY); runBeginEndBlocks(root.getEndBlocks(), context, self, null); // FIXME: No temp vars yet...not needed? if ((IRRuntimeHelpers.isDebug() || IRRuntimeHelpers.inProfileMode()) && interpInstrsCount > 10000) { LOG.info("-- Interpreted instructions: {}", interpInstrsCount); /* for (Operation o: opStats.keySet()) { System.out.println(o + " = " + opStats.get(o).count); } */ } return rv; } catch (IRBreakJump bj) { throw IRException.BREAK_LocalJumpError.getException(context.runtime); } }