* src/vm/jit/code.h (codeinfo): Added synchronizedoffset
[cacao.git] / src / vm / jit / i386 / codegen.c
index 57a79435b113a92ed8f3f01f5240419229e44f11..b5ef6d947486c775341ed437a5447b007c2d101a 100644 (file)
@@ -140,7 +140,7 @@ bool codegen_emit(jitdata *jd)
 #if defined(ENABLE_THREADS)
        /* space to save argument of monitor_enter */
 
-       if (checksync && (m->flags & ACC_SYNCHRONIZED))
+       if (checksync && code_is_synchronized(code))
                cd->stackframesize++;
 #endif
 
@@ -155,19 +155,20 @@ 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. */
+
        if (code_is_leafmethod(code))
                (void) dseg_add_unique_s4(cd, 1);                  /* IsLeaf          */
        else
@@ -361,7 +362,7 @@ bool codegen_emit(jitdata *jd)
        /* call monitorenter function */
 
 #if defined(ENABLE_THREADS)
-       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+       if (checksync && code_is_synchronized(code)) {
                s1 = rd->memuse;
 
                if (m->flags & ACC_STATIC) {
@@ -2746,7 +2747,7 @@ nowperformreturn:
 #endif
 
 #if defined(ENABLE_THREADS)
-                       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+                       if (checksync && code_is_synchronized(code)) {
                                M_ALD(REG_ITMP2, REG_SP, rd->memuse * 8);
 
                                /* we need to save the proper return value */