* src/vm/jit/code.h (codeinfo): Removed basicblocks and isleafmethod.
authortwisti <none@none>
Mon, 10 Jul 2006 14:02:25 +0000 (14:02 +0000)
committertwisti <none@none>
Mon, 10 Jul 2006 14:02:25 +0000 (14:02 +0000)
* src/vm/jit/jit.h (jitdata): Added isleafmethod.

* src/vm/jit/alpha/codegen.c (codegen): Use jd->isleafmethod. Pass
register number to codegen_add_classcastexception_ref.

* src/vm/jit/allocator/simplereg.c (interface_regalloc): Use
jd->isleafmethod.
(local_regalloc): Likewise.

* src/vm/jit/parse.c (new_parse): Likewise.
(parse): Likewise.

* src/vm/jit/parse.h (NEW_OP_BUILTIN_CHECK_EXCEPTION): Likewise.
(NEW_OP_BUILTIN_NO_EXCEPTION): Likewise.
(NEW_OP_BUILTIN_ARITHMETIC): Likewise.
(BUILTIN): Likewise.

src/vm/jit/allocator/simplereg.c
src/vm/jit/alpha/codegen.c
src/vm/jit/code.h
src/vm/jit/jit.h
src/vm/jit/parse.c
src/vm/jit/parse.h

index de42e2e6105983bcf1d80ec7101281918dfd688d..540498b9e905d9e546aeac7148ec1aaee2fe98b6 100644 (file)
@@ -32,7 +32,7 @@
             Michael Starzinger
             Edwin Steiner
 
-   $Id: simplereg.c 5079 2006-07-06 11:36:01Z twisti $
+   $Id: simplereg.c 5096 2006-07-10 14:02:25Z twisti $
 
 */
 
@@ -124,7 +124,6 @@ bool regalloc(jitdata *jd)
 static void interface_regalloc(jitdata *jd)
 {
        methodinfo   *m;
-       codeinfo     *code;
        codegendata  *cd;
        registerdata *rd;
 
@@ -140,10 +139,9 @@ static void interface_regalloc(jitdata *jd)
 
        /* get required compiler data */
 
-       m    = jd->m;
-       code = jd->code;
-       cd   = jd->cd;
-       rd   = jd->rd;
+       m  = jd->m;
+       cd = jd->cd;
+       rd = jd->rd;
 
        /* rd->memuse was already set in stack.c to allocate stack space
           for passing arguments to called methods. */
@@ -156,7 +154,7 @@ static void interface_regalloc(jitdata *jd)
        }
 #endif
 
-       if (code->isleafmethod) {
+       if (jd->isleafmethod) {
                /* Reserve argument register, which will be used for Locals acting */
                /* as Parameters */
                if (rd->argintreguse < m->parseddesc->argintreguse)
@@ -191,7 +189,7 @@ static void interface_regalloc(jitdata *jd)
                                if (!saved) {
 #if defined(HAS_ADDRESS_REGISTER_FILE)
                                        if (IS_ADR_TYPE(t)) {
-                                               if (!code->isleafmethod 
+                                               if (!jd->isleafmethod 
                                                        &&(rd->argadrreguse < ADR_ARG_CNT)) {
                                                        v->regoff = rd->argadrregs[rd->argadrreguse++];
                                                } else if (rd->tmpadrreguse > 0) {
@@ -420,7 +418,6 @@ static void interface_regalloc(jitdata *jd)
 static void local_regalloc(jitdata *jd)
 {
        methodinfo   *m;
-       codeinfo     *code;
        codegendata  *cd;
        registerdata *rd;
 
@@ -437,12 +434,11 @@ static void local_regalloc(jitdata *jd)
 
        /* get required compiler data */
 
-       m    = jd->m;
-       code = jd->code;
-       cd   = jd->cd;
-       rd   = jd->rd;
+       m  = jd->m;
+       cd = jd->cd;
+       rd = jd->rd;
 
-       if (code->isleafmethod) {
+       if (jd->isleafmethod) {
                methoddesc *md = m->parseddesc;
 
                iargcnt = rd->argintreguse;
index 88732afe07bf9e0645759029027c20e4f8448430..11602e0303d3eaf9bb3cdce6c47101a3b0e9d0ee 100644 (file)
@@ -32,7 +32,7 @@
             Christian Ullrich
             Edwin Steiner
 
-   $Id: codegen.c 5071 2006-07-03 13:49:14Z twisti $
+   $Id: codegen.c 5096 2006-07-10 14:02:25Z twisti $
 
 */
 
@@ -117,7 +117,7 @@ bool codegen(jitdata *jd)
        s4 i, p, t, l;
        s4 savedregs_num;
 
-       savedregs_num = (m->isleafmethod) ? 0 : 1;        /* space to save the RA */
+       savedregs_num = (jd->isleafmethod) ? 0 : 1;       /* space to save the RA */
 
        /* space to save used callee saved registers */
 
@@ -153,7 +153,7 @@ bool codegen(jitdata *jd)
 #endif
                (void) dseg_adds4(cd, 0);                          /* IsSync          */
 
-       (void) dseg_adds4(cd, m->isleafmethod);                /* IsLeaf          */
+       (void) dseg_adds4(cd, jd->isleafmethod);               /* IsLeaf          */
        (void) dseg_adds4(cd, INT_SAV_CNT - rd->savintreguse); /* IntSave         */
        (void) dseg_adds4(cd, FLT_SAV_CNT - rd->savfltreguse); /* FltSave         */
 
@@ -178,7 +178,7 @@ bool codegen(jitdata *jd)
        /* save return address and used callee saved registers */
 
        p = stackframesize;
-       if (!m->isleafmethod) {
+       if (!jd->isleafmethod) {
                p--; M_AST(REG_RA, REG_SP, p * 8);
        }
        for (i = INT_SAV_CNT - 1; i >= rd->savintreguse; i--) {
@@ -2992,7 +2992,7 @@ nowperformreturn:
 
                        /* restore return address                                         */
 
-                       if (!m->isleafmethod) {
+                       if (!jd->isleafmethod) {
                                p--; M_LLD(REG_RA, REG_SP, p * 8);
                        }
 
@@ -3321,11 +3321,11 @@ gen_method:
 
                                super = (classinfo *) iptr->val.a;
 
-                               if (!super) {
+                               if (super == NULL) {
                                        superindex = 0;
                                        supervftbl = NULL;
-
-                               else {
+                               }
+                               else {
                                        superindex = super->index;
                                        supervftbl = super->vftbl;
                                }
@@ -3338,18 +3338,18 @@ gen_method:
                                /* calculate interface checkcast code size */
 
                                s2 = 6;
-                               if (!super)
+                               if (super == NULL)
                                        s2 += opt_showdisassemble ? 1 : 0;
 
                                /* calculate class checkcast code size */
 
                                s3 = 9 /* 8 + (s1 == REG_ITMP1) */;
-                               if (!super)
+                               if (super == NULL)
                                        s3 += opt_showdisassemble ? 1 : 0;
 
                                /* if class is not resolved, check which code to call */
 
-                               if (!super) {
+                               if (super == NULL) {
                                        M_BEQZ(s1, 4 + (opt_showdisassemble ? 1 : 0) + s2 + 1 + s3);
 
                                        disp = dseg_adds4(cd, 0);                 /* super->flags */
@@ -3370,11 +3370,11 @@ gen_method:
 
                                /* interface checkcast code */
 
-                               if (!super || (super->flags & ACC_INTERFACE)) {
-                                       if (super) {
+                               if ((super == NULL) || (super->flags & ACC_INTERFACE)) {
+                                       if (super != NULL) {
                                                M_BEQZ(s1, s2);
-
-                                       else {
+                                       }
+                                       else {
                                                codegen_addpatchref(cd,
                                                                                        PATCHER_checkcast_instanceof_interface,
                                                                                        (constant_classref *) iptr->target,
@@ -3389,26 +3389,26 @@ gen_method:
                                                  OFFSET(vftbl_t, interfacetablelength));
                                        M_LDA(REG_ITMP3, REG_ITMP3, -superindex);
                                        M_BLEZ(REG_ITMP3, 0);
-                                       codegen_add_classcastexception_ref(cd);
+                                       codegen_add_classcastexception_ref(cd, s1);
                                        M_ALD(REG_ITMP3, REG_ITMP2,
                                                  (s4) (OFFSET(vftbl_t, interfacetable[0]) -
                                                                superindex * sizeof(methodptr*)));
                                        M_BEQZ(REG_ITMP3, 0);
-                                       codegen_add_classcastexception_ref(cd);
+                                       codegen_add_classcastexception_ref(cd, s1);
 
-                                       if (!super)
+                                       if (super == NULL)
                                                M_BR(s3);
                                }
 
                                /* class checkcast code */
 
-                               if (!super || !(super->flags & ACC_INTERFACE)) {
+                               if ((super == NULL) || !(super->flags & ACC_INTERFACE)) {
                                        disp = dseg_addaddress(cd, supervftbl);
 
-                                       if (super) {
+                                       if (super != NULL) {
                                                M_BEQZ(s1, s3);
-
-                                       else {
+                                       }
+                                       else {
                                                codegen_addpatchref(cd,
                                                                                        PATCHER_checkcast_instanceof_class,
                                                                                        (constant_classref *) iptr->target,
@@ -3443,11 +3443,12 @@ gen_method:
                                        /*                              } */
                                        M_CMPULE(REG_ITMP2, REG_ITMP3, REG_ITMP3);
                                        M_BEQZ(REG_ITMP3, 0);
-                                       codegen_add_classcastexception_ref(cd);
+                                       codegen_add_classcastexception_ref(cd, s1);
                                }
-                               d = codegen_reg_of_var(rd, iptr->opc, iptr->dst, s1);
 
-                       } else {
+                               d = codegen_reg_of_var(rd, iptr->opc, iptr->dst, s1);
+                       }
+                       else {
                                /* array type cast-check */
 
                                s1 = emit_load_s1(jd, iptr, src, rd->argintregs[0]);
@@ -3472,11 +3473,12 @@ gen_method:
                                M_LDA(REG_PV, REG_RA, -disp);
 
                                M_BEQZ(REG_RESULT, 0);
-                               codegen_add_classcastexception_ref(cd);
+                               codegen_add_classcastexception_ref(cd, s1);
 
                                s1 = emit_load_s1(jd, iptr, src, REG_ITMP1);
                                d = codegen_reg_of_var(rd, iptr->opc, iptr->dst, s1);
                        }
+
                        M_INTMOVE(s1, d);
                        emit_store(jd, iptr, iptr->dst, d);
                        break;
@@ -3506,11 +3508,11 @@ gen_method:
 
                        super = (classinfo *) iptr->val.a;
 
-                       if (!super) {
+                       if (super == NULL) {
                                superindex = 0;
                                supervftbl = NULL;
-
-                       else {
+                       }
+                       else {
                                superindex = super->index;
                                supervftbl = super->vftbl;
                        }
@@ -3528,18 +3530,18 @@ gen_method:
                        /* calculate interface instanceof code size */
 
                        s2 = 6;
-                       if (!super)
+                       if (super == NULL)
                                s2 += (d == REG_ITMP2 ? 1 : 0) + (opt_showdisassemble ? 1 : 0);
 
                        /* calculate class instanceof code size */
 
                        s3 = 7;
-                       if (!super)
+                       if (super == NULL)
                                s3 += (opt_showdisassemble ? 1 : 0);
 
                        /* if class is not resolved, check which code to call */
 
-                       if (!super) {
+                       if (super == NULL) {
                                M_CLR(d);
                                M_BEQZ(s1, 4 + (opt_showdisassemble ? 1 : 0) + s2 + 1 + s3);
 
@@ -3561,14 +3563,14 @@ gen_method:
 
                        /* interface instanceof code */
 
-                       if (!super || (super->flags & ACC_INTERFACE)) {
-                               if (super) {
+                       if ((super == NULL) || (super->flags & ACC_INTERFACE)) {
+                               if (super != NULL) {
                                        M_CLR(d);
                                        M_BEQZ(s1, s2);
-
-                               else {
-                                       /* If d == REG_ITMP2, then it's destroyed in check code   */
-                                       /* above.                                                 */
+                               }
+                               else {
+                                       /* If d == REG_ITMP2, then it's destroyed in check
+                                          code above. */
                                        if (d == REG_ITMP2)
                                                M_CLR(d);
 
@@ -3589,20 +3591,20 @@ gen_method:
                                                        superindex * sizeof(methodptr*)));
                                M_CMPULT(REG_ZERO, REG_ITMP1, d);      /* REG_ITMP1 != 0  */
 
-                               if (!super)
+                               if (super == NULL)
                                        M_BR(s3);
                        }
 
                        /* class instanceof code */
 
-                       if (!super || !(super->flags & ACC_INTERFACE)) {
+                       if ((super == NULL) || !(super->flags & ACC_INTERFACE)) {
                                disp = dseg_addaddress(cd, supervftbl);
 
-                               if (super) {
+                               if (super != NULL) {
                                        M_CLR(d);
                                        M_BEQZ(s1, s3);
-
-                               else {
+                               }
+                               else {
                                        codegen_addpatchref(cd, PATCHER_checkcast_instanceof_class,
                                                                                (constant_classref *) iptr->target,
                                                                                disp);
@@ -3785,7 +3787,7 @@ gen_method:
                                M_MOV(REG_PV, rd->argintregs[0]);
                                M_MOV(REG_SP, rd->argintregs[1]);
 
-                               if (m->isleafmethod)
+                               if (jd->isleafmethod)
                                        M_MOV(REG_RA, rd->argintregs[2]);
                                else
                                        M_ALD(rd->argintregs[2],
@@ -3794,7 +3796,7 @@ gen_method:
                                M_LDA(REG_SP, REG_SP, -2 * 8);
                                M_AST(rd->argintregs[3], REG_SP, 0 * 8);         /* store XPC */
 
-                               if (m->isleafmethod)
+                               if (jd->isleafmethod)
                                        M_AST(REG_RA, REG_SP, 1 * 8);
 
                                M_MOV(REG_ITMP3, REG_PV);
@@ -3804,7 +3806,7 @@ gen_method:
 
                                M_MOV(REG_RESULT, REG_ITMP1_XPTR);
 
-                               if (m->isleafmethod)
+                               if (jd->isleafmethod)
                                        M_ALD(REG_RA, REG_SP, 1 * 8);
 
                                M_ALD(REG_ITMP2_XPC, REG_SP, 0 * 8);
@@ -4416,7 +4418,7 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd)
 
        codegen_finish(jd);
 
-       return jd->code->entrypoint;
+       return code->entrypoint;
 }
 
 
index e10cd212cb731dd425c859a157b17e8469f6b0c7..f23c1e25ba228f3be0bde3527697be150a98a6a8 100644 (file)
@@ -59,15 +59,12 @@ struct codeinfo {
        codeinfo     *prev;                 /* previous codeinfo of this method   */
 
        u1            optlevel;             /* optimization level of this code    */
-
        s4            basicblockcount;      /* number of basic blocks             */
-       basicblock   *basicblocks;          /* points to basic block array        */
 
        /* machine code */
        u1           *mcode;                /* pointer to machine code            */
        u1           *entrypoint;           /* machine code entry point           */
        s4            mcodelength;          /* length of generated machine code   */
-       bool          isleafmethod;         /* does method call subroutines       */
 
        /* replacement */                                   
        rplpoint     *rplpoints;            /* replacement points                 */
index 5a927e1469b660288e4333b25876935db6f56020..aab3b11e5d48d9c3e813f831dc85b2c728d99f23 100644 (file)
@@ -30,7 +30,7 @@
    Changes: Christian Thalinger
                        Edwin Steiner
 
-   $Id: jit.h 5052 2006-06-28 17:05:46Z twisti $
+   $Id: jit.h 5096 2006-07-10 14:02:25Z twisti $
 
 */
 
@@ -95,7 +95,9 @@ struct jitdata {
 #if defined(ENABLE_LOOP)
        loopdata        *ld;
 #endif
+
        u4               flags;             /* contains JIT compiler flags        */
+       bool             isleafmethod;      /* does method call subroutines       */
 
        new_instruction *new_instructions;
        basicblock      *new_basicblocks;
index f61c1267490f009dc7c40dbbeb7ac52097285e48..3a1c0e2f72851f89f243aec14f471da18693a8f6 100644 (file)
@@ -31,7 +31,7 @@
             Joseph Wenninger
             Christian Thalinger
 
-   $Id: parse.c 5079 2006-07-06 11:36:01Z twisti $
+   $Id: parse.c 5096 2006-07-10 14:02:25Z twisti $
 
 */
 
@@ -278,7 +278,7 @@ bool new_parse(jitdata *jd)
 
 #if defined(ENABLE_THREADS)
        if (checksync && (m->flags & ACC_SYNCHRONIZED))
-               code->isleafmethod = false;
+               jd->isleafmethod = false;
 #endif
 
        /* setup line number info */
@@ -658,7 +658,7 @@ fetch_opcode:
                        break;
 
                case JAVA_MULTIANEWARRAY:
-                       code->isleafmethod = false;
+                       jd->isleafmethod = false;
                        i = code_get_u2(p + 1, m);
                        {
                                s4 v = code_get_u1(p + 3, m);
@@ -900,7 +900,7 @@ jsr_tail:
 
                case JAVA_AASTORE:
                        NEW_OP(opcode);
-                       code->isleafmethod = false;
+                       jd->isleafmethod = false;
                        break;
 
                case JAVA_GETSTATIC:
@@ -987,7 +987,7 @@ invoke_nonstatic_method:
                                        return false;
 
 invoke_method:
-                       code->isleafmethod = false;
+                       jd->isleafmethod = false;
 
                        NEW_OP_PREPARE_ZEROFLAGS(opcode);
                        iptr->sx.s23.s3.fmiref = mr;
@@ -1047,7 +1047,7 @@ invoke_method:
                        if (cr->name->text[0] == '[') {
                                /* array type cast-check */
                                flags = INS_FLAG_ARRAY;
-                               code->isleafmethod = false;
+                               jd->isleafmethod = false;
                        }
                        else {
                                /* object type cast-check */
@@ -1544,7 +1544,7 @@ bool parse(jitdata *jd)
 
 #if defined(ENABLE_THREADS)
        if (checksync && (m->flags & ACC_SYNCHRONIZED))
-               code->isleafmethod = false;
+               jd->isleafmethod = false;
 #endif
 
        /* scan all java instructions */
@@ -1913,7 +1913,7 @@ fetch_opcode:
                        break;
 
                case JAVA_MULTIANEWARRAY:
-                       code->isleafmethod = false;
+                       jd->isleafmethod = false;
                        i = code_get_u2(p + 1, m);
                        {
                                s4 v = code_get_u1(p + 3, m);
@@ -2135,7 +2135,7 @@ fetch_opcode:
 
                case JAVA_AASTORE:
                        OP(opcode);
-                       code->isleafmethod = false;
+                       jd->isleafmethod = false;
                        break;
 
                case JAVA_GETSTATIC:
@@ -2232,7 +2232,7 @@ invoke_nonstatic_method:
                                        return false;
 
 invoke_method:
-                       code->isleafmethod = false;
+                       jd->isleafmethod = false;
 
                        OP2A_NOINC(opcode, 0, mr, currentline);
 
@@ -2302,7 +2302,7 @@ invoke_method:
                        if (cr->name->text[0] == '[') {
                                /* array type cast-check */
                                OP2AT(opcode, 0, c, cr, currentline);
-                               code->isleafmethod = false;
+                               jd->isleafmethod = false;
 
                        } 
                        else {
@@ -2368,7 +2368,7 @@ invoke_method:
 #if !SUPPORT_DIVISION
                        bte = builtintable_get_internal(BUILTIN_idiv);
                        OP2A(opcode, bte->md->paramcount, bte, currentline);
-                       code->isleafmethod = false;
+                       jd->isleafmethod = false;
 #else
                        OP(opcode);
 #endif
@@ -2378,7 +2378,7 @@ invoke_method:
 #if !SUPPORT_DIVISION
                        bte = builtintable_get_internal(BUILTIN_irem);
                        OP2A(opcode, bte->md->paramcount, bte, currentline);
-                       code->isleafmethod = false;
+                       jd->isleafmethod = false;
 #else
                        OP(opcode);
 #endif
@@ -2388,7 +2388,7 @@ invoke_method:
 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
                        bte = builtintable_get_internal(BUILTIN_ldiv);
                        OP2A(opcode, bte->md->paramcount, bte, currentline);
-                       code->isleafmethod = false;
+                       jd->isleafmethod = false;
 #else
                        OP(opcode);
 #endif
@@ -2398,7 +2398,7 @@ invoke_method:
 #if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
                        bte = builtintable_get_internal(BUILTIN_lrem);
                        OP2A(opcode, bte->md->paramcount, bte, currentline);
-                       code->isleafmethod = false;
+                       jd->isleafmethod = false;
 #else
                        OP(opcode);
 #endif
index 3e1eb90263d00bb6bc9e44d51d8500e2b26fcc10..4decb5ec2d4d5dc52c1f683b4aa7b0197a388c6a 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Edwin Steiner
 
-   $Id: parse.h 5079 2006-07-06 11:36:01Z twisti $
+   $Id: parse.h 5096 2006-07-10 14:02:25Z twisti $
 
 */
 
     } while (0)
 
 #define NEW_OP_BUILTIN_CHECK_EXCEPTION(bte)                            \
-    code->isleafmethod       = false;                                  \
+    jd->isleafmethod         = false;                                  \
        NEW_OP_PREPARE_ZEROFLAGS(ICMD_BUILTIN);                            \
     iptr->sx.s23.s3.bte      = (bte);                                  \
     PINC
 
 #define NEW_OP_BUILTIN_NO_EXCEPTION(bte)                               \
-    code->isleafmethod       = false;                                  \
+    jd->isleafmethod         = false;                                  \
        NEW_OP_PREPARE(ICMD_BUILTIN);                                      \
     iptr->sx.s23.s3.bte      = (bte);                                  \
     iptr->flags.bits         = INS_FLAG_NOCHECK;                       \
     PINC
 
 #define NEW_OP_BUILTIN_ARITHMETIC(opcode, bte)                         \
-    code->isleafmethod       = false;                                  \
+    jd->isleafmethod         = false;                                  \
        NEW_OP_PREPARE_ZEROFLAGS(opcode);                                  \
     iptr->sx.s23.s3.bte      = (bte);                                  \
     PINC
     PINC
 
 #define BUILTIN(v,o1,t,l) \
-    code->isleafmethod = false; \
-    iptr->opc          = ICMD_BUILTIN; \
-    iptr->op1          = (o1); \
-    iptr->val.a        = (v); \
-    iptr->target       = (t); \
-    iptr->line         = (l); \
+    jd->isleafmethod = false; \
+    iptr->opc        = ICMD_BUILTIN; \
+    iptr->op1        = (o1); \
+    iptr->val.a      = (v); \
+    iptr->target     = (t); \
+    iptr->line       = (l); \
     PINC
 
 #define OP1LOAD_ONEWORD(o,o1) \