* src/vm/jit/jit.h (basicblock): Added fields invars and outvars.
authoredwin <none@none>
Tue, 5 Sep 2006 11:40:03 +0000 (11:40 +0000)
committeredwin <none@none>
Tue, 5 Sep 2006 11:40:03 +0000 (11:40 +0000)
* src/vm/jit/stack.h (MARKREACHED): Set invars.
* src/vm/jit/stack.c (new_stack_analyse): Set invars and outvars.
* src/vm/jit/show.c (new_show_basicblock): Show invars and outvars.

--HG--
branch : new_instruction_format

src/vm/jit/jit.h
src/vm/jit/show.c
src/vm/jit/stack.c
src/vm/jit/stack.h

index 9a7961047a01eb33586a505a8e98753ae273fe5f..f9977b015596f2990e5a0f72dd4fba32c7eaf82e 100644 (file)
@@ -30,7 +30,7 @@
    Changes: Christian Thalinger
                        Edwin Steiner
 
-   $Id: jit.h 5310 2006-09-05 11:34:49Z edwin $
+   $Id: jit.h 5311 2006-09-05 11:40:03Z edwin $
 
 */
 
@@ -417,7 +417,9 @@ struct basicblock {
        s4            icount;       /* number of intermediate code instructions   */
        s4            mpc;          /* machine code pc at start of block          */
        stackptr      instack;      /* stack at begin of basic block              */
+       stackptr     *invars;       /* array of in-variables at begin of block    */
        stackptr      outstack;     /* stack at end of basic block                */
+       stackptr     *outvars;      /* array of out-variables at end of block     */
        s4            indepth;      /* stack depth at begin of basic block        */
        s4            outdepth;     /* stack depth end of basic block             */
 
index fa4da00e1979c82ce3136970701da1be76f20673..76a96da9e4116ae6371041aa68c22e8f5c1bd791 100644 (file)
@@ -410,6 +410,12 @@ void new_show_basicblock(jitdata *jd, basicblock *bptr, int stage)
 
                printf("]):\n");
 
+               if (stage >= SHOW_STACK) {
+                       printf("IN:  ");
+                       new_show_variable_array(jd, bptr->invars, bptr->indepth, stage);
+                       printf("\n");
+               }
+
                iptr = /*XXX*/ (new_instruction *) bptr->iinstr;
 
                for (i = 0; i < bptr->icount; i++, iptr++) {
@@ -419,6 +425,12 @@ void new_show_basicblock(jitdata *jd, basicblock *bptr, int stage)
                        printf("\n");
                }
 
+               if (stage >= SHOW_STACK) {
+                       printf("OUT: ");
+                       new_show_variable_array(jd, bptr->outvars, bptr->outdepth, stage);
+                       printf("\n");
+               }
+
 #if defined(ENABLE_DISASSEMBLER)
                if ((stage >= SHOW_CODE) && JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd) &&
                        (!deadcode)) {
index e6b2573c386fb802526fa80a08d0a04fe7f0a2b4..521fcf455aaf47e1f78b091b05abbfd9c5f88532 100644 (file)
@@ -30,7 +30,7 @@
             Christian Thalinger
             Christian Ullrich
 
-   $Id: stack.c 5310 2006-09-05 11:34:49Z edwin $
+   $Id: stack.c 5311 2006-09-05 11:40:03Z edwin $
 
 */
 
@@ -432,7 +432,8 @@ bool new_stack_analyse(jitdata *jd)
 
        new = jd->new_stack;
        jd->new_basicblocks[0].flags = BBREACHED;
-       jd->new_basicblocks[0].instack = 0;
+       jd->new_basicblocks[0].instack = NULL;
+       jd->new_basicblocks[0].invars = NULL;
        jd->new_basicblocks[0].indepth = 0;
 
        /* initialize in-stack of exception handlers */
@@ -442,6 +443,8 @@ bool new_stack_analyse(jitdata *jd)
                bptr->flags = BBREACHED;
                bptr->type = BBTYPE_EXH;
                bptr->instack = new;
+               bptr->invars = DMNEW(stackptr, 1);
+               bptr->invars[0] = new;
                bptr->indepth = 1;
                bptr->predecessorcount = CFG_UNKNOWN_PREDECESSORS;
                STACKRESET;
@@ -572,6 +575,9 @@ bool new_stack_analyse(jitdata *jd)
                                        /* by falling through from the previous block.  */
                                        COPYCURSTACK(copy);
                                        bptr->instack = copy;
+                                       bptr->invars = DMNEW(stackptr, stackdepth);
+                                       for (i=stackdepth; i--; copy = copy->prev)
+                                               bptr->invars[i] = copy;
                                        bptr->indepth = stackdepth;
                                }
                                else {
@@ -2692,6 +2698,9 @@ icmd_BUILTIN:
 
                                bptr->outstack = curstack;
                                bptr->outdepth = stackdepth;
+                               bptr->outvars = DMNEW(stackptr, stackdepth);
+                               for (i = stackdepth, copy = curstack; i--; copy = copy->prev)
+                                       bptr->outvars[i] = copy;
 
                                /* stack slots at basic block end become interfaces */
 
index 02b2d41553accc0e55282dd4a4743574eab772ae..a08d5f2e53f40e5de297569472163c9164c99a96 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Christian Ullrich
 
-   $Id: stack.h 5303 2006-09-05 10:39:58Z edwin $
+   $Id: stack.h 5311 2006-09-05 11:40:03Z edwin $
 
 */
 
  * c...current stack
  */
 
+/* XXX this macro is much too big! */
+
 #define MARKREACHED(b,c) \
     do { \
                if ((b) <= (bptr)) \
                        (b)->bitflags |= BBFLAG_REPLACEMENT; \
            if ((b)->flags < BBREACHED) { \
+                       int locali; \
                    COPYCURSTACK((c)); \
             (b)->flags = BBREACHED; \
             (b)->instack = (c); \
             (b)->indepth = stackdepth; \
+                       (b)->invars = DMNEW(stackptr, stackdepth); \
+                       for (locali = stackdepth; locali--; (c) = (c)->prev) \
+                               (b)->invars[locali] = (c); \
         } else { \
             stackptr s = curstack; \
             stackptr t = (b)->instack; \