An object reference is a simple (jobject ), an integer index into the object table.
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.c.
#include "arch.h"
#include "jvmcfg.h"
#include "cfmacros.h"
#include "classfile.h"
#include "exit.h"
#include "gc.h"
#include "jvm.h"
#include "jvmclass.h"
#include "linkage.h"
#include "method.h"
#include "native.h"
#include "opcode.h"
#include "utf.h"
#include "util.h"
Go to the source code of this file.
Functions | |
static jvm_object_hash | object_allocate_slot (rboolean tryagain) |
Locate and reserve an unused object table slot for a new object instance. | |
static void | object_c_dummy (void) |
rvoid | object_init () |
Initialize the object area of the JVM model. | |
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). | |
rboolean | object_locate_pcfs (jvm_object_hash objhash) |
Check whether or not a class file data area is used by at least one other object besides this one. | |
rvoid | object_new_setup (jvm_object_hash objhash) |
Set up an empty object in a given object table slot. | |
rvoid | object_run_method (jvm_class_index clsidx, rchar *mthname, rchar *mthdesc, jvm_thread_index thridx) |
Invoke a method on a thread for any class, either static or instance method, either native or virtual. | |
rvoid | object_shutdown () |
Shut down the object area of the JVM model after JVM execution. | |
Variables | |
static char * | object_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/object.c $ $Id: object.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable." |
|
|
|
Initialize the object area of the JVM model. Parameters: rvoid
Definition at line 71 of file object.c. References jvm_object_hash_null, jvm_object_initialized, rjvm::object_allocate_last, object_new_setup(), pjvm, and rtrue. |
|
|
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(). |
|
Locate and reserve an unused object table slot for a new object instance.
< This slot contains an object < 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 329 of file object.c. References EXIT_JVM_OBJECT, exit_throw_exception(), GC_RUN, JVMCFG_FIRST_OBJECT, JVMCFG_MAX_OBJECTS, JVMCLASS_JAVA_LANG_OUTOFMEMORYERROR, OBJECT, rjvm::object_allocate_last, OBJECT_STATUS_INUSE, OBJECT_STATUS_NULL, pjvm, rfalse, and rtrue. |
|
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. |
|
Check whether or not a class file data area is used by at least one other object besides this one. If a jvm_table_linkage.pcfs pointer is rnull, that means that that object has probably already run this function from object_instance_delete(), having found that at least one other object was using this class data. After all other objects have cleared out that pointer, there will only be one reference, and that is the one from this object. Upon return to object_instance_delete(), call classfile_unload_classdata() and clear the pointer to rnull, thus completing the unload process for the class file data area and all its object slot pointers.
< This slot contains an object < This slot contains an object |
|
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. |
|
Shut down the object area of the JVM model after JVM execution. See also comments on why there are two stages of class shutdown, class_shutdown_1() and class_shutdown_2(). Parameters: rvoid
< This slot contains an object < This slot contains an object < NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.) |
|
|