* src/vm/jit/code.h (codeinfo): Added synchronizedoffset
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Sat, 13 Oct 2007 14:48:33 +0000 (16:48 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Sat, 13 Oct 2007 14:48:33 +0000 (16:48 +0200)
(temporarily).

* src/vm/exceptions.c (exceptions_handle_exception): Don't use IsSync
but code->synchronizedoffset.

* src/vm/jit/allocator/lsra.c,
src/vm/jit/allocator/simplereg.c,
src/vm/jit/code.c: Use code_is_synchronized.

* src/vm/jit/alpha/codegen.c,
src/vm/jit/arm/codegen.c,
src/vm/jit/i386/codegen.c,
src/vm/jit/m68k/codegen.c,
src/vm/jit/mips/codegen.c,
src/vm/jit/powerpc/codegen.c,
src/vm/jit/powerpc64/codegen.c,
src/vm/jit/s390/codegen.c,
src/vm/jit/sparc64/codegen.c,
src/vm/jit/x86_64/codegen.c: Use code_is_synchronized and set
code->synchronizedoffset.

15 files changed:
src/vm/exceptions.c
src/vm/jit/allocator/lsra.c
src/vm/jit/allocator/simplereg.c
src/vm/jit/alpha/codegen.c
src/vm/jit/arm/codegen.c
src/vm/jit/code.c
src/vm/jit/code.h
src/vm/jit/i386/codegen.c
src/vm/jit/m68k/codegen.c
src/vm/jit/mips/codegen.c
src/vm/jit/powerpc/codegen.c
src/vm/jit/powerpc64/codegen.c
src/vm/jit/s390/codegen.c
src/vm/jit/sparc64/codegen.c
src/vm/jit/x86_64/codegen.c

index fc0c5efe18bca0e5a0f128e17ed0721bcc7fe149..1139c512900815ecdbe8aa3f58d91799dbbd58a0 100644 (file)
@@ -1713,7 +1713,6 @@ u1 *exceptions_handle_exception(java_object_t *xptro, u1 *xpc, u1 *pv, u1 *sp)
        java_handle_t         *xptr;
        methodinfo            *m;
        codeinfo              *code;
-       s4                     issync;
        dseg_exception_entry  *ex;
        s4                     exceptiontablelength;
        s4                     i;
@@ -1740,10 +1739,10 @@ u1 *exceptions_handle_exception(java_object_t *xptro, u1 *xpc, u1 *pv, u1 *sp)
 
        result = NULL;
 
-       /* get info from the method header */
+       /* Get the codeinfo for the current method. */
+
+       code = code_get_codeinfo_for_pv(pv);
 
-       code                 = *((codeinfo **)            (pv + CodeinfoPointer));
-       issync               = *((s4 *)                   (pv + IsSync));
        ex                   =   (dseg_exception_entry *) (pv + ExTableStart);
        exceptiontablelength = *((s4 *)                   (pv + ExTableSize));
 
@@ -1868,16 +1867,16 @@ u1 *exceptions_handle_exception(java_object_t *xptro, u1 *xpc, u1 *pv, u1 *sp)
        }
 
 #if defined(ENABLE_THREADS)
-       /* is this method synchronized? */
+       /* Is this method realization synchronized? */
 
-       if (issync) {
-               /* get synchronization object */
+       if (code_is_synchronized(code)) {
+               /* Get synchronization object. */
 
 # if (defined(__MIPS__) && (SIZEOF_VOID_P == 4)) || defined(__I386__) || defined(__S390__) || defined(__POWERPC__)
                /* XXX change this if we ever want to use 4-byte stackslots */
-               o = *((java_object_t **) (sp + issync - 8));
+               o = *((java_object_t **) (sp + code->synchronizedoffset - 8));
 # else
-               o = *((java_object_t **) (sp + issync - SIZEOF_VOID_P));
+               o = *((java_object_t **) (sp + code->synchronizedoffset - SIZEOF_VOID_P));
 # endif
 
                assert(o != NULL);
index d3a949cf51a740d53c8d95a69ac381fa3964920c..b8fc55ac8da5b1f5d46c2d6d0ea71a6992d61a23 100644 (file)
@@ -1300,7 +1300,7 @@ void lsra_main(jitdata *jd) {
        /* rd->memuse was already set in stack.c to allocate stack space for */
        /* passing arguments to called methods */
 #if defined(__I386__)
-       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+       if (checksync && code_is_synchronized(code)) {
                /* reserve 0(%esp) for Monitorenter/exit Argument on i386 */
                if (rd->memuse < 1)
                        rd->memuse = 1;
index be17bd03753e8f770eb9204a09a90eb432bc9a1d..d400406f0e4e5171dc0d032efd0d9c6501333f80 100644 (file)
@@ -344,7 +344,7 @@ static void simplereg_allocate_interfaces(jitdata *jd)
           for passing arguments to called methods. */
 
 #if defined(__I386__)
-       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+       if (checksync && code_is_synchronized(code)) {
                /* reserve 0(%esp) for Monitorenter/exit Argument on i386 */
                if (rd->memuse < 1)
                        rd->memuse = 1;
index d97819e1337aa39442cc879cb8f294b37f1cb4d9..ed9064e01f4aa213a3ddccdc015a6ef36092fa0f 100644 (file)
@@ -128,7 +128,7 @@ bool codegen_emit(jitdata *jd)
        cd->stackframesize = rd->memuse + savedregs_num;
 
 #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
 
@@ -141,18 +141,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. */
 
@@ -248,7 +247,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)) {
                /* stack offset for monitor argument */
 
                s1 = rd->memuse;
@@ -2392,7 +2391,7 @@ nowperformreturn:
 #endif
 
 #if defined(ENABLE_THREADS)
-                       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+                       if (checksync && code_is_synchronized(code)) {
                                M_ALD(REG_A0, REG_SP, rd->memuse * 8);
 
                                switch (iptr->opc) {
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;
index 8b9360abcf1420abb16808fb3ba10c54658355d0..a7ce525cde29eb8157862840723aaaa542d88058 100644 (file)
@@ -228,7 +228,7 @@ int code_get_sync_slot_count(codeinfo *code)
        if (!checksync)
                return 0;
 
-       if (!(code->m->flags & ACC_SYNCHRONIZED))
+       if (!code_is_synchronized(code))
                return 0;
 
        count = 1;
index c998325dad0a89c103f096d3fcbd59002cc79d4d..05b5d28ad83cb4d7a12ff19c0dec8e2be4f4a0ef 100644 (file)
@@ -70,6 +70,8 @@ struct codeinfo {
        u1            optlevel;             /* optimization level of this code    */
        s4            basicblockcount;      /* number of basic blocks             */
 
+       int32_t       synchronizedoffset;   /* stack offset of synchronized obj.  */
+
        /* machine code */
        u1           *mcode;                /* pointer to machine code            */
        u1           *entrypoint;           /* machine code entry point           */
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 */
index 8f29667621addbfe6c69d3b647e4345a4102faca..d3d28007b64f3f7d8f4368e8243f723a4df26910 100644 (file)
@@ -126,7 +126,7 @@ bool codegen_emit(jitdata *jd)
 #if 0
 #if defined(ENABLE_THREADS)
                /* we need additional space to save argument of monitor_enter */
-               if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+               if (checksync && code_is_synchronized(code))    {
                        if (IS_2_WORD_TYPE(m->parseddesc->returntype.type))     {
                                cd->stackframesize += 2;
                        } else  {
@@ -139,12 +139,13 @@ bool codegen_emit(jitdata *jd)
                /* create method header */
                (void) dseg_add_unique_address(cd, code);              /* CodeinfoPointer */
                (void) dseg_add_unique_s4(cd, cd->stackframesize);         /* FrameSize       */
-#if defined(ENABLE_THREADS)
-               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          */
+
+               /* XXX Remove this "offset by one". */
+
+               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. */
 
@@ -269,7 +270,7 @@ bool codegen_emit(jitdata *jd)
 
 #if defined(ENABLE_THREADS)
        /* call lock_monitor_enter function */
-       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+       if (checksync && code_is_synchronized(code))    {
                if (m->flags & ACC_STATIC)      {
                        M_AMOV_IMM((&m->class->object.header), REG_ATMP1);
                } else  {
@@ -1893,7 +1894,7 @@ nowperformreturn:
 
 #if defined(ENABLE_THREADS)
                        /* call lock_monitor_exit */
-                       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+                       if (checksync && code_is_synchronized(code)) {
                                M_ILD(REG_ITMP3, REG_SP, rd->memuse * 8);
 
                                /* we need to save the proper return value */
index b12731dae81abb79ab7d8e78314d79fb849272f6..2fbf949e27e424dae1c8eb37c651ea84827756e2 100644 (file)
@@ -130,7 +130,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)) {
 # if SIZEOF_VOID_P == 8
                cd->stackframesize++;
 # else
@@ -150,18 +150,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. */
 
@@ -289,7 +288,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)) {
                /* stack offset for monitor argument */
 
                s1 = rd->memuse;
@@ -2838,7 +2837,7 @@ nowperformreturn:
 #endif
 
 #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);
 
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);
index 08c3bd142c1cc4cb2bf970cf99920159d34f8f13..0fe923374b79bb83b006bbc811bd65a9d4665ef2 100644 (file)
@@ -135,7 +135,7 @@ bool codegen_emit(jitdata *jd)
     /* monitor_exit. The stack position for the argument can not be shared  */
        /* with place to save the return register on PPC64, since both values     */
        /* reside in R3 */
-       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+       if (checksync && code_is_synchronized(code)) {
                /* reserve 2 slots for long/double return values for monitorexit */
                cd->stackframesize += 2;
        }
@@ -156,19 +156,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. */
 
@@ -267,7 +265,7 @@ bool codegen_emit(jitdata *jd)
 
 #if defined(ENABLE_THREADS)
 
-       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+       if (checksync && code_is_synchronized(code)) {
 
                /* stackoffset for argument used for LOCK_monitor_exit */
                s1 = rd->memuse;
@@ -1868,7 +1866,7 @@ nowperformreturn:
 #endif         
 
 #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_ALD(REG_ITMP3, REG_ITMP3, 0); /* TOC */
index a15094e304fbdb9f3bc02e2f5c033412e153c62d..bfe32a153babca2a7750ea4f2debbeabfb0ca8b2 100644 (file)
@@ -186,7 +186,7 @@ bool codegen_emit(jitdata *jd)
           not be shared with place to save the return register
           since both values reside in R2. */
 
-       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+       if (checksync && code_is_synchronized(code)) {
                /* 1 slot space to save argument of monitor_enter */
                /* 1 slot to temporary store return value before monitor_exit */
                cd->stackframesize += 2;
@@ -206,18 +206,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. */
 
@@ -369,7 +368,7 @@ bool codegen_emit(jitdata *jd)
        /* save monitorenter argument */
 
 #if defined(ENABLE_THREADS)
-       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+       if (checksync && code_is_synchronized(code)) {
                /* stack offset for monitor argument */
 
                s1 = rd->memuse;
@@ -2604,7 +2603,7 @@ nowperformreturn:
 #endif /* !defined(NDEBUG) */
 
 #if defined(ENABLE_THREADS)
-                       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+                       if (checksync && code_is_synchronized(code)) {
                                /* we need to save the proper return value */
 
                                switch (iptr->opc) {
index ff5e41fc1443dc337afc4f53efcadcc801e485c7..794b456a48549981439cb8ea4780f2472291c37a 100644 (file)
@@ -175,7 +175,7 @@ bool codegen_emit(jitdata *jd)
        cd->stackframesize = rd->memuse + savedregs_num;
 
 #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
 
@@ -189,18 +189,17 @@ bool codegen_emit(jitdata *jd)
        (void) dseg_add_unique_address(cd, code);              /* CodeinfoPointer */
        framesize_disp = 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, JITSTACK + (rd->memuse + 1) * 8); /* IsSync */
-       else
-#endif
-               (void) dseg_add_unique_s4(cd, 0);                  /* IsSync          */
+       code->synchronizedoffset = JITSTACK + (rd->memuse + 1) * 8;
+
+       /* REMOVEME dummy IsSync */
+       (void) dseg_add_unique_s4(cd, 0);
                                               
        /* REMOVEME: We still need it for exception handling in assembler. */
 
@@ -251,7 +250,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)) {
                /* stack offset for monitor argument */
 
                s1 = rd->memuse;
@@ -2290,7 +2289,7 @@ nowperformreturn:
 #endif
 
 #if defined(ENABLE_THREADS)
-                       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+                       if (checksync && code_is_synchronized(code)) {
                                /* XXX jit-c-call */
                                disp = dseg_add_functionptr(cd, LOCK_monitor_exit);
                                M_ALD(REG_ITMP3, REG_PV, disp);
index 05da87aa1fcaa8bd84fb6ddfb7d8b78ccddb859d..bb6a779a3d0a01bccc88f1feb49e11202cc4fe05 100644 (file)
@@ -136,7 +136,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
 
@@ -152,18 +152,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);
                                               
        if (code_is_leafmethod(code))
                (void) dseg_add_unique_s4(cd, 1);                  /* IsLeaf          */
@@ -268,7 +267,7 @@ bool codegen_emit(jitdata *jd)
        /* save monitorenter argument */
 
 #if defined(ENABLE_THREADS)
-       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+       if (checksync && code_is_synchronized(code)) {
                /* stack offset for monitor argument */
 
                s1 = rd->memuse;
@@ -2202,7 +2201,7 @@ nowperformreturn:
 #endif /* !defined(NDEBUG) */
 
 #if defined(ENABLE_THREADS)
-                       if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
+                       if (checksync && code_is_synchronized(code)) {
                                M_ALD(REG_A0, REG_SP, rd->memuse * 8);
        
                                /* we need to save the proper return value */