Merged revisions 8245-8298 via svnmerge from
[cacao.git] / src / vm / jit / m68k / codegen.c
index 4023041827596bcd6d47939e33e8396a7f9cc214..d97fde5c8fa955bf2439e4623ead00a6882fa7ad 100644 (file)
@@ -30,6 +30,7 @@
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 
 #include "md-abi.h"
 #include "md-os.h"
@@ -40,6 +41,7 @@
 
 #include "mm/memory.h"
 #include "native/jni.h"
+#include "native/localref.h"
 #include "native/native.h"
 
 #include "threads/lock-common.h"
@@ -1116,21 +1118,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)
@@ -1170,15 +1178,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);
@@ -1723,7 +1734,7 @@ bool codegen_emit(jitdata *jd)
                                        /* load object pointer (==argument 0) */
                                        M_ALD(REG_ATMP1, REG_SP, 0);
                                        /* implicit null-pointer check */
-                                       M_ALD(REG_METHODPTR, REG_ATMP1, OFFSET(java_objectheader, vftbl));
+                                       M_ALD(REG_METHODPTR, REG_ATMP1, OFFSET(java_object_t, vftbl));
                                        M_ALD(REG_ATMP3, REG_METHODPTR, s1);
                                        /* generate the actual call */
                                        M_JSR(REG_ATMP3);
@@ -1742,7 +1753,7 @@ bool codegen_emit(jitdata *jd)
                                        M_ALD(REG_ATMP1, REG_SP, 0);
 
                                        /* implicit null-pointer check */
-                                       M_ALD(REG_METHODPTR, REG_ATMP1, OFFSET(java_objectheader, vftbl));
+                                       M_ALD(REG_METHODPTR, REG_ATMP1, OFFSET(java_object_t, vftbl));
                                        M_ALD(REG_METHODPTR, REG_METHODPTR, s1);
                                        M_ALD(REG_ATMP3, REG_METHODPTR, s2);
 
@@ -2031,7 +2042,7 @@ nowperformreturn:
                                        emit_label_beq(cd, BRANCH_LABEL_3);
                                }
 
-                               M_ALD(REG_ATMP1, s1, OFFSET(java_objectheader, vftbl));
+                               M_ALD(REG_ATMP1, s1, OFFSET(java_object_t, vftbl));
                                M_ILD(REG_ITMP3, REG_ATMP1, OFFSET(vftbl_t, interfacetablelength));
                                M_IADD_IMM(-superindex, REG_ITMP3);     /* -superindex may be patched patched */
                                M_ITST(REG_ITMP3);
@@ -2061,7 +2072,7 @@ nowperformreturn:
                                        emit_label_beq(cd, BRANCH_LABEL_5);
                                }
 
-                               M_ALD(REG_ATMP1, s1, OFFSET(java_objectheader, vftbl));
+                               M_ALD(REG_ATMP1, s1, OFFSET(java_object_t, vftbl));
 
                                CODEGEN_CRITICAL_SECTION_START;
 
@@ -2151,7 +2162,7 @@ nowperformreturn:
                                                emit_label_beq(cd, BRANCH_LABEL_3);
                                        }
 
-                                       M_ALD(REG_ATMP2, s1, OFFSET(java_objectheader, vftbl));
+                                       M_ALD(REG_ATMP2, s1, OFFSET(java_object_t, vftbl));
                                        M_ILD(REG_ITMP3, REG_ATMP2, OFFSET(vftbl_t, interfacetablelength));
        
                                        M_IADD_IMM(-superindex, REG_ITMP3);     /* superindex patched */
@@ -2182,7 +2193,7 @@ nowperformreturn:
                                                emit_label_beq(cd, BRANCH_LABEL_5);
                                        }
 
-                                       M_ALD(REG_ATMP2, s1, OFFSET(java_objectheader, vftbl));
+                                       M_ALD(REG_ATMP2, s1, OFFSET(java_object_t, vftbl));
 
                                        CODEGEN_CRITICAL_SECTION_START;