java.lang.Object structure
in this real machine implementation.
When initializing an object, the following activities happen in the object array:
(1) Its jvm_object_hash is used to address an empty slot in the object storage area.
(2) Its ACC_xxx flags from the class file are stored into access_flags.
(3) Its mlock_thridx is cleared, that is, no thread holds its monitor lock.
(4) Since it is not a jvm_object_hash_null value, its status is set to OBJECT_STATUS_INUSE. All other bits are clear.
(5) Declare to garbage collection that this object is now referenced.
(6) The data value(s) are stored in the array object_instance_field_data according to their various types. Since this array is a (jvalue), fields of any mixed type may be stored here. For example, An (int) is stored in object_instance_field_data._jint), while an object reference is stored in object_instance_field_data._jobjhash. Notice that a java.lang.Integer is
not an (int), and has its several fields stored in this array as their normal types.
Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
Licensed under the Apache License, Version 2.0 ("the License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
Definition in file object.h.
Go to the source code of this file.
Data Structures | |
struct | jvm_table_linkage |
Type definition for references to Java classes, enums, interfaces. More... | |
struct | robject |
General object slot definition. More... | |
Object status bits | |
Bitwise status bits for the status of an object slot.
These object status bits have direct CLASS_STATUS_xxx equivalents and a few THREAD_STATUS_xxx equivalents also. There are no overloaded bit positions between them (for ease of diagnostics). | |
#define | OBJECT_STATUS_2000 0x2000 |
not used | |
#define | OBJECT_STATUS_4000 0x4000 |
not used | |
#define | OBJECT_STATUS_8000 0x8000 |
not used | |
#define | OBJECT_STATUS_ARRAY 0x0004 |
Object is an array instead of an object instance. | |
#define | OBJECT_STATUS_CLASS 0x0020 |
This object is a class definition instead of an object instance. | |
#define | OBJECT_STATUS_EMPTY 0x0000 |
This slot is available for use. | |
#define | OBJECT_STATUS_GCREQ 0x0008 |
Object may be garbage collected. | |
#define | OBJECT_STATUS_INUSE 0x0001 |
This slot contains an object. | |
#define | OBJECT_STATUS_MLOCK 0x0100 |
Object monitor locked by mlock_thridx. | |
#define | OBJECT_STATUS_NULL 0x0002 |
NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized. | |
#define | OBJECT_STATUS_REFERENCE 0x0080 |
Object instance variable is a reference. | |
#define | OBJECT_STATUS_SUBARRAY 0x0020 |
This is a subset of an array, that is, of smaller dimension. | |
#define | OBJECT_STATUS_THREAD 0x0040 |
Object is a java/Lang/Thread. | |
Defines | |
#define | LOCAL_STATUS_REFERENCE OBJECT_STATUS_REFERENCE |
Reserved symbol for garbage collection of local variables, distinguishing primatives from reference types. | |
#define | OBJECT(objhash) pjvm->object[objhash] |
Access structures of object table at certain index. | |
Functions | |
ARCH_COPYRIGHT_APACHE (object, h,"$URL: https://svn.apache.org/path/name/object.h $ $Id: object.h 0 09/28/2005 dlydick $") | |
rvoid | object_init (rvoid) |
jvm_object_hash | object_instance_delete (jvm_object_hash objhash, rboolean rmref) |
Un-reserve a slot from the object area. | |
rvoid | object_instance_finalize (jvm_object_hash objhash, jvm_thread_index thridx) |
Finalize an object instance before deletion. | |
jvm_object_hash | object_instance_new (rushort special_obj, ClassFile *pcfs, jvm_class_index clsidx, jvm_array_dim arraydims, jint *arraylength, rboolean run_init_, jvm_thread_index thridx) |
Create a Java new object instance of a class and optionally run its <init> method with default parameters (none). | |
rvoid | object_new_setup (jvm_object_hash objhash) |
Set up an empty object in a given object table slot. | |
rvoid | object_shutdown (rvoid) |
rboolean | objectutil_release (jvm_object_hash objhashthis, jvm_thread_index thridx) |
Attempt to wait() on an object's monitor lock by releasing it and requesting RELEASE state. | |
rboolean | objectutil_synchronize (jvm_object_hash objhashthis, jvm_thread_index thridx) |
Attempt to synchronize() on an object's monitor lock by contending for it. | |
rvoid | objectutil_unsynchronize (jvm_object_hash objhashthis, jvm_thread_index thridx) |
Release synchronize from an object monitor lock. |
|
Access structures of object table at certain index.
The object table, being an array of slots, provides space for one object instance per slot. This macro references one of them using the
Definition at line 104 of file object.h. Referenced by field_index_get_object_instance_pjvalue(), field_index_put_object_instance_pjvalue(), gc_run_stub(), jlObject_wait4ever(), object_allocate_slot(), object_instance_delete(), object_instance_finalize(), object_new_setup(), and objectutil_synchronize(). |
|
This slot is available for use.
Definition at line 164 of file object.h. Referenced by opcode_run(). |
|
This slot contains an object.
Definition at line 166 of file object.h. Referenced by gc_run_stub(), object_allocate_slot(), object_instance_finalize(), object_new_setup(), and objectutil_synchronize(). |
|
NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized. ) Definition at line 167 of file object.h. Referenced by gc_run_stub(), object_allocate_slot(), object_new_setup(), and objectutil_synchronize(). |
|
Object is an array instead of an object instance.
Definition at line 174 of file object.h. Referenced by opcode_run(). |
|
Object may be garbage collected.
Definition at line 176 of file object.h. Referenced by gc_run_stub(). |
|
This object is a class definition instead of an object instance.
|
|
This is a subset of an array, that is, of smaller dimension.
|
|
Object is a
Definition at line 186 of file object.h. Referenced by opcode_run(). |
|
Object instance variable is a reference. This is the same definition as for CLASS_STATUS_REFERENCE and for LOCAL_STATUS_REFERENCE, the local variable reference bit for variables on the stack frame, where the GC algorithm implements it. |
|
Object monitor locked by mlock_thridx.
Definition at line 201 of file object.h. Referenced by jlObject_wait4ever(), and objectutil_synchronize(). |
|
not used
|
|
not used
|
|
not used
|
|
Reserved symbol for garbage collection of local variables, distinguishing primatives from reference types. When garbage collecting local variables on the stack, there must be a distinction drawn between local variables that are primative data types and those that area reference types. This symbol is reserved for that purpose. If implemented, it will always be found in the gc_XXX.c and gc_XXX.h source files and will never be found anywhere else. However, it is also mentioned in the documentation outside of GC modules; therefore, it is documented here for completeness. The actual value and implementation of this symbol is dependent on the GC system and the constraints given elsewhere in the documentation. The value given here is a dummy value. Its actual value must be declared previous to the inclusion in a source file of this header file. |
|
|
|
|
|
|
|
Set up an empty object in a given object table slot. The objhash of JVMCFG_NULL_OBJECT has special properties in that it can ALWAYS be allocated and is NEVER garbage collected! Part of the purpose for this is the JVMCFG_NULL_OBJECT is of value zero, which is widely used throughout the code as a special value. This this slot is not available for anything else.
< NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)
< Invalid basetype due to malformed < Not stated in spec, but implied < Not defined, empty (not in spec) < This slot contains an object < This slot contains an object < This slot contains an object Definition at line 245 of file object.c. References jvm_class_index_null, jvm_object_hash_null, jvm_thread_index_null, LOCAL_ACC_EMPTY, LOCAL_BASETYPE_ERROR, LOCAL_CONSTANT_NO_ARRAY_DIMS, OBJECT, OBJECT_OBJECT_LINKAGE, OBJECT_STATUS_INUSE, OBJECT_STATUS_NULL, and rnull. Referenced by object_init(). |
|
Create a Java The following four mutually exclusive variations are available using special_obj modifier:
No verification of special_obj is performed, only these values are assumed. All fields (or array components) are set to zeroes per JVM spec.
Notice that standard practice is to do Use a simple circular slot allocation mechanism to report where most recent object was allocated. The search for the next slot will begin from here and go all the way around the array to this same slot. If not successful, return a jvm_object_hash_null, else the object hash value of the slot. Even though this function makes types of two recursive calls to itself, there is very little local storage allocated on the stack, and that is mainly fragmented into the if() blocks where such storage is used. Therefore, even though this function may recurse for either (a) number of array dimensions, or (b) number of superclasses, in depth, there should never be any real machine stack overflow problems unless the stack is either, (a) unnaturally restricted to a very small size or, (b) a class file is not checked for CONSTANT_MAX_ARRAY_DIMS or, (c) test for superclass circularity is not working properly or, (d) a class has zillions of legitimate superclasses, such as could be created by an automated JVM regression tester.
< This object is a class definition instead of an object instance < Object is an array instead of an object instance
< Primative for < Object is an array instead of an object instance < This is a subset of an array, that is, of smaller dimension
< Unicode character < Double-precision floating-point value < Single-precision floating-point value < Integer < Long integer < an instance of class '/class/name' < Signed short < Boolean, true or false < Object is an array instead of an object instance < This is a subset of an array, that is, of smaller dimension
< Object is a < Not stated in spec, but implied < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.) < (Not in this section of spec, but very relevant) Definition at line 545 of file object.c. Referenced by opcode_load_run_throwable(), and opcode_run(). |
|
Finalize an object instance before deletion. This invokes an object's finalize() method, if declared, on the specified thread, or on the system thread if jvm_thread_index_null thread given.
< null-terminated string form of METHOD_CHAR_OPEN_PARM < null-terminated string form of METHOD_CHAR_OPEN_PARM < null-terminated string form of METHOD_CHAR_VOID < null-terminated string form of METHOD_CHAR_OPEN_PARM < null-terminated string form of METHOD_CHAR_OPEN_PARM < null-terminated string form of METHOD_CHAR_VOID Definition at line 871 of file object.c. References jvm_object_hash_null, JVMCFG_MAX_OBJECTS, OBJECT, OBJECT_OBJECT_LINKAGE, OBJECT_STATUS_INUSE, rnull, and rtrue. |
|
Un-reserve a slot from the object area. This is the reverse of the process of object_instance_new() above. Only tear down the heap allocations and mark the slot as empty. Leave the rest of the data in place for post-mortem. When the slot gets allocated again, any zeroing out of values will just get overwritten again, so don't bother. The object_instance_finalize() function MUST be run before calling this function!
< This is a subset of an array, that is, of smaller dimension < Object is an array instead of an object instance < This is a subset of an array, that is, of smaller dimension < This slot contains an object < This slot contains an object Definition at line 1016 of file object.c. References GC_OBJECT_RMREF_FROM_OBJECT, and OBJECT. |
|
Attempt to If acquired, stay in the RUNNING state. If not, go to the SYNCHRONIZED state and arbitrate for it in the LOCK state.
< NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.) < Object monitor locked by mlock_thridx < Object monitor locked by mlock_thridx < Access structures of the thread now running in the JVM. < Object monitor locked by mlock_thridx < Access structures of the thread now running in the JVM. < Access structures of the thread now running in the JVM.
< thread threw a Definition at line 102 of file objectutil.c. References CURRENT_THREAD, jvm_object_hash_null, JVMCLASS_JAVA_LANG_ILLEGALMONITORSTATEEXCEPTION, JVMCLASS_JAVA_LANG_NULLPOINTEREXCEPTION, OBJECT, OBJECT_STATUS_INUSE, OBJECT_STATUS_MLOCK, OBJECT_STATUS_NULL, rfalse, rtrue, THREAD, THREAD_STATUS_THREW_EXCEPTION, thread_throw_exception(), and threadstate_request_synchronized(). Referenced by opcode_run(). |
|
Release
< NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)
< thread threw a < Object monitor locked by mlock_thridx < Object monitor locked by mlock_thridx < Access structures of the thread now running in the JVM.
< thread threw a Definition at line 240 of file objectutil.c. Referenced by opcode_run(). |
|
Attempt to Save the MLOCK to be released for subsequent processing by threadstate_request_release().
Definition at line 326 of file objectutil.c. Referenced by jlObject_wait4ever(). |