* src/vm/jit/code.h (codeinfo): Added synchronizedoffset
[cacao.git] / src / vm / jit / arm / codegen.c
index f3ee6e3baad21bf81b41f29636c2abac1ccbdd1b..abb5586a5ba05d9fc25f56c39b2b277fbf01c2b4 100644 (file)
@@ -129,7 +129,7 @@ bool codegen_emit(jitdata *jd)
        spilledregs_num = rd->memuse;
 
 #if defined(ENABLE_THREADS)        /* space to save argument of monitor_enter */
-       if (checksync && (m->flags & ACC_SYNCHRONIZED))
+       if (checksync && code_is_synchronized(code))
                spilledregs_num++;
 #endif
 
@@ -147,18 +147,17 @@ bool codegen_emit(jitdata *jd)
        (void) dseg_add_unique_address(cd, code);              /* CodeinfoPointer */
        (void) dseg_add_unique_s4(cd, cd->stackframesize);     /* FrameSize       */
 
-#if defined(ENABLE_THREADS)
        /* IsSync contains the offset relative to the stack pointer for the
           argument of monitor_exit used in the exception handler. Since the
           offset could be zero and give a wrong meaning of the flag it is
           offset by one.
        */
+       /* XXX Remove this "offset by one". */
 
-       if (checksync && (m->flags & ACC_SYNCHRONIZED))
-               (void) dseg_add_unique_s4(cd, rd->memuse * 8 + 4);/* IsSync         */
-       else
-#endif
-               (void) dseg_add_unique_s4(cd, 0);                  /* IsSync          */
+       code->synchronizedoffset = rd->memuse * 8 + 4;
+
+       /* REMOVEME dummy IsSync */
+       (void) dseg_add_unique_s4(cd, 0);
 
        /* REMOVEME: We still need it for exception handling in assembler. */
 
@@ -288,7 +287,7 @@ bool codegen_emit(jitdata *jd)
 #if defined(ENABLE_THREADS)
        /* call monitorenter function */
 
-       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+       if (checksync && code_is_synchronized(code)) {
                /* stack offset for monitor argument */
 
                s1 = rd->memuse * 8;
@@ -2126,7 +2125,7 @@ bool codegen_emit(jitdata *jd)
 #if defined(ENABLE_THREADS)
                        /* call monitorexit function */
 
-                       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+                       if (checksync && code_is_synchronized(code)) {
                                /* stack offset for monitor argument */
 
                                s1 = rd->memuse * 8;