Update of /cvsroot/monetdb/pathfinder/compiler/mil
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10665/mil

Modified Files:
      Tag: XQuery_0-18
        mil_opt.c 
Log Message:
[ 1730617 ] XQ: 32 docs

- bugfix: after the dead-code optimized conditional administration has overflown
          we must *give-up* elimination of statements, rather than just stopping
          the variable usage-tracking. 
- increase the conditional admin max-depth from 32 to 32767



Index: mil_opt.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/mil_opt.c,v
retrieving revision 1.28.2.1
retrieving revision 1.28.2.2
diff -u -d -r1.28.2.1 -r1.28.2.2
--- mil_opt.c   6 Jun 2007 14:00:42 -0000       1.28.2.1
+++ mil_opt.c   6 Jun 2007 16:18:07 -0000       1.28.2.2
@@ -381,7 +381,7 @@
 
        /* OK, delete the statements */
        do {
-               o->stmts[stmt].deleted = 1; 
+               o->stmts[stmt].deleted = o->delete;
                o->stmts[stmt].nilassign = 0; 
                if (++stmt == OPT_STMTS) stmt = 0;
        } while (stmt != until);
@@ -455,7 +455,7 @@
  */
 static void opt_elim(opt_t* o, unsigned int stmt, int kill_nilassign) {
        unsigned int assigns_to = o->stmts[stmt].assigns_to;
-       if ((assigns_to < 32768) & (o->stmts[stmt].used == 0) & 
o->stmts[stmt].inactive & (o->curvar+1 < OPT_VARS)) { 
+       if ((assigns_to < 32768) & (o->stmts[stmt].used == 0) & 
o->stmts[stmt].inactive & (o->curvar+1 < OPT_VARS)) {
                char *p = o->stmts[stmt].mil;
 
                o->stmts[stmt].assigns_to |= 32768; /* this ensures we kill the 
statement only once */
@@ -472,7 +472,7 @@
                        if (p[0] == ':' && p[1] == '=') {
                                *p++ = 0; /* special case: "var x := y" =>  
"var x ;" */
                        } 
-                       o->stmts[stmt].deleted = 1;
+                       o->stmts[stmt].deleted = o->delete;
                }
                /* decrement the references (if any) and try to eliminate more 
*/ 
                while(o->stmts[stmt].refs > 0) {
@@ -527,7 +527,7 @@
 #endif
                opt_elimvar(o, o->curvar = i, 0);
                if (o->stmts[stmt].stmt_nr == o->vars[i].def_stmt_nr && 
o->stmts[stmt].used == 0) {
-                       o->stmts[stmt].deleted = 1;
+                       o->stmts[stmt].deleted = o->delete;
                }
        }
 }
@@ -578,7 +578,7 @@
                }
        } else {
                /* delete this statement */
-               o->stmts[stmt].deleted = 1;
+               o->stmts[stmt].deleted = o->delete;
        }
 }
 
@@ -747,7 +747,9 @@
                                        o->condifelse[o->condlevel] = 
o->else_statement;
                                        opt_start_cond(o, OPT_COND(o));
                                        o->else_statement = o->if_statement = 0;
-                               }
+                               } else if (o->if_statement | o->else_statement) 
{
+                                        o->delete = 0; /* after if-nesting 
overflow we cannot guarantee correctness further on anymore */
+                                }
                                break; /* blocks are separate statements */
                        } else if (p[0]  == '}') {
                                char *q = opt_skip(p+1, 1); /* peek over 
whitespace & comment */
@@ -874,6 +876,7 @@
        if (o) {
                memset(o, 0, sizeof(opt_t));
                o->optimize = optimize;
+               o->delete = 1;
                o->sec = OPT_SEC_IGNORE;
                opt_setname("if", &name_if);
                opt_setname("else", &name_else);


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to