@JRubyMethod public IRubyObject local_variable_set(ThreadContext context, IRubyObject symbol, IRubyObject value) { String name = symbol.asJavaString().intern(); DynamicScope evalScope = binding.getEvalScope(context.runtime); int slot = evalScope.getStaticScope().isDefined(name); if (slot == -1) { // Yay! New variable associated with this binding slot = evalScope.getStaticScope().addVariable(name.intern()); evalScope.growIfNeeded(); } return evalScope.setValue(slot & 0xffff, value, slot >> 16); }
@JRubyMethod public IRubyObject local_variable_set(ThreadContext context, IRubyObject symbol, IRubyObject value) { String name = symbol.asJavaString().intern(); DynamicScope evalScope = binding.getEvalScope(context.runtime); int slot = evalScope.getStaticScope().isDefined(name); if (slot == -1) { // Yay! New variable associated with this binding slot = evalScope.getStaticScope().addVariable(name.intern()); evalScope.growIfNeeded(); } return evalScope.setValue(slot & 0xffff, value, slot >> 16); }
@JIT public static DynamicScope prepareScriptScope(ThreadContext context, StaticScope scope) { IRScope irScope = scope.getIRScope(); if (irScope.isScriptScope()) { DynamicScope tlbScope = ((IRScriptBody) irScope).getScriptDynamicScope(); if (tlbScope != null) { context.preScopedBody(tlbScope); tlbScope.growIfNeeded(); return tlbScope; } } DynamicScope dynScope = DynamicScope.newDynamicScope(scope); context.pushScope(dynScope); return dynScope; }
@JIT public static DynamicScope prepareScriptScope(ThreadContext context, StaticScope scope) { IRScope irScope = scope.getIRScope(); if (irScope.isScriptScope()) { DynamicScope tlbScope = ((IRScriptBody) irScope).getScriptDynamicScope(); if (tlbScope != null) { context.preScopedBody(tlbScope); tlbScope.growIfNeeded(); return tlbScope; } } DynamicScope dynScope = DynamicScope.newDynamicScope(scope); context.pushScope(dynScope); return dynScope; }
result.getScope().growIfNeeded();
result.getScope().growIfNeeded();
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(); } }
private static IRubyObject evalCommon(ThreadContext context, DynamicScope evalScope, IRubyObject self, IRubyObject src, String file, int lineNumber, String name, Block blockArg, EvalType evalType) { StaticScope ss = evalScope.getStaticScope(); BeginEndInterpreterContext ic = prepareIC(context, evalScope, src, file, lineNumber, evalType); evalScope.setEvalType(evalType); context.pushScope(evalScope); try { evalScope.growIfNeeded(); runBeginBlocks(ic.getBeginBlocks(), context, self, ss, null); return Interpreter.INTERPRET_EVAL(context, self, ic, ic.getStaticScope().getModule(), IRubyObject.NULL_ARRAY, name, blockArg); } finally { evalScope.clearEvalType(); context.popScope(); } }
private static IRubyObject evalCommon(ThreadContext context, DynamicScope evalScope, IRubyObject self, IRubyObject src, String file, int lineNumber, String name, Block blockArg, EvalType evalType) { StaticScope ss = evalScope.getStaticScope(); BeginEndInterpreterContext ic = prepareIC(context, evalScope, src, file, lineNumber, evalType); evalScope.setEvalType(evalType); context.pushScope(evalScope); try { evalScope.growIfNeeded(); runBeginBlocks(ic.getBeginBlocks(), context, self, ss, null); return Interpreter.INTERPRET_EVAL(context, self, ic, ic.getStaticScope().getModule(), IRubyObject.NULL_ARRAY, name, blockArg); } finally { evalScope.clearEvalType(); context.popScope(); } }
result.getScope().growIfNeeded();
result.getScope().growIfNeeded();