| Modifier and Type | Field and Description |
|---|---|
| private final VariableAccessorField | ffiHandleVariableAccessorField
a lazy accessor for FFI handle |
| private volatile int | fieldVariables
whether objects associated with this table use fields |
| private volatile int | hasFFI
whether a slot has been allocated to ffi |
| private volatile int | hasObjectID
whether a slot has been allocated to object_id |
| private volatile int | hasObjectspaceGroup
whether a slot has been allocated to objectspace_group |
| private final VariableAccessorField | objectGroupVariableAccessorField
a lazy accessor for object group |
| private final VariableAccessorField | objectIdVariableAccessorField
a lazy accessor for object_id |
| private final RubyClass | realClass
the "real" class associated with this table |
| private Map | variableAccessors
a map from strings to accessors for this table |
| private volatile String[] | variableNames
an array of all registered variable names |
| Access | Constructor and Description |
|---|---|
| public | VariableTableManager(RubyClass
the "real" class associated with this table realClass)Construct a new VariableTable Manager for the given "real" class. |
| pack-priv | VariableTableManager(VariableTableManager
VariableTableManager to copy original)Copy constructor with deep cloning. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv final VariableAccessor | Returns: the new VariableAccessorthe name of the variable name)Allocate a new VariableAccessor for the named variable. |
| pack-priv final synchronized VariableAccessor | allocateVariableAccessors(String name, Function<Integer, VariableAccessor> builder)
Allocation helper to map variables to names |
| public Object | |
| private static Map | |
| private static Map | copyVariableAccessors(Map<String, VariableAccessor> myVariableAccessors, String name, VariableAccessor ivarAccessor)
|
| public void | |
| public VariableTableManager | |
| public final Object | Returns: the object's FFI handlethe object self)Retrieve the FFI ext handle for the given object. |
| public VariableAccessorField | Returns: the lazy accessor for FFI handle
Deprecated
since 9.4-. Use
getFFIHandleAccessorForRead() or getFFIHandleAccessorForWrite()
Retrieve the lazy accessor (VariableAccessorField) for FFI handle. |
| public VariableAccessor | Returns: the read accessor for FFI handleRetrieve the read accessor for FFI handle. |
| public VariableAccessor | Returns: the write accessor for FFI handleRetrieve the write accessor for FFI handle. |
| public VariableAccessorField | Returns: the lazy accessor for object group
Deprecated
since 9.4-. Use
getObjectGroupAccessorForRead() or getObjectGroupAccessorForWrite()
Retrieve the lazy accessor (VariableAccessorField) for object group. |
| public VariableAccessor | Returns: the read accessor for object groupRetrieve the read accessor for object group. |
| public VariableAccessor | Returns: the write accessor for object groupRetrieve the write accessor for object group. |
| public long | Returns: the object's object_id (possibly new)the object from which to get object_id self)Get the object_id from a given RubyBasicObject, possibly allocating space for it. |
| public VariableAccessorField | Returns: the lazy accessor for object_id
Deprecated
since 9.4-. Use
getObjectIdAccessorForRead() or getObjectIdAccessorForWrite()
Retrieve the lazy accessor (VariableAccessorField) for object_id. |
| public VariableAccessor | Returns: the read accessor for object_idRetrieve the read accessor for object_id for reads. |
| public VariableAccessor | Returns: the write accessor for object_idRetrieve the write accessor for object_id. |
| public RubyClass | |
| public VariableAccessor | getVariableAccessorForJavaMappedVar(String name, boolean unwrap, Class<?> unwrapType, Class<?> fieldType, MethodHandle getter, MethodHandle setter)
|
| public VariableAccessor | Returns: an accessor appropriate for readingthe name of the variable name)Get the variable accessor for the given name with intent to use it for reading. |
| public VariableAccessor | |
| public VariableAccessor | Returns: an accessor appropriate for writingthe name of the variable name)Get the variable accessor for the given name with intent to use it for writing. |
| public Map | Returns: a map of current variable accessorsGet the map of all current variable accessors with intent to read from it. |
| pack-priv VariableAccessor | Returns: an accessorthe name of the variable name, Function<Integer, VariableAccessor> a builder to use if the accessor doesn't exist yet defaultAccessorBuilder)Get the variable accessor for the given name, or if it doesn't exist, create it with the provided builder. |
| public String[] | Returns: a copy of the array of known instance variable namesGet an array of all the known instance variable names. |
| public Map | Returns: a map of names to accessors for all variablesGet a Map representing all variables registered in the variable table. |
| public int | Returns: the variable table's size, excluding extrasGet the size of the variable table, excluding extra vars (object_id, etc). |
| public int | getVariableTableSizeWithExtras()
Get the size of the variable table, including extra vars (object_etc, etc). |
| public boolean | |
| public boolean | Returns: true if object_id has been allocated; false otherwiseWhether this table has been used to allocate space for an object_id. |
| public boolean | Returns: true if object has any variables, else falseReturns true if object has any variables, defined as:
|
| private long | Returns: The generated object IDThe variable accessor to use for storing the
generated object ID objectIdAccessor)We lazily stand up the object ID since it forces us to stand up per-object state for a given object. |
| pack-priv final Function | makeRawFieldAccessorBuilder(String name, boolean unwrap, Class<?> unwrapType, Class<?> fieldType, MethodHandle getter, MethodHandle setter)
Makes a raw field accessor builder for reified classes with java_field. |
| pack-priv final Function | makeRubyFieldAccessorBuilder(String name, MethodHandle getter, MethodHandle setter)
Makes an IRubyObject field accessor builder for reified classes. |
| private static Object[] | Returns: a new table formed by combining the given tablesthe current table currentTable, Object[] the other (incoming) table otherTable, int the index of object_id to exclude objectIdIdx)Make a new variable table based on the values in a current and other (incoming) table, excluding object_id at specified index. |
| pack-priv final Function | |
| public synchronized void | requestFieldStorage(String name, Class<?> fieldType, Boolean unwrap, Class<?> toType)
This is internal API, don't call this directly if you aren't in the JRuby codebase, it may change Request that the listed ivars (no @ in name) have field storage when we are reified |
| public void | requestFieldStorage(JavaClassConfiguration.
Actually requests field storage for the ivar once we are reified This is internal API, don't call this directly if you aren't in the JRuby codebase, it may change |
| public void | |
| public final void | setFFIHandle(RubyBasicObject
Set the FFI handle for the given object. |
| private static void | setObjectId(RubyClass realClass, RubyBasicObject
the object into which to set object_id self, int the index allocated to store object_id index, long the value of object_id value)Update object_id with the given value. |
| public void | setVariableInternal(RubyBasicObject
the object into which to set the value self, int the index allocated for the value index, Object the value value)Virtual entry point for setting a variable into an object. |
| public static void | setVariableInternal(RubyClass
the "real" class of the object realClass, RubyBasicObject the object into which to set the variable self, int the index allocated for the variable index, Object the value of the variable value)Static entry point for setting a variable in an object. |
| public void | syncVariables(RubyBasicObject
the object into which to sync variables self, IRubyObject the object from which to sync variables other)Sync one this object's variables with other's - this is used to make rbClone work correctly. |
| ffiHandleVariableAccessorField | back to summary |
|---|---|
| private final VariableAccessorField ffiHandleVariableAccessorField a lazy accessor for FFI handle | |
| fieldVariables | back to summary |
|---|---|
| private volatile int fieldVariables whether objects associated with this table use fields | |
| hasFFI | back to summary |
|---|---|
| private volatile int hasFFI whether a slot has been allocated to ffi | |
| hasObjectID | back to summary |
|---|---|
| private volatile int hasObjectID whether a slot has been allocated to object_id | |
| hasObjectspaceGroup | back to summary |
|---|---|
| private volatile int hasObjectspaceGroup whether a slot has been allocated to objectspace_group | |
| objectGroupVariableAccessorField | back to summary |
|---|---|
| private final VariableAccessorField objectGroupVariableAccessorField a lazy accessor for object group | |
| objectIdVariableAccessorField | back to summary |
|---|---|
| private final VariableAccessorField objectIdVariableAccessorField a lazy accessor for object_id | |
| realClass | back to summary |
|---|---|
| private final RubyClass realClass the "real" class associated with this table | |
| variableAccessors | back to summary |
|---|---|
| private Map<String, VariableAccessor> variableAccessors a map from strings to accessors for this table
| |
| variableNames | back to summary |
|---|---|
| private volatile String[] variableNames an array of all registered variable names | |
| VariableTableManager | back to summary |
|---|---|
| public VariableTableManager(RubyClass realClass) Construct a new VariableTable Manager for the given "real" class.
| |
| VariableTableManager | back to summary |
|---|---|
| pack-priv VariableTableManager(VariableTableManager original) Copy constructor with deep cloning.
| |
| allocateVariableAccessor | back to summary |
|---|---|
| pack-priv final VariableAccessor allocateVariableAccessor(String name) Allocate a new VariableAccessor for the named variable.
| |
| allocateVariableAccessors | back to summary |
|---|---|
| pack-priv final synchronized VariableAccessor allocateVariableAccessors(String name, Function<Integer, VariableAccessor> builder) Allocation helper to map variables to names | |
| clearVariable | back to summary |
|---|---|
| public Object clearVariable(RubyBasicObject object, String name) | |
| copyVariableAccessors | back to summary |
|---|---|
| private static Map | |
| copyVariableAccessors | back to summary |
|---|---|
| private static Map | |
| deserializeVariables | back to summary |
|---|---|
| public void deserializeVariables(RubyBasicObject object, ObjectInputStream ois) throws IOException, ClassNotFoundException | |
| duplicate | back to summary |
|---|---|
| public VariableTableManager duplicate() | |
| getFFIHandle | back to summary |
|---|---|
| public final Object getFFIHandle(RubyBasicObject self) Retrieve the FFI ext handle for the given object.
| |
| getFFIHandleAccessorField | back to summary |
|---|---|
| public VariableAccessorField getFFIHandleAccessorField()
Retrieve the lazy accessor (VariableAccessorField) for FFI handle.
| |
| getFFIHandleAccessorForRead | back to summary |
|---|---|
| public VariableAccessor getFFIHandleAccessorForRead() Retrieve the read accessor for FFI handle. If no object_id has been prepared, this will return a dummy accessor that just returns null.
| |
| getFFIHandleAccessorForWrite | back to summary |
|---|---|
| public VariableAccessor getFFIHandleAccessorForWrite() Retrieve the write accessor for FFI handle.
| |
| getObjectGroupAccessorField | back to summary |
|---|---|
| public VariableAccessorField getObjectGroupAccessorField()
Retrieve the lazy accessor (VariableAccessorField) for object group.
| |
| getObjectGroupAccessorForRead | back to summary |
|---|---|
| public VariableAccessor getObjectGroupAccessorForRead() Retrieve the read accessor for object group. If no object_id has been prepared, this will return a dummy accessor that just returns null.
| |
| getObjectGroupAccessorForWrite | back to summary |
|---|---|
| public VariableAccessor getObjectGroupAccessorForWrite() Retrieve the write accessor for object group.
| |
| getObjectId | back to summary |
|---|---|
| public long getObjectId(RubyBasicObject self) Get the object_id from a given RubyBasicObject, possibly allocating space for it.
| |
| getObjectIdAccessorField | back to summary |
|---|---|
| public VariableAccessorField getObjectIdAccessorField()
Retrieve the lazy accessor (VariableAccessorField) for object_id.
| |
| getObjectIdAccessorForRead | back to summary |
|---|---|
| public VariableAccessor getObjectIdAccessorForRead() Retrieve the read accessor for object_id for reads. If no object_id has been prepared, this will return a dummy accessor that just returns null.
| |
| getObjectIdAccessorForWrite | back to summary |
|---|---|
| public VariableAccessor getObjectIdAccessorForWrite() Retrieve the write accessor for object_id.
| |
| getRealClass | back to summary |
|---|---|
| public RubyClass getRealClass() | |
| getVariableAccessorForJavaMappedVar | back to summary |
|---|---|
| public VariableAccessor getVariableAccessorForJavaMappedVar(String name, boolean unwrap, Class<?> unwrapType, Class<?> fieldType, MethodHandle getter, MethodHandle setter) | |
| getVariableAccessorForRead | back to summary |
|---|---|
| public VariableAccessor getVariableAccessorForRead(String name) Get the variable accessor for the given name with intent to use it for reading.
| |
| getVariableAccessorForRubyVar | back to summary |
|---|---|
| public VariableAccessor getVariableAccessorForRubyVar(String name, MethodHandle getter, MethodHandle setter) | |
| getVariableAccessorForWrite | back to summary |
|---|---|
| public VariableAccessor getVariableAccessorForWrite(String name) Get the variable accessor for the given name with intent to use it for writing.
| |
| getVariableAccessorsForRead | back to summary |
|---|---|
| public Map Get the map of all current variable accessors with intent to read from it.
| |
| getVariableAccessorWithBuilder | back to summary |
|---|---|
| pack-priv VariableAccessor getVariableAccessorWithBuilder(String name, Function<Integer, VariableAccessor> defaultAccessorBuilder) Get the variable accessor for the given name, or if it doesn't exist, create it with the provided builder.
| |
| getVariableNames | back to summary |
|---|---|
| public String[] getVariableNames() Get an array of all the known instance variable names. The offset into the array indicates the offset of the variable's value in the per-object variable array.
| |
| getVariableTableCopy | back to summary |
|---|---|
| public Map Get a Map representing all variables registered in the variable table.
| |
| getVariableTableSize | back to summary |
|---|---|
| public int getVariableTableSize() Get the size of the variable table, excluding extra vars (object_id, etc).
| |
| getVariableTableSizeWithExtras | back to summary |
|---|---|
| public int getVariableTableSizeWithExtras() Get the size of the variable table, including extra vars (object_etc, etc). | |
| hasInstanceVariables | back to summary |
|---|---|
| public boolean hasInstanceVariables(RubyBasicObject object) | |
| hasObjectID | back to summary |
|---|---|
| public boolean hasObjectID() Whether this table has been used to allocate space for an object_id.
| |
| hasVariables | back to summary |
|---|---|
| public boolean hasVariables(RubyBasicObject object) Returns true if object has any variables, defined as:
| |
| initObjectId | back to summary |
|---|---|
| private long initObjectId(RubyBasicObject self, VariableAccessor objectIdAccessor) We lazily stand up the object ID since it forces us to stand up per-object state for a given object. We also check for ObjectSpace here, and normally we do not register a given object ID into ObjectSpace due to the high cost associated with constructing the related weakref. Most uses of id/object_id will only ever need it to be a unique identifier, and the id2ref behavior provided by ObjectSpace is considered internal and not generally supported. Note that this method does not need to be synchronized, since it is only called from #getObjectId, which synchronizes against the target object. The accessor is already present, and variable accesses are thread-safe (albeit not atomic, which necessitates the synchronization in getObjectId). Synchronization here ends up being a bottleneck for every object created from the class that contains this VariableTableManager. See GH #1400.
| |
| makeRawFieldAccessorBuilder | back to summary |
|---|---|
| pack-priv final Function Makes a raw field accessor builder for reified classes with java_field. Pass this into getVariableAccessorWithBuilder | |
| makeRubyFieldAccessorBuilder | back to summary |
|---|---|
| pack-priv final Function Makes an IRubyObject field accessor builder for reified classes. Pass this into getVariableAccessorWithBuilder | |
| makeSyncedTable | back to summary |
|---|---|
| private static Object[] makeSyncedTable(Object[] currentTable, Object[] otherTable, int objectIdIdx) Make a new variable table based on the values in a current and other (incoming) table, excluding object_id at specified index. | |
| makeTableVariableAccessorBuilder | back to summary |
|---|---|
| pack-priv final Function Makes a standard table accessor builder. Pass this into getVariableAccessorWithBuilder | |
| requestFieldStorage | back to summary |
|---|---|
| public synchronized void requestFieldStorage(String name, Class<?> fieldType, Boolean unwrap, Class<?> toType) This is internal API, don't call this directly if you aren't in the JRuby codebase, it may change Request that the listed ivars (no @ in name) have field storage when we are reified | |
| requestFieldStorage | back to summary |
|---|---|
| public void requestFieldStorage(JavaClassConfiguration. Actually requests field storage for the ivar once we are reified This is internal API, don't call this directly if you aren't in the JRuby codebase, it may change | |
| serializeVariables | back to summary |
|---|---|
| public void serializeVariables(RubyBasicObject object, ObjectOutputStream oos) throws IOException | |
| setFFIHandle | back to summary |
|---|---|
| public final void setFFIHandle(RubyBasicObject self, Object value) Set the FFI handle for the given object.
| |
| setObjectId | back to summary |
|---|---|
| private static void setObjectId(RubyClass realClass, RubyBasicObject self, int index, long value) Update object_id with the given value.
| |
| setVariableInternal | back to summary |
|---|---|
| public void setVariableInternal(RubyBasicObject self, int index, Object value) Virtual entry point for setting a variable into an object.
| |
| setVariableInternal | back to summary |
|---|---|
| public static void setVariableInternal(RubyClass realClass, RubyBasicObject self, int index, Object value) Static entry point for setting a variable in an object.
| |
| syncVariables | back to summary |
|---|---|
| public void syncVariables(RubyBasicObject self, IRubyObject other) Sync one this object's variables with other's - this is used to make rbClone work correctly.
| |