* src/vm/jit/code.h (codeinfo): Added synchronizedoffset
[cacao.git] / src / vm / jit / powerpc / codegen.c
index 657a315b61c83f40500bfe3df3c6bd8f7a7783cd..764b156a4ab14a585519cfc555d1c195ef883a3d 100644 (file)
@@ -137,7 +137,7 @@ bool codegen_emit(jitdata *jd)
           not be shared with place to save the return register on PPC,
           since both values reside in R3. */
 
-       if (checksync && (m->flags & ACC_SYNCHRONIZED))
+       if (checksync && code_is_synchronized(code))
                cd->stackframesize += 2;
 #endif
 
@@ -154,18 +154,17 @@ bool codegen_emit(jitdata *jd)
        (void) dseg_add_unique_address(cd, code);              /* CodeinfoPointer */
        (void) dseg_add_unique_s4(cd, cd->stackframesize * 8); /* 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 + 1) * 8);/* IsSync         */
-       else
-#endif
-               (void) dseg_add_unique_s4(cd, 0);                  /* IsSync          */
+       code->synchronizedoffset = (rd->memuse + 1) * 8;
+
+       /* REMOVEME dummy IsSync */
+       (void) dseg_add_unique_s4(cd, 0);
                                               
        /* REMOVEME: We still need it for exception handling in assembler. */
 
@@ -306,7 +305,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;
@@ -2083,7 +2082,7 @@ nowperformreturn:
                        emit_verbosecall_exit(jd);
 
 #if defined(ENABLE_THREADS)
-                       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+                       if (checksync && code_is_synchronized(code)) {
                                disp = dseg_add_functionptr(cd, LOCK_monitor_exit);
                                M_ALD(REG_ITMP3, REG_PV, disp);
                                M_MTCTR(REG_ITMP3);