From 7a74611c86446420a67178b30316fcc0db1f0dfa Mon Sep 17 00:00:00 2001 From: michi Date: Mon, 20 Aug 2007 19:10:46 +0000 Subject: [PATCH] * src/native/vm/java_lang_Class.c (_Jv_java_lang_Class_getClassLoader) [ENABLE_HANDLES]: Fixed implementation. * src/native/vm/gnu/java_lang_VMSystem.c (Java_java_lang_VMSystem_identityHashCode) [ENABLE_GC_CACAO]: Likewise. --HG-- branch : exact-gc --- src/native/vm/gnu/java_lang_VMSystem.c | 15 ++++++++++++--- src/native/vm/java_lang_Class.c | 18 +++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/native/vm/gnu/java_lang_VMSystem.c b/src/native/vm/gnu/java_lang_VMSystem.c index 8e27184ab..0ae162c34 100644 --- a/src/native/vm/gnu/java_lang_VMSystem.c +++ b/src/native/vm/gnu/java_lang_VMSystem.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: java_lang_VMSystem.c 8321 2007-08-16 11:37:25Z michi $ + $Id: java_lang_VMSystem.c 8363 2007-08-20 19:10:46Z michi $ */ @@ -36,6 +36,7 @@ #include "mm/gc-common.h" #include "native/jni.h" +#include "native/llni.h" #include "native/native.h" #include "native/include/java_lang_Object.h" @@ -90,11 +91,19 @@ JNIEXPORT void JNICALL Java_java_lang_VMSystem_arraycopy(JNIEnv *env, jclass cla */ JNIEXPORT s4 JNICALL Java_java_lang_VMSystem_identityHashCode(JNIEnv *env, jclass clazz, java_lang_Object *o) { + s4 hashcode; + + LLNI_CRITICAL_START; + #if defined(ENABLE_GC_CACAO) - return heap_get_hashcode((java_objectheader *) o); + hashcode = heap_get_hashcode(LLNI_UNWRAP((java_handle_t *) o)); #else - return (s4) ((ptrint) o); + hashcode = (s4) ((ptrint) o); #endif + + LLNI_CRITICAL_END; + + return hashcode; } diff --git a/src/native/vm/java_lang_Class.c b/src/native/vm/java_lang_Class.c index 32366f052..af28dd3c4 100644 --- a/src/native/vm/java_lang_Class.c +++ b/src/native/vm/java_lang_Class.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: java_lang_Class.c 8343 2007-08-17 21:39:32Z michi $ + $Id: java_lang_Class.c 8363 2007-08-20 19:10:46Z michi $ */ @@ -570,14 +570,22 @@ java_handle_objectarray_t *_Jv_java_lang_Class_getDeclaredConstructors(java_lang */ java_lang_ClassLoader *_Jv_java_lang_Class_getClassLoader(java_lang_Class *klass) { - classinfo *c; + classinfo *c; + classloader *cl; - c = LLNI_classinfo_unwrap(klass); + c = LLNI_classinfo_unwrap(klass); + cl = c->classloader; - if (c->classloader == NULL) + if (cl == NULL) return NULL; else - return (java_lang_ClassLoader *) c->classloader->object; +#if defined(ENABLE_HANDLES) + /* the classloader entry itself is the handle */ + return (java_lang_ClassLoader *) cl; +#else + /* get the object out of the classloader entry */ + return (java_lang_ClassLoader *) cl->object; +#endif } #endif /* defined(ENABLE_JAVASE) */ -- 2.25.1