* src/vm/jit/stack.c (new_stack_analyse): Ifdeffed handling of new var
authorchristian <none@none>
Wed, 6 Sep 2006 13:46:37 +0000 (13:46 +0000)
committerchristian <none@none>
Wed, 6 Sep 2006 13:46:37 +0000 (13:46 +0000)
system.

* src/vm/jit/stack.h: Likewise.

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

* src/vm/jit/parse.h: Likewise.

* src/vm/jit/jit.h: Ifdeffed structure entries for new var system.

--HG--
branch : new_instruction_format

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

index 9b5a8ae977ff696a0c80c955e4134261a427a71e..affe4b2ea3905c6f3c117dbbeaf83884d6ce1da7 100644 (file)
@@ -30,7 +30,7 @@
    Changes: Christian Thalinger
                        Edwin Steiner
 
-   $Id: jit.h 5363 2006-09-06 10:20:07Z christian $
+   $Id: jit.h 5370 2006-09-06 13:46:37Z christian $
 
 */
 
@@ -116,8 +116,8 @@ struct jitdata {
        s4               new_c_debug_nr;
 
 #if defined(NEW_VAR)
-/*     varinfo **var; */
-/*     int     var_top; */
+       varinfo *var;
+       int     vartop;
     
        int     varcount;
        int     localcount;
@@ -222,16 +222,25 @@ typedef struct {
 /*** s1 operand ***/
 
 typedef union {
+#if defined(NEW_VAR)
+       s4                         varindex;
+#else
     stackptr                   var;
     s4                         localindex;
+#endif
     s4                         argcount;
 } s1_operand_t;
 
 /*** s2 operand ***/
 
 typedef union {
+#if defined(NEW_VAR)
+       s4                         varindex;
+       s4                         *args;
+#else
     stackptr                   var;
     stackptr                  *args;
+#endif
     classref_or_classinfo      c;
     unresolved_class          *uc;
     ptrint                     constval;         /* for PUT*CONST             */
@@ -242,7 +251,11 @@ typedef union {
 /*** s3 operand ***/
 
 typedef union {
+#if defined(NEW_VAR)
+       s4                         varindex;
+#else
     stackptr                   var;
+#endif
     ptrint                     constval;
     classref_or_classinfo      c;
     constant_FMIref           *fmiref;
@@ -270,8 +283,12 @@ typedef union {
 /*** dst operand ***/
 
 typedef union {
+#if defined(VAR_NEW)
+       s4                         varindex;
+#else
     stackptr                   var;
     s4                         localindex;
+#endif
     basicblock                *block;       /* valid after stack analysis     */
     branch_target_t           *table;       /* for TABLESWITCH                */
     lookup_target_t           *lookup;      /* for LOOKUPSWITCH               */
index 031eae696f2af8a8e6aefec7460674390d9a3215..f5d88cb36b2789ca421fc9468ae08102ff0b02d8 100644 (file)
@@ -31,7 +31,7 @@
             Joseph Wenninger
             Christian Thalinger
 
-   $Id: parse.c 5366 2006-09-06 11:01:11Z edwin $
+   $Id: parse.c 5370 2006-09-06 13:46:37Z christian $
 
 */
 
@@ -1298,10 +1298,6 @@ invoke_method:
        jd->new_basicblockcount = b_count;
        jd->new_stackcount = s_count + jd->new_basicblockcount * m->maxstack; /* in-stacks */
 
-#if defined(NEW_VAR)
-       jd->local_map = local_map;
-#endif
-
        /* allocate stack table */
 
        jd->new_stack = DMNEW(stackelement, jd->new_stackcount);
@@ -1404,6 +1400,8 @@ invoke_method:
 #endif
 
 #if defined(NEW_VAR)
+       jd->local_map = local_map;
+
        /* calculate local variable renaming */
 
        {
@@ -1425,7 +1423,14 @@ invoke_method:
                }
 
                jd->localcount = nlocals;
-
+               /* if dropped varindices for temp stackslots get reused(?max 2*       */
+               /* m->maxstack elements for stack), nlocals + s_count would be        */
+               /* sufficient */
+               jd->varcount   = nlocals + s_count + 
+                       jd->new_basicblockcount * m->maxstack;        /* out-stacks */
+               
+               jd->var_top = nlocals;
+               jd->var = DMNEW(varinfo, jd->varcount);
        }
 #endif
 
index 2a2725d9ffe9e5d6233cded9874505c3736b3f5f..73a01b45c0299d63252998bb6788a4292747ceee 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Edwin Steiner
 
-   $Id: parse.h 5366 2006-09-06 11:01:11Z edwin $
+   $Id: parse.h 5370 2006-09-06 13:46:37Z christian $
 
 */
 
     iptr->dst.insindex       = (iindex);                               \
     PINC
 
-#define OP_LOCALINDEX(o,index)                                         \
+#if defined(NEW_VAR)
+# define OP_LOCALINDEX(o,index)                                        \
        OP_PREPARE_ZEROFLAGS(o);                                           \
-    iptr->s1.localindex      = (index);                                \
+    iptr->s1.varindex      = (index);                                \
     PINC
 
-#define OP_LOCALINDEX_I(o,index,v)                                     \
+# define OP_LOCALINDEX_I(o,index,v)                                    \
        OP_PREPARE_ZEROFLAGS(o);                                           \
-    iptr->s1.localindex      = (index);                                \
+    iptr->s1.varindex      = (index);                                  \
     iptr->sx.val.i           = (v);                                    \
     PINC
 
-#if defined(VAR)
-#define LOCALTYPE_USED(index,type)                                                                        \
+# define LOCALTYPE_USED(index,type)                                                                       \
        do {                                                                                                                       \
                local_map[index * 5 +type] = 1;                                                            \
        } while (0)
-#else
-#define LOCALTYPE_USED(index,type)
-#endif
+#else 
+# define OP_LOCALINDEX(o,index)                                        \
+       OP_PREPARE_ZEROFLAGS(o);                                           \
+    iptr->s1.localindex      = (index);                                  \
+    PINC
+
+# define OP_LOCALINDEX_I(o,index,v)                                    \
+       OP_PREPARE_ZEROFLAGS(o);                                           \
+    iptr->s1.localindex      = (index);                                \
+    iptr->sx.val.i           = (v);                                    \
+    PINC
+
+# define LOCALTYPE_USED(index,type)
+#endif /* defined(NEW_VAR) */
 
 #define OP_LOAD_ONEWORD(o,index,type)                                                         \
     do {                                                               \
                LOCALTYPE_USED(index,type);                                                                        \
        } while (0)
 
-#define OP_STORE_ONEWORD(o,index,type)                                                        \
+#if defined(NEW_VAR)
+# define OP_STORE_ONEWORD(o,index,type)                                                               \
+    do {                                                               \
+        INDEX_ONEWORD(index);                                          \
+        OP_PREPARE_ZEROFLAGS(o);                                       \
+        iptr->dst.varindex = (index);                                  \
+               LOCALTYPE_USED(index,type);                                                                        \
+        PINC;                                                          \
+    } while (0)
+
+# define OP_STORE_TWOWORD(o,index,type)                                                               \
+    do {                                                               \
+        INDEX_TWOWORD(index);                                          \
+        OP_PREPARE_ZEROFLAGS(o);                                       \
+        iptr->dst.varindex = (index);                                  \
+               LOCALTYPE_USED(index,type);                                                                        \
+        PINC;                                                          \
+    } while (0)
+#else
+# define OP_STORE_ONEWORD(o,index,type)                                                               \
     do {                                                               \
         INDEX_ONEWORD(index);                                          \
         OP_PREPARE_ZEROFLAGS(o);                                       \
         PINC;                                                          \
     } while (0)
 
-#define OP_STORE_TWOWORD(o,index,type)                                                        \
+# define OP_STORE_TWOWORD(o,index,type)                                                               \
     do {                                                               \
         INDEX_TWOWORD(index);                                          \
         OP_PREPARE_ZEROFLAGS(o);                                       \
                LOCALTYPE_USED(index,type);                                                                        \
         PINC;                                                          \
     } while (0)
+#endif /*  defined(NEW_VAR) */
 
 #define OP_BUILTIN_CHECK_EXCEPTION(bte)                                \
     jd->isleafmethod         = false;                                  \
index 43d5dbdae09a31813ef9c37a3fab03a8cf2eb49b..751e37bcda9e2af1ca68dbbb15df8ebcd1c1d60f 100644 (file)
@@ -30,7 +30,7 @@
             Christian Thalinger
             Christian Ullrich
 
-   $Id: stack.c 5365 2006-09-06 10:56:43Z edwin $
+   $Id: stack.c 5370 2006-09-06 13:46:37Z christian $
 
 */
 
@@ -143,6 +143,123 @@ bool stack_init(void)
    types are not discerned.
 
 *******************************************************************************/
+#if defined(NEW_VAR)
+#define GET_NEW_INDEX(new_varindex)                            \
+       do {                                                                                                                     \
+               assert(jd->vartop < jd->varcount);                                                       \
+               (new_varindex) = (jd->vartop)++;                                                         \
+       } while(0)
+
+/* not implemented now, can be used to reuse varindices */
+#define RELEASE_INDEX(varindex)
+
+#define CLR_S1                                                       \
+    (iptr->s1.varindex = -1)
+
+#define USE_S1_LOCAL(type1)
+
+#define USE_S1(type1)                                                \
+    do {                                                             \
+        REQUIRE_1;                                                   \
+        CHECK_BASIC_TYPE(type1, curstack->type);                     \
+        iptr->s1.varindex = curstack->varnum;                        \
+    } while (0)
+
+#define USE_S1_ANY                                                   \
+    do {                                                             \
+        REQUIRE_1;                                                   \
+        iptr->s1.varindex = curstack->varnum;                        \
+    } while (0)
+
+#define USE_S1_S2(type1, type2)                                      \
+    do {                                                             \
+        REQUIRE_2;                                                   \
+        CHECK_BASIC_TYPE(type1, curstack->prev->type);               \
+        CHECK_BASIC_TYPE(type2, curstack->type);                     \
+        iptr->sx.s23.s2.varindex = curstack->varnum;                 \
+        iptr->s1.varindex = curstack->prev->varnum;                  \
+    } while (0)
+
+#define USE_S1_S2_ANY_ANY                                            \
+    do {                                                             \
+        REQUIRE_2;                                                   \
+        iptr->sx.s23.s2.varindex = curstack->varnum;                 \
+        iptr->s1.varindex = curstack->prev->varnum;                  \
+    } while (0)
+
+#define USE_S1_S2_S3(type1, type2, type3)                            \
+    do {                                                             \
+        REQUIRE_3;                                                   \
+        CHECK_BASIC_TYPE(type1, curstack->prev->prev->type);         \
+        CHECK_BASIC_TYPE(type2, curstack->prev->type);               \
+        CHECK_BASIC_TYPE(type3, curstack->type);                                               \
+        iptr->sx.s23.s3.varindex = curstack->varnum;                                   \
+        iptr->sx.s23.s2.varindex = curstack->prev->varnum;                             \
+        iptr->s1.varindex = curstack->prev->prev->varnum;                              \
+    } while (0)
+
+#define CLR_DST                                                      \
+    (iptr->dst.varindex = -1)
+
+#define DST(typed, varindex)                                         \
+    do {                                                             \
+        NEWSTACKn((varindex));                                                                          \
+        iptr->dst.varindex = (varindex);                                                        \
+    } while (0)
+
+#define DST_LOCALVAR(typed, index)                                   \
+    do {                                                                                                                          \
+        NEWSTACK(typed, LOCALVAR, (index));                                                       \
+        iptr->dst.varindex = (index);                                                             \
+    } while (0)
+
+#define OP0_1(typed)                                                 \
+    do {                                                             \
+        CLR_S1;                                                      \
+               GET_NEW_INDEX(new_index);                                                                        \
+               DST(typed, new_index);                                                                           \
+        stackdepth++;                                                \
+    } while (0)
+
+#define OP1_0_ANY                                                    \
+    do {                                                             \
+        POP_S1_ANY;                                                  \
+        CLR_DST;                                                     \
+        stackdepth--;                                                \
+    } while (0)
+
+#define OP1_BRANCH(type1)                                            \
+    do {                                                             \
+        POP_S1(type1);                                               \
+        stackdepth--;                                                \
+    } while (0)
+
+#define OP1_1(type1, typed)                                          \
+    do {                                                             \
+        POP_S1(type1);                                               \
+               GET_NEW_INDEX(new_index);                                                                        \
+        DST(typed, new_index;                                                                           \
+    } while (0)
+
+#define OP2_1(type1, type2, typed)                                   \
+    do {                                                             \
+        POP_S1_S2(type1, type2);                                     \
+               GET_NEW_INDEX(new_index);                                                                        \
+        DST(typed, new_index);                                                                          \
+               stackdepth--;                                                \
+    } while (0)
+
+#define DUP_SLOT(sp)                                                 \
+    do {                                                             \
+        if ((sp)->varkind != TEMPVAR) {                                                                 \
+                       GET_NEW_INDEX(new_index);                                                                \
+            NEWSTACK((sp)->type, TEMPVAR, new_index);               \
+               }                                                                                                                        \
+        else                                                         \
+            NEWSTACK((sp)->type, (sp)->varkind, (sp)->varnum);       \
+    } while(0)
+
+#else /* defined(NEW_VAR) */
 
 #define CLR_S1                                                       \
     (iptr->s1.var = NULL)
@@ -189,6 +306,65 @@ bool stack_init(void)
         iptr->s1.var = curstack->prev->prev;                         \
     } while (0)
 
+#define CLR_DST                                                      \
+    (iptr->dst.var = NULL)
+
+#define DST(typed, depth)                                            \
+    do {                                                             \
+        NEWSTACKn(typed, (depth));                                   \
+        iptr->dst.var = curstack;                                    \
+    } while (0)
+
+#define DST_LOCALVAR(typed, index)                                   \
+    do {                                                             \
+        NEWSTACK(typed, LOCALVAR, (index));                          \
+        iptr->dst.var = curstack;                                    \
+    } while (0)
+
+#define OP0_1(typed)                                                 \
+    do {                                                             \
+        CLR_S1;                                                      \
+        DST(typed, stackdepth);                                      \
+        stackdepth++;                                                \
+    } while (0)
+
+#define OP1_0_ANY                                                    \
+    do {                                                             \
+        POP_S1_ANY;                                                  \
+        CLR_DST;                                                     \
+        stackdepth--;                                                \
+    } while (0)
+
+#define OP1_BRANCH(type1)                                            \
+    do {                                                             \
+        POP_S1(type1);                                               \
+        stackdepth--;                                                \
+    } while (0)
+
+#define OP1_1(type1, typed)                                          \
+    do {                                                             \
+        POP_S1(type1);                                               \
+        DST(typed, stackdepth - 1);                                  \
+    } while (0)
+
+#define OP2_1(type1, type2, typed)                                   \
+    do {                                                             \
+        POP_S1_S2(type1, type2);                                     \
+        DST(typed, stackdepth - 2);                                  \
+        stackdepth--;                                                \
+    } while (0)
+
+#define DUP_SLOT(sp)                                                 \
+    do {                                                             \
+        if ((sp)->varkind != TEMPVAR)                                \
+            NEWSTACK((sp)->type, TEMPVAR, stackdepth);               \
+        else                                                         \
+            NEWSTACK((sp)->type, (sp)->varkind, (sp)->varnum);       \
+    } while(0)
+
+#endif /* defined(NEW_VAR) */
+
+
 #define POP_S1(type1)                                                \
     do {                                                             \
         USE_S1(type1);                                               \
@@ -240,21 +416,6 @@ bool stack_init(void)
 #define CLR_SX                                                       \
     (iptr->sx.val.l = 0)
 
-#define CLR_DST                                                      \
-    (iptr->dst.var = NULL)
-
-#define DST(typed, depth)                                            \
-    do {                                                             \
-        NEWSTACKn(typed, (depth));                                   \
-        iptr->dst.var = curstack;                                    \
-    } while (0)
-
-#define DST_LOCALVAR(typed, index)                                   \
-    do {                                                             \
-        NEWSTACK(typed, LOCALVAR, (index));                          \
-        iptr->dst.var = curstack;                                    \
-    } while (0)
-
 #define OP0_0                                                        \
     do {                                                             \
         CLR_S1;                                                      \
@@ -266,13 +427,6 @@ bool stack_init(void)
         CLR_S1;                                                      \
     } while (0)
 
-#define OP0_1(typed)                                                 \
-    do {                                                             \
-        CLR_S1;                                                      \
-        DST(typed, stackdepth);                                      \
-        stackdepth++;                                                \
-    } while (0)
-
 #define OP1_0(type1)                                                 \
     do {                                                             \
         POP_S1(type1);                                               \
@@ -280,25 +434,6 @@ bool stack_init(void)
         stackdepth--;                                                \
     } while (0)
 
-#define OP1_0_ANY                                                    \
-    do {                                                             \
-        POP_S1_ANY;                                                  \
-        CLR_DST;                                                     \
-        stackdepth--;                                                \
-    } while (0)
-
-#define OP1_BRANCH(type1)                                            \
-    do {                                                             \
-        POP_S1(type1);                                               \
-        stackdepth--;                                                \
-    } while (0)
-
-#define OP1_1(type1, typed)                                          \
-    do {                                                             \
-        POP_S1(type1);                                               \
-        DST(typed, stackdepth - 1);                                  \
-    } while (0)
-
 #define OP2_0(type1, type2)                                          \
     do {                                                             \
         POP_S1_S2(type1, type2);                                     \
@@ -319,13 +454,6 @@ bool stack_init(void)
         stackdepth -= 2;                                             \
     } while (0)
 
-#define OP2_1(type1, type2, typed)                                   \
-    do {                                                             \
-        POP_S1_S2(type1, type2);                                     \
-        DST(typed, stackdepth - 2);                                  \
-        stackdepth--;                                                \
-    } while (0)
-
 #define OP3_0(type1, type2, type3)                                   \
     do {                                                             \
         POP_S1_S2_S3(type1, type2, type3);                           \
@@ -357,14 +485,6 @@ bool stack_init(void)
         MARKREACHED(tempbptr, tempsp);                               \
     } while (0)
 
-#define DUP_SLOT(sp)                                                 \
-    do {                                                             \
-        if ((sp)->varkind != TEMPVAR)                                \
-            NEWSTACK((sp)->type, TEMPVAR, stackdepth);               \
-        else                                                         \
-            NEWSTACK((sp)->type, (sp)->varkind, (sp)->varnum);       \
-    } while(0)
-
 bool new_stack_analyse(jitdata *jd)
 {
        methodinfo   *m;              /* method being analyzed                    */
@@ -402,7 +522,9 @@ bool new_stack_analyse(jitdata *jd)
 #if defined(ENABLE_STATISTICS)
        int           iteration_count;  /* number of iterations of analysis       */
 #endif
-
+#if defined(NEW_VAR)
+       int           new_index; /* used to get a new var index with GET_NEW_INDEX*/
+#endif
 #if defined(STACK_VERBOSE)
        new_show_method(jd, SHOW_PARSE);
 #endif
@@ -422,7 +544,11 @@ bool new_stack_analyse(jitdata *jd)
        iteration_count = 0;
 #endif
 
+#if defined(NEW_VAR)
+       last_store_boundary = DMNEW(stackptr, jd->localcount);
+#else
        last_store_boundary = DMNEW(stackptr , cd->maxlocals);
+#endif
 
        /* initialize in-stack of first block */
 
@@ -439,12 +565,19 @@ 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;
+#if defined(NEW_VAR)
+               GET_NEW_INDEX(new_index);
+               bptr->invars = DMNEW(s4, 1);
+               bptr->invars[0] = new_index;
+               NEWSTACK(TYPE_ADR, STACKVAR,new_index);
+#else
+               bptr->invars = DMNEW(stackptr, 1);
+               bptr->invars[0] = new;
                NEWXSTACK;
+#endif
        }
 
        /* count predecessors of each block ***************************************/
@@ -571,9 +704,16 @@ bool new_stack_analyse(jitdata *jd)
                                        /* by falling through from the previous block.  */
                                        COPYCURSTACK(copy);
                                        bptr->instack = copy;
+
+#if defined(NEW_VAR)
+                                       bptr->invars = DMNEW(s4, stackdepth);
+                                       for (i=stackdepth; i--; copy = copy->prev)
+                                               bptr->invars[i] = copy->varnum;
+#else
                                        bptr->invars = DMNEW(stackptr, stackdepth);
                                        for (i=stackdepth; i--; copy = copy->prev)
                                                bptr->invars[i] = copy;
+#endif
                                        bptr->indepth = stackdepth;
                                }
                                else {
@@ -660,7 +800,9 @@ icmd_NOP:
                                                USE_S1_LOCAL(TYPE_ADR);
                                                CLR_SX;
                                                CLR_DST;
+#if !defined(NEW_VAR)
                                                IF_NO_INTRP( rd->locals[iptr->s1.localindex][TYPE_ADR].type = TYPE_ADR; );
+#endif
                                                superblockend = true;
                                                break;
 
@@ -1446,13 +1588,17 @@ normal_ACONST:
                                        case ICMD_ALOAD:
                                                COUNT(count_load_instruction);
                                                i = opcode - ICMD_ILOAD;
-
-                                               /* for new vars */
-/*                                             iptr->s1.localindex = jd->local_map[iptr->s1.localindex * 5 + i]; */
+#if defined(NEW_VAR)
+                                               iptr->s1.varindex = 
+                                                       jd->local_map[iptr->s1.varindex * 5 + i];
+               
+                                               LOAD(i, iptr->s1.varindex);
+#else
 
                                                IF_NO_INTRP( rd->locals[iptr->s1.localindex][i].type = 
                                                                         i; )
                                                LOAD(i, iptr->s1.localindex);
+#endif
                                                break;
 
                                                /* pop 2 push 1 */
@@ -1484,10 +1630,14 @@ normal_ACONST:
                                        case ICMD_IINC:
                                                STATISTICS_STACKDEPTH_DISTRIBUTION(count_store_depth);
 
-                                               /* for new vars */
-/*                                             iptr->s1.localindex = jd->local_map[iptr->s1.localindex * 5 + i]; */
+#if defined(NEW_VAR)
+                                               iptr->s1.varindex = 
+                                                       jd->local_map[iptr->s1.varindex * 5 + i];
 
+                                               last_store_boundary[iptr->s1.varindex] = new;
+#else
                                                last_store_boundary[iptr->s1.localindex] = new;
+#endif
 
                                                copy = curstack;
                                                i = stackdepth - 1;
@@ -1496,13 +1646,22 @@ normal_ACONST:
                                                                (copy->varnum == iptr->s1.localindex))
                                                        {
                                                                copy->varkind = TEMPVAR;
+#if defined(NEW_VAR)
+                                                               GET_NEW_INDEX(new_index);
+                                                               copy->varnum = new_index;
+#else
                                                                copy->varnum = i;
+#endif
                                                        }
                                                        i--;
                                                        copy = copy->prev;
                                                }
 
+#if defined(NEW_VAR)
+                                               iptr->dst.varindex = iptr->s1.varindex;
+#else
                                                iptr->dst.localindex = iptr->s1.localindex;
+#endif
                                                break;
 
                                                /* pop 1 push 0 store */
@@ -1515,12 +1674,15 @@ normal_ACONST:
                                                REQUIRE_1;
 
                                                i = opcode - ICMD_ISTORE; /* type */
-                                               j = iptr->dst.localindex; /* index */
+#if defined(NEW_VAR)
+                                               j = iptr->dst.varindex = 
+                                                       jd->local_map[iptr->dst.varindex * 5 + 1]:
 
-                                               /* for new vars */
-/*                                             iptr->dst.localindex = jd->local_map[iptr->dst.localindex * 5 + i]; */
+#else
+                                               j = iptr->dst.localindex; /* index */
 
                                                IF_NO_INTRP( rd->locals[j][i].type = i; )
+#endif
 
 #if defined(ENABLE_STATISTICS)
                                                if (opt_stat) {
@@ -1546,7 +1708,12 @@ normal_ACONST:
                                                                (copy->varnum == j))
                                                        {
                                                                copy->varkind = TEMPVAR;
+#if defined(NEW_VAR)
+                                                               GET_NEW_INDEX(new_index);
+                                                               copy->varnum = new_index;
+#else
                                                                copy->varnum = i;
+#endif
                                                        }
                                                        i--;
                                                        copy = copy->prev;
@@ -1583,7 +1750,10 @@ normal_ACONST:
                                                }
 
                                                /* coalesce the temporary variable with Lj */
-
+#if defined(NEW_VAR)
+                                               assert(currstack->varkind == TEMPVAR);
+                                               RELEASE_INDEX(curstack->varnum);
+#endif
                                                curstack->varkind = LOCALVAR;
                                                curstack->varnum = j;
                                                goto store_tail;
@@ -1594,7 +1764,12 @@ assume_conflict:
                                                        && (curstack->varnum == j))
                                                {
                                                        curstack->varkind = TEMPVAR;
+#if defined(NEW_VAR)
+                                                       GET_NEW_INDEX(new_index);
+                                                       curstack->varnum = new_index;
+#else
                                                        curstack->varnum = stackdepth-1;
+#endif
                                                }
 
                                                /* remember the stack boundary at this store */
@@ -1837,9 +2012,14 @@ store_tail:
 
 icmd_DUP:
                                                USE_S1_ANY; /* XXX live through */
-                                               DUP_SLOT(iptr->s1.var);
+                                               /* DUP_SLOT(iptr->s1.var); */
+                                               DUP_SLOT(curstack);
                                                last_dup_boundary = new - 1;
+#if defined(NEW_VAR)
+                                               iptr->dst.varindex = curstack->varnum;
+#else
                                                iptr->dst.var = curstack;
+#endif
                                                stackdepth++;
                                                break;
 
index 5928156659792525c7c653dda9b38bdec96b40f7..55f47256edf859ee8cc779ae1c0f2d4772e08ca1 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Christian Ullrich
 
-   $Id: stack.h 5367 2006-09-06 11:12:55Z edwin $
+   $Id: stack.h 5370 2006-09-06 13:46:37Z christian $
 
 */
 
 /* ALLOCATING STACK SLOTS                           */
 /*--------------------------------------------------*/
 
-#define NEWSTACK(s,v,n) \
+#define NEWSTACK(s,v,n)        \
     do { \
         new->prev = curstack; \
         new->type = (s); \
 /* allocate the input stack for an exception handler */
 #define NEWXSTACK   {NEWSTACK(TYPE_ADR,STACKVAR,0);curstack=0;}
 
-
 /*--------------------------------------------------*/
 /* STACK MANIPULATION                               */
 /*--------------------------------------------------*/
  * block to another. The destination block receives the copy as its
  * input stack.
  */
-#define COPYCURSTACK(copy) {\
+#if defined(NEW_VAR)
+# define COPYCURSTACK(copy) {\
+       stackptr s;\
+       if(curstack){\
+               s=curstack;\
+               new+=stackdepth;\
+               copy=new;\
+               while(s){\
+                       copy--;                                                         \
+                       copy->prev=copy-1;\
+                       copy->type=s->type;\
+                       copy->flags=0;\
+                       copy->varkind=STACKVAR;\
+                       copy->varnum=s->varnum;\
+                       assert(s->varkind == STACKVAR); \
+                       s=s->prev;\
+                       }\
+               copy->prev=NULL;\
+               copy=new-1;\
+               }\
+       else\
+               copy=NULL;\
+}
+#else
+# define COPYCURSTACK(copy) {\
        int d;\
        stackptr s;\
        if(curstack){\
        else\
                copy=NULL;\
 }
+#endif
 
 /* MARKREACHED marks the destination block <b> as reached. If this
  * block has been reached before we check if stack depth and types