Package org.jruby.ast.executable
Class RuntimeCache
java.lang.Object
org.jruby.ast.executable.RuntimeCache
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intByteList[]CallSite[]private static final intprivate static final BigInteger[]private static final ByteList[]private static final CacheEntry[]private static final CallSite[]private static final org.jcodings.Encoding[]private static final RubyFixnum[]private static final RubyFloat[]private static final RubyRegexp[]private static final RubySymbol[]private static final StaticScope[]private static final RubyString[]private static final VariableAccessor[]private static final intorg.jcodings.Encoding[]private static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate CacheEntrycacheAndGet(ThreadContext context, RubyClass selfType, int index, String methodName) final RubyRegexpcacheRegexp(int index, RubyRegexp regexp) final RubyRegexpcacheRegexp(int index, RubyString pattern, int options) final BigIntegergetBigInteger(int index, String pattern) final ByteListgetByteList(int index) private CacheEntrygetCacheEntry(int index) final CallSitegetCallSite(int index) final IRubyObjectgetConstant(ThreadContext context, StaticScope scope, String name, int index) final IRubyObjectgetConstantDefined(ThreadContext context, StaticScope scope, String name, int index) final IRubyObjectgetConstantFrom(RubyModule target, ThreadContext context, String name, int index) private static intgetDescriptorValue(String descriptor, int type) final org.jcodings.EncodinggetEncoding(int index) final RubyFixnumgetFixnum(ThreadContext context, int index, int value) final RubyFixnumgetFixnum(ThreadContext context, int index, long value) final RubyFloatgetFloat(ThreadContext context, int index, double value) final RubyStringgetFrozenString(ThreadContext context, int bytelistIndex, int stringIndex, int codeRange) getMethod(ThreadContext context, RubyClass selfType, int index, String methodName) getMethod(ThreadContext context, IRubyObject self, int index, String methodName) getMethodEntry(ThreadContext context, RubyClass selfType, int index, String methodName) final RubyRegexpgetRegexp(int index) final RubyRegexpgetRegexp(ThreadContext context, int index, ByteList pattern, int options) final StaticScopegetScope(int index) final StaticScopegetScope(ThreadContext context, StaticScope parent, String varNamesDescriptor, int index) final RubyStringgetString(ThreadContext context, int index, int codeRange) final RubySymbolgetSymbol(ThreadContext context, int index, String name, String encodingName) private final IRubyObjectgetValue(ThreadContext context, int index, String name, IRubyObject object) getValue(ThreadContext context, StaticScope scope, String name, int index) getValueFrom(RubyModule target, ThreadContext context, String name, int index) final IRubyObjectgetVariable(ThreadContext context, int index, String name, IRubyObject object) final IRubyObjectgetVariableDefined(ThreadContext context, int index, String name, IRubyObject object) final voidinitBigIntegers(int size) final voidinitCallSites(int size) final voidinitConstants(int size) final org.jcodings.Encoding[]initEncodings(int size) final voidinitFixnums(int size) final voidinitFloats(int size) final voidinitFromDescriptor(String descriptor) Given a packed descriptor listing methods and their type, populate the call site cache.final RubyString[]initFrozenStrings(int size) final voidinitMethodCache(int size) final voidinitOthers(String descriptor) Given a packed descriptor of other cache sizes, construct the cache arrays The format of the descriptor is the actual size cast to char in this order: scopeCount inheritedSymbolCount inheritedFixnumCount inheritedConstantCount inheritedRegexpCount inheritedBigIntegerCount inheritedVariableReaderCount inheritedVariableWriterCount inheritedBlockBodyCount inheritedBlockCallbackCount inheritedMethodCount inheritedStringCountfinal voidinitRegexps(int size) final voidinitScopes(int size) final ByteList[]initStrings(int size) final voidinitSymbols(int size) final voidinitVariableReaders(int size) final voidinitVariableWriters(int size) private static RubyClasspollAndGetClass(ThreadContext context, IRubyObject self) reCache(ThreadContext context, StaticScope scope, String name, int index) reCacheFrom(RubyModule target, ThreadContext context, String name, int index) searchWithCache(RubyClass clazz, int index, String name1) searchWithCache(RubyClass clazz, int index, String name1, String name2) searchWithCache(RubyClass clazz, int index, String name1, String name2, String name3) searchWithCache(RubyClass clazz, int index, String name1, String name2, String name3, String name4, String name5) searchWithCache(RubyClass clazz, int index, String name1, String name2, String name3, String name4, String name5, String name6) searchWithCache(RubyClass clazz, int index, String name1, String name2, String name3, String name4, String name5, String name6, String name7) searchWithCache(RubyClass clazz, int index, String name1, String name2, String name3, String name4, String name5, String name6, String name7, String name8) searchWithCache(IRubyObject obj, int index, String name1) searchWithCache(IRubyObject obj, int index, String name1, String name2) searchWithCache(IRubyObject obj, int index, String name1, String name2, String name3) searchWithCache(IRubyObject obj, int index, String name1, String name2, String name3, String name4) searchWithCache(IRubyObject obj, int index, String name1, String name2, String name3, String name4, String name5) searchWithCache(IRubyObject obj, int index, String name1, String name2, String name3, String name4, String name5, String name6) searchWithCache(IRubyObject obj, int index, String name1, String name2, String name3, String name4, String name5, String name6, String name7) searchWithCache(IRubyObject obj, int index, String name1, String name2, String name3, String name4, String name5, String name6, String name7, String name8) private DynamicMethodsearchWithCacheNoMethodMissing(RubyClass clazz, int index, String name1) private DynamicMethodsearchWithCacheNoMethodMissing(RubyClass clazz, int index, String name1, String name2) final DynamicMethodsearchWithCacheNoMethodMissing(IRubyObject obj, int index, String name1) final DynamicMethodsearchWithCacheNoMethodMissing(IRubyObject obj, int index, String name1, String name2) final IRubyObjectsetVariable(int index, String name, IRubyObject object, IRubyObject value) private voidwarnAboutUninitializedIvar(Ruby runtime, String name)
-
Field Details
-
SCOPE
private static final int SCOPE- See Also:
-
SYMBOL
private static final int SYMBOL- See Also:
-
FIXNUM
private static final int FIXNUM- See Also:
-
FLOAT
private static final int FLOAT- See Also:
-
CONSTANT
private static final int CONSTANT- See Also:
-
REGEXP
private static final int REGEXP- See Also:
-
BIGINTEGER
private static final int BIGINTEGER- See Also:
-
VARIABLEREADER
private static final int VARIABLEREADER- See Also:
-
VARIABLEWRITER
private static final int VARIABLEWRITER- See Also:
-
METHOD
private static final int METHOD- See Also:
-
STRING
private static final int STRING- See Also:
-
ENCODING
private static final int ENCODING- See Also:
-
FROZEN_STRING
private static final int FROZEN_STRING- See Also:
-
EMPTY_SCOPES
-
scopes
-
EMPTY_CALLSITES
-
callSites
-
EMPTY_CACHEENTRIES
-
methodCache
-
EMPTY_RUBYSYMBOLS
-
symbols
-
EMPTY_BYTELISTS
-
byteLists
-
EMPTY_STRINGS
-
frozenStrings
-
EMPTY_ENCODINGS
private static final org.jcodings.Encoding[] EMPTY_ENCODINGS -
encodings
public org.jcodings.Encoding[] encodings -
EMPTY_FIXNUMS
-
fixnums
-
EMPTY_FLOATS
-
floats
-
EMPTY_RUBYREGEXPS
-
regexps
-
EMPTY_BIGINTEGERS
-
bigIntegers
-
EMPTY_VARIABLE_ACCESSORS
-
variableReaders
-
variableWriters
-
constants
-
-
Constructor Details
-
RuntimeCache
public RuntimeCache()
-
-
Method Details
-
getScope
public final StaticScope getScope(ThreadContext context, StaticScope parent, String varNamesDescriptor, int index) -
getScope
-
getCallSite
-
getSymbol
public final RubySymbol getSymbol(ThreadContext context, int index, String name, String encodingName) -
getString
-
getFrozenString
public final RubyString getFrozenString(ThreadContext context, int bytelistIndex, int stringIndex, int codeRange) -
getByteList
-
getEncoding
public final org.jcodings.Encoding getEncoding(int index) -
getFixnum
-
getFixnum
-
getFloat
-
getRegexp
-
getRegexp
-
cacheRegexp
-
cacheRegexp
-
getBigInteger
-
getVariable
public final IRubyObject getVariable(ThreadContext context, int index, String name, IRubyObject object) -
getVariableDefined
public final IRubyObject getVariableDefined(ThreadContext context, int index, String name, IRubyObject object) -
getValue
private final IRubyObject getValue(ThreadContext context, int index, String name, IRubyObject object) -
warnAboutUninitializedIvar
-
setVariable
-
initScopes
public final void initScopes(int size) -
initCallSites
public final void initCallSites(int size) -
initFromDescriptor
Given a packed descriptor listing methods and their type, populate the call site cache. The format of the methods portion of the descriptor is name1;type1;name2;type2 where type1 and type2 are a single capital letter N, F, V, or S for the four main call types. After the method portion, the other cache sizes are provided as a packed String of char values representing the numeric sizes. @see RuntimeCache#initOthers.- Parameters:
descriptor- The descriptor to use for populating call sites and caches
-
initOthers
Given a packed descriptor of other cache sizes, construct the cache arrays The format of the descriptor is the actual size cast to char in this order:- scopeCount
- inheritedSymbolCount
- inheritedFixnumCount
- inheritedConstantCount
- inheritedRegexpCount
- inheritedBigIntegerCount
- inheritedVariableReaderCount
- inheritedVariableWriterCount
- inheritedBlockBodyCount
- inheritedBlockCallbackCount
- inheritedMethodCount
- inheritedStringCount
- Parameters:
descriptor- The descriptor to use for preparing caches
-
getDescriptorValue
-
initSymbols
public final void initSymbols(int size) -
initStrings
-
initFrozenStrings
-
initEncodings
public final org.jcodings.Encoding[] initEncodings(int size) -
initFixnums
public final void initFixnums(int size) -
initFloats
public final void initFloats(int size) -
initRegexps
public final void initRegexps(int size) -
initBigIntegers
public final void initBigIntegers(int size) -
initConstants
public final void initConstants(int size) -
initVariableReaders
public final void initVariableReaders(int size) -
initVariableWriters
public final void initVariableWriters(int size) -
initMethodCache
public final void initMethodCache(int size) -
getConstant
public final IRubyObject getConstant(ThreadContext context, StaticScope scope, String name, int index) -
getConstantDefined
public final IRubyObject getConstantDefined(ThreadContext context, StaticScope scope, String name, int index) -
getValue
-
reCache
-
getConstantFrom
public final IRubyObject getConstantFrom(RubyModule target, ThreadContext context, String name, int index) -
getValueFrom
-
reCacheFrom
-
getMethod
public DynamicMethod getMethod(ThreadContext context, RubyClass selfType, int index, String methodName) -
getMethod
public DynamicMethod getMethod(ThreadContext context, IRubyObject self, int index, String methodName) -
getMethodEntry
public CacheEntry getMethodEntry(ThreadContext context, RubyClass selfType, int index, String methodName) -
cacheAndGet
private CacheEntry cacheAndGet(ThreadContext context, RubyClass selfType, int index, String methodName) -
searchWithCacheNoMethodMissing
-
searchWithCacheNoMethodMissing
private DynamicMethod searchWithCacheNoMethodMissing(RubyClass clazz, int index, String name1, String name2) -
searchWithCacheNoMethodMissing
-
searchWithCacheNoMethodMissing
public final DynamicMethod searchWithCacheNoMethodMissing(IRubyObject obj, int index, String name1, String name2) -
searchWithCache
-
searchWithCache
-
searchWithCache
public DynamicMethod searchWithCache(RubyClass clazz, int index, String name1, String name2, String name3) -
searchWithCache
-
searchWithCache
-
searchWithCache
-
searchWithCache
-
searchWithCache
-
searchWithCache
-
searchWithCache
-
searchWithCache
public DynamicMethod searchWithCache(IRubyObject obj, int index, String name1, String name2, String name3) -
searchWithCache
public DynamicMethod searchWithCache(IRubyObject obj, int index, String name1, String name2, String name3, String name4) -
searchWithCache
public DynamicMethod searchWithCache(IRubyObject obj, int index, String name1, String name2, String name3, String name4, String name5) -
searchWithCache
public DynamicMethod searchWithCache(IRubyObject obj, int index, String name1, String name2, String name3, String name4, String name5, String name6) -
searchWithCache
public DynamicMethod searchWithCache(IRubyObject obj, int index, String name1, String name2, String name3, String name4, String name5, String name6, String name7) -
searchWithCache
public DynamicMethod searchWithCache(IRubyObject obj, int index, String name1, String name2, String name3, String name4, String name5, String name6, String name7, String name8) -
pollAndGetClass
-
getCacheEntry
-