Package org.jruby
Class RubySymbol.SymbolTable
java.lang.Object
org.jruby.RubySymbol.SymbolTable
- Enclosing class:
- RubySymbol
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int(package private) static final floatprivate final float(package private) static final intprivate final Rubyprivate intprivate RubySymbol.SymbolTable.SymbolEntry[]private final ReentrantLockprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate RubySymbolcreateSymbol(String name, ByteList value, int hash, boolean hard) private RubySymbolcreateSymbol(String name, ByteList value, RubySymbol.ObjBooleanConsumer<RubySymbol> handler, int hash, boolean hard) private RubySymbolfastCreateSymbol(String internedName, boolean hard) fastGetSymbol(String internedName) fastGetSymbol(String internedName, boolean hard) private RubySymbolfindSymbol(ByteList bytes, int hash, boolean hard) private static RubySymbol.SymbolTable.SymbolEntrygetEntryFromTable(RubySymbol.SymbolTable.SymbolEntry[] table, int hash) private static intgetIndex(int hash, RubySymbol.SymbolTable.SymbolEntry[] table) getSymbol(ByteList bytes, RubySymbol.ObjBooleanConsumer<RubySymbol> handler, boolean hard) Get or retrieve an existing symbol from the table, invoking the given handler before return.private RubySymbol.SymbolTable.SymbolEntry[]private static booleanisSymbolMatch(String name, int hash, RubySymbol.SymbolTable.SymbolEntry entry) private static booleanisSymbolMatch(ByteList bytes, int hash, RubySymbol.SymbolTable.SymbolEntry entry) lookup(long id) Deprecated.private RubySymbollookupSymbol(String name, RubySymbol.SymbolTable.SymbolEntry[] table, int hash, int index) private RubySymbollookupSymbolByString(String internedName, RubySymbol.SymbolTable.SymbolEntry[] table, int index) private RubySymbol.SymbolTable.SymbolEntry[]rehash()private voidremoveDeadEntry(RubySymbol.SymbolTable.SymbolEntry[] table, int index, RubySymbol.SymbolTable.SymbolEntry last, RubySymbol.SymbolTable.SymbolEntry e) intsize()voidstore(RubySymbol symbol) Deprecated.private voidstoreSymbol(ByteList value, int hash, boolean hard, RubySymbol.SymbolTable.SymbolEntry[] table, int index, RubySymbol symbol, String internedName)
-
Field Details
-
DEFAULT_INITIAL_CAPACITY
static final int DEFAULT_INITIAL_CAPACITY- See Also:
-
MAXIMUM_CAPACITY
static final int MAXIMUM_CAPACITY- See Also:
-
DEFAULT_LOAD_FACTOR
static final float DEFAULT_LOAD_FACTOR- See Also:
-
tableLock
-
symbolTable
-
size
private int size -
threshold
private int threshold -
loadFactor
private final float loadFactor -
runtime
-
-
Constructor Details
-
SymbolTable
-
-
Method Details
-
getSymbol
-
getSymbol
-
getSymbol
-
getSymbol
-
getSymbol
public RubySymbol getSymbol(ByteList bytes, RubySymbol.ObjBooleanConsumer<RubySymbol> handler, boolean hard) Get or retrieve an existing symbol from the table, invoking the given handler before return. In the case of a new symbol, the handler will be invoked before the symbol is registered, so it can be manipulated without leaking changes.- Parameters:
bytes- the symbol byteshandler- the handler to invokehard- whether to hold a hard reference to the symbol- Returns:
- the new or existing symbol
-
findSymbol
-
fastGetSymbol
-
fastGetSymbol
-
getEntryFromTable
private static RubySymbol.SymbolTable.SymbolEntry getEntryFromTable(RubySymbol.SymbolTable.SymbolEntry[] table, int hash) -
isSymbolMatch
private static boolean isSymbolMatch(String name, int hash, RubySymbol.SymbolTable.SymbolEntry entry) -
isSymbolMatch
private static boolean isSymbolMatch(ByteList bytes, int hash, RubySymbol.SymbolTable.SymbolEntry entry) -
createSymbol
-
createSymbol
private RubySymbol createSymbol(String name, ByteList value, RubySymbol.ObjBooleanConsumer<RubySymbol> handler, int hash, boolean hard) - Parameters:
name- encoded symbol namevalue- symbol byteshandler- the handler to callhash- the hash for the symbolhard- whether to hold a hard reference to this symbol for the lifetime of the symbol table- Returns:
- the new or existing symbol
- See Also:
-
storeSymbol
private void storeSymbol(ByteList value, int hash, boolean hard, RubySymbol.SymbolTable.SymbolEntry[] table, int index, RubySymbol symbol, String internedName) -
fastCreateSymbol
-
getIndex
-
getTableForCreate
-
lookupSymbol
private RubySymbol lookupSymbol(String name, RubySymbol.SymbolTable.SymbolEntry[] table, int hash, int index) -
lookupSymbolByString
private RubySymbol lookupSymbolByString(String internedName, RubySymbol.SymbolTable.SymbolEntry[] table, int index) -
removeDeadEntry
private void removeDeadEntry(RubySymbol.SymbolTable.SymbolEntry[] table, int index, RubySymbol.SymbolTable.SymbolEntry last, RubySymbol.SymbolTable.SymbolEntry e) -
lookup
-
all_symbols
-
size
public int size() -
rehash
-
lookup
Deprecated. -
store
Deprecated.
-