java.lang.Object.
Two parallel sets of definitions are used here, one for internal implementation purposes, the other for the JNI interface. The first uses internal data types (via #ifdef JLOBJECT_LOCAL_DEFINED) where the second does not. Instead, it uses <jni.h> data
types. Those types must match up for JNI to work, yet by keeping them absolutely separate, application JNI code does not have any dependencies on the core code of this JVM implementation.
Even though there is only apparently one set of definitions, the #ifdef statement
controls which set is used.
This file must be included by JNI code along with the java.lang.Class JNI
header file. The following example shows how to call one of the local native methods of this class from the JNI environment. Notice that although this is not necessary due to the local implementation shortcut defined in native.c, it is not only possible, but sometimes quite desirable to do so.
#include <jni.h> #include <solaris/jni_md.h> ... or appropriate platform-specifics #include "java_lang_Object.h" ... JNI definitions #include "jlObject.h" ... this file JNIEXPORT jint JNICALL Java_java_lang_Object_hashCode(JNIEnv *env, jobject thisobj) { jint i; i = jlClass_hashCode(thisobj); ... call native implementation return(i); }
Although jvalue is indeed a part of both this implementation and the standard JNI interface through <jni.h>
, it is not recommended to use it if at all possible. Due to the fact that both definitions involve unions, along with the slightly differing contents between the two versions, it is almost certain that there will be compilation compatibility problems in the memory layouts from one platform to another, and possibly between the layouts between them on any given platform. Since jvalue is not specificaly a Java type, but instead a JNI construction, this may not be a problem, but this advisory is raised anyway in order to encourage reliable implementation of JNI.
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 jlObject.h.
Go to the source code of this file.
Reserved native local method ordinal numbers | |
These ordinal values are reserved for use by the local native method interface as implemented in native.c | |
#define | JLOBJECT_NMO_NULL 0 |
Empty table index for code internals. | |
#define | JLOBJECT_NMO_REGISTER 1 |
Reserved table index for JNI method registration. | |
#define | JLOBJECT_NMO_UNREGISTER 2 |
Reserved table index for JNI method de-registration. | |
Connection to local native method tables. | |
These manifest constant code fragments are designed to be inserted directly into locations in native.c without any other modification to that file except a single entry to actually invoke the method. | |
#define | NATIVE_TABLE_JLOBJECT |
Complete list of local native method ordinals for java.lang.Object. | |
#define | NATIVE_TABLE_JLOBJECT_JDOUBLE |
No (jdouble ) methods. | |
#define | NATIVE_TABLE_JLOBJECT_JFLOAT |
No (jfloat ) methods. | |
#define | NATIVE_TABLE_JLOBJECT_JINT case JLOBJECT_NMO_HASHCODE: |
(jint ) local native method ordinal table for java.lang.Object | |
#define | NATIVE_TABLE_JLOBJECT_JLONG |
No (jlong ) methods. | |
#define | NATIVE_TABLE_JLOBJECT_JOBJECT case JLOBJECT_NMO_GETCLASS: |
(jobject ) local native method ordinal table for java.lang.Object | |
#define | NATIVE_TABLE_JLOBJECT_JVOID |
(jvoid ) local native method ordinal table for java.lang.Object | |
#define | NATIVE_TABLE_JLOBJECT_ORDINALS |
Table of local native methods and their descriptors for java.lang.Object. | |
JNI parallel type definitions. | |
Implementation type definitions, but redefined from <jni.h> so no implementation header files are needed by JNI source code.
See also respective parallel definition for each one as found particularly in jvmcfg.h | |
typedef jclass | jvm_class_index |
Implementation type definition for jclass. | |
typedef jobject | jvm_object_hash |
Implementation type definition for jobject. | |
typedef void | jvoid |
Definition of Java void as used in this implementation. | |
Unified set of prototypes for functions | |
JNI table index and external reference to each function that locally implements a JNI native method. in jlObject.c
The JVM native interface ordinal definition base for this class is 10. An enumeration is used so the compiler can help the use to not choose duplicate values. | |
enum | jlObject_nmo_enum { JLOBJECT_NMO_GETCLASS = 10, JLOBJECT_NMO_HASHCODE = 11, JLOBJECT_NMO_WAIT4EVER = 12, JLOBJECT_NMO_WAITTIMED = 13 } |
jvm_object_hash | jlObject_getClass (jvm_object_hash objhash) |
JNI hook to getClass(). | |
jint | jlObject_hashCode (jvm_object_hash objhash) |
JNI hook to hashCode(). | |
jvoid | jlObject_wait4ever (jvm_object_hash objhashcurr) |
JNI hook to wait4ever(). | |
jvoid | jlObject_waittimed (jvm_object_hash objhashcurr, jlong sleeptime) |
JNI hook to waittimed(). |
|
Empty table index for code internals. See also parallel definition in jvmcfg.h Definition at line 123 of file jlObject.h. |
|
Reserved table index for JNI method registration. See also parallel definition in jvmcfg.h Definition at line 132 of file jlObject.h. |
|
Reserved table index for JNI method de-registration. See also parallel definition in jvmcfg.h Definition at line 141 of file jlObject.h. |
|
Value: case JLOBJECT_NMO_GETCLASS: \ case JLOBJECT_NMO_HASHCODE: \ case JLOBJECT_NMO_WAIT4EVER: \ case JLOBJECT_NMO_WAITTIMED: java.lang.Object.
Definition at line 318 of file jlObject.h. Referenced by native_verify_ordinal_definition(). |
|
Value: { \ { JLOBJECT_NMO_GETCLASS, "getClass", "()Ljava/lang/Class" }, \ { JLOBJECT_NMO_HASHCODE, "hashCode", "()I" }, \ { JLOBJECT_NMO_WAIT4EVER, "wait", "()V" }, \ { JLOBJECT_NMO_WAIT4EVER, "wait", "(J)V" }, \ \ /* Add other method entries here */ \ \ \ /* End of table marker */ \ { JVMCFG_JLOBJECT_NMO_NULL, \ CHEAT_AND_USE_NULL_TO_INITIALIZE, \ CHEAT_AND_USE_NULL_TO_INITIALIZE } \ } java.lang.Object.
Definition at line 328 of file jlObject.h. |
|
Value: case JLOBJECT_NMO_WAIT4EVER: \ case JLOBJECT_NMO_WAITTIMED: (jvoid ) local native method ordinal table for java.lang.Object
Definition at line 348 of file jlObject.h. |
|
Definition at line 356 of file jlObject.h. |
|
Definition at line 363 of file jlObject.h. |
|
No
Definition at line 366 of file jlObject.h. |
|
No
Definition at line 367 of file jlObject.h. |
|
No
Definition at line 368 of file jlObject.h. |
|
Implementation type definition for This symbol is defined for use in the core JVM code in jvmcfg.h.
Definition at line 202 of file jlObject.h. |
|
Implementation type definition for This symbol is defined for use in the core JVM code in jvmcfg.h.
Definition at line 221 of file jlObject.h. |
|
Definition of Java
This type definition is not typically part of This symbol is defined for use in the core JVM code in jrtypes.h. Definition at line 233 of file jlObject.h. |
|
Definition at line 255 of file jlObject.h. |
|
JNI hook to getClass().
Definition at line 102 of file jlObject.c. References CLASS, and OBJECT_CLASS_LINKAGE. Referenced by Java_java_lang_Object_getClass(), and native_run_local_return_jobject(). |
|
JNI hook to hashCode().
Definition at line 121 of file jlObject.c. Referenced by Java_java_lang_Object_hashCode(), and native_run_local_return_jint(). |
|
JNI hook to wait4ever(). < This slot contains an object
< Object is a
< Object is a
< Object is a < This slot contains an object
< Object is a < This slot contains an object
< Object is a
< Object is a < This slot contains an object
< Object is a < This slot contains an object
< Object is a < Access structures of the thread now running in the JVM. < thread is unconditionally waiting < Access structures of the thread now running in the JVM.
< thread threw a Definition at line 174 of file jlObject.c. References CURRENT_THREAD, JVMCLASS_JAVA_LANG_ILLEGALMONITORSTATEEXCEPTION, OBJECT, OBJECT_CLASS_LINKAGE, OBJECT_STATUS_MLOCK, OBJECT_THREAD_LINKAGE, objectutil_release(), rtrue, THREAD, THREAD_STATUS_THREW_EXCEPTION, THREAD_STATUS_WAIT4EVER, thread_throw_exception(), VERIFY_OBJECT_THREAD_LINKAGE, and VERIFY_THREAD_LINKAGE. Referenced by Java_java_lang_Object_wait(), and native_run_local_return_jvoid(). |
|
JNI hook to waittimed(). < This slot contains an object
< Object is a
< Object is a
< Object is a < This slot contains an object
< Object is a < This slot contains an object
< Object is a
< Object is a < This slot contains an object
< Object is a < This slot contains an object
< Object is a < Access structures of the thread now running in the JVM. < thread has joined another, but is waiting for a finite time < Access structures of the thread now running in the JVM.
< thread threw a Definition at line 239 of file jlObject.c. References jvm_object_hash_null, OBJECT_THREAD_LINKAGE, rtrue, VERIFY_OBJECT_THREAD_LINKAGE, and VERIFY_THREAD_LINKAGE. Referenced by Java_java_lang_Object_wait__J(), and native_run_local_return_jvoid(). |