Changeset: 61c91eeab5e6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=61c91eeab5e6
Modified Files:
        monetdb5/optimizer/opt_accumulators.mx
        monetdb5/optimizer/opt_aliases.mx
        monetdb5/optimizer/opt_coercion.mx
        monetdb5/optimizer/opt_commonTerms.mx
        monetdb5/optimizer/opt_constants.mx
        monetdb5/optimizer/opt_costModel.mx
        monetdb5/optimizer/opt_datacyclotron.mx
        monetdb5/optimizer/opt_dataflow.mx
        monetdb5/optimizer/opt_deadcode.mx
        monetdb5/optimizer/opt_derivepath.mx
        monetdb5/optimizer/opt_dictionary.mx
        monetdb5/optimizer/opt_emptySet.mx
        monetdb5/optimizer/opt_evaluate.mx
        monetdb5/optimizer/opt_garbageCollector.mx
        monetdb5/optimizer/opt_history.mx
        monetdb5/optimizer/opt_inline.mx
        monetdb5/optimizer/opt_joinpath.mx
        monetdb5/optimizer/opt_joinselect.mx
        monetdb5/optimizer/opt_mapreduce.mx
        monetdb5/optimizer/opt_mergetable.mx
        monetdb5/optimizer/opt_mitosis.mx
        monetdb5/optimizer/opt_multiplex.mx
        monetdb5/optimizer/opt_octopus.mx
        monetdb5/optimizer/opt_origin.mx
        monetdb5/optimizer/opt_peephole.mx
        monetdb5/optimizer/opt_prejoin.mx
        monetdb5/optimizer/opt_pushranges.mx
        monetdb5/optimizer/opt_recycler.mx
        monetdb5/optimizer/opt_reduce.mx
        monetdb5/optimizer/opt_remap.mx
        monetdb5/optimizer/opt_remoteQueries.mx
        monetdb5/optimizer/opt_reorder.mx
        monetdb5/optimizer/opt_singleton.mx
        monetdb5/optimizer/opt_statistics.c
        monetdb5/optimizer/opt_strengthReduction.mx
        monetdb5/optimizer/optimizer.mx
        monetdb5/optimizer/optimizerWrapper.mx
Branch: Aug2011
Log Message:

Backout changeset 08566c54e91b.
It's still a bad idea to use a global variable to send debug output to
all clients even if they didn't ask for it, but there is something to
be said for sending the output to clients that did ask for it (the mal
debugger).


diffs (truncated from 1771 to 300 lines):

diff --git a/monetdb5/optimizer/opt_accumulators.mx 
b/monetdb5/optimizer/opt_accumulators.mx
--- a/monetdb5/optimizer/opt_accumulators.mx
+++ b/monetdb5/optimizer/opt_accumulators.mx
@@ -107,7 +107,7 @@ OPTaccumulatorsImplementation(Client cnt
                        continue;
                }
                OPTDEBUGaccumulators
-                       printInstruction(GDKstdout, mb, 0, p, LIST_MAL_ALL);
+                       printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL);
                if (p->retc==1 && p->argc == 2) {
                        /* unary operation, avoid clash with binary */
                        pushInstruction(mb,p);
@@ -134,8 +134,8 @@ OPTaccumulatorsImplementation(Client cnt
                        typeChecker(scope, mb, p, TRUE);
                        if (mb->errors || p->typechk == TYPE_UNKNOWN) {
                                OPTDEBUGaccumulators{
-                                       mnstr_printf(GDKstdout,"# Failed 
typecheck");
-                                       printInstruction(GDKstdout, mb, 0, p, 
LIST_MAL_ALL);
+                                       mnstr_printf(cntxt->fdout,"# Failed 
typecheck");
+                                       printInstruction(cntxt->fdout, mb, 0, 
p, LIST_MAL_ALL);
                                }
                                /* reset instruction error buffer */
                                cntxt->errbuf[0]=0;
@@ -144,15 +144,15 @@ OPTaccumulatorsImplementation(Client cnt
                                p=q; /* restore */
                        } else  {
                                OPTDEBUGaccumulators{
-                                       mnstr_printf(GDKstdout, "#Found 
accumulation candidate ");
-                                       mnstr_printf(GDKstdout, "%d: %d(%d)\n", 
i, getArg(p,0),getArg(p,2));
-                                       printInstruction(GDKstdout, mb, 0, p, 
LIST_MAL_ALL);
+                                       mnstr_printf(cntxt->fdout, "#Found 
accumulation candidate ");
+                                       mnstr_printf(cntxt->fdout, "%d: 
%d(%d)\n", i, getArg(p,0),getArg(p,2));
+                                       printInstruction(cntxt->fdout, mb, 0, 
p, LIST_MAL_ALL);
                                }
                                freeInstruction(q);
                                actions++;  
                        }
                        OPTDEBUGaccumulators
-                               printInstruction(GDKstdout, mb, 0, p, 
LIST_MAL_ALL);
+                               printInstruction(cntxt->fdout, mb, 0, p, 
LIST_MAL_ALL);
                }
                pushInstruction(mb,p);
        } 
@@ -162,7 +162,7 @@ OPTaccumulatorsImplementation(Client cnt
        GDKfree(old);
        GDKfree(span);
        DEBUGoptimizers
-               mnstr_printf(GDKstdout,"#opt_accumulators:%d 
accumulations\n",actions);
+               mnstr_printf(cntxt->fdout,"#opt_accumulators:%d 
accumulations\n",actions);
        return actions;
 }
 
diff --git a/monetdb5/optimizer/opt_aliases.mx 
b/monetdb5/optimizer/opt_aliases.mx
--- a/monetdb5/optimizer/opt_aliases.mx
+++ b/monetdb5/optimizer/opt_aliases.mx
@@ -175,7 +175,7 @@ OPTaliasesImplementation(Client cntxt, M
        GDKfree(span);
        GDKfree(alias);
        DEBUGoptimizers
-               mnstr_printf(GDKstdout,"#opt_aliases: %d removed\n",actions);
+               mnstr_printf(cntxt->fdout,"#opt_aliases: %d removed\n",actions);
        return actions;
 }
 @include optimizerWrapper.mx
diff --git a/monetdb5/optimizer/opt_coercion.mx 
b/monetdb5/optimizer/opt_coercion.mx
--- a/monetdb5/optimizer/opt_coercion.mx
+++ b/monetdb5/optimizer/opt_coercion.mx
@@ -112,7 +112,7 @@ OPTcoercionImplementation(Client cntxt,M
         * structure. A cheaper optimizer is sufficient.
         */
        DEBUGoptimizers
-               mnstr_printf(GDKstdout,"#opt_coercion: %d coersions 
applied\n",actions);
+               mnstr_printf(cntxt->fdout,"#opt_coercion: %d coersions 
applied\n",actions);
        return actions;
 }
 @include optimizerWrapper.mx
diff --git a/monetdb5/optimizer/opt_commonTerms.mx 
b/monetdb5/optimizer/opt_commonTerms.mx
--- a/monetdb5/optimizer/opt_commonTerms.mx
+++ b/monetdb5/optimizer/opt_commonTerms.mx
@@ -189,15 +189,15 @@ OPTcommonTermsImplementation(Client cntx
                barrier |= getFunctionId(p) == assertRef;
                if (p->token == NOOPsymbol || p->token == ASSIGNsymbol || 
barrier /* || p->retc == p->argc */) {
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-                               mnstr_printf(GDKstdout, "COMMON SKIPPED[%d] %d 
%d\n",i, barrier, p->retc == p->argc);
+                               mnstr_printf(cntxt->fdout, "COMMON SKIPPED[%d] 
%d %d\n",i, barrier, p->retc == p->argc);
 #endif
                        continue;
                }
 
                /* from here we have a candidate to look for a match */
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-               mnstr_printf(GDKstdout,"#CANDIDATE[%d] ",i);
-               printInstruction(GDKstdout, mb, 0, p, LIST_MAL_ALL);
+               mnstr_printf(cntxt->fdout,"#CANDIDATE[%d] ",i);
+               printInstruction(cntxt->fdout, mb, 0, p, LIST_MAL_ALL);
 #endif
                prop = hasSideEffects(p,TRUE) || isUpdateInstruction(p);
                j =     isVarConstant(mb, getArg(p,p->argc-1))? cstlist: 
candidate;
@@ -206,11 +206,11 @@ OPTcommonTermsImplementation(Client cntx
                for (; j ; j = list[j]) 
                        if ( (q=getInstrPtr(mb,j))->fcn == p->fcn  && 
!isUnsafeFunction(q)){
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-                       mnstr_printf(GDKstdout,"#CANDIDATE %d, %d  %d %d ", i, 
j, 
+                       mnstr_printf(cntxt->fdout,"#CANDIDATE %d, %d  %d %d ", 
i, j, 
                                hasSameSignature(mb, p, q, p->retc), 
                                hasSameArguments(mb, p, q));
-                               printInstruction(GDKstdout, mb, 0, q, 
LIST_MAL_ALL);
-                               mnstr_printf(GDKstdout," :%d %d %d=%d %d %d %d 
%d %d\n", 
+                               printInstruction(cntxt->fdout, mb, 0, q, 
LIST_MAL_ALL);
+                               mnstr_printf(cntxt->fdout," :%d %d %d=%d %d %d 
%d %d %d\n", 
                                        q->token != ASSIGNsymbol ,
                                        list[getArg(q,q->argc-1)],i,
                                        !hasCommonResults(p, q), 
@@ -232,13 +232,13 @@ OPTcommonTermsImplementation(Client cntx
                                   ) {
                                                if (safetyBarrier(p, q) ){
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-                                               
mnstr_printf(GDKstdout,"#safetybarrier reached\n");
+                                               
mnstr_printf(cntxt->fdout,"#safetybarrier reached\n");
 #endif
                                                break;
                                        }
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-                                               mnstr_printf(GDKstdout, "Found 
a common expression " "%d <-> %d\n", j, i);
-                                               printInstruction(GDKstdout, mb, 
0, q, LIST_MAL_ALL);
+                                               mnstr_printf(cntxt->fdout, 
"Found a common expression " "%d <-> %d\n", j, i);
+                                               printInstruction(cntxt->fdout, 
mb, 0, q, LIST_MAL_ALL);
 #endif
                                        clrFunction(p);
                                        p->argc = p->retc;
@@ -247,8 +247,8 @@ OPTcommonTermsImplementation(Client cntx
                                                p= pushArgument(mb,p, 
getArg(q,k));
                                        }
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-                                       mnstr_printf(GDKstdout, "COMMON 
MODIFIED EXPRESSION %d -> %d\n",i,j);
-                                       printInstruction(GDKstdout, mb, 0, p, 
LIST_MAL_ALL);
+                                       mnstr_printf(cntxt->fdout, "COMMON 
MODIFIED EXPRESSION %d -> %d\n",i,j);
+                                       printInstruction(cntxt->fdout, mb, 0, 
p, LIST_MAL_ALL);
 #endif
                                        actions++;
                                        break; /* end of search */
@@ -256,8 +256,8 @@ OPTcommonTermsImplementation(Client cntx
                        }
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
                        else if ( hasSideEffects(q, TRUE) || 
isUpdateInstruction(p)){
-                               mnstr_printf(GDKstdout, "COMMON SKIPPED %d 
%d\n", hasSideEffects(q, TRUE) , isUpdateInstruction(p));
-                               printInstruction(GDKstdout, mb, 0, q, 
LIST_MAL_ALL);
+                               mnstr_printf(cntxt->fdout, "COMMON SKIPPED %d 
%d\n", hasSideEffects(q, TRUE) , isUpdateInstruction(p));
+                               printInstruction(cntxt->fdout, mb, 0, q, 
LIST_MAL_ALL);
                        }
 #endif
        }
@@ -269,9 +269,9 @@ OPTcommonTermsImplementation(Client cntx
        GDKfree(old);
        GDKfree(alias);
        DEBUGoptimizers
-               mnstr_printf(GDKstdout,"#opt_commonTerms: %d statements 
catched\n",actions);
+               mnstr_printf(cntxt->fdout,"#opt_commonTerms: %d statements 
catched\n",actions);
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
-               mnstr_printf(GDKstdout,"#opt_commonTerms: %d statements 
catched\n",actions);
+               mnstr_printf(cntxt->fdout,"#opt_commonTerms: %d statements 
catched\n",actions);
 #endif
        return actions;
 }
diff --git a/monetdb5/optimizer/opt_constants.mx 
b/monetdb5/optimizer/opt_constants.mx
--- a/monetdb5/optimizer/opt_constants.mx
+++ b/monetdb5/optimizer/opt_constants.mx
@@ -66,7 +66,7 @@ OPTconstantsImplementation(Client cntxt,
        int *alias, *index;
        VarPtr x,y, *cst;
 
-       OPTDEBUGconstants mnstr_printf(GDKstdout,"#OPT_CONSTANTS: MATCHING 
CONSTANTS ELEMENTS\n");
+       OPTDEBUGconstants mnstr_printf(cntxt->fdout,"#OPT_CONSTANTS: MATCHING 
CONSTANTS ELEMENTS\n");
 
        alias= (int*) GDKzalloc(sizeof(int) * mb->vtop);
        cst= (VarPtr*) GDKzalloc(sizeof(VarPtr) * mb->vtop);
@@ -95,9 +95,9 @@ OPTconstantsImplementation(Client cntxt,
                                         x->value.vtype == y->value.vtype &&
                                        ATOMcmp(x->value.vtype, 
VALget(&x->value), VALget(&y->value)) == 0){
                                        OPTDEBUGconstants {
-                                               
mnstr_printf(GDKstdout,"#opt_constants: matching elements %s %d %d ", 
getVarName(mb,i), i,k);
-                                               
ATOMprint(x->value.vtype,VALget(&x->value),GDKstdout);
-                                               mnstr_printf(GDKstdout,"\n");
+                                               
mnstr_printf(cntxt->fdout,"#opt_constants: matching elements %s %d %d ", 
getVarName(mb,i), i,k);
+                                               
ATOMprint(x->value.vtype,VALget(&x->value),cntxt->fdout);
+                                               mnstr_printf(cntxt->fdout,"\n");
                                        }
                                        /* re-use a constant */
                                        alias[i]= index[k];
@@ -107,7 +107,7 @@ OPTconstantsImplementation(Client cntxt,
                                }
                        }
                        if ( fnd == 0){
-                               OPTDEBUGconstants mnstr_printf(GDKstdout,"swith 
elements %d %d\n", i,n);
+                               OPTDEBUGconstants 
mnstr_printf(cntxt->fdout,"swith elements %d %d\n", i,n);
                                cst[n]= x;
                                index[n]= i;
                                n++;
@@ -120,7 +120,7 @@ OPTconstantsImplementation(Client cntxt,
                        getArg(p,k) = alias[getArg(p,k)];
        }
        DEBUGoptimizers
-               mnstr_printf(GDKstdout,"#opt_constants: %d constant duplicates 
removed\n", actions);
+               mnstr_printf(cntxt->fdout,"#opt_constants: %d constant 
duplicates removed\n", actions);
        GDKfree(alias);
        GDKfree(cst);
        GDKfree(index);
diff --git a/monetdb5/optimizer/opt_costModel.mx 
b/monetdb5/optimizer/opt_costModel.mx
--- a/monetdb5/optimizer/opt_costModel.mx
+++ b/monetdb5/optimizer/opt_costModel.mx
@@ -110,8 +110,8 @@ comment "Estimate the cost of a relation
                k = (@3);
                varSetProp(mb, getArg(p,@4), rowsProp, op_eq, 
VALset(&v,TYPE_wrd,&k));
                OPTDEBUGcostModel {
-                       mnstr_printf(GDKstdout,"COST of @1 @2 into @4: " SSZFMT 
"\n",k);
-                       printInstruction(GDKstdout,mb,0,p,0);
+                       mnstr_printf(cntxt->fdout,"COST of @1 @2 into @4: " 
SSZFMT "\n",k);
+                       printInstruction(cntxt->fdout,mb,0,p,0);
                }
 }
 @= newRows1
@@ -290,7 +290,7 @@ OPTcostModelImplementation(Client cntxt,
                }
        }
        DEBUGoptimizers
-               mnstr_printf(GDKstdout,"#opt_costModel: processed\n");
+               mnstr_printf(cntxt->fdout,"#opt_costModel: processed\n");
        return 1;
 }
 @include optimizerWrapper.mx
diff --git a/monetdb5/optimizer/opt_datacyclotron.mx 
b/monetdb5/optimizer/opt_datacyclotron.mx
--- a/monetdb5/optimizer/opt_datacyclotron.mx
+++ b/monetdb5/optimizer/opt_datacyclotron.mx
@@ -284,8 +284,8 @@ OPTdatacyclotronImplementation(Client cn
                goto out;
 
        OPTDEBUGdatacyclotron {
-               mnstr_printf(GDKstdout,"ENTERING DATA CYCLOTRON \n");
-               printFunction(GDKstdout,mb,0,LIST_MAL_ALL);
+               mnstr_printf(cntxt->fdout,"ENTERING DATA CYCLOTRON \n");
+               printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL);
        }
        limit= mb->stop;
        old = mb->stmt;
@@ -458,11 +458,11 @@ OPTdatacyclotronImplementation(Client cn
 out:
        OPTDEBUGdatacyclotron {
                if (errors && mb->errors)
-                       mnstr_printf(GDKstdout,"DATA CYCLOTRON FAILED\n");
+                       mnstr_printf(cntxt->fdout,"DATA CYCLOTRON FAILED\n");
                else
-                       mnstr_printf(GDKstdout,"LEAVING DATA CYCLOTRON \n");
+                       mnstr_printf(cntxt->fdout,"LEAVING DATA CYCLOTRON \n");
                chkProgram(cntxt->nspace,mb);
-               printFunction(GDKstdout,mb,0,LIST_MAL_ALL);
+               printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL);
        }
 
        if (old && (errors || mb->errors) ) {
diff --git a/monetdb5/optimizer/opt_dataflow.mx 
b/monetdb5/optimizer/opt_dataflow.mx
--- a/monetdb5/optimizer/opt_dataflow.mx
+++ b/monetdb5/optimizer/opt_dataflow.mx
@@ -246,7 +246,7 @@ OPTdataflowImplementation(Client cntxt, 
        GDKfree(span);
        GDKfree(init);
        DEBUGoptimizers
-               mnstr_printf(GDKstdout,"#opt_dataflow: %d flow blocks 
created\n",actions);
+               mnstr_printf(cntxt->fdout,"#opt_dataflow: %d flow blocks 
created\n",actions);
        return actions;
 }
 @include optimizerWrapper.mx
diff --git a/monetdb5/optimizer/opt_deadcode.mx 
b/monetdb5/optimizer/opt_deadcode.mx
--- a/monetdb5/optimizer/opt_deadcode.mx
+++ b/monetdb5/optimizer/opt_deadcode.mx
@@ -150,7 +150,7 @@ OPTdeadcodeImplementation(Client cntxt, 
                if( old[i])
                        freeInstruction(old[i]);
        DEBUGoptimizers
-               mnstr_printf(GDKstdout,"#opt_deadcode: %d statements 
removed\n", actions);
+               mnstr_printf(cntxt->fdout,"#opt_deadcode: %d statements 
removed\n", actions);
        GDKfree(old);
        /* we may have uncovered new use-less operations */
        if (actions) 
diff --git a/monetdb5/optimizer/opt_derivepath.mx 
b/monetdb5/optimizer/opt_derivepath.mx
--- a/monetdb5/optimizer/opt_derivepath.mx
+++ b/monetdb5/optimizer/opt_derivepath.mx
@@ -127,8 +127,8 @@ OPTderivePathImplementation(Client cntxt
                                pc[getArg(p,1)] = i;
                                actions++;
                                OPTDEBUGderivePath {
-                                       mnstr_printf(GDKstdout,"#new derivePath 
instruction\n");
-                                       printInstruction(GDKstdout,mb, 0, p, 
LIST_MAL_ALL);
+                                       mnstr_printf(cntxt->fdout,"#new 
derivePath instruction\n");
+                                       printInstruction(cntxt->fdout,mb, 0, p, 
LIST_MAL_ALL);
                                }
                }
                if (getModuleId(p) == groupRef && p->argc == 5 && 
(getFunctionId(p) == deriveRef || getFunctionId(p) == doneRef)){
@@ -147,8 +147,8 @@ OPTderivePathImplementation(Client cntxt
                                freeInstruction(p);
                                p= q;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to