* src/native/vm/java_lang_Class.c
authorpanzi <none@none>
Wed, 15 Aug 2007 13:49:26 +0000 (13:49 +0000)
committerpanzi <none@none>
Wed, 15 Aug 2007 13:49:26 +0000 (13:49 +0000)
(_Jv_java_lang_Class_getDeclaredAnnotations): Use LLNI_* macro.

* src/native/vm/gnu/java_lang_reflect_Method.c
(Java_java_lang_reflect_Method_getDefaultValue): Use LLNI_* macros.
(Java_java_lang_reflect_Method_declaredAnnotations): Use LLNI_* macros.
(Java_java_lang_reflect_Method_getParameterAnnotations): Use LLNI_* macros.

* src/native/vm/gnu/java_lang_reflect_Field.c
(Java_java_lang_reflect_Field_declaredAnnotations): Use LLNI_* macros.

* src/native/vm/gnu/java_lang_reflect_Constructor.c
(Java_java_lang_reflect_Constructor_declaredAnnotations): Use LLNI_* macros.
(Java_java_lang_reflect_Constructor_getParameterAnnotations): Use LLNI_* macros.

* src/native/vm/sun/jvm.c
(native/llni.h): Added include.
(JVM_GetFieldAnnotations): Use LLNI_* macros.
(JVM_GetMethodAnnotations): Use LLNI_* macros.
(JVM_GetMethodDefaultAnnotationValue): Use LLNI_* macros.
(JVM_GetMethodParameterAnnotations): Use LLNI_* macros.
(JVM_GetClassConstantPool): Use LLNI_* macros.

* src/native/vm/reflect.c
(reflect_constructor_new): Forgot to set annotations and parameterAnnotations
attributes for GNU Classpath.
(reflect_get_declaredannotatios): Use LLNI_* macros.
(reflect_get_parameterannotations): Use LLNI_* macros.

* src/native/vm/reflect.h
(reflect_get_declaredannotatios): Now the caller has to set the
declaredAnnotations attribute of the according object itself, because the
LLNI_* macros can't get the address of an field.

src/native/vm/gnu/java_lang_reflect_Constructor.c
src/native/vm/gnu/java_lang_reflect_Field.c
src/native/vm/gnu/java_lang_reflect_Method.c
src/native/vm/java_lang_Class.c
src/native/vm/reflect.c
src/native/vm/reflect.h
src/native/vm/sun/jvm.c

index 3a82a63aab28b0e2bc8cce0fe2845118083386d2..084a0cce33d91a54c10abf939135b7b05a80e36c 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_reflect_Constructor.c 8295 2007-08-11 17:57:24Z michi $
+   $Id: java_lang_reflect_Constructor.c 8305 2007-08-15 13:49:26Z panzi $
 
 */
 
@@ -112,14 +112,28 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Constructor_construct
  */
 JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Constructor_declaredAnnotations(JNIEnv *env, struct java_lang_reflect_Constructor* this)
 {
-       java_handle_t *o = (java_handle_t*)this;
+       java_handle_t        *o                   = (java_handle_t*)this;
+       struct java_util_Map *declaredAnnotations = NULL;
+       java_bytearray       *annotations         = NULL;
+       java_lang_Class      *declaringClass      = NULL;
 
        if (this == NULL) {
                exceptions_throw_nullpointerexception();
                return NULL;
        }
+       
+       LLNI_field_get_ref(this, declaredAnnotations, declaredAnnotations);
 
-       return reflect_get_declaredannotatios(&(this->declaredAnnotations), this->annotations, this->clazz, o->vftbl->class);
+       if (declaredAnnotations == NULL) {
+               LLNI_field_get_val(this, annotations, annotations);
+               LLNI_field_get_ref(this, clazz, declaringClass);
+
+               declaredAnnotations = reflect_get_declaredannotatios(annotations, declaringClass, o->vftbl->class);
+
+               LLNI_field_set_ref(this, declaredAnnotations, declaredAnnotations);
+       }
+
+       return declaredAnnotations;
 }
 
 
@@ -130,14 +144,21 @@ JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Constructor_decla
  */
 JNIEXPORT java_objectarray* JNICALL Java_java_lang_reflect_Constructor_getParameterAnnotations(JNIEnv *env, struct java_lang_reflect_Constructor* this)
 {
-       java_handle_t *o = (java_handle_t*)this;
+       java_handle_t   *o                    = (java_handle_t*)this;
+       java_bytearray  *parameterAnnotations = NULL;
+       int32_t          slot                 = -1;
+       java_lang_Class *declaringClass       = NULL;
 
        if (this == NULL) {
                exceptions_throw_nullpointerexception();
                return NULL;
        }
 
-       return reflect_get_parameterannotations((java_handle_t*)this->parameterAnnotations, this->slot, this->clazz, o->vftbl->class);
+       LLNI_field_get_ref(this, parameterAnnotations, parameterAnnotations);
+       LLNI_field_get_val(this, slot, slot);
+       LLNI_field_get_ref(this, clazz, declaringClass);
+
+       return reflect_get_parameterannotations((java_handle_t*)parameterAnnotations, slot, declaringClass, o->vftbl->class);
 }
 #endif
 
index b35f70a14c8f6d2576f8bf374c05853d3353b220..a58447c3993e5ae280d67c35c1c59a70be15f5d1 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_reflect_Field.c 8295 2007-08-11 17:57:24Z michi $
+   $Id: java_lang_reflect_Field.c 8305 2007-08-15 13:49:26Z panzi $
 
 */
 
@@ -1253,14 +1253,28 @@ JNIEXPORT java_lang_String* JNICALL Java_java_lang_reflect_Field_getSignature(JN
  */
 JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Field_declaredAnnotations(JNIEnv *env, struct java_lang_reflect_Field* this)
 {
-       java_handle_t *o = (java_handle_t*)this;
+       java_handle_t        *o                   = (java_handle_t*)this;
+       struct java_util_Map *declaredAnnotations = NULL;
+       java_bytearray       *annotations         = NULL;
+       java_lang_Class      *declaringClass      = NULL;
 
        if (this == NULL) {
                exceptions_throw_nullpointerexception();
                return NULL;
        }
 
-       return reflect_get_declaredannotatios(&(this->declaredAnnotations), this->annotations, this->clazz, o->vftbl->class);
+       LLNI_field_get_ref(this, declaredAnnotations, declaredAnnotations);
+
+       if (declaredAnnotations == NULL) {
+               LLNI_field_get_val(this, annotations, annotations);
+               LLNI_field_get_ref(this, clazz, declaringClass);
+
+               declaredAnnotations = reflect_get_declaredannotatios(annotations, declaringClass, o->vftbl->class);
+
+               LLNI_field_set_ref(this, declaredAnnotations, declaredAnnotations);
+       }
+
+       return declaredAnnotations;
 }
 #endif
 
index 826fbdc19ca3ded27f5d893fc1839253fe8bd5dc..b5c9f5898f7ac981def97145c52c1d2c42df9109 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_reflect_Method.c 8295 2007-08-11 17:57:24Z michi $
+   $Id: java_lang_reflect_Method.c 8305 2007-08-15 13:49:26Z panzi $
 
 */
 
@@ -229,9 +229,10 @@ JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_reflect_Method_getDefa
 {
        static methodinfo        *m_parseAnnotationDefault   = NULL;
        utf                      *utf_parseAnnotationDefault = NULL;
-       utf                      *utf_desc     = NULL;
-       sun_reflect_ConstantPool *constantPool = NULL;
-       java_handle_t            *o            = (java_handle_t*)this;
+       utf                      *utf_desc        = NULL;
+       sun_reflect_ConstantPool *constantPool    = NULL;
+       java_handle_t            *o               = (java_handle_t*)this;
+       java_lang_Object         *constantPoolOop = NULL;
 
        if (this == NULL) {
                exceptions_throw_nullpointerexception();
@@ -247,7 +248,8 @@ JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_reflect_Method_getDefa
                return NULL;
        }
 
-       constantPool->constantPoolOop = (java_lang_Object*)this->clazz;
+       LLNI_field_get_ref(this, clazz, constantPoolOop);
+       LLNI_field_set_ref(constantPool, constantPoolOop, constantPoolOop);
 
        /* only resolve the method the first time */
        if (m_parseAnnotationDefault == NULL) {
@@ -288,14 +290,28 @@ JNIEXPORT struct java_lang_Object* JNICALL Java_java_lang_reflect_Method_getDefa
  */
 JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Method_declaredAnnotations(JNIEnv *env, struct java_lang_reflect_Method* this)
 {
-       java_handle_t *o = (java_handle_t*)this;
+       java_handle_t        *o                   = (java_handle_t*)this;
+       struct java_util_Map *declaredAnnotations = NULL;
+       java_bytearray       *annotations         = NULL;
+       java_lang_Class      *declaringClass      = NULL;
 
        if (this == NULL) {
                exceptions_throw_nullpointerexception();
                return NULL;
        }
 
-       return reflect_get_declaredannotatios(&(this->declaredAnnotations), this->annotations, this->clazz, o->vftbl->class);
+       LLNI_field_get_ref(this, declaredAnnotations, declaredAnnotations);
+
+       if (declaredAnnotations == NULL) {
+               LLNI_field_get_val(this, annotations, annotations);
+               LLNI_field_get_ref(this, clazz, declaringClass);
+
+               declaredAnnotations = reflect_get_declaredannotatios(annotations, declaringClass, o->vftbl->class);
+
+               LLNI_field_set_ref(this, declaredAnnotations, declaredAnnotations);
+       }
+
+       return declaredAnnotations;
 }
 
 
@@ -306,14 +322,21 @@ JNIEXPORT struct java_util_Map* JNICALL Java_java_lang_reflect_Method_declaredAn
  */
 JNIEXPORT java_objectarray* JNICALL Java_java_lang_reflect_Method_getParameterAnnotations(JNIEnv *env, struct java_lang_reflect_Method* this)
 {
-       java_handle_t *o = (java_handle_t*)this;
+       java_handle_t   *o                    = (java_handle_t*)this;
+       java_bytearray  *parameterAnnotations = NULL;
+       int32_t          slot                 = -1;
+       java_lang_Class *declaringClass       = NULL;
 
        if (this == NULL) {
                exceptions_throw_nullpointerexception();
                return NULL;
        }
 
-       return reflect_get_parameterannotations((java_handle_t*)this->parameterAnnotations, this->slot, this->clazz, o->vftbl->class);
+       LLNI_field_get_ref(this, parameterAnnotations, parameterAnnotations);
+       LLNI_field_get_val(this, slot, slot);
+       LLNI_field_get_ref(this, clazz, declaringClass);
+
+       return reflect_get_parameterannotations((java_handle_t*)parameterAnnotations, slot, declaringClass, o->vftbl->class);
 }
 #endif
 
index b7bc93bf2577fa9c36d7a6ad0f2ac84ddb5eefd9..b644d609d2ab996a16aaef7afae8a80e44c92e5f 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_Class.c 8295 2007-08-11 17:57:24Z michi $
+   $Id: java_lang_Class.c 8305 2007-08-15 13:49:26Z panzi $
 
 */
 
@@ -726,6 +726,7 @@ java_objectarray *_Jv_java_lang_Class_getDeclaredAnnotations(java_lang_Class* kl
        java_bytearray           *annotations  = NULL;
        sun_reflect_ConstantPool *constantPool = NULL;
        uint32_t                  size         = 0;
+       java_lang_Object         *o            = (java_lang_Object*)klass;
 
        if (c == NULL) {
                exceptions_throw_nullpointerexception();
@@ -755,7 +756,7 @@ java_objectarray *_Jv_java_lang_Class_getDeclaredAnnotations(java_lang_Class* kl
                return NULL;
        }
 
-       constantPool->constantPoolOop = (java_lang_Object*)klass;
+       LLNI_field_set_ref(constantPool, constantPoolOop, o);
 
        /* only resolve the method the first time */
        if (m_parseAnnotationsIntoArray == NULL) {
index 93bc6a2a3076f432f6e45f1bf8b416c9bf802015..9281c70d1303b28ced37226e7bc3e5d72af70e31 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: reflect.c 8295 2007-08-11 17:57:24Z michi $
+   $Id: reflect.c 8305 2007-08-15 13:49:26Z panzi $
 
 */
 
@@ -136,11 +136,8 @@ java_lang_reflect_Constructor *reflect_constructor_new(methodinfo *m)
 
        LLNI_field_set_cls(rc, clazz               , c);
        LLNI_field_set_val(rc, slot                , slot);
-
-       /* TODO: add these private fields to java.lang.reflect.Constructor
        LLNI_field_set_ref(rc, annotations         , annotations);
        LLNI_field_set_ref(rc, parameterAnnotations, parameterAnnotations);
-       */
 
 #elif defined(WITH_CLASSPATH_SUN)
 
@@ -360,67 +357,61 @@ java_lang_reflect_Method *reflect_method_new(methodinfo *m)
 #if defined(WITH_CLASSPATH_GNU) && defined(ENABLE_ANNOTATIONS)
 /* reflect_get_declaredannotatios *********************************************
 
-   Returnes a java.util.Map<Class, Annotation> of the declared
-   annotations. Only calls the AnnotationParser if the declared
-   annotations are not yet parsed.
+   Returns a java.util.Map<Class, Annotation> of the declared
+   annotations.
 
 *******************************************************************************/
 
 struct java_util_Map* reflect_get_declaredannotatios(
-       struct java_util_Map **declaredAnnotations,
-       java_bytearray        *annotations,
-       java_lang_Class       *declaringClass,
-       classinfo             *referer)
+       java_bytearray       *annotations,
+       java_lang_Class      *declaringClass,
+       classinfo            *referer)
 {
        static methodinfo        *m_parseAnnotations   = NULL;
        utf                      *utf_parseAnnotations = NULL;
        utf                      *utf_desc             = NULL;
        sun_reflect_ConstantPool *constantPool         = NULL;
+       java_lang_Object         *constantPoolOop      = (java_lang_Object*)declaringClass;
 
-       if (*declaredAnnotations == NULL) {
-               constantPool = 
-                       (sun_reflect_ConstantPool*)native_new_and_init(
-                               class_sun_reflect_ConstantPool);
+       constantPool = 
+               (sun_reflect_ConstantPool*)native_new_and_init(
+                       class_sun_reflect_ConstantPool);
                
-               if(constantPool == NULL) {
+       if(constantPool == NULL) {
+               /* out of memory */
+               return NULL;
+       }
+               
+       LLNI_field_set_ref(constantPool, constantPoolOop, constantPoolOop);
+               
+       /* only resolve the method the first time */
+       if (m_parseAnnotations == NULL) {
+               utf_parseAnnotations = utf_new_char("parseAnnotations");
+               utf_desc = utf_new_char(
+                       "([BLsun/reflect/ConstantPool;Ljava/lang/Class;)"
+                       "Ljava/util/Map;");
+
+               if (utf_parseAnnotations == NULL || utf_desc == NULL) {
                        /* out of memory */
                        return NULL;
                }
                
-               constantPool->constantPoolOop = (java_lang_Object*)declaringClass;
-               
-               /* only resolve the method the first time */
-               if (m_parseAnnotations == NULL) {
-                       utf_parseAnnotations = utf_new_char("parseAnnotations");
-                       utf_desc = utf_new_char(
-                               "([BLsun/reflect/ConstantPool;Ljava/lang/Class;)"
-                               "Ljava/util/Map;");
-       
-                       if (utf_parseAnnotations == NULL || utf_desc == NULL) {
-                               /* out of memory */
-                               return NULL;
-                       }
-               
-                       m_parseAnnotations = class_resolveclassmethod(
-                               class_sun_reflect_annotation_AnnotationParser,
-                               utf_parseAnnotations,
-                               utf_desc,
-                               referer,
-                               true);
+               m_parseAnnotations = class_resolveclassmethod(
+                       class_sun_reflect_annotation_AnnotationParser,
+                       utf_parseAnnotations,
+                       utf_desc,
+                       referer,
+                       true);
        
-                       if (m_parseAnnotations == NULL) {
-                               /* method not found */
-                               return NULL;
-                       }
+               if (m_parseAnnotations == NULL) {
+                       /* method not found */
+                       return NULL;
                }
-       
-               *declaredAnnotations =
-                       (struct java_util_Map*)vm_call_method(
-                               m_parseAnnotations, NULL, annotations,
-                               constantPool, declaringClass);
        }
        
-       return *declaredAnnotations;
+       return (struct java_util_Map*)vm_call_method(
+                       m_parseAnnotations, NULL, annotations,
+                       constantPool, declaringClass);
 }
 
 
@@ -452,11 +443,12 @@ java_objectarray* reflect_get_parameterannotations(
         */
        static methodinfo        *m_parseParameterAnnotations   = NULL;
        utf                      *utf_parseParameterAnnotations = NULL;
-       utf                      *utf_desc      = NULL;
-       sun_reflect_ConstantPool *constantPool  = NULL;
-       classinfo                *c             = NULL;
-       methodinfo               *m             = NULL;
-       int32_t                   numParameters = -1;
+       utf                      *utf_desc        = NULL;
+       sun_reflect_ConstantPool *constantPool    = NULL;
+       java_lang_Object         *constantPoolOop = (java_lang_Object*)declaringClass;
+       classinfo                *c               = NULL;
+       methodinfo               *m               = NULL;
+       int32_t                   numParameters   = -1;
 
        /* get parameter count */
 
@@ -481,7 +473,7 @@ java_objectarray* reflect_get_parameterannotations(
                return NULL;
        }
 
-       constantPool->constantPoolOop = (java_lang_Object*)declaringClass;
+       LLNI_field_set_ref(constantPool, constantPoolOop, constantPoolOop);
 
        /* only resolve the method the first time */
        if (m_parseParameterAnnotations == NULL) {
index 51f8e8ff58f51884ba1d213a4523651363368422..1fa2f7d39d0851b39ef4d6e3a5da3ada2233fbfe 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: reflect.h 8295 2007-08-11 17:57:24Z michi $
+   $Id: reflect.h 8305 2007-08-15 13:49:26Z panzi $
 
 */
 
@@ -66,10 +66,9 @@ java_lang_reflect_Method      *reflect_method_new(methodinfo *m);
 
 #if defined(WITH_CLASSPATH_GNU) && defined(ENABLE_ANNOTATIONS)
 struct java_util_Map* reflect_get_declaredannotatios(
-       struct java_util_Map **declaredAnnotations,
-       java_bytearray        *annotations,
-       java_lang_Class       *declaringClass,
-       classinfo             *referer);
+       java_bytearray       *annotations,
+       java_lang_Class      *declaringClass,
+       classinfo            *referer);
 
 java_objectarray* reflect_get_parameterannotations(
        java_handle_t   *parameterAnnotations,
index 69ebaa76de8145396a26e4d1c73e30ce4b5c1988..37d23eda0d86f65b555a3040fecd370d6ab85a27 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: jvm.c 8295 2007-08-11 17:57:24Z michi $
+   $Id: jvm.c 8305 2007-08-15 13:49:26Z panzi $
 
 */
 
@@ -52,6 +52,7 @@
 #include "mm/memory.h"
 
 #include "native/jni.h"
+#include "native/llni.h"
 #include "native/native.h"
 
 #include "native/include/java_lang_AssertionStatusDirectives.h"
@@ -1047,6 +1048,7 @@ jbyteArray JVM_GetClassAnnotations(JNIEnv *env, jclass cls)
 jbyteArray JVM_GetFieldAnnotations(JNIEnv *env, jobject field)
 {
        java_lang_reflect_Field *rf = (java_lang_reflect_Field*)field;
+       java_bytearray          *ba = NULL;
 
        TRACEJVMCALLS("JVM_GetFieldAnnotations: field=%p", field);
 
@@ -1055,7 +1057,9 @@ jbyteArray JVM_GetFieldAnnotations(JNIEnv *env, jobject field)
                return NULL;
        }
 
-       return (jbyteArray)rf->annotations;
+       LLNI_field_get_ref(rf, annotations, ba);
+
+       return (jbyteArray)ba;
 }
 
 
@@ -1064,6 +1068,7 @@ jbyteArray JVM_GetFieldAnnotations(JNIEnv *env, jobject field)
 jbyteArray JVM_GetMethodAnnotations(JNIEnv *env, jobject method)
 {
        java_lang_reflect_Method *rm = (java_lang_reflect_Method*)method;
+       java_bytearray           *ba = NULL;
 
        TRACEJVMCALLS("JVM_GetMethodAnnotations: method=%p", method);
 
@@ -1072,7 +1077,9 @@ jbyteArray JVM_GetMethodAnnotations(JNIEnv *env, jobject method)
                return NULL;
        }
 
-       return (jbyteArray)rm->annotations;
+       LLNI_field_get_ref(rm, annotations, ba);
+
+       return (jbyteArray)ba;
 }
 
 
@@ -1081,6 +1088,7 @@ jbyteArray JVM_GetMethodAnnotations(JNIEnv *env, jobject method)
 jbyteArray JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method)
 {
        java_lang_reflect_Method *rm = (java_lang_reflect_Method*)method;
+       java_bytearray           *ba = NULL;
 
        TRACEJVMCALLS("JVM_GetMethodDefaultAnnotationValue: method=%p", method);
 
@@ -1089,7 +1097,9 @@ jbyteArray JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method)
                return NULL;
        }
 
-       return (jbyteArray)rm->annotationDefault;
+       LLNI_field_get_ref(rm, annotationDefault, ba);
+
+       return (jbyteArray)ba;
 }
 
 
@@ -1098,6 +1108,7 @@ jbyteArray JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method)
 jbyteArray JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method)
 {
        java_lang_reflect_Method *rm = (java_lang_reflect_Method*)method;
+       java_bytearray           *ba = NULL;
 
        TRACEJVMCALLS("JVM_GetMethodParameterAnnotations: method=%p", method);
 
@@ -1106,7 +1117,9 @@ jbyteArray JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method)
                return NULL;
        }
 
-       return (jbyteArray)rm->parameterAnnotations;
+       LLNI_field_get_ref(rm, parameterAnnotations, ba);
+
+       return (jbyteArray)ba;
 }
 
 
@@ -1164,7 +1177,8 @@ jint JVM_GetClassAccessFlags(JNIEnv *env, jclass cls)
 jobject JVM_GetClassConstantPool(JNIEnv *env, jclass cls)
 {
 #if defined(ENABLE_ANNOTATIONS)
-       sun_reflect_ConstantPool *constantPool = NULL;
+       sun_reflect_ConstantPool *constantPool    = NULL;
+       java_lang_Object         *constantPoolOop = (java_lang_Object*)cls;
        
        TRACEJVMCALLS("JVM_GetClassConstantPool: cls=%p", cls);
 
@@ -1179,7 +1193,8 @@ jobject JVM_GetClassConstantPool(JNIEnv *env, jclass cls)
                return NULL;
        }
        
-       constantPool->constantPoolOop = (java_lang_Object*)cls;
+       LLNI_field_set_ref(constantPool, constantPoolOop, constantPoolOop);
+
        return (jobject)constantPool;
 #else
        log_println("JVM_GetClassConstantPool: cls=%p, not implemented in this configuration!", cls);
@@ -1233,7 +1248,7 @@ jclass JVM_ConstantPoolGetClassAtIfLoaded(JNIEnv *env, jobject unused, jobject j
                return NULL;
        }
        
-       if (!resolve_classref(NULL,ref,resolveLazy,true,true,&c)) {
+       if (!resolve_classref(NULL, ref, resolveLazy, true, true, &c)) {
                return NULL;
        }
 
@@ -1281,7 +1296,7 @@ jobject JVM_ConstantPoolGetMethodAtIfLoaded(JNIEnv *env, jobject unused, jobject
                return NULL;
        }
 
-       if (!resolve_classref(NULL,ref->p.classref,resolveLazy,true,true,&c)) {
+       if (!resolve_classref(NULL, ref->p.classref, resolveLazy, true, true, &c)) {
                return NULL;
        }
 
@@ -1329,7 +1344,7 @@ jobject JVM_ConstantPoolGetFieldAtIfLoaded(JNIEnv *env, jobject unused, jobject
                return NULL;
        }
 
-       if (!resolve_classref(NULL,ref->p.classref,resolveLazy,true,true,&c)) {
+       if (!resolve_classref(NULL, ref->p.classref, resolveLazy, true, true, &c)) {
                return NULL;
        }