/** * Create a new Symbol.to_proc for the given symbol name and encoding. * * @param context * @param symbol * @return */ @Interp public static RubyProc newSymbolProc(ThreadContext context, RubySymbol symbol) { return (RubyProc) symbol.to_proc(context); }
@Interp @Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { return lvar.retrieve(context, self, currDynScope, temp); }
@Interp @Override public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) { return lvar.retrieve(context, self, currDynScope, temp); }
/** * Create a new Symbol.to_proc for the given symbol name and encoding. * * @param context * @param symbol * @return */ @Interp public static RubyProc newSymbolProc(ThreadContext context, RubySymbol symbol) { return (RubyProc) symbol.to_proc(context); }
@JIT @Interp public static IRubyObject isDefinedBackref(ThreadContext context, IRubyObject definedMessage) { return RubyMatchData.class.isInstance(context.getBackRef()) ? definedMessage : context.nil; }
@Interp @Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { return getLocalVar().retrieve(context, self, currScope, currDynScope, temp); }
@JIT @Interp public static IRubyObject isDefinedCall(ThreadContext context, IRubyObject self, IRubyObject receiver, String name, IRubyObject definedMessage) { IRubyObject boundValue = Helpers.getDefinedCall(context, self, receiver, name, definedMessage); return boundValue == null ? context.nil : boundValue; }
@JIT @Interp public static IRubyObject isDefinedConstantOrMethod(ThreadContext context, IRubyObject receiver, String name, IRubyObject definedConstantMessage, IRubyObject definedMethodMessage) { IRubyObject definedType = Helpers.getDefinedConstantOrBoundMethod(receiver, name, definedConstantMessage, definedMethodMessage); return definedType == null ? context.nil : definedType; }
/** * Construct a new DynamicMethod to wrap the given IRModuleBody and singletonizable object. Used by interpreter. */ @Interp public static DynamicMethod newInterpretedMetaClass(Ruby runtime, IRScope metaClassBody, IRubyObject obj) { RubyClass singletonClass = newMetaClassFromIR(runtime, metaClassBody, obj); return new InterpretedIRMetaClassBody(metaClassBody, singletonClass); }
/** * Construct a new DynamicMethod to wrap the given IRModuleBody and singletonizable object. Used by interpreter. */ @Interp public static DynamicMethod newInterpretedModuleBody(ThreadContext context, IRScope irModule, Object rubyContainer) { RubyModule newRubyModule = newRubyModuleFromIR(context, irModule, rubyContainer); return new InterpretedIRBodyMethod(irModule, newRubyModule); }
@Interp public static DynamicMethod newInterpretedClassBody(ThreadContext context, IRScope irClassBody, Object container, Object superClass) { RubyModule newRubyClass = newRubyClassFromIR(context.runtime, irClassBody, superClass, container); return new InterpretedIRBodyMethod(irClassBody, newRubyClass); }
@JIT @Interp public static RubyString freezeLiteralString(RubyString string) { string.setFrozen(true); return string; }
@JIT @Interp public static IRubyObject isDefinedConstantOrMethod(ThreadContext context, IRubyObject receiver, String name, IRubyObject definedConstantMessage, IRubyObject definedMethodMessage) { IRubyObject definedType = Helpers.getDefinedConstantOrBoundMethod(receiver, name, definedConstantMessage, definedMethodMessage); return definedType == null ? context.nil : definedType; }
/** * Construct a new DynamicMethod to wrap the given IRModuleBody and singletonizable object. Used by interpreter. */ @Interp public static DynamicMethod newInterpretedModuleBody(ThreadContext context, IRScope irModule, Object rubyContainer) { RubyModule newRubyModule = newRubyModuleFromIR(context, irModule, rubyContainer); return new InterpretedIRBodyMethod(irModule, newRubyModule); }
@Interp @Override public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) { return getLocalVar().retrieve(context, self, currScope, currDynScope, temp); }
@Interp public static DynamicMethod newInterpretedClassBody(ThreadContext context, IRScope irClassBody, Object container, Object superClass) { RubyModule newRubyClass = newRubyClassFromIR(context.runtime, irClassBody, superClass, container); return new InterpretedIRBodyMethod(irClassBody, newRubyClass); }
@JIT @Interp public static IRubyObject isDefinedCall(ThreadContext context, IRubyObject self, IRubyObject receiver, String name, IRubyObject definedMessage) { IRubyObject boundValue = Helpers.getDefinedCall(context, self, receiver, name, definedMessage); return boundValue == null ? context.nil : boundValue; }
/** * Construct a new DynamicMethod to wrap the given IRModuleBody and singletonizable object. Used by interpreter. */ @Interp public static DynamicMethod newInterpretedMetaClass(Ruby runtime, IRScope metaClassBody, IRubyObject obj) { RubyClass singletonClass = newMetaClassFromIR(runtime, metaClassBody, obj); return new InterpretedIRMetaClassBody(metaClassBody, singletonClass); }
@Interp @Override public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { return context.runtime.getGlobalVariables().get(getId()); }
@Interp @JIT public static DynamicScope pushBlockDynamicScopeIfNeeded(ThreadContext context, Block block, boolean pushNewDynScope, boolean reuseParentDynScope) { DynamicScope newScope = getNewBlockScope(block, pushNewDynScope, reuseParentDynScope); if (newScope != null) { context.pushScope(newScope); } return newScope; }