Changeset: 1c9b33b92a43 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1c9b33b92a43
Modified Files:
        MonetDB5/src/mal/mal.mx
        MonetDB5/src/mal/mal_interpreter.mx
        MonetDB5/src/modules/mal/pcre.mx
        MonetDB5/src/optimizer/opt_dictionary.mx
        MonetDB5/src/optimizer/opt_mapreduce.mx
        MonetDB5/src/optimizer/opt_octopus.mx
        MonetDB5/src/optimizer/opt_qep.mx
        MonetDB5/src/optimizer/opt_reorder.mx
        MonetDB5/src/optimizer/opt_strengthReduction.mx
        MonetDB5/src/optimizer/opt_tarantula.mx
        sql/src/backends/monet5/sql.mx
        sql/src/backends/monet5/sql_emptyset.mx
        sql/src/backends/monet5/sql_optimizer.mx
        sql/src/backends/monet5/sql_scenario.mx
Branch: default
Log Message:

Make sure mclient can handle debugging info.


diffs (truncated from 419 to 300 lines):

diff -r 5f8fce4fbe21 -r 1c9b33b92a43 MonetDB5/src/mal/mal.mx
--- a/MonetDB5/src/mal/mal.mx   Sun Aug 15 11:18:58 2010 +0200
+++ b/MonetDB5/src/mal/mal.mx   Sun Aug 15 20:41:28 2010 +0200
@@ -306,7 +306,7 @@
 #define LIST_MAL_CALL  (LIST_MAL_STMT | LIST_MAL_UDF | LIST_MAL_VALUE )
 #define LIST_MAL_DEBUG  (LIST_MAL_STMT | LIST_MAL_UDF | LIST_MAL_VALUE | 
LIST_MAL_ARG)
 #define LIST_MAL_EXPLAIN  (LIST_MAL_STMT | LIST_MAL_UDF | LIST_MAL_ARG)
-#define LIST_MAL_ALL   (LIST_MAL_STMT | LIST_MAL_TYPE | LIST_MAL_UDF | 
LIST_MAL_PROPS | LIST_MAL_DETAIL  | LIST_MAL_ARG | LIST_MAL_LNR)
+#define LIST_MAL_ALL   (LIST_MAL_STMT | LIST_MAL_TYPE | LIST_MAL_UDF | 
LIST_MAL_PROPS | LIST_MAL_DETAIL  | LIST_MAL_ARG | LIST_MAL_LNR | LIST_MAPI)
 
 #ifndef WORDS_BIGENDIAN
 #define STRUCT_ALIGNED
diff -r 5f8fce4fbe21 -r 1c9b33b92a43 MonetDB5/src/mal/mal_interpreter.mx
--- a/MonetDB5/src/mal/mal_interpreter.mx       Sun Aug 15 11:18:58 2010 +0200
+++ b/MonetDB5/src/mal/mal_interpreter.mx       Sun Aug 15 20:41:28 2010 +0200
@@ -978,7 +978,7 @@
        pci = getInstrPtr(flow->mb, stkpc);
 #ifdef DEBUG_FLOW
        printf("#EXECUTE THREAD %d \n", tid);
-       printInstruction(GDKstdout, flow->mb, 0, pci, LIST_MAL_STMT);
+       printInstruction(GDKstdout, flow->mb, 0, pci, LIST_MAL_STMT | 
LIST_MAPI);
 #endif
        THRset_errbuf(THRget(THRgettid()), cntxt->errbuf);      /* where to 
leave errors */
        if (stk->cmd || mb->trap) {
@@ -1023,7 +1023,7 @@
                if ( DFLOWadmission(argclaim,retclaim,hotclaim) ){
                        PARDEBUG {
                                mnstr_printf(GDKout,"#DFLOWdelay instruction %d 
pool  " LLFMT " claim "LLFMT"\n#", THRgettid(),  memorypool, argclaim+retclaim);
-                               printInstruction(GDKstdout, mb, 0, pci, 
LIST_MAL_STMT);
+                               printInstruction(GDKstdout, mb, 0, pci, 
LIST_MAL_STMT | LIST_MAPI);
                        }
                        for ( ; ; )
                        {
@@ -1031,7 +1031,7 @@
                                if ( DFLOWadmission(argclaim,retclaim,hotclaim) 
== 0) {
                                        PARDEBUG {
                                                mnstr_printf(GDKout,"#DFLOWcont 
 thread %d delay " LLFMT " pool  " LLFMT" delayed " LLFMT " ms\n#", 
THRgettid(),  memorypool, argclaim+retclaim, (GDKusec()-stk->clk)/1000);
-                                               printInstruction(GDKstdout, mb, 
0, pci, LIST_MAL_STMT);
+                                               printInstruction(GDKstdout, mb, 
0, pci, LIST_MAL_STMT | LIST_MAPI);
                                        }
                                        break;
                                }
@@ -1041,7 +1041,7 @@
                                /* re-schedule instructions that require a lot 
of memory for postponed execution */
                                PARDEBUG {
                                        mnstr_printf(GDKout,"#DFLOWrequeue 
instr  %d pool  " LLFMT " claim "LLFMT"\n#", THRgettid(),  memorypool, 
argclaim+retclaim);
-                                       printInstruction(GDKstdout, mb, 0, pci, 
LIST_MAL_STMT);
+                                       printInstruction(GDKstdout, mb, 0, pci, 
LIST_MAL_STMT | LIST_MAPI);
                                }
                                throw(MAL,"DFLOWadmission","failed");
                        }
@@ -1125,7 +1125,7 @@
                oldfs = fs;
 #ifdef DEBUG_FLOW
                if ( fs->pc >= 0)
-                       printInstruction(GDKstdout, fs->flow->mb, 0, 
getInstrPtr(fs->flow->mb,fs->pc), LIST_MAL_STMT);
+                       printInstruction(GDKstdout, fs->flow->mb, 0, 
getInstrPtr(fs->flow->mb,fs->pc), LIST_MAL_STMT | LIST_MAPI);
 #endif
                err = DFLOWstep(task, fs);
                /* restore the instruction and wait in specific cases*/
@@ -1178,7 +1178,7 @@
                int j, a;
 
                PARDEBUG
-                       printInstruction(GDKstdout, flow->mb, 0, p, 
LIST_MAL_STMT);
+                       printInstruction(GDKstdout, flow->mb, 0, p, 
LIST_MAL_STMT | LIST_MAPI);
 
                /* initial state, ie everything can run */
                fs[n].pc = i;
@@ -1258,7 +1258,7 @@
                mnstr_printf(GDKstdout,"#enqueue pc=%d", fs[i].pc);
                for(j=p->retc; j<p->argc; j++)
                        mnstr_printf(GDKstdout," %d ",flow->inuse[getArg(p,j)]);
-               printInstruction(GDKstdout, flow->mb, 0, p, LIST_MAL_STMT);
+               printInstruction(GDKstdout, flow->mb, 0, p, LIST_MAL_STMT | 
LIST_MAPI);
                mnstr_printf(GDKstdout,"\n");
        }
 }
@@ -1319,7 +1319,7 @@
                                mnstr_printf(GDKstdout,"#dequeue pc=%d", f->pc);
                                for(j=p->retc; j<p->argc; j++)
                                        mnstr_printf(GDKstdout," %d 
",flow->inuse[getArg(p,j)]);
-                               printInstruction(GDKstdout, flow->mb, 0, p, 
LIST_MAL_STMT);
+                               printInstruction(GDKstdout, flow->mb, 0, p, 
LIST_MAL_STMT | LIST_MAPI);
                        }
 
                        /* update the input args */
@@ -1381,7 +1381,7 @@
                for ( i =0 ; i<limit; i++)
                        if (fs[i].status != DFLOWwrapup  && fs[i].pc >=0) {
                                mnstr_printf(GDKstdout,"#missed %d %d %d ",  i, 
fs[i].status, fs[i].pc);
-                               printInstruction(GDKstdout, flow->mb, 0, 
getInstrPtr(flow->mb,fs[i].pc), LIST_MAL_STMT);
+                               printInstruction(GDKstdout, flow->mb, 0, 
getInstrPtr(flow->mb,fs[i].pc), LIST_MAL_STMT | LIST_MAPI);
                                candidates++;
                        }
                if ( candidates)
@@ -1406,7 +1406,7 @@
 
 #ifdef DEBUG_FLOW
        mnstr_printf(GDKstdout, "runMALdataflow for block %d - %d\n", 
startpc,stoppc);
-       printFunction(GDKstdout, mb, 0, LIST_MAL_STMT);
+       printFunction(GDKstdout, mb, 0, LIST_MAL_STMT | LIST_MAPI);
 #endif
 
        (void)env;
diff -r 5f8fce4fbe21 -r 1c9b33b92a43 MonetDB5/src/modules/mal/pcre.mx
--- a/MonetDB5/src/modules/mal/pcre.mx  Sun Aug 15 11:18:58 2010 +0200
+++ b/MonetDB5/src/modules/mal/pcre.mx  Sun Aug 15 20:41:28 2010 +0200
@@ -975,10 +975,13 @@
 {
        int escaped = 0;
        int hasWildcard = 0;
-       char *ppat = GDKmalloc(strlen(pat)*2+3 /* 3 = "^'the translated 
regexp'$0" */);
+       char *ppat;
        int esc = esc_str[0]; /* should change to utf8_convert() */
        int specials = 0;
 
+       if (pat == NULL )
+               return GDK_FAIL; 
+       ppat = GDKmalloc(strlen(pat)*2+3 /* 3 = "^'the translated regexp'$0" 
*/);
        if (ppat == NULL)
                return GDK_FAIL; 
 
@@ -1492,6 +1495,8 @@
        if (*s++ != '%') 
                return 0;
 #endif
+       if (s == 0)
+               return 0;
        if (*s == '%') 
                s++;
        while(*s) {
@@ -1535,7 +1540,7 @@
                
        r = PCREsql2pcre(&ppat, pat, esc);
 
-       if (!r) {
+       if (!r && ppat) {
                if (strcmp(ppat, (char*)str_nil) == 0) {
                        /* there is no pattern or escape involved, fall back to
                         * simple (no PCRE) match */
diff -r 5f8fce4fbe21 -r 1c9b33b92a43 MonetDB5/src/optimizer/opt_dictionary.mx
--- a/MonetDB5/src/optimizer/opt_dictionary.mx  Sun Aug 15 11:18:58 2010 +0200
+++ b/MonetDB5/src/optimizer/opt_dictionary.mx  Sun Aug 15 20:41:28 2010 +0200
@@ -220,7 +220,7 @@
        
        OPTDEBUGdictionary{
                mnstr_printf(cntxt->fdout,"#dictionary optimizer\n");
-               printFunction(cntxt->fdout,mb,0,LIST_MAL_DEBUG);
+               printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL);
        }
 
     if ( newMalBlkStmt(mb, mb->ssize) < 0)
diff -r 5f8fce4fbe21 -r 1c9b33b92a43 MonetDB5/src/optimizer/opt_mapreduce.mx
--- a/MonetDB5/src/optimizer/opt_mapreduce.mx   Sun Aug 15 11:18:58 2010 +0200
+++ b/MonetDB5/src/optimizer/opt_mapreduce.mx   Sun Aug 15 20:41:28 2010 +0200
@@ -351,7 +351,7 @@
 
 #if defined(_DEBUG_OPT_MAPREDUCE) && _DEBUG_OPT_MAPREDUCE == 0
        chkProgram(cntxt->nspace, reduce);
-       printFunction(cntxt->fdout, reduce, 0, LIST_MAL_STMT);
+       printFunction(cntxt->fdout, reduce, 0, LIST_MAL_STMT | LIST_MAPI);
 #endif
 
        MRcleanCloud();
@@ -980,11 +980,11 @@
 #if defined(_DEBUG_OPT_MAPREDUCE) && _DEBUG_OPT_MAPREDUCE == 10
        mnstr_printf(cntxt->fdout, "MAP program\n");
        chkProgram(cntxt->nspace, map);
-       printFunction(cntxt->fdout, map, 0, LIST_MAL_STMT);
+       printFunction(cntxt->fdout, map, 0, LIST_MAL_STMT | LIST_MAPI);
 
        mnstr_printf(cntxt->fdout, "REDUCE program\n");
        chkProgram(cntxt->nspace, reduce);
-       printFunction(cntxt->fdout, reduce, 0, LIST_MAL_STMT);
+       printFunction(cntxt->fdout, reduce, 0, LIST_MAL_STMT | LIST_MAPI);
 #endif
 
        GDKfree(omap);
diff -r 5f8fce4fbe21 -r 1c9b33b92a43 MonetDB5/src/optimizer/opt_octopus.mx
--- a/MonetDB5/src/optimizer/opt_octopus.mx     Sun Aug 15 11:18:58 2010 +0200
+++ b/MonetDB5/src/optimizer/opt_octopus.mx     Sun Aug 15 20:41:28 2010 +0200
@@ -421,7 +421,7 @@
                return 0;
        OPTDEBUGoctopus{
                mnstr_printf(cntxt->fdout, "#Octopus optimizer called\n");
-               printFunction(cntxt->fdout, mb, 0, LIST_MAL_STMT);
+               printFunction(cntxt->fdout, mb, 0, LIST_MAL_STMT | LIST_MAPI);
        }
        (void) stk;
 @-
@@ -788,19 +788,19 @@
        OPTDEBUGoctopus
        if (actions) {
                mnstr_printf(cntxt->fdout, "DONE octopus \n");
-               printFunction(cntxt->fdout, mb, 0, LIST_MAL_STMT);
-               printFunction(cntxt->fdout, sm, 0, LIST_MAL_STMT);
+               printFunction(cntxt->fdout, mb, 0, LIST_MAL_STMT | LIST_MAPI);
+               printFunction(cntxt->fdout, sm, 0, LIST_MAL_STMT | LIST_MAPI);
                for (i=0; i<tn; i++){
                        chkDeclarations(tentacle[i]);
                        chkFlow(tentacle[i]);
-                       printFunction(cntxt->fdout, tentacle[i], 0, 
LIST_MAL_STMT);
+                       printFunction(cntxt->fdout, tentacle[i], 0, 
LIST_MAL_STMT | LIST_MAPI);
                }
        }
-/*     printFunction(cntxt->fdout, mb, 0, LIST_MAL_STMT);
-       printFunction(cntxt->fdout, sm, 0, LIST_MAL_STMT);
+/*     printFunction(cntxt->fdout, mb, 0, LIST_MAL_STMT | LIST_MAPI);
+       printFunction(cntxt->fdout, sm, 0, LIST_MAL_STMT | LIST_MAPI);
 
        for (i=0; i<tn; i++)
-               printFunction(GDKout, tentacle[i], 0, LIST_MAL_STMT);
+               printFunction(GDKout, tentacle[i], 0, LIST_MAL_STMT | 
LIST_MAPI);
 */
        GDKfree(wnm);
        GDKfree(tnm);
diff -r 5f8fce4fbe21 -r 1c9b33b92a43 MonetDB5/src/optimizer/opt_qep.mx
--- a/MonetDB5/src/optimizer/opt_qep.mx Sun Aug 15 11:18:58 2010 +0200
+++ b/MonetDB5/src/optimizer/opt_qep.mx Sun Aug 15 20:41:28 2010 +0200
@@ -286,7 +286,7 @@
        str s;
        if( qep->p){
                for(i=0;i<indent; i++) mnstr_printf(f," ");
-               s= instruction2str(qep->mb, 0,qep->p, LIST_MAL_STMT);
+               s= instruction2str(qep->mb, 0,qep->p, LIST_MAL_STMT | 
LIST_MAPI);
                mnstr_printf(f,"%s\n",s);
                GDKfree(s);
                inc = 4;
diff -r 5f8fce4fbe21 -r 1c9b33b92a43 MonetDB5/src/optimizer/opt_reorder.mx
--- a/MonetDB5/src/optimizer/opt_reorder.mx     Sun Aug 15 11:18:58 2010 +0200
+++ b/MonetDB5/src/optimizer/opt_reorder.mx     Sun Aug 15 20:41:28 2010 +0200
@@ -189,7 +189,7 @@
                OPTdepthfirst(cntxt, mb,dep[pc]->stmt[i], old, dep);
                OPTDEBUGreorder{
                        mnstr_printf(cntxt->fdout,"dump[%d]:",pc);
-                       printInstruction(cntxt->fdout,mb,0,p,LIST_MAL_STMT);
+                       printInstruction(cntxt->fdout,mb,0,p,LIST_MAL_STMT | 
LIST_MAPI);
                }
        pushInstruction(mb, p);
 }
@@ -238,7 +238,7 @@
                        for(j=i-1; j>=start;j--) {
                                OPTDEBUGreorder if( old[j]){
                                        mnstr_printf(cntxt->fdout,"leftover: 
%d",start+1);
-                                       
printInstruction(cntxt->fdout,mb,0,old[j],LIST_MAL_STMT);
+                                       
printInstruction(cntxt->fdout,mb,0,old[j],LIST_MAL_STMT | LIST_MAPI);
                                }
                                OPTdepthfirst(cntxt, mb, j, old, dep);
                        }
diff -r 5f8fce4fbe21 -r 1c9b33b92a43 
MonetDB5/src/optimizer/opt_strengthReduction.mx
--- a/MonetDB5/src/optimizer/opt_strengthReduction.mx   Sun Aug 15 11:18:58 
2010 +0200
+++ b/MonetDB5/src/optimizer/opt_strengthReduction.mx   Sun Aug 15 20:41:28 
2010 +0200
@@ -210,10 +210,8 @@
                        for (k = 0; k < q->retc; k++)
                                if (SRoverwritten(p, getArg(q, k))) {
                                        se = TRUE;
-#ifdef DEBUG_OPT_STRENGTHREDUCTION
-                                       mnstr_printf(cntxt->fdout, "variable is 
set in loop %d\n", 
-                                               getArg(p, k));
-#endif
+                                       OPTDEBUGstrengthReduction
+                                               mnstr_printf(cntxt->fdout, 
"variable is set in loop %d\n", getArg(p, k));
                                        goto noreduction;
                                }
                }
@@ -225,18 +223,17 @@
                        if ( getBeginLifespan(span, getArg(p, k))<= blkbegin ||
                                 getEndLifespan(span, getArg(p, k))> blkexit) {
                                se = TRUE;
-#ifdef DEBUG_OPT_STRENGTHREDUCTION
-                               mnstr_printf(cntxt->fdout, "variable %d may not 
be moved %d-%d\n",
-                               getArg(p, k),getBeginLifespan(span, getArg(p, 
k)), getEndLifespan(span, getArg(p, k)));
-#endif
+                               OPTDEBUGstrengthReduction
+                                       mnstr_printf(cntxt->fdout, "variable %d 
may not be moved %d-%d\n",
+                                       getArg(p, k),getBeginLifespan(span, 
getArg(p, k)), getEndLifespan(span, getArg(p, k)));
                                goto noreduction;
                        }
 
   noreduction:
-#ifdef DEBUG_OPT_STRENGTHREDUCTION
-               mnstr_printf(cntxt->fdout,"move %d to stack %s\n", i, (se 
?"within":"before"));
-               printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL);
-#endif
+               OPTDEBUGstrengthReduction{
+                       mnstr_printf(cntxt->fdout,"move %d to stack %s\n", i, 
(se ?"within":"before"));
+                       printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL);
+               }
                if (blkexit && se == FALSE && !hasSideEffects(p, TRUE) && 
!isUpdateInstruction(p) )
                        before[bk++] = p;
                else
@@ -257,9 +254,9 @@
        }
        mb->stop = 0;
 
-#ifdef DEBUG_OPT_STRENGTHREDUCTION
-       mnstr_printf(cntxt->fdout,"stop= %d bk=%d\n",mb->stop,bk);
-#endif
+       OPTDEBUGstrengthReduction
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to