* src/vmcore/field.c (mm/memory.h): Added.
authortwisti <none@none>
Tue, 7 Aug 2007 13:24:43 +0000 (13:24 +0000)
committertwisti <none@none>
Tue, 7 Aug 2007 13:24:43 +0000 (13:24 +0000)
(vm/global.h): Likewise.
(field_load): Allocate value memory only for static and final fields.

* src/vmcore/field.h (fieldinfo): Made value a pointer.

* src/vmcore/loader.c (load_class_from_classbuffer): Allocate
fieldinfo's on the C heap.

* src/native/jni.c: fieldinfo->value is now a pointer.
* src/native/vm/sun_misc_Unsafe.c: Likewise.
* src/native/vm/gnu/java_lang_reflect_Field.c: Likewise.

* src/vm/jit/alpha/codegen.c,
src/vm/jit/alpha/patcher.c,
src/vm/jit/arm/codegen.c,
src/vm/jit/arm/patcher.c,
src/vm/jit/i386/codegen.c,
src/vm/jit/i386/patcher.c,
src/vm/jit/m68k/codegen.c,
src/vm/jit/m68k/patcher.c,
src/vm/jit/mips/codegen.c,
src/vm/jit/mips/patcher.c,
src/vm/jit/powerpc/codegen.c,
src/vm/jit/powerpc/patcher.c,
src/vm/jit/powerpc64/codegen.c,
src/vm/jit/powerpc64/patcher.c,
src/vm/jit/s390/codegen.c,
src/vm/jit/s390/patcher.c,
src/vm/jit/sparc64/codegen.c,
src/vm/jit/sparc64/patcher.c,
src/vm/jit/x86_64/codegen.c,
src/vm/jit/x86_64/patcher.c: Likewise.

26 files changed:
src/native/jni.c
src/native/vm/gnu/java_lang_reflect_Field.c
src/native/vm/sun_misc_Unsafe.c
src/vm/jit/alpha/codegen.c
src/vm/jit/alpha/patcher.c
src/vm/jit/arm/codegen.c
src/vm/jit/arm/patcher.c
src/vm/jit/i386/codegen.c
src/vm/jit/i386/patcher.c
src/vm/jit/m68k/codegen.c
src/vm/jit/m68k/patcher.c
src/vm/jit/mips/codegen.c
src/vm/jit/mips/patcher.c
src/vm/jit/powerpc/codegen.c
src/vm/jit/powerpc/patcher.c
src/vm/jit/powerpc64/codegen.c
src/vm/jit/powerpc64/patcher.c
src/vm/jit/s390/codegen.c
src/vm/jit/s390/patcher.c
src/vm/jit/sparc64/codegen.c
src/vm/jit/sparc64/patcher.c
src/vm/jit/x86_64/codegen.c
src/vm/jit/x86_64/patcher.c
src/vmcore/field.c
src/vmcore/field.h
src/vmcore/loader.c

index b4ae96d329998380c09353221ba83b3390d5581a..434f2ed3b8be7d0fbd74d72c11c6318b18590313 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: jni.c 8221 2007-07-22 19:31:41Z twisti $
+   $Id: jni.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -170,10 +170,10 @@ localref_table *_no_threads_localref_table;
 /* accessing instance fields macros *******************************************/
 
 #define SET_FIELD(o,type,f,value) \
-    *((type *) ((ptrint) (o) + (ptrint) ((fieldinfo *) (f))->offset)) = (type) (value)
+    *((type *) (((intptr_t) (o)) + ((intptr_t) ((fieldinfo *) (f))->offset))) = (type) (value)
 
 #define GET_FIELD(o,type,f) \
-    *((type *) ((ptrint) (o) + (ptrint) ((fieldinfo *) (f))->offset))
+    *((type *) (((intptr_t) (o)) + ((intptr_t) ((fieldinfo *) (f))->offset)))
 
 
 /* some forward declarations **************************************************/
@@ -3950,7 +3950,7 @@ jobject _Jv_JNI_GetStaticObjectField(JNIEnv *env, jclass clazz,
                if (!initialize_class(c))
                        return NULL;
 
-       return _Jv_JNI_NewLocalRef(env, f->value.a);
+       return _Jv_JNI_NewLocalRef(env, f->value->a);
 }
 
 
@@ -3969,7 +3969,7 @@ jboolean _Jv_JNI_GetStaticBooleanField(JNIEnv *env, jclass clazz,
                if (!initialize_class(c))
                        return false;
 
-       return f->value.i;
+       return f->value->i;
 }
 
 
@@ -3987,7 +3987,7 @@ jbyte _Jv_JNI_GetStaticByteField(JNIEnv *env, jclass clazz, jfieldID fieldID)
                if (!initialize_class(c))
                        return 0;
 
-       return f->value.i;
+       return f->value->i;
 }
 
 
@@ -4005,7 +4005,7 @@ jchar _Jv_JNI_GetStaticCharField(JNIEnv *env, jclass clazz, jfieldID fieldID)
                if (!initialize_class(c))
                        return 0;
 
-       return f->value.i;
+       return f->value->i;
 }
 
 
@@ -4023,7 +4023,7 @@ jshort _Jv_JNI_GetStaticShortField(JNIEnv *env, jclass clazz, jfieldID fieldID)
                if (!initialize_class(c))
                        return 0;
 
-       return f->value.i;
+       return f->value->i;
 }
 
 
@@ -4041,7 +4041,7 @@ jint _Jv_JNI_GetStaticIntField(JNIEnv *env, jclass clazz, jfieldID fieldID)
                if (!initialize_class(c))
                        return 0;
 
-       return f->value.i;
+       return f->value->i;
 }
 
 
@@ -4059,7 +4059,7 @@ jlong _Jv_JNI_GetStaticLongField(JNIEnv *env, jclass clazz, jfieldID fieldID)
                if (!initialize_class(c))
                        return 0;
 
-       return f->value.l;
+       return f->value->l;
 }
 
 
@@ -4077,7 +4077,7 @@ jfloat _Jv_JNI_GetStaticFloatField(JNIEnv *env, jclass clazz, jfieldID fieldID)
                if (!initialize_class(c))
                        return 0.0;
 
-       return f->value.f;
+       return f->value->f;
 }
 
 
@@ -4096,7 +4096,7 @@ jdouble _Jv_JNI_GetStaticDoubleField(JNIEnv *env, jclass clazz,
                if (!initialize_class(c))
                        return 0.0;
 
-       return f->value.d;
+       return f->value->d;
 }
 
 
@@ -4122,7 +4122,7 @@ void _Jv_JNI_SetStaticObjectField(JNIEnv *env, jclass clazz, jfieldID fieldID,
                if (!initialize_class(c))
                        return;
 
-       f->value.a = value;
+       f->value->a = value;
 }
 
 
@@ -4141,7 +4141,7 @@ void _Jv_JNI_SetStaticBooleanField(JNIEnv *env, jclass clazz, jfieldID fieldID,
                if (!initialize_class(c))
                        return;
 
-       f->value.i = value;
+       f->value->i = value;
 }
 
 
@@ -4160,7 +4160,7 @@ void _Jv_JNI_SetStaticByteField(JNIEnv *env, jclass clazz, jfieldID fieldID,
                if (!initialize_class(c))
                        return;
 
-       f->value.i = value;
+       f->value->i = value;
 }
 
 
@@ -4179,7 +4179,7 @@ void _Jv_JNI_SetStaticCharField(JNIEnv *env, jclass clazz, jfieldID fieldID,
                if (!initialize_class(c))
                        return;
 
-       f->value.i = value;
+       f->value->i = value;
 }
 
 
@@ -4198,7 +4198,7 @@ void _Jv_JNI_SetStaticShortField(JNIEnv *env, jclass clazz, jfieldID fieldID,
                if (!initialize_class(c))
                        return;
 
-       f->value.i = value;
+       f->value->i = value;
 }
 
 
@@ -4217,7 +4217,7 @@ void _Jv_JNI_SetStaticIntField(JNIEnv *env, jclass clazz, jfieldID fieldID,
                if (!initialize_class(c))
                        return;
 
-       f->value.i = value;
+       f->value->i = value;
 }
 
 
@@ -4236,7 +4236,7 @@ void _Jv_JNI_SetStaticLongField(JNIEnv *env, jclass clazz, jfieldID fieldID,
                if (!initialize_class(c))
                        return;
 
-       f->value.l = value;
+       f->value->l = value;
 }
 
 
@@ -4255,7 +4255,7 @@ void _Jv_JNI_SetStaticFloatField(JNIEnv *env, jclass clazz, jfieldID fieldID,
                if (!initialize_class(c))
                        return;
 
-       f->value.f = value;
+       f->value->f = value;
 }
 
 
@@ -4274,7 +4274,7 @@ void _Jv_JNI_SetStaticDoubleField(JNIEnv *env, jclass clazz, jfieldID fieldID,
                if (!initialize_class(c))
                        return;
 
-       f->value.d = value;
+       f->value->d = value;
 }
 
 
index 61de92d25b498b2eafbe663bb713c056ea7ece34..669db7ee61feb34242946ea302b51379229536e6 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_reflect_Field.c 8262 2007-08-06 12:44:01Z panzi $
+   $Id: java_lang_reflect_Field.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -160,9 +160,9 @@ static void *cacao_get_field_address(java_lang_reflect_Field *this,
                        if (!initialize_class(c))
                                return NULL;
 
-               /* return value address */
+               /* return value pointer */
 
-               return &(f->value);
+               return f->value;
 
        } else {
                /* obj is required for not-static fields */
@@ -173,7 +173,7 @@ static void *cacao_get_field_address(java_lang_reflect_Field *this,
                }
        
                if (builtin_instanceof((java_objectheader *) o, c))
-                       return (void *) ((intptr_t) o + f->offset);
+                       return (void *) (((intptr_t) o) + f->offset);
        }
 
        /* exception path */
index fcc6d571bd60f53bee89987e1c614ba8ba0f64e5..f01491d5a008b1828320decbe7b04564467af809 100644 (file)
@@ -435,7 +435,7 @@ JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_staticFieldOffset(JNIEnv *env, su
        c = (classinfo *) field->clazz;
        f = &(c->fields[field->slot]);
 
-       return (int64_t) (intptr_t) &(f->value);
+       return (int64_t) (intptr_t) f->value;
 }
 
 
index 546e7f8d37cb7d656f9c4bdc736df0cf3cde7fe9..eaafaefc5b0a733bf1b304c77d87d3219494e9eb 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 8211 2007-07-18 19:52:23Z michi $
+   $Id: codegen.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -1800,7 +1800,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
                                        patcher_add_patch_ref(jd, PATCHER_initialize_class, fi->class,
@@ -1845,7 +1845,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
                                        patcher_add_patch_ref(jd, PATCHER_initialize_class, fi->class,
@@ -1891,7 +1891,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
                                        patcher_add_patch_ref(jd, PATCHER_initialize_class, fi->class,
index bf35d8cb3ce00b760ee984620b5c522809fb9bd9..e9280929ec11c4bcd4dafd9a98fa628ea08514fa 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: patcher.c 8186 2007-07-05 23:48:16Z michi $
+   $Id: patcher.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -304,7 +304,7 @@ bool patcher_get_putstatic(patchref_t *pr)
 
        /* patch the field value's address */
 
-       *((ptrint *) datap) = (ptrint) &(fi->value);
+       *((intptr_t *) datap) = (intptr_t) fi->value;
 
        return true;
 }
index ddf555b1286d67db79504e0e534d8c238f8fe62b..75a182106c0b9769c83d7321bce11ffd2c13d041 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 8211 2007-07-18 19:52:23Z michi $
+   $Id: codegen.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -88,8 +88,6 @@ bool codegen_emit(jitdata *jd)
        basicblock     *bptr;
        instruction    *iptr;
        exception_entry *ex;
-       s4              fieldtype;
-       s4              varindex;
 
        s4              spilledregs_num;
        s4              savedregs_num;
@@ -100,6 +98,10 @@ bool codegen_emit(jitdata *jd)
        unresolved_method  *um;
        builtintable_entry *bte;
        methoddesc         *md;
+       fieldinfo          *fi;
+       unresolved_field   *uf;
+       int                 fieldtype;
+       int                 varindex;
 
        /* get required compiler data */
 
@@ -1373,11 +1375,9 @@ bool codegen_emit(jitdata *jd)
                case ICMD_GETSTATIC:  /* ...  ==> ..., value                          */
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               unresolved_field *uf = iptr->sx.s23.s3.uf;
-
+                               uf        = iptr->sx.s23.s3.uf;
                                fieldtype = uf->fieldref->parseddesc.fd->type;
-
-                               disp = dseg_add_unique_address(cd, NULL);
+                               disp      = dseg_add_unique_address(cd, NULL);
 
                                patcher_add_patch_ref(jd, PATCHER_get_putstatic, uf, disp);
 
@@ -1385,9 +1385,9 @@ bool codegen_emit(jitdata *jd)
                                        M_NOP;
                        }
                        else {
-                               fieldinfo *fi = iptr->sx.s23.s3.fmiref->p.field;
-
+                               fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class)) {
                                        patcher_add_patch_ref(jd, PATCHER_initialize_class,
@@ -1396,8 +1396,6 @@ bool codegen_emit(jitdata *jd)
                                        if (opt_showdisassemble)
                                                M_NOP;
                                }
-
-                               disp = dseg_add_address(cd, &(fi->value));
                        }
 
                        M_DSEG_LOAD(REG_ITMP3, disp);
@@ -1436,11 +1434,9 @@ bool codegen_emit(jitdata *jd)
                case ICMD_PUTSTATIC:  /* ..., value  ==> ...                          */
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               unresolved_field *uf = iptr->sx.s23.s3.uf;
-
+                               uf        = iptr->sx.s23.s3.uf;
                                fieldtype = uf->fieldref->parseddesc.fd->type;
-
-                               disp = dseg_add_unique_address(cd, NULL);
+                               disp      = dseg_add_unique_address(cd, NULL);
 
                                patcher_add_patch_ref(jd, PATCHER_get_putstatic, uf, disp);
 
@@ -1448,9 +1444,9 @@ bool codegen_emit(jitdata *jd)
                                        M_NOP;
                        }
                        else {
-                               fieldinfo *fi = iptr->sx.s23.s3.fmiref->p.field;
-
+                               fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class)) {
                                        patcher_add_patch_ref(jd, PATCHER_initialize_class,
@@ -1459,8 +1455,6 @@ bool codegen_emit(jitdata *jd)
                                        if (opt_showdisassemble)
                                                M_NOP;
                                }
-
-                               disp = dseg_add_address(cd, &(fi->value));
                        }
 
                        M_DSEG_LOAD(REG_ITMP3, disp);
@@ -1502,13 +1496,12 @@ bool codegen_emit(jitdata *jd)
 
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               unresolved_field *uf = iptr->sx.s23.s3.uf;
-
+                               uf        = iptr->sx.s23.s3.uf;
                                fieldtype = uf->fieldref->parseddesc.fd->type;
+                               disp      = 0;
                        }
                        else {
-                               fieldinfo *fi = iptr->sx.s23.s3.fmiref->p.field;
-
+                               fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
                                disp      = fi->offset;
                        }
@@ -1520,14 +1513,13 @@ bool codegen_emit(jitdata *jd)
 #endif
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               unresolved_field *uf = iptr->sx.s23.s3.uf;
+                               /* XXX REMOVE ME */
+                               uf = iptr->sx.s23.s3.uf;
 
                                patcher_add_patch_ref(jd, PATCHER_get_putfield, uf, 0);
 
                                if (opt_showdisassemble)
                                        M_NOP;
-
-                               disp = 0;
                        }
 
                        switch (fieldtype) {
@@ -1568,13 +1560,12 @@ bool codegen_emit(jitdata *jd)
                        emit_nullpointer_check(cd, iptr, s1);
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               unresolved_field *uf = iptr->sx.s23.s3.uf;
-
+                               uf        = iptr->sx.s23.s3.uf;
                                fieldtype = uf->fieldref->parseddesc.fd->type;
+                               disp      = 0;
                        }
                        else {
-                               fieldinfo *fi = iptr->sx.s23.s3.fmiref->p.field;
-
+                               fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
                                disp      = fi->offset;
                        }
@@ -1610,14 +1601,13 @@ bool codegen_emit(jitdata *jd)
                        }
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               unresolved_field *uf = iptr->sx.s23.s3.uf;
+                               /* XXX REMOVE ME */
+                               uf = iptr->sx.s23.s3.uf;
 
                                patcher_add_patch_ref(jd, PATCHER_get_putfield, uf, 0);
 
                                if (opt_showdisassemble)
                                        M_NOP;
-
-                               disp = 0;
                        }
 
                        switch (fieldtype) {
index 600a553e0cd40da29262a4ccaa922a163ba8a8a1..cc12574b9e0ed5a450101b3303a8f2d2c8c8f203 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: patcher.c 8160 2007-06-28 01:52:19Z michi $
+   $Id: patcher.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -30,6 +30,7 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 
 #include "vm/types.h"
 
@@ -102,7 +103,7 @@ bool patcher_get_putstatic(patchref_t *pr)
 
        /* patch the field value's address */
 
-       *((ptrint *) datap) = (ptrint) &(fi->value);
+       *((intptr_t *) datap) = (intptr_t) fi->value;
 
        return true;
 }
index 908caeb6feed2a4595489c91468ebd6526939102..a5629b4536aba6fa5f1adfd504bdfcb8f935cbe2 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 8211 2007-07-18 19:52:23Z michi $
+   $Id: codegen.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -30,6 +30,7 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 #include <stdio.h>
 
 #include "vm/types.h"
@@ -2198,7 +2199,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = (ptrint) &(fi->value);
+                               disp      = (intptr_t) fi->value;
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
                                        codegen_addpatchref(cd, PATCHER_clinit, fi->class, 0);
@@ -2239,7 +2240,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = (ptrint) &(fi->value);
+                               disp      = (intptr_t) fi->value;
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
                                        codegen_addpatchref(cd, PATCHER_clinit, fi->class, 0);
@@ -2281,7 +2282,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = (ptrint) &(fi->value);
+                               disp      = (intptr_t) fi->value;
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
                                        codegen_addpatchref(cd, PATCHER_clinit, fi->class, 0);
@@ -2308,21 +2309,17 @@ bool codegen_emit(jitdata *jd)
                        emit_nullpointer_check(cd, iptr, s1);
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               unresolved_field *uf = iptr->sx.s23.s3.uf;
-
+                               uf        = iptr->sx.s23.s3.uf;
                                fieldtype = uf->fieldref->parseddesc.fd->type;
+                               disp      = 0;
 
                                codegen_addpatchref(cd, PATCHER_getfield,
                                                                        iptr->sx.s23.s3.uf, 0);
-
-                               disp = 0;
-
                        }
                        else {
-                               fieldinfo *fi = iptr->sx.s23.s3.fmiref->p.field;
-                               
+                               fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp = fi->offset;
+                               disp      = fi->offset;
                        }
 
                        switch (fieldtype) {
@@ -2355,13 +2352,11 @@ bool codegen_emit(jitdata *jd)
                        /* must be done here because of code patching */
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               unresolved_field *uf = iptr->sx.s23.s3.uf;
-
+                               uf        = iptr->sx.s23.s3.uf;
                                fieldtype = uf->fieldref->parseddesc.fd->type;
                        }
                        else {
-                               fieldinfo *fi = iptr->sx.s23.s3.fmiref->p.field;
-
+                               fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
                        }
 
@@ -2375,16 +2370,15 @@ bool codegen_emit(jitdata *jd)
                                s2 = emit_load_s2(jd, iptr, REG_FTMP2);
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               unresolved_field *uf = iptr->sx.s23.s3.uf;
-
-                               codegen_addpatchref(cd, PATCHER_putfield, uf, 0);
-
+                               /* XXX */
+                               uf   = iptr->sx.s23.s3.uf;
                                disp = 0;
 
+                               codegen_addpatchref(cd, PATCHER_putfield, uf, 0);
                        }
                        else {
-                               fieldinfo *fi = iptr->sx.s23.s3.fmiref->p.field;
-
+                               /* XXX */
+                               fi   = iptr->sx.s23.s3.fmiref->p.field;
                                disp = fi->offset;
                        }
 
@@ -2413,25 +2407,19 @@ bool codegen_emit(jitdata *jd)
                        emit_nullpointer_check(cd, iptr, s1);
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               unresolved_field *uf = iptr->sx.s23.s3.uf;
-
+                               uf        = iptr->sx.s23.s3.uf;
                                fieldtype = uf->fieldref->parseddesc.fd->type;
+                               disp      = 0;
 
                                codegen_addpatchref(cd, PATCHER_putfieldconst,
                                                                        uf, 0);
-
-                               disp = 0;
-
                        }
-                       else
-                       {
-                               fieldinfo *fi = iptr->sx.s23.s3.fmiref->p.field;
-
+                       else {
+                               fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp = fi->offset;
+                               disp      = fi->offset;
                        }
 
-
                        switch (fieldtype) {
                        case TYPE_INT:
                        case TYPE_ADR:
index bf8a6fdd60fa60796d14dabbde7768d3df30d919..8bd37746e18e2f8f9f32b89fc7741a7b8aaac0eb 100644 (file)
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: patcher.c 8143 2007-06-26 15:47:43Z twisti $
+   $Id: patcher.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
 
 #include "config.h"
+
+#include <stdint.h>
+
 #include "vm/types.h"
 
 #include "vm/jit/i386/codegen.h"
@@ -171,7 +174,7 @@ bool patcher_get_putstatic(u1 *sp)
 
        /* patch the field value's address */
 
-       *((ptrint *) (ra + 1)) = (ptrint) &(fi->value);
+       *((intptr_t *) (ra + 1)) = (intptr_t) fi->value;
 
        return true;
 }
index 1616268f77a82b8e72942924b48b83f8de2d259f..b3ecefddb1d3fe303e5fc69bc29b31e9f5604898 100644 (file)
@@ -30,6 +30,7 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 
 #include "md-abi.h"
 #include "md-os.h"
@@ -1115,21 +1116,27 @@ bool codegen_emit(jitdata *jd)
 
 
                /* MEMORY *************************************************************/
-               case ICMD_GETSTATIC:
-                       if (INSTRUCTION_IS_UNRESOLVED(iptr))    {
+
+               case ICMD_GETSTATIC:  /* ...  ==> ..., value                          */
+
+                       if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
                                uf        = iptr->sx.s23.s3.uf;
                                fieldtype = uf->fieldref->parseddesc.fd->type;
-                               codegen_addpatchref(cd, PATCHER_get_putstatic, uf, 0);
-                       } else  {
-                               fieldinfo *fi = iptr->sx.s23.s3.fmiref->p.field;
+                               disp      = 0;
 
+                               codegen_addpatchref(cd, PATCHER_get_putstatic, uf, 0);
+                       }
+                       else {
+                               fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
+                               disp      = (intptr_t) fi->value;
+
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class)) {
-                                       codegen_addpatchref(cd, PATCHER_initialize_class, fi->class, 0);
+                                       codegen_addpatchref(cd, PATCHER_initialize_class, fi->class,
+                                                                               0);
                                }
-
-                               disp = (ptrint) &(fi->value);
                        }
+
                        M_AMOV_IMM(disp, REG_ATMP1);
                        switch (fieldtype) {
 #if defined(ENABLE_SOFTFLOAT)
@@ -1169,15 +1176,18 @@ bool codegen_emit(jitdata *jd)
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
                                uf        = iptr->sx.s23.s3.uf;
                                fieldtype = uf->fieldref->parseddesc.fd->type;
+                               disp      = 0;
 
                                codegen_addpatchref(cd, PATCHER_get_putstatic, uf, 0);
-                       } else {
+                       }
+                       else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = &(fi->value);
+                               disp      = (intptr_t) fi->value;
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
-                                       codegen_addpatchref(cd, PATCHER_initialize_class, fi->class, 0);
+                                       codegen_addpatchref(cd, PATCHER_initialize_class, fi->class,
+                                                                               0);
                        }
                
                        M_AMOV_IMM(disp, REG_ATMP1);
index f7923e3fa3f267dcffc106602e1d7789fd05e4ec..0774f4e41193f05c72705550d9a996b7b6a123f9 100644 (file)
@@ -29,6 +29,7 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 
 #include "vm/types.h"
 
@@ -348,7 +349,7 @@ bool patcher_get_putstatic(u1 *sp)
        /* patch the field value's address */
        if (opt_shownops) disp += PATCHER_CALL_SIZE;
        assert(*((uint16_t*)(disp)) == 0x247c);
-       *((ptrint *) (disp+2)) = (ptrint) &(fi->value);
+       *((intptr_t *) (disp+2)) = (intptr_t) fi->value;
 
        /* synchronize inst cache */
        md_icacheflush(disp+2, SIZEOF_VOID_P);
index fc76167bf1a9f079b5791724d2ada73ca8448bba..a55c3a9641dfa98902ada53a6bbccbb869a634ba 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 8264 2007-08-06 16:02:28Z twisti $
+   $Id: codegen.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -1993,7 +1993,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
                                        patcher_add_patch_ref(jd, PATCHER_initialize_class,
@@ -2043,7 +2043,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
                                        patcher_add_patch_ref(jd, PATCHER_initialize_class,
@@ -2081,8 +2081,6 @@ bool codegen_emit(jitdata *jd)
                        break;
 
                case ICMD_PUTSTATICCONST: /* ...  ==> ...                             */
-                                         /* val = value (in current instruction)     */
-                                         /* following NOP)                           */
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
                                uf        = iptr->sx.s23.s3.uf;
@@ -2094,7 +2092,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
                                        patcher_add_patch_ref(jd, PATCHER_initialize_class,
@@ -2231,15 +2229,14 @@ bool codegen_emit(jitdata *jd)
                        emit_nullpointer_check(cd, iptr, s1);
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               unresolved_field *uf = iptr->sx.s23.s3.uf;
-
+                               uf        = iptr->sx.s23.s3.uf;
                                fieldtype = uf->fieldref->parseddesc.fd->type;
                                disp      = 0;
 
                                patcher_add_patch_ref(jd, PATCHER_get_putfield, uf, 0);
                        }
                        else {
-                               fieldinfo *fi = iptr->sx.s23.s3.fmiref->p.field;
+                               fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
                                disp      = fi->offset;
                        }
index b620f8000f1f3cf87f96c56b3af17f6704bf0a0a..8ad124171a6d825d8339193cd0a9e40df5c5319b 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: patcher.c 8264 2007-08-06 16:02:28Z twisti $
+   $Id: patcher.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -30,6 +30,7 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 
 #include "vm/types.h"
 
@@ -150,7 +151,7 @@ bool patcher_get_putstatic(patchref_t *pr)
 
        /* patch the field value's address */
 
-       *((ptrint *) datap) = (ptrint) &(fi->value);
+       *((intptr_t *) datap) = (intptr_t) fi->value;
 
        /* synchronize data cache */
 
index cec29e578fcd21e04c8b146fa5d9f21adf9dce8d..8f1eac47bda2597944544dfdd50661833cf2170e 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 8216 2007-07-19 13:51:21Z michi $
+   $Id: codegen.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -1644,7 +1644,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
                                        patcher_add_patch_ref(jd, PATCHER_initialize_class,
@@ -1690,7 +1690,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
                                        patcher_add_patch_ref(jd, PATCHER_initialize_class,
index 105f7a583afdc3f04c3f126cdeb3136cebd648f1..653b04f4f2b1b72d0cdf64a619104e9696eacdb8 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: patcher.c 8216 2007-07-19 13:51:21Z michi $
+   $Id: patcher.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -30,6 +30,7 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 
 #include "vm/types.h"
 
@@ -337,7 +338,7 @@ bool patcher_get_putstatic(patchref_t *pr)
 
        /* patch the field value's address */
 
-       *((ptrint *) datap) = (ptrint) &(fi->value);
+       *((intptr_t *) datap) = (intptr_t) fi->value;
 
        /* synchronize data cache */
 
index 01919a281b2cd23ab1ba8a15befa374fed58ee01..1d754d927ee284da5e1ee375984c7e4e79b1fd7c 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 8211 2007-07-18 19:52:23Z michi $
+   $Id: codegen.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -30,6 +30,7 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <signal.h>
 
@@ -1574,7 +1575,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class)) {
                                        codegen_addpatchref(cd, PATCHER_clinit, fi->class, disp);
@@ -1621,7 +1622,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class)) {
                                        codegen_addpatchref(cd, PATCHER_clinit, fi->class, disp);
index dce048b35ecb01f911b233ce35151a49a43bee92..aecd6bb81ccbf0eaf65b3073ae0506cb089bda05 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: patcher.c 7909 2007-05-15 10:32:16Z tbfg $
+   $Id: patcher.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -30,6 +30,7 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 
 #include "vm/types.h"
 
@@ -174,7 +175,7 @@ bool patcher_get_putstatic(u1 *sp)
 
        /* patch the field value's address */
 
-       *((ptrint *) (pv + disp)) = (ptrint) &(fi->value);
+       *((intptr_t *) (pv + disp)) = (intptr_t) fi->value;
 
        /* synchronize data cache */
 
index 078fed2de41e1eda2d4e94e97841ed1a64b9bab9..02af44c6324501a11ffb2e2415fbd1e5195c98b4 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 8251 2007-08-01 15:26:59Z pm $
+   $Id: codegen.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -30,9 +30,9 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 #include <stdio.h>
 
-
 #include "native/jni.h"
 #include "native/native.h"
 
@@ -1973,7 +1973,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class)) {
                                        PROFILE_CYCLE_STOP;
@@ -2025,7 +2025,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class)) {
                                        PROFILE_CYCLE_STOP;
index 612e007b5172d91b46ef4a5d84442441c9c91ae7..2eb44fe5a6ea4f9988bcbf7d6602402fd5b56944 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Peter Molnar
 
-   $Id: patcher.c 8251 2007-08-01 15:26:59Z pm $
+   $Id: patcher.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -36,6 +36,7 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 
 #include "mm/memory.h"
 #include "native/native.h"
@@ -92,7 +93,7 @@ bool patcher_get_putstatic(patchref_t *pr)
 
        /* patch the field value's address */
 
-       *((ptrint *) datap) = (ptrint) &(fi->value);
+       *((intptr_t *) datap) = (intptr_t) fi->value;
 
        return true;
 }
index 1ba11be8377b311f684640894365a6fc4bf8b646..d46f6848a7b71cc9df0b0d0390a3ddfa2e148990 100644 (file)
@@ -30,6 +30,7 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 #include <stdio.h>
 
 #include "vm/types.h"
@@ -1609,16 +1610,16 @@ bool codegen_emit(jitdata *jd)
                case ICMD_GETSTATIC:  /* ...  ==> ..., value                          */
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               uf = iptr->sx.s23.s3.uf;
+                               uf        = iptr->sx.s23.s3.uf;
                                fieldtype = uf->fieldref->parseddesc.fd->type;
                                disp      = dseg_add_unique_address(cd, uf);
 
                                codegen_add_patch_ref(cd, PATCHER_get_putstatic, uf, disp);
                        } 
                        else {
-                               fi = iptr->sx.s23.s3.fmiref->p.field;
+                               fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
                                        codegen_add_patch_ref(cd, PATCHER_clinit, fi->class, disp);
@@ -1654,16 +1655,16 @@ bool codegen_emit(jitdata *jd)
                case ICMD_PUTSTATIC:  /* ..., value  ==> ...                          */
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               uf = iptr->sx.s23.s3.uf;
+                               uf        = iptr->sx.s23.s3.uf;
                                fieldtype = uf->fieldref->parseddesc.fd->type;
                                disp      = dseg_add_unique_address(cd, uf);
 
                                codegen_add_patch_ref(cd, PATCHER_get_putstatic, uf, disp);
                        } 
                        else {
-                               fi = iptr->sx.s23.s3.fmiref->p.field;
+                               fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
                                        codegen_add_patch_ref(cd, PATCHER_clinit, fi->class, disp);
@@ -1702,14 +1703,14 @@ bool codegen_emit(jitdata *jd)
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
                                uf        = iptr->sx.s23.s3.uf;
                                fieldtype = uf->fieldref->parseddesc.fd->type;
-                               disp = dseg_add_unique_address(cd, uf);
+                               disp      = dseg_add_unique_address(cd, uf);
 
                                codegen_add_patch_ref(cd, PATCHER_get_putstatic, uf, disp);
                        } 
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class))
                                        codegen_add_patch_ref(cd, PATCHER_clinit, fi->class, disp);
index a635097e2a3423ebb401cedbe6b4aa89d96d0afd..c3afd5ec1f10c80da7954c4d27dbc92d05639e0f 100644 (file)
@@ -30,6 +30,7 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 
 #include "vm/types.h"
 
@@ -196,7 +197,7 @@ bool patcher_get_putstatic(u1 *sp)
 
        /* patch the field value's address */
 
-       *((ptrint *) (pv + disp)) = (ptrint) &(fi->value);
+       *((intptr_t *) (pv + disp)) = (intptr_t) fi->value;
 
        /* synchronize data cache */
 
index 7c0b5650cd5a65440cda7f7ce1af53e3d941c24f..08789c8f53ffabf258de05ffd4df737ac835aac1 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 8211 2007-07-18 19:52:23Z michi $
+   $Id: codegen.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -1768,7 +1768,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
                                disp      = disp + -((cd->mcodeptr + 7) - cd->mcodebase);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class)) {
@@ -1832,7 +1832,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
                                disp      = disp + -((cd->mcodeptr + 7) - cd->mcodebase);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class)) {
@@ -1897,7 +1897,7 @@ bool codegen_emit(jitdata *jd)
                        else {
                                fi        = iptr->sx.s23.s3.fmiref->p.field;
                                fieldtype = fi->type;
-                               disp      = dseg_add_address(cd, &(fi->value));
+                               disp      = dseg_add_address(cd, fi->value);
                                disp      = disp + -((cd->mcodeptr + 7) - cd->mcodebase);
 
                                if (!CLASS_IS_OR_ALMOST_INITIALIZED(fi->class)) {
index ef1551844c5ff95f16829d8d2c31cf1c1b87b1b7..dee83f47eb3a21fad538a7f0afe51799a10dfaad 100644 (file)
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: patcher.c 7596 2007-03-28 21:05:53Z twisti $
+   $Id: patcher.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
 
 #include "config.h"
+
+#include <stdint.h>
+
 #include "vm/types.h"
 
 #include "vm/jit/x86_64/codegen.h"
@@ -173,7 +176,7 @@ bool patcher_get_putstatic(u1 *sp)
 
        /* patch the field value's address */
 
-       *((ptrint *) (ra + 7 + disp)) = (ptrint) &(fi->value);
+       *((intptr_t *) (ra + 7 + disp)) = (intptr_t) fi->value;
 
        return true;
 }
@@ -226,9 +229,9 @@ bool patcher_get_putfield(u1 *sp)
                byte = *(ra + 3);
 
                if (byte == 0x24)
-                       *((u4 *) (ra + 4)) = (u4) (fi->offset);
+                       *((int32_t *) (ra + 4)) = fi->offset;
                else
-                       *((u4 *) (ra + 3)) = (u4) (fi->offset);
+                       *((int32_t *) (ra + 3)) = fi->offset;
        }
        else {
                /* check for special case: %rsp or %r12 as base register */
@@ -236,9 +239,9 @@ bool patcher_get_putfield(u1 *sp)
                byte = *(ra + 5);
 
                if (byte == 0x24)
-                       *((u4 *) (ra + 6)) = (u4) (fi->offset);
+                       *((int32_t *) (ra + 6)) = fi->offset;
                else
-                       *((u4 *) (ra + 5)) = (u4) (fi->offset);
+                       *((int32_t *) (ra + 5)) = fi->offset;
        }
 
        return true;
@@ -287,21 +290,21 @@ bool patcher_putfieldconst(u1 *sp)
                /* handle special case when the base register is %r12 */
 
                if (*(ra + 2) == 0x84) {
-                       *((u4 *) (ra + 4))      = (u4) (fi->offset);
-                       *((u4 *) (ra + 12 + 4)) = (u4) (fi->offset + 4);
+                       *((uint32_t *) (ra + 4))      = fi->offset;
+                       *((uint32_t *) (ra + 12 + 4)) = fi->offset + 4;
                }
                else {
-                       *((u4 *) (ra + 3))      = (u4) (fi->offset);
-                       *((u4 *) (ra + 11 + 3)) = (u4) (fi->offset + 4);
+                       *((uint32_t *) (ra + 3))      = fi->offset;
+                       *((uint32_t *) (ra + 11 + 3)) = fi->offset + 4;
                }
        }
        else {
                /* handle special case when the base register is %r12 */
 
                if (*(ra + 2) == 0x84)
-                       *((u4 *) (ra + 4)) = (u4) (fi->offset);
+                       *((uint32_t *) (ra + 4)) = fi->offset;
                else
-                       *((u4 *) (ra + 3)) = (u4) (fi->offset);
+                       *((uint32_t *) (ra + 3)) = fi->offset;
        }
 
        return true;
index 753b3159483f89e2a396109629d7a5fdb35d228c..2728851f503568b4dffa3829396064c40c20f953 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: field.c 8249 2007-07-31 12:59:03Z panzi $
+   $Id: field.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
 
 #include "vm/types.h"
 
+#include "mm/memory.h"
+
 #include "vm/exceptions.h"
+#include "vm/global.h"
 #include "vm/stringlocal.h"
 #include "vm/vm.h"
 
@@ -66,22 +69,31 @@ bool field_load(classbuffer *cb, fieldinfo *f, descriptor_pool *descpool)
 {
        classinfo *c;
        u4 attrnum, i;
-       u4 jtype;
        u4 pindex = field_load_NOVALUE;     /* constantvalue_index */
        utf *u;
 
+       /* Get class. */
+
        c = cb->class;
 
+       f->class = c;
+
+       /* Get access flags. */
+
        if (!suck_check_classbuffer_size(cb, 2 + 2 + 2))
                return false;
 
        f->flags = suck_u2(cb);
 
+       /* Get name. */
+
        if (!(u = class_getconstant(c, suck_u2(cb), CONSTANT_Utf8)))
                return false;
 
        f->name = u;
 
+       /* Get descriptor. */
+
        if (!(u = class_getconstant(c, suck_u2(cb), CONSTANT_Utf8)))
                return false;
 
@@ -136,46 +148,79 @@ bool field_load(classbuffer *cb, fieldinfo *f, descriptor_pool *descpool)
 
        /* data type */
 
-       jtype = descriptor_to_basic_type(f->descriptor);
+       f->type = descriptor_to_basic_type(f->descriptor);
 
-       f->class  = c;
-       f->type   = jtype;
-       f->offset = 0;                             /* offset from start of object */
+       /* For static-fields allocate memory for the value and set the
+          value to 0. */
 
-       switch (f->type) {
-       case TYPE_INT:
-               f->value.i = 0;
-               break;
+       if (f->flags & ACC_STATIC) {
+               switch (f->type) {
+               case TYPE_INT:
+               case TYPE_LNG:
+               case TYPE_FLT:
+               case TYPE_DBL:
+                       f->value = NEW(imm_union);
+                       break;
 
-       case TYPE_FLT:
-               f->value.f = 0.0;
-               break;
+               case TYPE_ADR:
+#if defined(ENABLE_GC_CACAO)
+                       f->value = NEW(imm_union);
+#else
+                       f->value = GCNEW_UNCOLLECTABLE(imm_union, 1);
+#endif
+                       break;
 
-       case TYPE_DBL:
-               f->value.d = 0.0;
-               break;
+               default:
+                       vm_abort("field_load: invalid field type %d", f->type);
+               }
 
-       case TYPE_ADR:
-               f->value.a = NULL;
-               if (!(f->flags & ACC_STATIC))
-                       c->flags |= ACC_CLASS_HAS_POINTERS;
-               break;
+               /* Set the field to zero, for float and double fields set the
+                  correct 0.0 value. */
 
-       case TYPE_LNG:
-#if U8_AVAILABLE
-               f->value.l = 0;
-#else
-               f->value.l.low  = 0;
-               f->value.l.high = 0;
-#endif
-               break;
+               switch (f->type) {
+               case TYPE_INT:
+               case TYPE_LNG:
+               case TYPE_ADR:
+                       f->value->l = 0;
+                       break;
+
+               case TYPE_FLT:
+                       f->value->f = 0.0;
+                       break;
+
+               case TYPE_DBL:
+                       f->value->d = 0.0;
+                       break;
+               }
+       }
+       else {
+               /* For instance-fields set the offset to 0. */
+
+               f->offset = 0;
+
+               /* For final fields, which are not static, we need a value
+                  structure. */
+
+               if (f->flags & ACC_FINAL) {
+                       f->value = NEW(imm_union);
+                       /* XXX hack */
+                       f->value->l = 0;
+               }
+
+               switch (f->type) {
+               case TYPE_ADR:
+                       c->flags |= ACC_CLASS_HAS_POINTERS;
+                       break;
+               }
        }
 
        /* read attributes */
+
        if (!suck_check_classbuffer_size(cb, 2))
                return false;
 
        attrnum = suck_u2(cb);
+
        for (i = 0; i < attrnum; i++) {
                if (!suck_check_classbuffer_size(cb, 2))
                        return false;
@@ -207,14 +252,14 @@ bool field_load(classbuffer *cb, fieldinfo *f, descriptor_pool *descpool)
                
                        /* initialize field with value from constantpool */             
 
-                       switch (jtype) {
+                       switch (f->type) {
                        case TYPE_INT: {
                                constant_integer *ci; 
 
                                if (!(ci = class_getconstant(c, pindex, CONSTANT_Integer)))
                                        return false;
 
-                               f->value.i = ci->value;
+                               f->value->i = ci->value;
                        }
                        break;
                                        
@@ -224,7 +269,7 @@ bool field_load(classbuffer *cb, fieldinfo *f, descriptor_pool *descpool)
                                if (!(cl = class_getconstant(c, pindex, CONSTANT_Long)))
                                        return false;
 
-                               f->value.l = cl->value;
+                               f->value->l = cl->value;
                        }
                        break;
 
@@ -234,7 +279,7 @@ bool field_load(classbuffer *cb, fieldinfo *f, descriptor_pool *descpool)
                                if (!(cf = class_getconstant(c, pindex, CONSTANT_Float)))
                                        return false;
 
-                               f->value.f = cf->value;
+                               f->value->f = cf->value;
                        }
                        break;
                                                                                        
@@ -244,7 +289,7 @@ bool field_load(classbuffer *cb, fieldinfo *f, descriptor_pool *descpool)
                                if (!(cd = class_getconstant(c, pindex, CONSTANT_Double)))
                                        return false;
 
-                               f->value.d = cd->value;
+                               f->value->d = cd->value;
                        }
                        break;
                                                
@@ -252,12 +297,13 @@ bool field_load(classbuffer *cb, fieldinfo *f, descriptor_pool *descpool)
                                if (!(u = class_getconstant(c, pindex, CONSTANT_String)))
                                        return false;
 
-                               /* create javastring from compressed utf8-string */
-                               f->value.a = literalstring_new(u);
+                               /* Create Java-string from compressed UTF8-string. */
+
+                               f->value->a = literalstring_new(u);
                                break;
        
                        default: 
-                               vm_abort("field_load: invalid field type %d", jtype);
+                               vm_abort("field_load: invalid field type %d", f->type);
                        }
                }
 #if defined(ENABLE_JAVASE)
index a13a5f383e8edce8a9673d30ae697d510253a52e..dce84cefefa0055cdd02ac2e635eda03bad435d3 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: field.h 8249 2007-07-31 12:59:03Z panzi $
+   $Id: field.h 8268 2007-08-07 13:24:43Z twisti $
 */
 
 
@@ -65,9 +65,8 @@ struct fieldinfo {          /* field of a class                                 */
        utf       *signature; /* Signature attribute string                       */
        typedesc  *parseddesc;/* parsed descriptor                                */
 
-       s4         offset;    /* offset from start of object (instance variables) */
-
-       imm_union  value;     /* storage for static values (class variables)      */
+       int32_t    offset;    /* offset from start of object (instance variables) */
+       imm_union *value;     /* storage for static values (class variables)      */
 };
 
 
index 26447947c10ce9ef8c82854f5ded7bb33482f19c..62742a9b84016a1a28173a426c42051a0d9ae9d6 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: loader.c 8249 2007-07-31 12:59:03Z panzi $
+   $Id: loader.c 8268 2007-08-07 13:24:43Z twisti $
 
 */
 
@@ -1421,16 +1421,14 @@ classinfo *load_class_from_classbuffer(classbuffer *cb)
        RT_TIMING_GET_TIME(time_setup);
 
        /* load fields */
+
        if (!suck_check_classbuffer_size(cb, 2))
                goto return_exception;
 
        c->fieldscount = suck_u2(cb);
-#if defined(ENABLE_GC_CACAO)
-       c->fields = MNEW(fieldinfo, c->fieldscount);
+       c->fields      = MNEW(fieldinfo, c->fieldscount);
+
        MZERO(c->fields, fieldinfo, c->fieldscount);
-#else
-       c->fields = GCNEW_UNCOLLECTABLE(fieldinfo, c->fieldscount);
-#endif
 
        for (i = 0; i < c->fieldscount; i++) {
                if (!field_load(cb, &(c->fields[i]), descpool))
@@ -1440,11 +1438,12 @@ classinfo *load_class_from_classbuffer(classbuffer *cb)
        RT_TIMING_GET_TIME(time_fields);
 
        /* load methods */
+
        if (!suck_check_classbuffer_size(cb, 2))
                goto return_exception;
 
        c->methodscount = suck_u2(cb);
-       c->methods = MNEW(methodinfo, c->methodscount);
+       c->methods      = MNEW(methodinfo, c->methodscount);
 
        MZERO(c->methods, methodinfo, c->methodscount);