Changeset: 69f187111a4e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=69f187111a4e
Modified Files:
        clients/Tests/exports.stable.out
        monetdb5/extras/mal_optimizer_template/opt_sql_append.c
        monetdb5/mal/mal.c
        monetdb5/mal/mal_client.c
        monetdb5/mal/mal_dataflow.c
        monetdb5/mal/mal_factory.c
        monetdb5/mal/mal_function.c
        monetdb5/mal/mal_function.h
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_interpreter.c
        monetdb5/mal/mal_listing.c
        monetdb5/mal/mal_listing.h
        monetdb5/mal/mal_resolve.c
        monetdb5/mal/mal_resource.c
        monetdb5/modules/atoms/color.c
        monetdb5/modules/mal/groupby.c
        monetdb5/modules/mal/groupby.h
        monetdb5/modules/mal/json_util.h
        monetdb5/modules/mal/mal_mapi.c
        monetdb5/modules/mal/manifold.c
        monetdb5/modules/mal/oltp.c
        monetdb5/modules/mal/orderidx.c
        monetdb5/modules/mal/remote.c
        monetdb5/optimizer/opt_coercion.c
        monetdb5/optimizer/opt_commonTerms.c
        monetdb5/optimizer/opt_constants.c
        monetdb5/optimizer/opt_dataflow.c
        monetdb5/optimizer/opt_emptybind.c
        monetdb5/optimizer/opt_evaluate.c
        monetdb5/optimizer/opt_garbageCollector.c
        monetdb5/optimizer/opt_generator.c
        monetdb5/optimizer/opt_inline.c
        monetdb5/optimizer/opt_jit.c
        monetdb5/optimizer/opt_mergetable.c
        monetdb5/optimizer/opt_mitosis.c
        monetdb5/optimizer/opt_multiplex.c
        monetdb5/optimizer/opt_oltp.c
        monetdb5/optimizer/opt_projectionpath.c
        monetdb5/optimizer/opt_pushselect.c
        monetdb5/optimizer/opt_remap.c
        monetdb5/optimizer/opt_remoteQueries.c
        monetdb5/optimizer/opt_reorder.c
        monetdb5/optimizer/opt_wrapper.c
        monetdb5/scheduler/run_memo.c
        monetdb5/scheduler/run_pipeline.c
        monetdb5/scheduler/srvpool.c
        sql/backends/monet5/sql_execute.c
        sql/backends/monet5/sql_orderidx.c
        sql/backends/monet5/sql_scenario.c
        sql/backends/monet5/sql_statistics.c
Branch: default
Log Message:

Sent all debugging output to stderr


diffs (truncated from 2275 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -2074,6 +2074,8 @@ void finishSessionProfiler(Client cntxt)
 str firstnRef;
 Module fixModule(Module scope, str nme);
 int fndConstant(MalBlkPtr mb, const ValRecord *cst, int depth);
+void fprintFunction(FILE *fd, MalBlkPtr mb, MalStkPtr stk, int flg);
+void fprintInstruction(FILE *fd, MalBlkPtr mb, MalStkPtr stk, InstrPtr p, int 
flg);
 void freeException(str);
 void freeInstruction(InstrPtr p);
 void freeMalBlk(MalBlkPtr mb);
diff --git a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c 
b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
--- a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
+++ b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
@@ -306,7 +306,6 @@ str OPTsql_append(Client cntxt, MalBlkPt
        clk = GDKusec()- clk;
     snprintf(buf,256,"%-20s actions=%2d time=" LLFMT " 
usec","optimizer.sql_append",actions, clk);
     newComment(mb,buf);
-       QOTupdateStatistics("optimizer.sql_append",actions,clk);
        addtoMalBlkHistory(mb);
        return msg;
 }
diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -127,7 +127,6 @@ void mserver_reset(int exit)
        MCstopClients(0);
        setHeartbeat(-1);
        stopProfiler();
-       QOTstatisticsExit();
        AUTHreset(); 
        if ((err = msab_wildRetreat()) != NULL) {
                fprintf(stderr, "!%s", err);
diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -147,7 +147,7 @@ MCnewClient(void)
                return NULL;
        c->idx = (int) (c - mal_clients);
 #ifdef MAL_CLIENT_DEBUG
-       printf("New client created %d\n", (int) (c - mal_clients));
+       fprintf(stderr,"New client created %d\n", (int) (c - mal_clients));
 #endif
        return c;
 }
@@ -175,7 +175,7 @@ void
 MCexitClient(Client c)
 {
 #ifdef MAL_CLIENT_DEBUG
-       printf("# Exit client %d\n", c->idx);
+       fprintf(stderr,"# Exit client %d\n", c->idx);
 #endif
        finishSessionProfiler(c);
        MPresetProfiler(c->fdout);
@@ -356,7 +356,7 @@ freeClient(Client c)
        c->mode = FINISHCLIENT;
 
 #ifdef MAL_CLIENT_DEBUG
-       printf("# Free client %d\n", c->idx);
+       fprintf(stderr,"# Free client %d\n", c->idx);
 #endif
        MCexitClient(c);
 
@@ -461,7 +461,7 @@ void
 MCcloseClient(Client c)
 {
 #ifdef MAL_DEBUG_CLIENT
-       printf("closeClient %d " OIDFMT "\n", (int) (c - mal_clients), c->user);
+       fprintf(stderr,"closeClient %d " OIDFMT "\n", (int) (c - mal_clients), 
c->user);
 #endif
        /* free resources of a single thread */
        if (!isAdministrator(c)) {
@@ -520,7 +520,7 @@ MCreadClient(Client c)
        bstream *in = c->fdin;
 
 #ifdef MAL_CLIENT_DEBUG
-       printf("# streamClient %d %d\n", c->idx, isa_block_stream(in->s));
+       fprintf(stderr,"# streamClient %d %d\n", c->idx, 
isa_block_stream(in->s));
 #endif
 
        while (in->pos < in->len &&
@@ -555,13 +555,13 @@ MCreadClient(Client c)
                                in->len++;
                }
 #ifdef MAL_CLIENT_DEBUG
-               printf("# simple stream received %d sum " SZFMT "\n", c->idx, 
sum);
+               fprintf(stderr, "# simple stream received %d sum " SZFMT "\n", 
c->idx, sum);
 #endif
        }
        if (in->pos >= in->len) {
                /* end of stream reached */
 #ifdef MAL_CLIENT_DEBUG
-               printf("# end of stream received %d %d\n", c->idx, c->bak == 0);
+               fprintf(stderr,"# end of stream received %d %d\n", c->idx, 
c->bak == 0);
 #endif
                if (c->bak) {
                        MCpopClientInput(c);
@@ -572,7 +572,7 @@ MCreadClient(Client c)
                return 0;
        }
 #ifdef MAL_CLIENT_DEBUG
-       printf("# finished stream read %d %d\n", (int) in->pos, (int) in->len);
+       fprintf(stderr,"# finished stream read %d %d\n", (int) in->pos, (int) 
in->len);
        printf("#%s\n", in->buf);
 #endif
        return 1;
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -639,15 +639,15 @@ DFLOWinitBlk(DataFlow flow, MalBlkPtr mb
        GDKfree(assign);
        PARDEBUG {
                for (n = 0; n < flow->stop - flow->start; n++) {
-                       mnstr_printf(GDKstdout, "#[%d] %d: ", flow->start + n, 
n);
-                       printInstruction(GDKstdout, mb, 0, getInstrPtr(mb, n + 
flow->start), LIST_MAL_ALL);
-                       mnstr_printf(GDKstdout, "#[%d]Dependents block count %d 
wakeup", flow->start + n, flow->status[n].blocks);
+                       fprintf(stderr, "#[%d] %d: ", flow->start + n, n);
+                       fprintInstruction(stderr, mb, 0, getInstrPtr(mb, n + 
flow->start), LIST_MAL_ALL);
+                       fprintf(stderr, "#[%d]Dependents block count %d 
wakeup", flow->start + n, flow->status[n].blocks);
                        for (j = n; flow->edges[j]; j = flow->edges[j]) {
-                               mnstr_printf(GDKstdout, "%d ", flow->start + 
flow->nodes[j]);
+                               fprintf(stderr, "%d ", flow->start + 
flow->nodes[j]);
                                if (flow->edges[j] == -1)
                                        break;
                        }
-                       mnstr_printf(GDKstdout, "\n");
+                       fprintf(stderr, "\n");
                }
        }
 #ifdef USE_MAL_ADMISSION
@@ -790,7 +790,7 @@ runMALdataflow(Client cntxt, MalBlkPtr m
 
 #ifdef DEBUG_FLOW
        fprintf(stderr, "#runMALdataflow for block %d - %d\n", startpc, stoppc);
-       printFunction(GDKstdout, mb, 0, LIST_ALL);
+       fprintFunction(stderr, mb, 0, LIST_ALL);
 #endif
 
        /* in debugging mode we should not start multiple threads */
diff --git a/monetdb5/mal/mal_factory.c b/monetdb5/mal/mal_factory.c
--- a/monetdb5/mal/mal_factory.c
+++ b/monetdb5/mal/mal_factory.c
@@ -64,7 +64,7 @@ runFactory(Client cntxt, MalBlkPtr mb, M
        str msg;
 
 #ifdef DEBUG_MAL_FACTORY
-       mnstr_printf(cntxt->fdout, "#factoryMgr called\n");
+       fprintf(stderr, "#factoryMgr called\n");
 #endif
        /* the lookup can be largely avoided by handing out the index
           upon factory definition. todo
@@ -277,7 +277,7 @@ yieldResult(MalBlkPtr mb, InstrPtr p, in
                                return(int) (pl-plants);
                        for (i = 0; i < p->retc; i++) {
 #ifdef DEBUG_MAL_FACTORY
-                               printf("lhs %d rhs %d\n", getArg(pl->pci, i), 
getArg(p, i));
+                               fprintf(stderr,"#lhs %d rhs %d\n", 
getArg(pl->pci, i), getArg(p, i));
 #endif
                                rhs = &pl->stk->stk[getArg(p, i)];
                                lhs = &pl->env->stk[getArg(pl->pci, i)];
diff --git a/monetdb5/mal/mal_function.c b/monetdb5/mal/mal_function.c
--- a/monetdb5/mal/mal_function.c
+++ b/monetdb5/mal/mal_function.c
@@ -228,7 +228,7 @@ void chkFlow(stream *out, MalBlkPtr mb)
                showScriptException(out, mb,lastInstruction,SYNTAX,
                        "instructions after END");
 #ifdef DEBUG_MAL_FCN
-               printFunction(out, mb, 0, LIST_MAL_ALL);
+               fprintFunction(stderr, mb, 0, LIST_MAL_ALL);
 #endif
                mb->errors++;
        }
@@ -288,13 +288,13 @@ static void replaceTypeVar(MalBlkPtr mb,
        int j,i,x,y;
 #ifdef DEBUG_MAL_FCN
        char *tpenme = getTypeName(t);
-       mnstr_printf(GDKout,"replace type _%d by type %s\n",v, tpenme);
+       fprintf(stderr,"#replace type _%d by type %s\n",v, tpenme);
        GDKfree(tpenme);
 #endif
        for(j=0; j<mb->stop; j++){
            p= getInstrPtr(mb,j);
 #ifdef DEBUG_MAL_FCN
-               printInstruction(GDKout,mb,0,p,LIST_MAL_ALL);
+               fprintInstruction(stderr,mb,0,p,LIST_MAL_ALL);
 #endif
        if( p->polymorphic)
        for(i=0;i<p->argc; i++)
@@ -314,7 +314,7 @@ static void replaceTypeVar(MalBlkPtr mb,
 #ifdef DEBUG_MAL_FCN
                        {
                                char *xnme = getTypeName(x), *ynme = 
getTypeName(y);
-                               mnstr_printf(GDKout," %d replaced %s->%s 
\n",i,xnme,ynme);
+                               fprintf(stderr," %d replaced %s->%s 
\n",i,xnme,ynme);
                                GDKfree(xnme);
                                GDKfree(ynme);
                        }
@@ -323,7 +323,7 @@ static void replaceTypeVar(MalBlkPtr mb,
                if(getTypeIndex(x) == v){
 #ifdef DEBUG_MAL_FCN
                        char *xnme = getTypeName(x);
-                       mnstr_printf(GDKout," replace x= %s 
polymorphic\n",xnme);
+                       fprintf(stderr," replace x= %s polymorphic\n",xnme);
                        GDKfree(xnme);
 #endif
                        setArgType(mb,p,i,t);
@@ -331,13 +331,13 @@ static void replaceTypeVar(MalBlkPtr mb,
 #ifdef DEBUG_MAL_FCN
                else {
                        char *xnme = getTypeName(x);
-                       mnstr_printf(GDKout," non x= %s 
%d\n",xnme,getTypeIndex(x));
+                       fprintf(stderr," non x= %s %d\n",xnme,getTypeIndex(x));
                        GDKfree(xnme);
                }
 #endif
        }
 #ifdef DEBUG_MAL_FCN
-               printInstruction(GDKout,mb,0,p,LIST_MAL_ALL);
+               fprintInstruction(stderr,mb,0,p,LIST_MAL_ALL);
 #endif
        }
 }
@@ -393,9 +393,9 @@ cloneFunction(stream *out, Module scope,
        InstrPtr pp;
 
 #ifdef DEBUG_CLONE
-       mnstr_printf(out,"clone the function %s to scope %s\n",
+       fprintf(stderr,"clone the function %s to scope %s\n",
                                 proc->name,scope->name);
-       printInstruction(out,mb,0,p,LIST_MAL_ALL);
+       fprintInstruction(stderr,mb,0,p,LIST_MAL_ALL);
 #endif
        new = newFunction(scope->name, proc->name, getSignature(proc)->token);
        if( new == NULL){
@@ -406,8 +406,8 @@ cloneFunction(stream *out, Module scope,
        new->def = copyMalBlk(proc->def);
        /* now change the definition of the original proc */
 #ifdef DEBUG_CLONE
-       mnstr_printf(out, "CLONED VERSION\n");
-       printFunction(out, new->def, 0, LIST_MAL_ALL);
+       fprintf(stderr, "CLONED VERSION\n");
+       fprintFunction(stderr, new->def, 0, LIST_MAL_ALL);
 #endif
        /* check for errors after fixation , TODO*/
        pp = getSignature(new);
@@ -426,7 +426,7 @@ cloneFunction(stream *out, Module scope,
 #ifdef DEBUG_MAL_FCN
                else {
                        char *tpenme = getTypeName(v);
-                       mnstr_printf(out,"%d remains %s\n", i, tpenme);
+                       fprintf(stderr,"%d remains %s\n", i, tpenme);
                        GDKfree(tpenme);
                }
 #endif
@@ -443,8 +443,8 @@ cloneFunction(stream *out, Module scope,
                clrVarFixed(new->def, i);
 
 #ifdef DEBUG_MAL_FCN
-       mnstr_printf(out, "FUNCTION TO BE CHECKED\n");
-       printFunction(out, new->def, 0, LIST_MAL_ALL);
+       fprintf(stderr, "FUNCTION TO BE CHECKED\n");
+       fprintFunction(stderr, new->def, 0, LIST_MAL_ALL);
 #endif
 
        /* check for errors after fixation , TODO*/
@@ -455,12 +455,12 @@ cloneFunction(stream *out, Module scope,
                        showScriptException(out, new->def, 0, MAL,
                                                                "Error in 
cloned function");
 #ifdef DEBUG_MAL_FCN
-                       printFunction(out, new->def, 0, LIST_MAL_ALL);
+                       fprintFunction(stderr, new->def, 0, LIST_MAL_ALL);
 #endif
                }
        }
 #ifdef DEBUG_CLONE
-       mnstr_printf(out, "newly cloned function added to %s %d \n",
+       fprintf(stderr, "newly cloned function added to %s %d \n",
                                 scope->name, i);
        printFunction(out, new->def, 0, LIST_MAL_ALL);
 #endif
@@ -559,6 +559,25 @@ void printFunction(stream *fd, MalBlkPtr
        listFunction(fd,mb,stk,flg,0,mb->stop);
 }
 
+void fprintFunction(FILE *fd, MalBlkPtr mb, MalStkPtr stk, int flg)
+{
+       int i,j;
+       InstrPtr p;
+       // Set the used bits properly
+       for(i=0; i< mb->vtop; i++)
+               clrVarUsed(mb,i);
+       for(i=0; i< mb->stop; i++){
+               p= getInstrPtr(mb,i);
+               for(j= p->retc; j<p->argc; j++)
+                       setVarUsed(mb, getArg(p,j));
+               if( p->barrier)
+                       for(j= 0; j< p->retc; j++)
+                               setVarUsed(mb, getArg(p,j));
+       }
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to