Package org.jruby
Class Ruby
java.lang.Object
org.jruby.Ruby
- All Implemented Interfaces:
Constantizable
The Ruby object represents the top-level of a JRuby "instance" in a given VM.
JRuby supports spawning multiple instances in the same JVM. Generally, objects
created under these instances are tied to a given runtime, for such details
as identity and type, because multiple Ruby instances means there are
multiple instances of each class. This means that in multi-runtime mode
(or really, multi-VM mode, where each JRuby instance is a ruby "VM"), objects
generally can't be transported across runtimes without marshaling.
This class roots everything that makes the JRuby runtime function, and
provides a number of utility methods for constructing global types and
accessing global runtime structures.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interface(package private) static classstatic interfaceprivate classstatic interfaceDeprecated.static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate static final Patternprivate final ConcurrentWeakHashMap<RubyModule,Object> private IRubyObjectprivate RubyClassprivate final RubyClassprivate final RubyClassprivate final AtomicIntegerprivate DynamicMethodThe built-in Class#new method, so we can bind more directly to allocate and initialize.private final RubyClassAll the core classes we keep hard references to.private final BeanManagerprivate final RubyClassprivate final RubyClassprivate final Cachesprivate final AtomicIntegerprivate final Ruby.CallTraceFuncHookprivate final RubyClassprivate RubyHashprivate final Invalidatorprivate final RubyClassprivate final RubyClassprivate final RubyModuleprivate final RubyClassprivate RubyClassprivate final RubyClass(package private) final RubyInstanceConfigprivate final Configprivate final ObjectA representation of this runtime as a JIT-optimizable constant.private final ConcurrentHashMap<String,Invalidator> private final RubyClassprivate final RubyClassprivate RubyClassprivate final booleanprivate final CoverageDataprivate Stringprivate intprivate final RubyClassprivate booleanprivate final ThreadLocal<Ruby.FStringEqual>private final ConcurrentHashMap<Ruby.FStringEqual,WeakReference<RubyString>> A map from Ruby string data to a pre-frozen global version of that string.private org.jcodings.Encodingprivate org.jcodings.Encodingprivate org.jcodings.Encodingprivate DynamicMethodprivate DynamicMethod(package private) RubyRandom.RandomTypeprivate RubyThreadGroupprivate final EnumMap<DefinedMessage,RubyString> private final RubyClassprivate static final Ruby.ObjectSpacerprivate booleanprivate final RubyClassprivate final AtomicLongprivate static final EventHook[]private final RubyArrayprivate static final Ruby.ObjectSpacerprivate final RubyClassprivate RubyClassprivate RubyClassprivate final EncodingServiceprivate final RubyModuleprivate final RubyClassprivate RubyHashprivate RubyClassprivate PrintStreamstatic final Stringprivate RubyModuleprivate RubyModuleprivate EventHook[]private final RubyClassprivate final AtomicIntegerprivate final ExecutorServiceprivate final List<Ruby.ExitFunction>Reserved for userland at_exit logic that runs before internal services start shutting down.private final RubyClassprivate final RubyBooleanprivate RubyClassprivate FFIprivate final RubyClassprivate RubyClassprivate final ExecutorServiceprivate final RubyClassprivate final FilenoUtilprivate final RubyClassprivate final RubyModuleprivate Map<Finalizable,Object> A list of "external" finalizers (the ones, registered via ObjectSpace), weakly referenced, to be executed on tearDown.private final Object(package private) final RubyFixnum[]private final RubyClass(package private) final Object[]private final Invalidatorprivate booleanprivate final RubyClassprivate RubyClassprivate final Invalidatorprivate booleanprivate RubyClassprivate final RubyModuleprivate final RubyClassprivate static RubyThe "global" runtime.private longDeprecated.private final GlobalVariablesprivate RubyClassprivate booleanprivate final RubyClassprivate final longThe runtime-local seed for hash randomizationprivate final longprivate final Objectprivate InputStreamprivate RubyClassprivate final InlineStatsprivate final ThreadLocal<Map<Object,Object>> private final RubyClassprivate Map<Finalizable,Object> A list of JRuby-internal finalizers, weakly referenced, to be executed on tearDown.private final Objectprivate final Interpreterprivate RubyClassprivate RubyClassprivate RubyClassprivate final RubyClassprivate RubyClassprivate final IRManagerprivate final Map<Class,Consumer<RubyModule>> private final JavaSupportprivate final JITCompilerprivate final JRubyClassLoaderprivate KCodeprivate final RubyModuleAll the core modules we keep direct references to, for quick access and to ensure they remain available.private RubyClassprivate static final Ruby.RecursiveFunctionEx<Ruby.RecursiveFunction>Deprecated.private RubyClassprivate final LoadServiceprivate RubyClassprivate RubyClassprivate static final LoggerThe logger used to log relevant bits.private final RubyModuleprivate final RubyClassprivate RubyClassprivate final RubyModuleprivate final RubyClassprivate final RubyClassprivate final AtomicIntegerprivate final AtomicIntegerprivate MRIRecursionGuardprivate final RubyClassprivate RubyClassprivate RubyClassprivate RubyClassprivate jnr.posix.POSIXstatic final intprivate final RubyClassprivate final RubyNilprivate final IRubyObject[]private RubyClassprivate RubyClassprivate DynamicMethodprivate RubyClassprivate MethodHandleThe nullToNil filter for this runtime.private final RubyClassprivate final RubyClassprivate final ObjectSpaceprivate booleanprivate final RubyModuleprivate final Ruby.ObjectSpacerprivate PrintStreamprivate final Parserprivate final ParserStatsprivate RubyClassfinal ClassValue<TypePopulator>private final jnr.posix.POSIXprivate final List<Ruby.ExitFunction>Registry of shutdown operations that should happen after all user code has been run (e.g.private RubyModuleprivate DynamicMethodprivate final RubyClassprivate final RubyModuleprivate RubyModuleprivate RubyClassprivate RubyModuleprivate RubyModuleprivate Profileprivate final ProfilingServiceLookupUsed to find the ProfilingService implementation to use.private DynamicMethodprivate final RubyClass(package private) final RandomThe runtime-local random number generator.private final RubyClassprivate final RubyClassprivate RubyClassprivate final RubyClassprivate GlobalVariableprivate final RubyClassprivate RubyClassprivate final org.joni.WarnCallbackprivate booleanprivate DynamicMethodprivate DynamicMethod(package private) static final Stringprivate IRubyObjectDeprecated.private static final AtomicIntegerprivate final Runtimeprivate final RuntimeCacheprivate RubyClassprivate final booleanprivate final intprivate RubyClassprivate RubyClassprivate static booleanprivate final SelectorPoolprivate RubyClassprivate final IRubyObject[]private booleanfinal JavaSitesprivate final RubyClassprivate RubyClassprivate final longprivate final StaticScopeFactorystatic final Stringprivate RubyClassprivate final RubyClassprivate final Map<String,List<StrptimeToken>> private final RubyClassprivate DynamicMethodprivate final RubyClassprivate final AtomicIntegerprivate final RubySymbol.SymbolTableprivate RubyClassprivate RubyClassprivate RubyClassprivate RubyClassprivate final RubyClassprivate RubyClassprivate final RubyClassprivate static final ThreadLocal<Ruby>The "thread local" runtime.private ThreadServiceprivate final EnumMap<RubyThread.Status,RubyString> private final RubyClassprivate RubyClassprivate final IRubyObjectprivate final RubyClassprivate final RubyBooleanprivate RubyClass(package private) RubyStringprivate final RubyClassprivate RubyClassprivate RubyClassprivate DynamicMethodprivate booleanprivate IRubyObjectprivate final AtomicIntegerprivate final RubyModuleprivate final RubyWarningsprivate booleanprivate final RubyClassprivate RubyClass -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateRuby(RubyInstanceConfig config) Create and initialize a new JRuby runtime. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBoundMethod(String className, String methodName, String rubyName) voidaddBoundMethods(int tuplesIndex, String... classNamesAndTuples) voidaddBoundMethods(String className, String... tuples) voidaddBoundMethodsPacked(String className, String packedTuples) Deprecated.private InvalidatoraddConstantInvalidator(String constantName) private voidvoidaddEventHook(EventHook hook) voidaddFinalizer(Finalizable finalizer) private RootNodeaddGetsLoop(RootNode oldRoot, boolean printing, boolean processLineEndings, boolean split) voidaddInternalFinalizer(Finalizable finalizer) private voidvoidaddModule(RubyModule module) (package private) voidaddProfiledMethod(String id, DynamicMethod method) Add a method, so it can be printed out later.voidaddSimpleBoundMethodsPacked(String className, String packedNames) Deprecated.voidaddToObjectSpace(boolean useObjectSpace, IRubyObject object) intintprivate booleanalreadyRegisteredEndBlock(RubyProc newProc) voidcallEventHooks(ThreadContext context, RubyEvent event, String file, int line, String name, IRubyObject type) voidcheckSafeString(IRubyObject object) Deprecated.static voidClear the global runtime.voidcompileAndLoadFile(String filename, InputStream in, boolean wrap) constant()private voidcreateSysErr(int i, String name) Creates a system error.defineClass(String name, RubyClass superClass, ObjectAllocator allocator) Define a new class under the Object namespace.defineClass(String name, RubyClass superClass, ObjectAllocator allocator, CallSite[] callSites) A variation of defineClass that allows passing in an array of supplementary call sites for improving dynamic invocation performance.defineClassUnder(String name, RubyClass superClass, ObjectAllocator allocator, RubyModule parent) Define a new class with the given name under the given module or class namespace.defineClassUnder(String id, RubyClass superClass, ObjectAllocator allocator, RubyModule parent, CallSite[] callSites) A variation of defineClassUnder that allows passing in an array of supplementary call sites to improve dynamic invocation.voiddefineGlobalConstant(String name, IRubyObject value) rb_define_global_const Define a constant on the global namespace (i.e.defineModule(String name) Define a new module under the Object namespace.defineModuleUnder(String name, RubyModule parent) Define a new module with the given name under the given module or class namespace.voiddefineReadonlyVariable(String name, IRubyObject value, GlobalVariable.Scope scope) defines a readonly global variablevoiddefineVariable(GlobalVariable variable, GlobalVariable.Scope scope) Defines a global variableprivate voidprivate IRubyObjectprivate booleanvoideachModule(Consumer<RubyModule> func) private byte[]encodeToBytes(String string) evalScriptlet(String script) Evaluates a script under the current scope (perhaps the top-level scope) and returns the result (generally the last value calculated).evalScriptlet(String script, DynamicScope scope) Evaluates a script under the current scope (perhaps the top-level scope) and returns the result (generally the last value calculated).execRecursive(Ruby.RecursiveFunction func, IRubyObject obj) Deprecated.execRecursiveOuter(Ruby.RecursiveFunction func, IRubyObject obj) Deprecated.Use ThreadContext.safeRecurse.executeScript(String script, String filename) Parse and execute the specified script This differs from the other methods in that it accepts a string-based script and parses and runs it as though it were loaded at a command-line.fastGetClass(String internedName) Deprecated.fastGetModule(String internedName) Deprecated.fastNewSymbol(String internedName) Faster thannewSymbol(String)if you already have an interned name String.fetchGlobalConstant(String name) Fetch a constant from the global namespace (i.e.freezeAndDedupString(RubyString string) Given a Ruby string, cache a frozen, duplicated copy of it, or find an existing copy already prepared.getArray()intGet the current backtrace count.Get the base Class#new method.getCachedStrptimePattern(String pattern) Get the Caches management object.intGet the current backtrace count.getChain()Deprecated.Retrieve the class with the given name from the Object namespace.getClassFromPath(String path) getClassFromPath(String path, RubyClass undefinedExceptionClass, boolean flexibleSearch) Find module from a string (e.g.static ClassLoaderintDeprecated.getConstantInvalidator(String constantName) static RubyDeprecated.intgetData()getDebug()Getter for property isDebug.Get the default java.nio.charset.Charset for the current default internal encoding.org.jcodings.EncodingReturn the default internal encoding, if set, or UTF-8 by default.org.jcodings.Encodingorg.jcodings.Encodingstatic RubyDeprecated.use #newInstance()org.jcodings.EncodingThis is an internal encoding if actually specified via default_internal= or passed in via -E.Deprecated.internal API, to be hiddengetDefinedMessage(DefinedMessage definedMessage) getDir()getDummy()getENV()getErr()getErrno()getErrno(int n) getEtc()intGet the current exception count.getFalse()Returns the "false" instance from the instance pool.getFatal()getFFI()getFiber()getFile()Deprecated.getFloat()Deprecated.getGC()static RubyGet the global runtime.longDeprecated.getHash()longlongGet the global object used to synchronize class-hierarchy modifications like cache invalidation, subclass sets, and included hierarchy sets.getIn()getIO()getKCode()Returns the loadService.getMath()Retrieve the module with the given name from the Object namespace.getMutex()jnr.posix.POSIXGet the native POSIX associated with this runtime.longGet a new serial number for a new DynamicMethod instanceintGet a new generation number for a module or class.getNil()Returns the "nil" singleton instance.Get the "nullToNil" method handle filter for this runtime.From Object, retrieve the named module.getOut()jnr.posix.POSIXgetPosix()getProc()Deprecated.private ProfilingServiceLookupSimple getter for #profilingServiceLookup to avoid direct property accessgetQueue()Deprecated.internal API, to be removedgetRange()(package private) org.joni.WarnCallbackDeprecated.Deprecated.Get the core class RuntimeCache instance, for doing dynamic calls from core class methods.intintDeprecated.Get the runtime-global selector poollongstatic RubyGet the thread-local runtime for the current thread, or null if unset.getThreadStatus(RubyThread.Status status) getTime()Getter for property rubyTopSelf.getTrue()Returns the "true" instance from the instance pool.Getter for property isVerbose.intGet the current backtrace count.booleanprivate voidvoidDeprecated.voidIncrement the count of backtraces generated by code in this runtime.voidIncrement the count of backtraces generated by code in this runtime.voidIncrement the count of exceptions generated by code in this runtime.voidIncrement the count of backtraces generated for warnings in this runtime.private voidprivate RubyClassprivate RubyClassprivate voidprivate voidprivate voidCreate module Errno's Variables.private voidprivate voidLoad libraries expected to be present after a normal boot.private JRubyClassLoaderprivate voidinitKernelGsub(RubyModule kernel) private voidprivate Ruby.ObjectSpacerinitObjectSpacer(RubyInstanceConfig config) private voidprivate Randomprivate voidprivate voidprivate voidbooleanis1_8()Deprecated.booleanis1_9()Deprecated.booleanis2_0()Deprecated.booleanbooleanbooleanbooleanisClassDefined(String name) booleanisDebug()booleanisDefaultMethodMissing(DynamicMethod method) booleanbooleanDeprecated.booleanDeprecated.booleanDeprecated.static booleanTests whether globalRuntime has been instantiated or not.booleanisInspecting(Object obj) booleanbooleanstatic booleanbooleanbooleanprivate void<C extends Enum<C> & jnr.constants.Constant>
voidloadConstantSet(RubyModule module, Class<C> enumClass) Define all constants from the given jnr-constants enum which are defined on the current platform.voidloadConstantSet(RubyModule module, String constantSetName) Define all constants from the named jnr-constants set which are defined on the current platform.voidloadExtension(String extName, BasicLibraryService extension, boolean wrap) Load the given BasicLibraryService instance, wrapping it in Ruby framing to ensure it is isolated from any parent scope.voidloadFile(String scriptName, InputStream in, boolean wrap) private voidvoidvoidloadScript(Script script) voidloadScript(Script script, boolean wrap) newArgumentError(int got, int expected) newArgumentError(int got, int min, int max) newArgumentError(String message) newArgumentError(String name, int got, int expected) newArgumentError(String name, int got, int min, int max) newArray()newArray(int size) newArray(List<IRubyObject> list) newArray(IRubyObject object) newArray(IRubyObject... objects) newArray(IRubyObject car, IRubyObject cdr) newArrayNoCopy(IRubyObject... objects) newArrayNoCopyLight(IRubyObject... objects) newBinding(Binding binding) newBlockPassProc(Block.Type type, Block block) newBoolean(boolean value) newConcurrencyError(String message) newConverterNotFoundError(String message) newDeduplicatedString(String string) newEncodingCompatibilityError(String message) newEncodingError(String message) newEOFError(String message) newErrnoEACCESError(String message) Deprecated.newErrnoEADDRFromBindException(BindException be, String contextMessage) newErrnoEADDRINUSEError(String message) newErrnoEADDRNOTAVAILError(String message) newErrnoEAFNOSUPPORTError(String message) newErrnoEAGAINError(String message) newErrnoEAGAINReadableError(String message) newErrnoEAGAINWritableError(String message) newErrnoEBADFError(String message) newErrnoECONNREFUSEDError(String message) newErrnoEDOMError(String message) newErrnoEEXISTError(String message) newErrnoEHOSTUNREACHError(String message) newErrnoEINPROGRESSError(String message) newErrnoEINPROGRESSWritableError(String message) newErrnoEINVALError(String message) newErrnoEISCONNError(String message) newErrnoEISDirError(String message) newErrnoENOENTError(String message) newErrnoENOTCONNError(String message) newErrnoENOTDIRError(String message) newErrnoENOTEMPTYError(String message) newErrnoENOTSOCKError(String message) newErrnoEOPNOTSUPPError(String message) newErrnoEPERMError(String name) newErrnoESPIPEError(String message) newErrnoEXDEVError(String message) newErrnoFromBindException(BindException be, String contextMessage) newErrnoFromErrno(jnr.constants.platform.Errno errno, String message) newErrnoFromInt(int errno) newErrnoFromInt(int errno, String message) newErrnoFromInt(int errno, String methodName, String message) newFiberError(String message) newFileStat(FileDescriptor descriptor) newFileStat(String filename, boolean lstat) newFixnum(int value) newFixnum(long value) newFixnum(jnr.constants.Constant value) newFloat(double value) newFloatDomainError(String message) newFrozenError(String objectType) newFrozenError(String objectType, boolean runtimeError) newFrozenError(RubyModule type) newIllegalSequence(String message) Deprecated.newIndexError(String message) static RubyReturns a new instance of the JRuby runtime configured with defaults.static RubynewInstance(InputStream in, PrintStream out, PrintStream err) Returns a new instance of the JRuby runtime configured with the given input, output and error streams and otherwise default configuration (except where specified system properties alter defaults).static RubynewInstance(RubyInstanceConfig config) Returns a new instance of the JRuby runtime configured as specified.newInterruptedRegexpError(String message) newInvalidByteSequenceError(String message) newInvalidEncoding(String message) Deprecated.newIOError(String message) Java does not give us enough information for specific error conditions so we are reduced to divining them through string matches...newKeyError(String message, IRubyObject recv, IRubyObject key) private RaiseExceptionnewLightweightErrnoException(RubyClass exceptionClass, String message) Generate one of the ERRNO exceptions.newLightweightStopIterationError(String message) Deprecated.newLoadError(String message) newLoadError(String message, String path) newLocalJumpError(RubyLocalJumpError.Reason reason, IRubyObject exitValue, String message) newMathDomainError(String message) newNameError(String message, String name) Construct a NameError with a pre-formatted message and name.newNameError(String message, String name, Throwable origException) Construct a NameError with an optional originating exception and a pre-formatted message.newNameError(String message, String name, Throwable exception, boolean printWhenVerbose) Construct a NameError with the given pre-formatted message, name, and optional original exception.newNameError(String message, IRubyObject name) newNameError(String message, IRubyObject recv, String name) Construct a NameError that formats its message with an sprintf format string.newNameError(String message, IRubyObject recv, String name, boolean privateCall) Construct a NameError that formats its message with an sprintf format string and has private_call? set to given.newNameError(String message, IRubyObject name, Throwable exception, boolean printWhenVerbose) newNameError(String message, IRubyObject recv, IRubyObject name) newNameError(String message, IRubyObject recv, IRubyObject name, boolean privateCall) Construct a NameError that formats its message with an sprintf format string.newNameErrorObject(String message, IRubyObject name) Deprecated.newNoMethodError(String message, String name, IRubyObject args) Construct a NoMethodError with a pre-formatted message.newNoMethodError(String message, IRubyObject recv, String name, RubyArray args) newNoMethodError(String message, IRubyObject recv, String name, RubyArray args, boolean privateCall) Construct a NoMethodError that formats its message with an sprintf format string.newNotImplementedError(String message) newProc(Block.Type type, Block block) newRaiseException(RubyClass exceptionClass, String message) Construct a new RaiseException wrapping a new Ruby exception object appropriate to the given exception class.newRangeError(String message) newRational(long num, long den) newRationalReduced(long num, long den) newRegexpError(String message) newRuntimeError(String message) newSecurityError(String message) newStandardError(String message) newStopIteration(IRubyObject result, String message) Generate a StopIteration exception.newStringShared(ByteList byteList) Deprecated.newSyntaxError(String message) newSystemCallError(String message) newSystemExit(int status) newSystemExit(int status, String message) newSystemStackError(String message) newSystemStackError(String message, StackOverflowError error) newThreadError(String message) newTime(long milliseconds) newTypeError(String message) newTypeError(IRubyObject receivedObject, String expectedType) newTypeError(IRubyObject receivedObject, RubyClass expectedType) newTypeError(IRubyObject receivedObject, RubyModule expectedType) newUndefinedConversionError(String message) private MRIRecursionGuardDeprecated.parse(String content, String file, DynamicScope scope, int lineNumber, boolean extraPositionInformation) Deprecated.parse(ByteList content, String file, DynamicScope scope, int lineNumber, boolean extraPositionInformation) parseEval(String content, String file, DynamicScope scope, int lineNumber) parseEval(ByteList content, String file, DynamicScope scope, int lineNumber) parseFile(InputStream in, String file, DynamicScope scope) parseFile(InputStream in, String file, DynamicScope scope, int lineNumber) parseFile(String file, InputStream in, DynamicScope scope) parseFile(String file, InputStream in, DynamicScope scope, int lineNumber) private NodeparseFileAndGetAST(InputStream in, String file, DynamicScope scope, int lineNumber, boolean isFromMain) parseFileFromMain(InputStream in, String file, DynamicScope scope) parseFileFromMain(String file, InputStream in, DynamicScope scope) private NodeparseFileFromMainAndGetAST(InputStream in, String file, DynamicScope scope) parseFromMain(InputStream inputStream, String filename) Parse the script contained in the given input stream, using the given filename as the name of the script, and return the root Node.parseFromMain(String fileName, InputStream in) parseInline(InputStream in, String file, DynamicScope scope) private ScriptAndCodeprecompileCLI(RootNode scriptNode) voidprintError(Throwable ex) voidPrints an error with backtrace to the error stream.voidprintProfileData(ProfileCollection profileData) TDOD remove the synchronized.voidpushEndBlock(RubyProc proc) It is possible for looping or repeated execution to encounter the same END block multiple times.pushExitBlock(RubyProc proc) Push block onto exit stack.voidAdd an exit function to be run on runtime exit.voidpushPostExitFunction(Ruby.ExitFunction postExit) Add a post-termination exit function that should be run to shut down JRuby internal services.<T extends IRubyObject>
TrecursiveListOperation(Callable<T> body) Deprecated.voidregisterInspecting(Object obj) void(package private) voidreinitialize(boolean reinitCore) voidBy defaulttearDown(boolean)does not release the class-loader's resources as threads might be still running accessing the classes/packages even after the runtime has been torn down.voidremoveAllCallEventHooksFor(ThreadContext context) Remove all event hooks which are associated with a particular thread.voidremoveEventHook(EventHook hook) voidremoveFinalizer(Finalizable finalizer) voidremoveInternalFinalizer(Finalizable finalizer) voidDeprecated.voidDeprecated.voidrunFromMain(InputStream inputStream, String filename) Run the script contained in the specified input stream, using the specified filename as the name of the script being executed.runInterpreter(Node scriptNode) runInterpreter(ParseResult parseResult) runInterpreter(ThreadContext context, Node rootNode, IRubyObject self) runInterpreter(ThreadContext context, ParseResult parseResult, IRubyObject self) runInterpreterBody(Node scriptNode) This is used for the "gets" loop, and we bypass 'load' to use an already-prepared, already-pushed scope for the script body.runNormally(Node scriptNode) Run the specified script without any of the loop-processing wrapper code.runNormally(Node scriptNode, boolean wrap) Run the specified script without any of the loop-processing wrapper code.runNormally(Node scriptNode, IRubyObject self, boolean wrap) runScript(Script script, IRubyObject self, boolean wrap) runScriptBody(Script script) This is used for the "gets" loop, and we bypass 'load' to use an already-prepared, already-pushed scope for the script body.runWithGetsLoop(Node scriptNode, boolean printing, boolean processLineEnds, boolean split, boolean unused) Deprecated.runWithGetsLoop(RootNode scriptNode, boolean printing, boolean processLineEnds, boolean split) Run the given script with a "while gets; end" loop wrapped around it.<T> IRubyObjectsafeRecurse(Ruby.RecursiveFunctionEx<T> func, ThreadContext context, T state, IRubyObject obj, String name, boolean outer) Deprecated.Use ThreadContext.safeRecursesafeRecurse(Ruby.RecursiveFunction func, IRubyObject obj, String name, boolean outer) Deprecated.voidsecure(int level) Deprecated.voidsetAbortOnException(boolean abortOnException) voidsetArgsFile(IRubyObject argsFile) (package private) voidDeprecated.voidsetBaseNewMethod(DynamicMethod baseNewMethod) Set the base Class#new method.(package private) voidDeprecated.(package private) voidsetBinding(RubyClass bindingClass) Deprecated.(package private) voidsetComparable(RubyModule comparableModule) Deprecated.(package private) voidsetComplex(RubyClass complexClass) Deprecated.(package private) voidsetContinuation(RubyClass continuationClass) Deprecated.(package private) voidsetConverter(RubyClass converterClass) Deprecated.voidstatic voidsetCurrentInstance(Ruby runtime) Deprecated.voidsetCurrentLine(int line) voidsetDebug(IRubyObject debug) Setter for property isDebug.voidsetDefaultExternalEncoding(org.jcodings.Encoding defaultExternalEncoding) voidsetDefaultFilesystemEncoding(org.jcodings.Encoding defaultFilesystemEncoding) voidsetDefaultInternalEncoding(org.jcodings.Encoding defaultInternalEncoding) voidsetDefaultMethodMissing(DynamicMethod method, DynamicMethod moduleMethod) voidsetDefaultRand(RubyRandom.RandomType defaultRand) (package private) voidsetDefaultThreadGroup(RubyThreadGroup defaultThreadGroup) (package private) voidDeprecated.voidsetDoNotReverseLookupEnabled(boolean b) (package private) voidsetEncoding(RubyClass encodingClass) Deprecated.(package private) voidsetEnumerable(RubyModule enumerableModule) Deprecated.(package private) voidsetEnumerator(RubyClass enumeratorClass) Deprecated.voidvoidsetEtc(RubyModule etcModule) (package private) voidsetException(RubyClass exceptionClass) Deprecated.(package private) voidsetFalseClass(RubyClass falseClass) Deprecated.voidvoidDeprecated.(package private) voidDeprecated.(package private) voidsetFileStat(RubyClass fileStatClass) Deprecated.(package private) voidsetFileTest(RubyModule fileTestModule) Deprecated.(package private) voidDeprecated.(package private) voidDeprecated.(package private) voidsetGC(RubyModule gcModule) Deprecated.voidsetGenerator(RubyClass generatorClass) Deprecated.voidsetGlobalAbortOnExceptionEnabled(boolean enable) Deprecated.private static voidsetGlobalRuntimeFirstTimeOnly(Ruby runtime) Set the global runtime to the given runtime only if it has no been set.voidsetGlobalVariables(GlobalVariables globalVariables) Deprecated.voidsetGroupStruct(RubyClass groupStruct) (package private) voidDeprecated.(package private) voidsetInteger(RubyClass integerClass) Deprecated.(package private) voidDeprecated.voidsetJRubyHome(String home) void(package private) voidsetKernel(RubyModule kernelModule) Deprecated.voidsetLocation(RubyClass location) (package private) voidsetMarshal(RubyModule marshalModule) Deprecated.(package private) voidsetMatchData(RubyClass matchDataClass) Deprecated.(package private) voidsetMath(RubyModule mathModule) Deprecated.(package private) voidDeprecated.private voidDeprecated.(package private) voidsetNilClass(RubyClass nilClass) Deprecated.voidsetNormalMethodMissing(DynamicMethod method) (package private) voidsetNumeric(RubyClass numericClass) Deprecated.voidsetObjectSpaceEnabled(boolean objectSpaceEnabled) (package private) voidsetObjectSpaceModule(RubyModule objectSpaceModule) Deprecated.voidsetPasswdStruct(RubyClass passwdStruct) (package private) voidsetPrecision(RubyModule precisionModule) voidsetPrivateMethodMissing(DynamicMethod method) (package private) voidDeprecated.(package private) voidsetProcess(RubyModule processModule) Deprecated.(package private) voidsetProcGID(RubyModule procGIDModule) (package private) voidsetProcStatus(RubyClass procStatusClass) (package private) voidsetProcSys(RubyModule procSysModule) (package private) voidsetProcUID(RubyModule procUIDModule) void(package private) voidsetRandomClass(RubyClass randomClass) Deprecated.(package private) voidDeprecated.(package private) voidsetRational(RubyClass rationalClass) Deprecated.voidsetRecordSeparatorVar(GlobalVariable recordSeparatorVar) (package private) voidDeprecated.voidsetReportOnException(boolean enable) voidsetReportOnException(IRubyObject enable) voidvoidvoidsetRootFiber(IRubyObject fiber) Deprecated.voidsetSafeLevel(int safeLevel) Deprecated.static voidsetSecurityRestricted(boolean restricted) (package private) voidDeprecated.(package private) voidsetStructClass(RubyClass structClass) Deprecated.voidsetSuperMethodMissing(DynamicMethod method) (package private) voidDeprecated.(package private) voidDeprecated.(package private) voidsetThreadGroup(RubyClass threadGroupClass) Deprecated.static voidsetThreadLocalRuntime(Ruby ruby) Set the thread-local runtime to the given runtime.(package private) voidDeprecated.(package private) voidsetTmsStruct(RubyClass tmsStruct) voidsetTraceFunction(Ruby.CallTraceFuncHook hook, RubyProc traceFunction) voidsetTraceFunction(RubyProc traceFunction) (package private) voidsetTrueClass(RubyClass trueClass) Deprecated.(package private) voidsetUnboundMethod(RubyClass unboundMethodClass) Deprecated.private voidsetupSourceEncoding(ParserConfiguration parserConfig, org.jcodings.Encoding defaultEncoding) setupWrappedToplevel(IRubyObject self, StaticScope top) voidvoidsetVerbose(IRubyObject verbose) Setter for property isVerbose.voidsetWarning(RubyModule warningModule) Deprecated.(package private) voidsetYielder(RubyClass yielderClass) Deprecated.private voidsystemTeardown(ThreadContext context) voidtearDown()Make sure Kernel#at_exit procs getService invoked on runtime shutdown.voidtearDown(boolean systemExit) tryCompile(Node node) Try to compile the code associated with the given Node, returning an instance of the successfully-compiled Script or null if the script could not be compiled.private ScriptAndCodetryCompile(RootNode root, ClassDefiningClassLoader classLoader) private ScripttryScriptFromClass(String filename) voidvoidConvenience method for java integrators who may need to switch the notion of "global" runtime.private intuserTeardown(ThreadContext context) booleanprivate voidwrapWithModule(RubyBasicObject self, ParseResult result)
-
Field Details
-
LOG
The logger used to log relevant bits. -
NIL_PREFILLED_ARRAY_SIZE
public static final int NIL_PREFILLED_ARRAY_SIZE- See Also:
-
nilPrefilledArray
-
errnos
-
defaultRand
RubyRandom.RandomType defaultRand -
charsetMap
-
ROOT_FRAME_NAME
- See Also:
-
interest
-
callTraceFuncHook
-
ADDR_NOT_AVAIL_PATTERN
-
inspect
-
DEDUP_WRAPPER_CACHE
-
LEGACY_RECURSE
Deprecated. -
constantNameInvalidators
-
checkpointInvalidator
-
threadService
-
posix
private final jnr.posix.POSIX posix -
nativePosix
private jnr.posix.POSIX nativePosix -
objectSpace
-
symbolTable
-
EMPTY_HOOKS
-
eventHooks
-
hasEventHooks
private boolean hasEventHooks -
abortOnException
private boolean abortOnException -
reportOnException
private boolean reportOnException -
doNotReverseLookupEnabled
private boolean doNotReverseLookupEnabled -
objectSpaceEnabled
private volatile boolean objectSpaceEnabled -
siphashEnabled
private boolean siphashEnabled -
globalState
Deprecated. -
topSelf
-
nilObject
-
singleNilArray
-
trueObject
-
falseObject
-
fixnumCache
-
fixnumConstants
-
rootFiber
Deprecated. -
verbose
private boolean verbose -
warningsEnabled
private boolean warningsEnabled -
debug
private boolean debug -
verboseValue
-
defaultThreadGroup
-
basicObjectClass
All the core classes we keep hard references to. These are here largely so that if someone redefines String or Array we won't start blowing up creating strings and arrays internally. They also provide much faster access than going through normal hash lookup on the Object class. -
objectClass
-
moduleClass
-
classClass
-
nilClass
-
trueClass
-
falseClass
-
numericClass
-
floatClass
-
integerClass
-
fixnumClass
-
complexClass
-
rationalClass
-
enumeratorClass
-
yielderClass
-
fiberClass
-
generatorClass
-
chainClass
-
aseqClass
-
arrayClass
-
hashClass
-
rangeClass
-
stringClass
-
encodingClass
-
converterClass
-
symbolClass
-
procClass
-
bindingClass
-
methodClass
-
unboundMethodClass
-
matchDataClass
-
regexpClass
-
timeClass
-
bignumClass
-
dirClass
-
fileClass
-
fileStatClass
-
ioClass
-
threadClass
-
threadGroupClass
-
continuationClass
-
structClass
-
exceptionClass
-
dummyClass
-
randomClass
-
dataClass
-
mutexClass
-
conditionVariableClass
-
queueClass
-
closedQueueError
-
sizedQueueClass
-
tmsStruct
-
passwdStruct
-
groupStruct
-
procStatusClass
-
runtimeError
-
frozenError
-
ioError
-
scriptError
-
nameError
-
nameErrorMessage
-
noMethodError
-
signalException
-
rangeError
-
systemExit
-
localJumpError
-
nativeException
-
systemCallError
-
fatal
-
interrupt
-
typeError
-
argumentError
-
uncaughtThrowError
-
indexError
-
stopIteration
-
syntaxError
-
standardError
-
loadError
-
notImplementedError
-
securityError
-
noMemoryError
-
regexpError
-
eofError
-
threadError
-
concurrencyError
-
systemStackError
-
zeroDivisionError
-
floatDomainError
-
mathDomainError
-
encodingError
-
encodingCompatibilityError
-
converterNotFoundError
-
undefinedConversionError
-
invalidByteSequenceError
-
fiberError
-
keyError
-
locationClass
-
interruptedRegexpError
-
kernelModule
All the core modules we keep direct references to, for quick access and to ensure they remain available. -
comparableModule
-
enumerableModule
-
mathModule
-
marshalModule
-
fileTestModule
-
gcModule
-
objectSpaceModule
-
processModule
-
warningModule
-
etcModule
-
procUIDModule
-
procGIDModule
-
procSysModule
-
precisionModule
-
errnoModule
-
privateMethodMissing
-
protectedMethodMissing
-
variableMethodMissing
-
superMethodMissing
-
normalMethodMissing
-
defaultMethodMissing
-
defaultModuleMethodMissing
-
respondTo
-
respondToMissing
-
recordSeparatorVar
-
currentDirectory
-
currentLine
private volatile int currentLine -
argsFile
-
startTime
private final long startTime -
config
-
in
-
out
-
err
-
javaSupport
-
jrubyClassLoader
-
beanManager
-
parserStats
-
inlineStats
-
jitCompiler
-
caches
-
securityRestricted
private static volatile boolean securityRestricted -
parser
-
loadService
-
defaultInternalEncoding
private org.jcodings.Encoding defaultInternalEncoding -
defaultExternalEncoding
private org.jcodings.Encoding defaultExternalEncoding -
defaultFilesystemEncoding
private org.jcodings.Encoding defaultFilesystemEncoding -
encodingService
-
globalVariables
-
warnings
-
regexpWarnings
private final org.joni.WarnCallback regexpWarnings -
exitBlocks
Reserved for userland at_exit logic that runs before internal services start shutting down. -
postExitBlocks
Registry of shutdown operations that should happen after all user code has been run (e.g. at_exit hooks). -
profile
-
kcode
-
symbolLastId
-
moduleLastId
-
allModules
-
timeZoneCache
-
finalizers
A list of "external" finalizers (the ones, registered via ObjectSpace), weakly referenced, to be executed on tearDown. -
internalFinalizers
A list of JRuby-internal finalizers, weakly referenced, to be executed on tearDown. -
finalizersMutex
-
internalFinalizersMutex
-
executor
-
fiberExecutor
-
hierarchyLock
-
dynamicMethodSerial
-
moduleGeneration
-
boundMethods
-
selectorPool
-
runtimeCache
-
ERRNO_BACKTRACE_MESSAGE
- See Also:
-
STOPIERATION_BACKTRACE_MESSAGE
- See Also:
-
exceptionCount
-
backtraceCount
-
callerCount
-
warningCount
-
fixnumInvalidator
-
floatInvalidator
-
fixnumReopened
private boolean fixnumReopened -
floatReopened
private boolean floatReopened -
coreIsBooted
private final boolean coreIsBooted -
runtimeIsBooted
private final boolean runtimeIsBooted -
envObject
-
coverageData
-
globalRuntime
The "global" runtime. Set to the first runtime created, normally. -
threadLocalRuntime
The "thread local" runtime. Set to the global runtime if unset. -
random
The runtime-local random number generator. Uses SecureRandom if permissions allow. -
hashSeedK0
private final long hashSeedK0The runtime-local seed for hash randomization -
hashSeedK1
private final long hashSeedK1 -
staticScopeFactory
-
irManager
-
ffi
-
profilingServiceLookup
Used to find the ProfilingService implementation to use. If profiling is disabled it's null -
definedMessages
-
threadStatuses
-
DISABLED_OBJECTSPACE
-
ENABLED_OBJECTSPACE
-
objectSpacer
-
emptyFrozenArray
-
dedupMap
A map from Ruby string data to a pre-frozen global version of that string. Access must be synchronized. -
RUNTIME_NUMBER
-
runtimeNumber
private final int runtimeNumber -
configBean
-
runtimeBean
-
filenoUtil
-
interpreter
-
constant
A representation of this runtime as a JIT-optimizable constant. Used for e.g. invokedynamic binding of runtime accesses. -
baseNewMethod
The built-in Class#new method, so we can bind more directly to allocate and initialize. -
nullToNil
The nullToNil filter for this runtime. -
POPULATORS
-
sites
-
mriRecursionGuard
-
javaExtensionDefinitions
-
strptimeFormatCache
-
tzVar
-
-
Constructor Details
-
Ruby
Create and initialize a new JRuby runtime. The properties of the specified RubyInstanceConfig will be used to determine various JRuby runtime characteristics.- Parameters:
config- The configuration to use for the new instance- See Also:
-
-
Method Details
-
initProfiling
private void initProfiling() -
initBootLibraries
private void initBootLibraries() -
initKernelGsub
-
initObjectSpacer
-
initJRubyClassLoader
-
initDefaultEncodings
private void initDefaultEncodings() -
initDataClass
-
initRandom
-
registerMBeans
public void registerMBeans() -
reinitialize
void reinitialize(boolean reinitCore) -
newInstance
Returns a new instance of the JRuby runtime configured with defaults.- Returns:
- the JRuby runtime
- See Also:
-
newInstance
Returns a new instance of the JRuby runtime configured as specified.- Parameters:
config- The instance configuration- Returns:
- The JRuby runtime
- See Also:
-
loadRequiredLibraries
private void loadRequiredLibraries() -
newInstance
Returns a new instance of the JRuby runtime configured with the given input, output and error streams and otherwise default configuration (except where specified system properties alter defaults).- Parameters:
in- the custom input streamout- the custom output streamerr- the custom error stream- Returns:
- the JRuby runtime
- See Also:
-
isGlobalRuntimeReady
public static boolean isGlobalRuntimeReady()Tests whether globalRuntime has been instantiated or not. This method is used by singleton model of org.jruby.embed.ScriptingContainer to decide what RubyInstanceConfig should be used. When a global runtime is not there, RubyInstanceConfig of AbstractContextProvider will be used to enact configurations set by a user. When a global runtime is already instantiated, RubyInstanceConfig of the global runtime should be used in ScriptingContaiener.- Returns:
- true if a global runtime is instantiated, false for other.
-
setGlobalRuntimeFirstTimeOnly
Set the global runtime to the given runtime only if it has no been set.- Parameters:
runtime- the runtime to use for global runtime
-
getGlobalRuntime
Get the global runtime.- Returns:
- the global runtime
-
useAsGlobalRuntime
public void useAsGlobalRuntime()Convenience method for java integrators who may need to switch the notion of "global" runtime. Use JRuby.runtime.use_as_global_runtime from Ruby code to activate the current runtime as the global one. -
clearGlobalRuntime
public static void clearGlobalRuntime()Clear the global runtime. -
getThreadLocalRuntime
Get the thread-local runtime for the current thread, or null if unset.- Returns:
- the thread-local runtime, or null if unset
-
setThreadLocalRuntime
Set the thread-local runtime to the given runtime. Note that static threadlocals like this one can leak resources across (for example) application redeploys. If you use this, it is your responsibility to clean it up appropriately.- Parameters:
ruby- the new runtime for thread-local
-
evalScriptlet
Evaluates a script under the current scope (perhaps the top-level scope) and returns the result (generally the last value calculated). This version goes straight into the interpreter, bypassing compilation and runtime preparation typical to normal script runs.- Parameters:
script- The scriptlet to run
-
evalScriptlet
Evaluates a script under the current scope (perhaps the top-level scope) and returns the result (generally the last value calculated). This version goes straight into the interpreter, bypassing compilation and runtime preparation typical to normal script runs. This version accepts a scope to use, so you can eval many times against the same scope.- Parameters:
script- The scriptlet to runscope- The scope to execute against (ManyVarsDynamicScope is recommended, so it can grow as needed)
-
executeScript
Parse and execute the specified script This differs from the other methods in that it accepts a string-based script and parses and runs it as though it were loaded at a command-line. This is the preferred way to start up a new script when calling directly into the Ruby object (which is generally *dis*couraged.- Parameters:
script- The contents of the script to run as a normal, root script- Returns:
- The last value of the script
-
runFromMain
Run the script contained in the specified input stream, using the specified filename as the name of the script being executed. The stream will be read fully before being parsed and executed. The given filename will be used for the ruby $PROGRAM_NAME and $0 global variables in this runtime. This method is intended to be called once per runtime, generally from Main or from main-like top-level entry points. As part of executing the script loaded from the input stream, various RubyInstanceConfig properties will be used to determine whether to compile the script before execution or run with various wrappers (for looping, printing, and so on, see jruby -help).- Parameters:
inputStream- The InputStream from which to read the script contentsfilename- The filename to use when parsing, and for $PROGRAM_NAME and $0 ruby global variables.
-
tryScriptFromClass
-
parseFromMain
Parse the script contained in the given input stream, using the given filename as the name of the script, and return the root Node. This is used to verify that the script syntax is valid, for jruby -c. The current scope (generally the top-level scope) is used as the parent scope for parsing.- Parameters:
inputStream- The input stream from which to read the scriptfilename- The filename to use for parsing
-
parseFromMain
-
runWithGetsLoop
@Deprecated public IRubyObject runWithGetsLoop(Node scriptNode, boolean printing, boolean processLineEnds, boolean split, boolean unused) Deprecated.Run the given script with a "while gets; end" loop wrapped around it. This is primarily used for the -n command-line flag, to allow writing a short script that processes input lines using the specified code.- Parameters:
scriptNode- The root node of the script to executeprinting- Whether $_ should be printed after each loop (as in the -p command-line flag)processLineEnds- Whether line endings should be processed by setting $\ to $/ andchop!ing every line readsplit- Whether to split each line read usingString#splitbytecode before executing.- Returns:
- The result of executing the specified script
-
runWithGetsLoop
public IRubyObject runWithGetsLoop(RootNode scriptNode, boolean printing, boolean processLineEnds, boolean split) Run the given script with a "while gets; end" loop wrapped around it. This is primarily used for the -n command-line flag, to allow writing a short script that processes input lines using the specified code.- Parameters:
scriptNode- The root node of the script to executeprinting- Whether $_ should be printed after each loop (as in the -p command-line flag)processLineEnds- Whether line endings should be processed by setting $\ to $/ andchop!ing every line readsplit- Whether to split each line read usingString#splitbytecode before executing.- Returns:
- The result of executing the specified script
-
addGetsLoop
-
runNormally
Run the specified script without any of the loop-processing wrapper code.- Parameters:
scriptNode- The root node of the script to be executed bytecode before executionwrap- whether to wrap the execution in an anonymous module- Returns:
- The result of executing the script
-
runNormally
-
runNormally
Run the specified script without any of the loop-processing wrapper code.- Parameters:
scriptNode- The root node of the script to be executed bytecode before execution- Returns:
- The result of executing the script
-
precompileCLI
-
tryCompile
Try to compile the code associated with the given Node, returning an instance of the successfully-compiled Script or null if the script could not be compiled.- Parameters:
node- The node to attempt to compiled- Returns:
- an instance of the successfully-compiled Script, or null.
-
tryCompile
-
runScript
-
runScript
-
runScript
-
runScriptBody
This is used for the "gets" loop, and we bypass 'load' to use an already-prepared, already-pushed scope for the script body. -
runInterpreter
-
runInterpreter
-
runInterpreter
-
runInterpreter
-
runInterpreterBody
This is used for the "gets" loop, and we bypass 'load' to use an already-prepared, already-pushed scope for the script body. -
getParser
-
getBeanManager
-
getJITCompiler
-
getInlineStats
-
getCaches
Get the Caches management object.- Returns:
- the current runtime's Caches management object
-
getDefaultInstance
Deprecated.use #newInstance() -
getCurrentInstance
Deprecated. -
setCurrentInstance
Deprecated. -
allocSymbolId
public int allocSymbolId() -
allocModuleId
public int allocModuleId() -
addModule
-
eachModule
-
getModule
Retrieve the module with the given name from the Object namespace.- Parameters:
name- The name of the module- Returns:
- The module or null if not found
-
fastGetModule
Deprecated. -
getClass
Retrieve the class with the given name from the Object namespace.- Parameters:
name- The name of the class- Returns:
- The class
-
fastGetClass
Deprecated.Retrieve the class with the given name from the Object namespace. The module name must be an interned string, but this method will be faster than the non-interned version.- Parameters:
internedName- the name of the class; must be an interned String!- Returns:
-
defineClass
Define a new class under the Object namespace. Roughly equivalent to rb_define_class in MRI.- Parameters:
name- The name for the new classsuperClass- The super class for the new classallocator- An ObjectAllocator instance that can construct instances of the new class.- Returns:
- The new class
-
defineClass
public RubyClass defineClass(String name, RubyClass superClass, ObjectAllocator allocator, CallSite[] callSites) A variation of defineClass that allows passing in an array of supplementary call sites for improving dynamic invocation performance.- Parameters:
name- The name for the new classsuperClass- The super class for the new classallocator- An ObjectAllocator instance that can construct instances of the new class.- Returns:
- The new class
-
defineClassUnder
public RubyClass defineClassUnder(String name, RubyClass superClass, ObjectAllocator allocator, RubyModule parent) Define a new class with the given name under the given module or class namespace. Roughly equivalent to rb_define_class_under in MRI. If the name specified is already bound, its value will be returned if: * It is a class * No new superclass is being defined- Parameters:
name- The name for the new classsuperClass- The super class for the new classallocator- An ObjectAllocator instance that can construct instances of the new class.parent- The namespace under which to define the new class- Returns:
- The new class
-
defineClassUnder
public RubyClass defineClassUnder(String id, RubyClass superClass, ObjectAllocator allocator, RubyModule parent, CallSite[] callSites) A variation of defineClassUnder that allows passing in an array of supplementary call sites to improve dynamic invocation.- Parameters:
id- The name for the new class as an ISO-8859_1 String (id-value)superClass- The super class for the new classallocator- An ObjectAllocator instance that can construct instances of the new class.parent- The namespace under which to define the new classcallSites- The array of call sites to add- Returns:
- The new class
-
defineModule
Define a new module under the Object namespace. Roughly equivalent to rb_define_module in MRI.- Parameters:
name- The name of the new module
-
defineModuleUnder
Define a new module with the given name under the given module or class namespace. Roughly equivalent to rb_define_module_under in MRI.- Parameters:
name- The name of the new moduleparent- The class or module namespace under which to define the module
-
getOrCreateModule
From Object, retrieve the named module. If it doesn't exist a new module is created.- Parameters:
id- The name of the module
-
getKCode
-
setKCode
-
defineGlobalConstant
rb_define_global_const Define a constant on the global namespace (i.e. Object) with the given name and value.- Parameters:
name- the namevalue- the value
-
fetchGlobalConstant
Fetch a constant from the global namespace (i.e. Object) with the given name.- Parameters:
name- the name- Returns:
- the value
-
isClassDefined
-
loadJavaSupport
-
loadBundler
private void loadBundler() -
doesReflectionWork
private boolean doesReflectionWork() -
initDefinedMessages
private void initDefinedMessages() -
initThreadStatuses
private void initThreadStatuses() -
initContinuation
-
getNilPrefilledArray
-
initExceptions
private void initExceptions() -
ifAllowed
-
initNativeException
private void initNativeException() -
getErrno
-
initErrno
private void initErrno()Create module Errno's Variables. We have this method since Errno does not have its own java class. -
createSysErr
Creates a system error.- Parameters:
i- the error code (will probably use a java exception instead)name- of the error to define.
-
initJavaSupport
private void initJavaSupport()Load libraries expected to be present after a normal boot. This used to register lazy "builtins" that were shipped with JRuby but did not have a file on the filesystem to load via normal `require` logic. Because of how this interacted (badly) with require-hooking tools like bootsnap, we have moved to having all builtins as actual files rather than special virtual entries. -
initRubyKernel
private void initRubyKernel() -
initRubyPreludes
private void initRubyPreludes() -
getIRManager
-
getTopSelf
Getter for property rubyTopSelf.- Returns:
- Value of property rubyTopSelf.
-
setCurrentDirectory
-
getCurrentDirectory
-
setCurrentLine
public void setCurrentLine(int line) -
getCurrentLine
public int getCurrentLine() -
setArgsFile
-
getArgsFile
-
getEtc
-
setEtc
-
getObject
-
getBasicObject
-
getModule
-
getClassClass
-
getKernel
-
getPrivateMethodMissing
-
setPrivateMethodMissing
-
getProtectedMethodMissing
-
setProtectedMethodMissing
-
getVariableMethodMissing
-
setVariableMethodMissing
-
getSuperMethodMissing
-
setSuperMethodMissing
-
getNormalMethodMissing
-
setNormalMethodMissing
-
getDefaultMethodMissing
-
isDefaultMethodMissing
-
setDefaultMethodMissing
-
getRespondToMethod
-
setRespondToMethod
-
getRespondToMissingMethod
-
setRespondToMissingMethod
-
getDummy
-
getComparable
-
getNumeric
-
getFloat
-
getInteger
-
getFixnum
-
getComplex
-
getRational
-
getEnumerable
-
getEnumerator
-
getYielder
-
getGenerator
-
getChain
-
getArithmeticSequence
-
getFiber
-
getString
-
getEncoding
-
getConverter
-
getSymbol
-
getArray
-
getHash
-
getRange
-
getTrue
Returns the "true" instance from the instance pool.- Returns:
- The "true" instance.
-
getFalse
Returns the "false" instance from the instance pool.- Returns:
- The "false" instance.
-
getNil
Returns the "nil" singleton instance.- Returns:
- "nil"
-
getSingleNilArray
-
getNilClass
-
getTrueClass
-
getFalseClass
-
getProc
-
getBinding
-
getMethod
-
getUnboundMethod
-
getMatchData
-
getRegexp
-
getTime
-
getMath
-
getMarshal
-
getBignum
-
getDir
-
getFile
-
getFileStat
-
getFileTest
-
getIO
-
getThread
-
getThreadGroup
-
getDefaultThreadGroup
-
setDefaultThreadGroup
-
getContinuation
-
getStructClass
-
getRandomClass
-
getTmsStruct
-
setTmsStruct
-
getPasswdStruct
-
setPasswdStruct
-
getGroupStruct
-
setGroupStruct
-
getGC
-
getObjectSpaceModule
-
getProcess
-
getProcStatus
-
setProcStatus
-
getProcUID
-
setProcUID
-
getProcGID
-
setProcGID
-
getProcSysModule
-
setProcSys
-
getPrecision
-
setPrecision
-
getENV
-
setENV
-
getLocation
-
setLocation
-
getMutex
-
getConditionVariable
-
getQueue
-
getClosedQueueError
-
getSizedQueueClass
-
getWarning
-
getErrno
-
getException
-
getNameError
-
getNameErrorMessage
-
getNoMethodError
-
getSignalException
-
getRangeError
-
getSystemExit
-
getLocalJumpError
-
getNativeException
-
getSystemCallError
-
getKeyError
-
getFatal
-
getInterrupt
-
getTypeError
-
getArgumentError
-
getUncaughtThrowError
-
getIndexError
-
getStopIteration
-
getSyntaxError
-
getStandardError
-
getRuntimeError
-
getFrozenError
-
getIOError
-
getLoadError
-
getNotImplementedError
-
getSecurityError
-
getNoMemoryError
-
getRegexpError
-
getInterruptedRegexpError
-
getEOFError
-
getThreadError
-
getConcurrencyError
-
getSystemStackError
-
getZeroDivisionError
-
getFloatDomainError
-
getMathDomainError
-
getEncodingError
-
getEncodingCompatibilityError
-
getConverterNotFoundError
-
getFiberError
-
getUndefinedConversionError
-
getInvalidByteSequenceError
-
getDefaultRand
Deprecated.internal API, to be hidden -
setDefaultRand
-
getCharsetMap
Deprecated. -
getVerbose
Getter for property isVerbose.- Returns:
- Value of property isVerbose.
-
isVerbose
public boolean isVerbose() -
warningsEnabled
public boolean warningsEnabled() -
setVerbose
Setter for property isVerbose.- Parameters:
verbose- New value of property isVerbose.
-
getDebug
Getter for property isDebug.- Returns:
- Value of property isDebug.
-
isDebug
public boolean isDebug() -
setDebug
Setter for property isDebug.- Parameters:
debug- New value of property isDebug.
-
getJavaSupport
-
getClassLoader
-
getJRubyClassLoader
-
defineVariable
Defines a global variable -
defineReadonlyVariable
defines a readonly global variable -
parseFile
-
parseFile
-
parseFile
-
parseFile
-
parseFileFromMain
-
parseFileFromMain
-
parseFileFromMainAndGetAST
-
parseFileAndGetAST
private Node parseFileAndGetAST(InputStream in, String file, DynamicScope scope, int lineNumber, boolean isFromMain) -
parseInline
-
setupSourceEncoding
private void setupSourceEncoding(ParserConfiguration parserConfig, org.jcodings.Encoding defaultEncoding) -
parseEval
-
encodeToBytes
-
parse
@Deprecated public Node parse(String content, String file, DynamicScope scope, int lineNumber, boolean extraPositionInformation) Deprecated. -
parseEval
-
parse
public Node parse(ByteList content, String file, DynamicScope scope, int lineNumber, boolean extraPositionInformation) -
getThreadService
-
getCurrentContext
-
getLoadService
Returns the loadService.- Returns:
- ILoadService
-
getDefaultInternalEncoding
public org.jcodings.Encoding getDefaultInternalEncoding()This is an internal encoding if actually specified via default_internal= or passed in via -E.- Returns:
- null or encoding
-
setDefaultInternalEncoding
public void setDefaultInternalEncoding(org.jcodings.Encoding defaultInternalEncoding) -
getDefaultExternalEncoding
public org.jcodings.Encoding getDefaultExternalEncoding() -
setDefaultExternalEncoding
public void setDefaultExternalEncoding(org.jcodings.Encoding defaultExternalEncoding) -
getDefaultFilesystemEncoding
public org.jcodings.Encoding getDefaultFilesystemEncoding() -
setDefaultFilesystemEncoding
public void setDefaultFilesystemEncoding(org.jcodings.Encoding defaultFilesystemEncoding) -
getDefaultCharset
Get the default java.nio.charset.Charset for the current default internal encoding. -
getDefaultEncoding
public org.jcodings.Encoding getDefaultEncoding()Return the default internal encoding, if set, or UTF-8 by default.- Returns:
- the default encoding used for new Ruby strings
-
getEncodingService
-
getWarnings
-
getRegexpWarnings
org.joni.WarnCallback getRegexpWarnings() -
getErrorStream
-
getInputStream
-
getOutputStream
-
getClassFromPath
-
getClassFromPath
public RubyModule getClassFromPath(String path, RubyClass undefinedExceptionClass, boolean flexibleSearch) Find module from a string (e.g. Foo, Foo::Bar::Car).- Parameters:
path- the path to be searched.undefinedExceptionClass- exception type to be thrown when it cannot be found.flexibleSearch- use getConstant vs getConstantAt (former will find inherited constants from parents and fire const_missing).- Returns:
- the module or null when flexible search is false and a constant cannot be found.
-
printError
Prints an error with backtrace to the error stream. MRI: eval.c - error_print() -
printError
-
loadFile
-
loadScope
-
compileAndLoadFile
-
setupWrappedToplevel
-
wrapWithModule
-
loadScript
-
loadScript
-
loadExtension
Load the given BasicLibraryService instance, wrapping it in Ruby framing to ensure it is isolated from any parent scope.- Parameters:
extName- The name of the extension, to go on the frame wrapping itextension- The extension object to loadwrap- Whether to use a new "self" for toplevel
-
addBoundMethod
-
addBoundMethods
-
addBoundMethods
-
addBoundMethodsPacked
Deprecated. -
addSimpleBoundMethodsPacked
Deprecated. -
getBoundMethods
-
addEventHook
-
removeEventHook
-
setTraceFunction
-
setTraceFunction
-
removeAllCallEventHooksFor
Remove all event hooks which are associated with a particular thread.- Parameters:
context- the context of the ruby thread we are interested in.
-
callEventHooks
public void callEventHooks(ThreadContext context, RubyEvent event, String file, int line, String name, IRubyObject type) -
hasEventHooks
public boolean hasEventHooks() -
getGlobalVariables
-
setGlobalVariables
Deprecated. -
pushExitFunction
Add an exit function to be run on runtime exit. Functions are run in FILO order.- Parameters:
func- the function to be run
-
pushExitBlock
Push block onto exit stack. When runtime environment exits these blocks will be evaluated.- Returns:
- the element that was pushed onto stack
-
pushPostExitFunction
Add a post-termination exit function that should be run to shut down JRuby internal services. This will be run toward the end of teardown, after all user code has finished executing (e.g. at_exit hooks and user-defined finalizers). The exit functions registered here are run in FILO order.- Parameters:
postExit- theRuby.ExitFunctionto run after user exit hooks have completed
-
pushEndBlock
It is possible for looping or repeated execution to encounter the same END block multiple times. Rather than store extra runtime state we will just make sure it is not already registered. at_exit by contrast can push the same block many times (and should use pushExitBlock). -
alreadyRegisteredEndBlock
-
addInternalFinalizer
-
addFinalizer
-
removeInternalFinalizer
-
removeFinalizer
-
tearDown
public void tearDown()Make sure Kernel#at_exit procs getService invoked on runtime shutdown. This method needs to be explicitly called to work properly. I thought about using finalize(), but that did not work and I am not sure the runtime will be at a state to run procs by the time Ruby is going away. This method can contain any other things that need to be cleaned up at shutdown. -
tearDown
public void tearDown(boolean systemExit) -
systemTeardown
-
userTeardown
-
releaseClassLoader
public void releaseClassLoader()By defaulttearDown(boolean)does not release the class-loader's resources as threads might be still running accessing the classes/packages even after the runtime has been torn down. This method exists to handle such cases, e.g. with embedded uses we always release the runtime loader but not otherwise - you should do that manually. -
printProfileData
TDOD remove the synchronized. Synchronization should be a implementation detail of the ProfilingService.- Parameters:
profileData-
-
getProfilingServiceLookup
Simple getter for #profilingServiceLookup to avoid direct property access- Returns:
- #profilingServiceLookup
-
getProfilingService
- Returns:
- the, for this ruby instance, configured implementation of ProfilingService, or null
-
newEmptyArray
-
newArray
-
newArrayLight
-
newArray
-
newArray
-
newArray
-
newArrayNoCopy
-
newArrayNoCopyLight
-
newArray
-
newArray
-
getEmptyFrozenArray
-
newBoolean
-
newFileStat
-
newFileStat
-
newFixnum
-
newFixnum
-
newFixnum
-
newFloat
-
newNumeric
-
newRational
-
newRationalReduced
-
newProc
-
newBlockPassProc
-
newBinding
-
newBinding
-
newString
-
newString
-
newDeduplicatedString
-
newString
-
newSymbol
-
newSymbol
-
newSymbol
-
fastNewSymbol
Faster thannewSymbol(String)if you already have an interned name String. Don't intern your string just to call this version - the overhead of interning will more than wipe out any benefit from the faster lookup.- Parameters:
internedName- the symbol name, must be interned! if in doubt, callnewSymbol(String)instead.- Returns:
- the symbol for name
-
newTime
-
newRuntimeError
-
newArgumentError
-
newArgumentError
-
newArgumentError
-
newArgumentError
-
newArgumentError
-
newErrnoEBADFError
-
newErrnoEISCONNError
-
newErrnoEINPROGRESSError
-
newErrnoEINPROGRESSWritableError
-
newErrnoENOPROTOOPTError
-
newErrnoEPIPEError
-
newErrnoECONNABORTEDError
-
newErrnoECONNREFUSEDError
-
newErrnoECONNREFUSEDError
-
newErrnoECONNRESETError
-
newErrnoEADDRINUSEError
-
newErrnoEADDRINUSEError
-
newErrnoEHOSTUNREACHError
-
newErrnoEINVALError
-
newErrnoELOOPError
-
newErrnoEMFILEError
-
newErrnoENFILEError
-
newErrnoENOENTError
-
newErrnoEACCESError
-
newErrnoEAGAINError
-
newErrnoEAGAINReadableError
-
newErrnoEAGAINWritableError
-
newErrnoEISDirError
-
newErrnoEPERMError
-
newErrnoEISDirError
-
newErrnoESPIPEError
-
newErrnoEBADFError
-
newErrnoEINPROGRESSError
-
newErrnoEINPROGRESSWritableError
-
newErrnoEISCONNError
-
newErrnoEINVALError
-
newErrnoENOTDIRError
-
newErrnoENOTEMPTYError
-
newErrnoENOTSOCKError
-
newErrnoENOTCONNError
-
newErrnoENOTCONNError
-
newErrnoENOENTError
-
newErrnoEOPNOTSUPPError
-
newErrnoESPIPEError
-
newErrnoEEXISTError
-
newErrnoEDOMError
-
newErrnoECHILDError
-
newErrnoEADDRNOTAVAILError
-
newErrnoESRCHError
-
newErrnoEWOULDBLOCKError
-
newErrnoEDESTADDRREQError
-
newErrnoENETUNREACHError
-
newErrnoEMSGSIZEError
-
newErrnoEXDEVError
-
newIndexError
-
newSecurityError
-
newSystemCallError
-
newKeyError
-
newErrnoEINTRError
-
newErrnoEAFNOSUPPORTError
-
newErrnoFromLastPOSIXErrno
-
newErrnoFromInt
-
newErrnoFromInt
-
newErrnoFromErrno
-
newErrnoFromInt
-
newErrnoFromBindException
-
newErrnoEADDRFromBindException
-
newTypeError
-
newThreadError
-
newConcurrencyError
-
newSyntaxError
-
newRegexpError
-
newInterruptedRegexpError
-
newRangeError
-
newNotImplementedError
-
newInvalidEncoding
Deprecated. -
newIllegalSequence
Deprecated. -
newNameError
-
newNameError
public RaiseException newNameError(String message, IRubyObject recv, IRubyObject name, boolean privateCall) Construct a NameError that formats its message with an sprintf format string. The arguments given to sprintf are as follows: 0: the name that failed 1: the receiver object that failed 2: a ":" character for non-singleton recv, blank otherwise 3: the name of the a non-singleton recv's class, blank if recv is a singleton Passing a string with no format characters will warn in verbose mode and error in debug mode. See jruby/jruby#3934.- Parameters:
message- an sprintf format string for the messagerecv- the receiver objectname- the name that failedprivateCall- whether the failure was due to method visibility- Returns:
- a new NameError
-
newNameError
Construct a NameError that formats its message with an sprintf format string. This version just accepts a java.lang.String for the name. -
newNameError
public RaiseException newNameError(String message, IRubyObject recv, String name, boolean privateCall) Construct a NameError that formats its message with an sprintf format string and has private_call? set to given. This version just accepts a java.lang.String for the name. -
newNameError
public RaiseException newNameError(String message, String name, Throwable exception, boolean printWhenVerbose) Construct a NameError with the given pre-formatted message, name, and optional original exception. If the original exception is given, and either we are in verbose mode with printWhenVerbose set to true or we are in debug mode.- Parameters:
message- the pre-formatted message for the NameErrorname- the name that failedexception- the original exception, or nullprintWhenVerbose- whether to log this exception when verbose mode is enabled- Returns:
- a new NameError
-
newNameError
public RaiseException newNameError(String message, IRubyObject name, Throwable exception, boolean printWhenVerbose) -
newNameError
Construct a NameError with a pre-formatted message and name. This is the same as callingnewNameError(String, String, Throwable)with a null originating exception.- Parameters:
message- the pre-formatted message for the errorname- the name that failed- Returns:
- a new NameError
-
newNameError
-
newNameError
Construct a NameError with an optional originating exception and a pre-formatted message. This is the same as callingnewNameError(String, String, Throwable, boolean)with a null originating exception and false for verbose-mode logging.- Parameters:
message- a formatted string message for the errorname- the name that failedorigException- the original exception, or null if none- Returns:
- a new NameError
-
newNoMethodError
public RaiseException newNoMethodError(String message, IRubyObject recv, String name, RubyArray args) -
newNoMethodError
public RaiseException newNoMethodError(String message, IRubyObject recv, String name, RubyArray args, boolean privateCall) Construct a NoMethodError that formats its message with an sprintf format string. This works likenewNameError(String, IRubyObject, IRubyObject)but accepts a java.lang.String for name and a RubyArray of the original call arguments.- Returns:
- a new NoMethodError
- See Also:
-
newNoMethodError
Construct a NoMethodError with a pre-formatted message.- Parameters:
message- the pre-formatted messagename- the name that failedargs- the original arguments to the call that failed- Returns:
- a new NoMethodError
-
newLocalJumpError
public RaiseException newLocalJumpError(RubyLocalJumpError.Reason reason, IRubyObject exitValue, String message) -
newLocalJumpErrorNoBlock
-
newRedoLocalJumpError
-
newLoadError
-
newLoadError
-
newFrozenError
-
newFrozenError
-
newFrozenError
-
newSystemStackError
-
newSystemStackError
-
newSystemExit
-
newSystemExit
-
newIOError
-
newStandardError
-
newIOErrorFromException
Java does not give us enough information for specific error conditions so we are reduced to divining them through string matches... TODO: Should ECONNABORTED get thrown earlier in the descriptor itself or is it ok to handle this late? TODO: Should we include this into Errno code somewhere do we can use this from other places as well? -
newTypeError
-
newTypeError
-
newTypeError
-
newEOFError
-
newEOFError
-
newZeroDivisionError
-
newFloatDomainError
-
newMathDomainError
-
newEncodingError
-
newEncodingCompatibilityError
-
newConverterNotFoundError
-
newFiberError
-
newUndefinedConversionError
-
newInvalidByteSequenceError
-
newRaiseException
Construct a new RaiseException wrapping a new Ruby exception object appropriate to the given exception class. There are additional forms of this construction logic inRaiseException.from(org.jruby.Ruby, org.jruby.RubyClass, java.lang.String).- Parameters:
exceptionClass- the exception class from which to construct the exception objectmessage- a simple message for the exception- Returns:
- a new RaiseException wrapping a new Ruby exception
- See Also:
-
newLightweightErrnoException
Generate one of the ERRNO exceptions. This differs from the normal logic by avoiding the generation of a backtrace. Many ERRNO values are expected, such as EAGAIN, and JRuby pays a very high cost to generate backtraces that are never used. The flags -Xerrno.backtrace=true or the property jruby.errno.backtrace=true forces all errno exceptions to generate a backtrace.- Parameters:
exceptionClass-message-- Returns:
-
newStopIteration
Generate a StopIteration exception. This differs from the normal logic by avoiding the generation of a backtrace. StopIteration is used by Enumerator to end an external iteration, and so generating a full backtrace is usually unreasonable overhead. The flag -Xstop_iteration.backtrace=true or the property jruby.stop_iteration.backtrace=true forces all StopIteration exceptions to generate a backtrace.- Parameters:
message- the message for the exception
-
newLightweightStopIterationError
Deprecated. -
disabledBacktrace
-
newData
-
getSymbolTable
-
getObjectSpace
-
getIn
-
getOut
-
getErr
-
isAbortOnException
public boolean isAbortOnException() -
setAbortOnException
public void setAbortOnException(boolean abortOnException) -
isGlobalAbortOnExceptionEnabled
Deprecated. -
setGlobalAbortOnExceptionEnabled
Deprecated. -
getReportOnException
Deprecated. -
isReportOnException
public boolean isReportOnException() -
setReportOnException
-
setReportOnException
public void setReportOnException(boolean enable) -
isDoNotReverseLookupEnabled
public boolean isDoNotReverseLookupEnabled() -
setDoNotReverseLookupEnabled
public void setDoNotReverseLookupEnabled(boolean b) -
registerInspecting
-
isInspecting
-
unregisterInspecting
-
isObjectSpaceEnabled
public boolean isObjectSpaceEnabled() -
setObjectSpaceEnabled
public void setObjectSpaceEnabled(boolean objectSpaceEnabled) -
isSiphashEnabled
public boolean isSiphashEnabled() -
getStartTime
public long getStartTime() -
getProfile
-
getJRubyHome
-
setJRubyHome
-
getInstanceConfig
-
is2_0
Deprecated. -
getGlobalState
Deprecated.GET_VM_STATE_VERSION -
incGlobalState
Deprecated.INC_VM_STATE_VERSION -
isSecurityRestricted
public static boolean isSecurityRestricted() -
setSecurityRestricted
public static void setSecurityRestricted(boolean restricted) -
getPosix
public jnr.posix.POSIX getPosix() -
getNativePosix
public jnr.posix.POSIX getNativePosix()Get the native POSIX associated with this runtime. If native is not supported, this will return null.- Returns:
- a native POSIX, or null if native is not supported
-
setRecordSeparatorVar
-
getRecordSeparatorVar
-
getExecutor
-
getFiberExecutor
-
getTimezoneCache
-
getConstantGeneration
Deprecated. -
getConstantInvalidator
-
addConstantInvalidator
-
getCheckpointInvalidator
-
loadConstantSet
public <C extends Enum<C> & jnr.constants.Constant> void loadConstantSet(RubyModule module, Class<C> enumClass) Define all constants from the given jnr-constants enum which are defined on the current platform.- Type Parameters:
C- the enum type, which must implementConstant.- Parameters:
module- the module in which we want to define the constantsenumClass- the enum class of the constants to define
-
loadConstantSet
Define all constants from the named jnr-constants set which are defined on the current platform.- Parameters:
module- the module in which we want to define the constantsconstantSetName- the name of the constant set from which to get the constants
-
getNextDynamicMethodSerial
public long getNextDynamicMethodSerial()Get a new serial number for a new DynamicMethod instance- Returns:
- a new serial number
-
getNextModuleGeneration
public int getNextModuleGeneration()Get a new generation number for a module or class.- Returns:
- a new generation number
-
getHierarchyLock
Get the global object used to synchronize class-hierarchy modifications like cache invalidation, subclass sets, and included hierarchy sets.- Returns:
- The object to use for locking when modifying the hierarchy
-
getSelectorPool
Get the runtime-global selector pool- Returns:
- a SelectorPool from which to getService Selector instances
-
getRuntimeCache
Get the core class RuntimeCache instance, for doing dynamic calls from core class methods. -
getCachedStrptimePattern
-
addProfiledMethod
Add a method, so it can be printed out later.- Parameters:
id- raw name String of the method to be profiledmethod-
-
incrementExceptionCount
public void incrementExceptionCount()Increment the count of exceptions generated by code in this runtime. -
getExceptionCount
public int getExceptionCount()Get the current exception count.- Returns:
- he current exception count
-
incrementBacktraceCount
public void incrementBacktraceCount()Increment the count of backtraces generated by code in this runtime. -
getBacktraceCount
public int getBacktraceCount()Get the current backtrace count.- Returns:
- the current backtrace count
-
incrementWarningCount
public void incrementWarningCount()Increment the count of backtraces generated for warnings in this runtime. -
getWarningCount
public int getWarningCount()Get the current backtrace count.- Returns:
- the current backtrace count
-
incrementCallerCount
public void incrementCallerCount()Increment the count of backtraces generated by code in this runtime. -
getCallerCount
public int getCallerCount()Get the current backtrace count.- Returns:
- the current backtrace count
-
reopenFixnum
Deprecated.Mark Fixnum as reopened -
getFixnumInvalidator
Deprecated.Retrieve the invalidator for Fixnum reopening -
isFixnumReopened
Deprecated.Whether the Float class has been reopened and modified -
reopenFloat
Deprecated.Mark Float as reopened -
getFloatInvalidator
Deprecated.Retrieve the invalidator for Float reopening -
isFloatReopened
Deprecated.Whether the Float class has been reopened and modified -
isBootingCore
public boolean isBootingCore() -
isBooting
public boolean isBooting() -
getCoverageData
-
getRandom
Deprecated.internal API, to be removed -
getHashSeedK0
public long getHashSeedK0() -
getHashSeedK1
public long getHashSeedK1() -
getStaticScopeFactory
-
getFFI
-
setFFI
-
getDefinedMessage
-
getThreadStatus
-
freezeAndDedupString
Given a Ruby string, cache a frozen, duplicated copy of it, or find an existing copy already prepared. This is used to reduce in-memory duplication of pre-frozen or known-frozen strings. Note that this cache does some sync against the Ruby instance. This could cause contention under heavy concurrent load, so a reexamination of this design might be warranted. Because RubyString.equals does not consider encoding, and MRI's logic for deduplication does need to consider encoding, we use a wrapper object as the key. These wrappers need to be used on all get operations, so if we don't need to insert anything we reuse that wrapper the next time. The logic here reads like this: 1. If the string is not a natural String object, just freeze and return it. 2. Use the wrapper from the thread-local cache or create and set a new one. 3. Use the wrapper to look up the deduplicated string. 4. If there's a dedup in the cache, clear the wrapper for next time and return the dedup. 5. Remove the wrapper from the threadlocal to avoid reusing it, since we'll insert it. 6. Atomically set the new entry or repair the GCed entry that already exists. 7. Return the newly-deduplicated string.- Parameters:
string- the string to freeze-dup if an equivalent does not already exist- Returns:
- the freeze-duped version of the string
-
getRuntimeNumber
public int getRuntimeNumber() -
constant
- Specified by:
constantin interfaceConstantizable- See Also:
-
setBaseNewMethod
Set the base Class#new method.- Parameters:
baseNewMethod-
-
getBaseNewMethod
Get the base Class#new method.- Returns:
- the base Class#new method
-
getNullToNilHandle
Get the "nullToNil" method handle filter for this runtime.- Returns:
- a method handle suitable for filtering a single IRubyObject value from null to nil
-
addLoadParseToStats
private void addLoadParseToStats() -
addEvalParseToStats
private void addEvalParseToStats() -
getFilenoUtil
-
getData
-
getJavaExtensionDefinitions
- Returns:
- Class -> extension initializer map
-
getSafeLevel
Deprecated. -
setSafeLevel
Deprecated. -
checkSafeString
Deprecated. -
secure
Deprecated. -
newNameErrorObject
Deprecated. -
is1_8
Deprecated. -
is1_9
Deprecated. -
safeRecurse
@Deprecated public IRubyObject safeRecurse(Ruby.RecursiveFunction func, IRubyObject obj, String name, boolean outer) Deprecated. -
getProfiledMethods
Deprecated. -
safeRecurse
@Deprecated public <T> IRubyObject safeRecurse(Ruby.RecursiveFunctionEx<T> func, ThreadContext context, T state, IRubyObject obj, String name, boolean outer) Deprecated.Use ThreadContext.safeRecurse -
execRecursive
Deprecated.Perform a recursive walk on the given object using the given function. Do not call this method directly unless you know you're within a call torecursiveListOperation, which will ensure the thread-local recursion tracking data structs are cleared. MRI: rb_exec_recursive Calls func(obj, arg, recursive), where recursive is non-zero if the current method is called recursively on obj- Parameters:
func-obj-- Returns:
-
execRecursiveOuter
Deprecated.Use ThreadContext.safeRecurse.Perform a recursive walk on the given object using the given function. Treat this as the outermost call, cleaning up recursive structures. MRI: rb_exec_recursive_outer If recursion is detected on the current method and obj, the outermost func will be called with (obj, arg, Qtrue). All inner func will be short-circuited using throw.- Parameters:
func-obj-- Returns:
-
recursiveListOperation
Deprecated.Begin a recursive walk that may make one or more calls toexecRecursive. Clean up recursive structures once complete.- Type Parameters:
T-- Parameters:
body-- Returns:
-
oldRecursionGuard
Deprecated. -
getRootFiber
Deprecated. -
setRootFiber
Deprecated. -
setKernel
Deprecated. -
setComparable
Deprecated. -
setNumeric
Deprecated. -
setFloat
Deprecated. -
setInteger
Deprecated. -
setFixnum
Deprecated. -
setComplex
Deprecated. -
setRational
Deprecated. -
setEnumerable
Deprecated. -
setEnumerator
Deprecated. -
setYielder
Deprecated. -
setGenerator
Deprecated. -
setFiber
Deprecated. -
setString
Deprecated. -
setEncoding
Deprecated. -
setConverter
Deprecated. -
setSymbol
Deprecated. -
setArray
Deprecated. -
setHash
Deprecated. -
setRange
Deprecated. -
setNilClass
Deprecated. -
setTrueClass
Deprecated. -
setFalseClass
Deprecated. -
setProc
Deprecated. -
setBinding
Deprecated. -
setMethod
Deprecated. -
setUnboundMethod
Deprecated. -
setMatchData
Deprecated. -
setRegexp
Deprecated. -
setTime
Deprecated. -
setMath
Deprecated. -
setMarshal
Deprecated. -
setBignum
Deprecated. -
setDir
Deprecated. -
setFile
Deprecated. -
setFileStat
Deprecated. -
setFileTest
Deprecated. -
setIO
Deprecated. -
setThread
Deprecated. -
setThreadGroup
Deprecated. -
setContinuation
Deprecated. -
setStructClass
Deprecated. -
setRandomClass
Deprecated. -
setGC
Deprecated. -
setObjectSpaceModule
Deprecated. -
setProcess
Deprecated. -
setWarning
Deprecated. -
setException
Deprecated. -
addToObjectSpace
-
setNetworkStack
Deprecated. -
deprecatedNetworkStackProperty
private void deprecatedNetworkStackProperty() -
newErrnoEADDRFromBindException
Deprecated.
-