Changeset: 4550c67185db for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4550c67185db
Modified Files:
        monetdb5/optimizer/opt_garbageCollector.c
Branch: default
Log Message:

Only cleanup names when you need them in debugging


diffs (62 lines):

diff --git a/monetdb5/optimizer/opt_garbageCollector.c 
b/monetdb5/optimizer/opt_garbageCollector.c
--- a/monetdb5/optimizer/opt_garbageCollector.c
+++ b/monetdb5/optimizer/opt_garbageCollector.c
@@ -25,7 +25,7 @@
 str
 OPTgarbageCollectorImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci)
 {
-       int i, limit;
+       int i, j, limit;
        InstrPtr p;
        int actions = 0;
        char buf[256];
@@ -37,25 +37,37 @@ OPTgarbageCollectorImplementation(Client
        (void) stk;
        if ( mb->inlineProp)
                return 0;
+
+       limit = mb->stop;
        
        used = (char*) GDKzalloc(sizeof(char) * mb->vtop);
        if ( used == NULL)
                throw(MAL, "optimizer.garbagecollector", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
 
        limit = mb->stop;
+       if ( mb->keephistory )
+       {
+               /* In debugging or profiling mode we should cleanup namings*/
+               for( i = 0; i< mb->stop; i++){
+                       p = getInstrPtr(mb, i);
+                       for ( j = p->retc; j < p->argc; j++)
+                               used[getArg(p,j)] = 1;
+               }
 
-       /* variables get their name from the position */
-       /* rename all temporaries used for ease of variable table 
interpretation */
-       /* this code should not be necessary is variables always keep their 
position */
-       for( i = 0; i < mb->vtop; i++){
-               //strcpy(buf, getVarName(mb,i));
-               if (getVarName(mb,i)[0] == 'X' && getVarName(mb,i)[1] == '_')
-                       snprintf(getVarName(mb,i),IDLENGTH,"X_%d",i);
-               else
-               if (getVarName(mb,i)[0] == 'C' && getVarName(mb,i)[1] == '_')
-                       snprintf(getVarName(mb,i),IDLENGTH,"C_%d",i);
-               //if(strcmp(buf, getVarName(mb,i)) )
-                       //fprintf(stderr, "non-matching name/entry %s %s\n", 
buf, getVarName(mb,i));
+               /* variables get their name from the position */
+               /* rename all temporaries used for ease of variable table 
interpretation */
+               /* this code should not be necessary is variables always keep 
their position */
+               for( i = 0; i < mb->vtop; i++)
+               if( used[i]) {
+                       //strcpy(buf, getVarName(mb,i));
+                       if (getVarName(mb,i)[0] == 'X' && getVarName(mb,i)[1] 
== '_')
+                               snprintf(getVarName(mb,i),IDLENGTH,"X_%d",i);
+                       else
+                       if (getVarName(mb,i)[0] == 'C' && getVarName(mb,i)[1] 
== '_')
+                               snprintf(getVarName(mb,i),IDLENGTH,"C_%d",i);
+                       //if(strcmp(buf, getVarName(mb,i)) )
+                               //fprintf(stderr, "non-matching name/entry %s 
%s\n", buf, getVarName(mb,i));
+               }
        }
 
        // move SQL query definition to the front for event profiling tools
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to