java.lang.Class structure
in this real machine implementation.
The definition of a class index is found here, as is the definition of a class. When initializing an class, the following activities happen in the class array:
(1) Its class index is used to address an empty slot in the class storage area.
(2) Since it is not a jvm_class_index_null value, its status is set to CLASS_STATUS_INUSE, with an |
OBJECT_STATUS_ARRAY if it is an array type. All other bits are clear.
(3) Allocate an object table slot that references this class table slot. This a class definition can be references using an object hash.
(4) Recursively define array class 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 class.h.
#include "object.h"
Go to the source code of this file.
Data Structures | |
struct | rclass |
General class slot definition. More... | |
Class status bits | |
Bitwise status bits for the status of a class slot.
These class status bits have direct OBJECT_STATUS_xxx equivalents and a few THREAD_STATUS_xxx equivalents also. There are no overloaded bit positions between them (for ease of diagnostics). | |
#define | CLASS_STATUS_2000 0x2000 |
not used | |
#define | CLASS_STATUS_4000 0x4000 |
not used | |
#define | CLASS_STATUS_8000 0x8000 |
not used | |
#define | CLASS_STATUS_ARRAY 0x0008 |
Class is an array type where arraydims contains number of dimensions. | |
#define | CLASS_STATUS_CLINIT 0x1000 |
Class loaded, initialized, and ready to allocate instances. | |
#define | CLASS_STATUS_DOCLINIT 0x0800 |
Class loaded, needs <clinit>. | |
#define | CLASS_STATUS_EMPTY 0x0000 |
This slot is available for use. | |
#define | CLASS_STATUS_GCREQ 0x0004 |
Class may be garbage collected. | |
#define | CLASS_STATUS_INUSE 0x0001 |
This slot contains a class. | |
#define | CLASS_STATUS_LINKED 0x0400 |
Class linkages completed. | |
#define | CLASS_STATUS_NULL 0x0002 |
NULL class slot. | |
#define | CLASS_STATUS_PRIMATIVE 0x0200 |
Primative for java.lang.Class. | |
#define | CLASS_STATUS_REFERENCE 0x0080 |
Class variable is a reference. | |
Defines | |
#define | CLASS(clsidx) pjvm->class[clsidx] |
Access structures of class table at certain index. | |
Functions | |
ARCH_COPYRIGHT_APACHE (class, h,"$URL: https://svn.apache.org/path/name/class.h $ $Id: class.h 0 09/28/2005 dlydick $") | |
jvm_class_index | class_find_by_cp_entry (cp_info_dup *clsname) |
Scan class table using CP table entry for presence of a class of specific name and number of dimensions. | |
jvm_class_index | class_find_by_prchar (rchar *clsname) |
Retrieve by (rchar *) name a class index to a class. | |
u2 | class_get_num_object_instance_fields (ClassFile *pcfs) |
Report number of object instance fields are in a class file. | |
u2 | class_get_num_static_fields (ClassFile *pcfs) |
Report number of class static fields are in a class file. | |
jvalue * | class_get_object_instance_field_data (jvm_class_index clsidx, jvm_object_hash objhash, ClassFile *pcfs) |
Load the field data table for object instance fields in this class. | |
jvm_class_index * | class_get_object_instance_field_lookups (ClassFile *pcfs) |
Load the field lookup table for object instance fields in this class. | |
jvalue * | class_get_static_field_data (jvm_class_index clsidx, ClassFile *pcfs) |
Load the field data table for class static fields in this class. | |
jvm_class_index * | class_get_static_field_lookups (ClassFile *pcfs) |
Load the field lookup table for class static fields in this class. | |
rvoid | class_init (rvoid) |
jvm_class_index | class_load_from_cp_entry_utf (cp_info_dup *clsname, rboolean find_registerNatives, jint *arraylength) |
jvm_class_index | class_load_from_prchar (rchar *clsname, rboolean find_registerNatives, jint *arraylength) |
jvm_class_index | class_load_primative (u1 basetype) |
Load primative classes for java.lang.Class. | |
jvm_class_index | class_load_resolve_clinit (rchar *clsname, jvm_thread_index thridx, rboolean usesystemthread, rboolean find_registerNatives) |
All-purpose class loading, load, resolve, <clinit> , each step only run if needed. | |
jvm_class_index | class_reload (jvm_class_index clsidxOLD) |
Reload a class in the class table after java.lang.String has become available. | |
rvoid | class_shutdown_1 (rvoid) |
rvoid | class_shutdown_2 (rvoid) |
jvm_class_index | class_static_delete (jvm_class_index clsidx, rboolean rmref) |
Un-reserve a slot from the class table. | |
jvm_class_index | class_static_new (rushort status_req, ClassFile *pcfs, jvm_array_dim arraydims, jint *arraylength, jvm_class_index lower_dim_array) |
Load a class into ad class table slot and load up its associated class definition object. | |
jvm_class_index | classutil_jobject2clsidx (jvm_object_hash objhash) |
|
Access structures of class table at certain index.
The class table, being an array of slots, provides space for one class definition per slot. This macro references one of them using the
Definition at line 84 of file class.h. Referenced by class_allocate_slot(), class_get_object_instance_field_data(), class_load_from_prchar(), class_static_delete(), class_static_setup(), field_index_get_class_static_lookup(), field_index_get_class_static_pjvalue(), field_index_get_object_instance_lookup(), field_index_get_object_instance_pjvalue(), field_index_is_class_static(), field_index_is_object_instance(), field_index_put_class_static_pjvalue(), field_index_put_object_instance_pjvalue(), gc_run_stub(), jlClass_isArray(), jlObject_getClass(), linkage_resolve_class(), and opcode_run(). |
|
This slot is available for use.
|
|
This slot contains a class.
Definition at line 111 of file class.h. Referenced by class_allocate_slot(), class_static_setup(), gc_run_stub(), and linkage_resolve_class(). |
|
NULL class slot. Exactly on exists in normal use, any else besides the JVMCFG_NULL_CLASS is a class slot now being initialized. Definition at line 112 of file class.h. Referenced by class_allocate_slot(), class_get_object_instance_field_data(), class_static_setup(), and gc_run_stub(). |
|
Class may be garbage collected.
Definition at line 122 of file class.h. Referenced by gc_run_stub(). |
|
Class is an array type where
Definition at line 124 of file class.h. Referenced by jlClass_isArray(), and opcode_run(). |
|
Class variable is a reference. This is the same definition as for OBJECT_STATUS_REFERENCE and for LOCAL_STATUS_REFERENCE, the local variable reference bit for variables on the stack frame, where the GC algorithm implements it. |
|
Primative for
|
|
Class linkages completed.
Definition at line 150 of file class.h. Referenced by linkage_resolve_class(). |
|
Class loaded, needs
|
|
Class loaded, initialized, and ready to allocate instances.
Definition at line 153 of file class.h. Referenced by class_load_from_prchar(). |
|
not used
|
|
not used
|
|
not used
|
|
|
|
|
|
|
|
|
|
Load a class into ad class table slot and load up its associated class definition object.
Create a Java class itself (and NOT a
No verification of special_cls is performed, only these values are assumed. Use a simple circular slot allocation mechanism to report where most recent class 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, throw error, but do not return.
java.lang.Class < This slot is available for use
< Primative for
< Class is an array type where < This object is a class definition instead of an object instance
< Class is an array type where
< NULL class slot. Exactly on exists in normal use, any else besides the JVMCFG_NULL_CLASS is a class slot now being initialized. Definition at line 353 of file class.c. References jvm_class_index_null. |
|
Reload a class in the class table after This process does not re-read the class file, only redoes class initialization. The class_objhash does not get deleted.
< NULL class slot. Exactly on exists in normal use, any else besides the JVMCFG_NULL_CLASS is a class slot now being initialized. < This slot is available for use < NULL class slot. Exactly on exists in normal use, any else besides the JVMCFG_NULL_CLASS is a class slot now being initialized. |
|
Un-reserve a slot from the class table. This is the reverse of the process of class_static_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.
Definition at line 732 of file class.c. References CLASS, GC_CLASS_FIELD_RMREF, and HEAP_FREE_DATA. |
|
Scan class table using CP table entry for presence of a class of specific name and number of dimensions.
< NULL class slot. Exactly on exists in normal use, any else besides the JVMCFG_NULL_CLASS is a class slot now being initialized. Definition at line 839 of file class.c. References class_find_by_cp_entry(), HEAP_FREE_DATA, and nts_prchar2utf(). Referenced by class_find_by_cp_entry(), class_load_primative(), and linkage_resolve_class(). |
|
Retrieve by (rchar *) name a class index to a class.
Definition at line 898 of file class.c. Referenced by opcode_run(), and thread_new(). |
|
Load primative classes for
Load primative classes as opposed to a real class Classes loaded with this method will typically never have any references to them except from their class object created within class_static_new(), yet are completely valid and are used intensively by class type processing. Because they never have references removed, they will never be marked for garbage collection, either. In this way, they are permanently available to the JVM for class type processing.
java.lang.Class < Not stated in spec, but implied
Definition at line 940 of file class.c. References class_find_by_cp_entry(), class_load_from_prchar(), CONSTANT_Utf8, EXIT_JVM_INTERNAL, exit_throw_exception(), jvm_class_index_null, JVMCLASS_JAVA_LANG_INTERNALERROR, LOCAL_CONSTANT_NO_ARRAY_DIMS, PTR_THIS_CP_Utf8, rnull, utf_get_utf_arraydims(), and utf_utf2prchar(). |
|
|
< Not stated in spec, but implied < Not stated in spec, but implied < Not stated in spec, but implied < This slot is available for use
< Class is an array type where < Convenient alias for DML5 < Convenient alias for DML5
< Not stated in spec, but implied < Convenient alias for DML5 For internal use only. Load superclass
WATCH OUT! RECURSIVE CALL! This will recurse until super_class is a
<clinit>
|
|
All-purpose class loading, load, resolve,
Load a class into the JVM, resolve its linkages, and run its
For internal use only. see similar logic for loading a new stack frame and PC in thread_new_common()
< Start PC location
< Class loaded, needs Definition at line 1445 of file class.c. Referenced by opcode_load_run_throwable(), and opcode_run(). |
|
Report number of class static fields are in a class file.
static .
Definition at line 1887 of file class.c. References class_get_num_static_fields(), HEAP_GET_DATA, and rtrue. Referenced by class_get_num_static_fields(). |
|
Load the field lookup table for class static fields in this class.
static .
Definition at line 1921 of file class.c. References ACC_STATIC, field_info::access_flags, class_get_constant_field_attribute(), ClassFile::fields, jvm_object_hash_null, and rtrue. |
|
Load the field data table for class static fields in this class.
static .
Definition at line 1968 of file class.c. References ACC_STATIC, field_info::access_flags, class_get_num_object_instance_fields(), ClassFile::fields, HEAP_GET_DATA, and rfalse. |
|
Report number of object instance fields are in a class file.
static .
Definition at line 2020 of file class.c. References class_get_num_object_instance_fields(). Referenced by class_get_num_object_instance_fields(), and class_get_static_field_data(). |
|
Load the field lookup table for object instance fields in this class.
static .
|
|
Load the field data table for object instance fields in this class. This initialization is the same for all objects of this class, so this function is still naturally a part of class processing instead of object processing.
static .
Definition at line 2111 of file class.c. References CLASS, CLASS_STATUS_NULL, GC_CLASS_RMREF_FROM_CLASS, GC_OBJECT_RMREF_FROM_CLASS, and jvm_class_index_null. |
|
|