Changeset: d5f09d5db060 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d5f09d5db060
Modified Files:
monetdb5/extras/mal_optimizer_template/opt_sql_append.c
monetdb5/mal/mal.h
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
monetdb5/mal/mal_listing.c
monetdb5/optimizer/opt_wrapper.c
monetdb5/optimizer/optimizer.c
monetdb5/scheduler/run_isolate.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_optimizer.c
Branch: default
Log Message:
Simplify and cleanup
Remove history markers, just rely on the list.
diffs (235 lines):
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
@@ -288,7 +288,7 @@ str OPTsql_append(Client cntxt, MalBlkPt
}
if( mb->errors ){
/* when we have errors, we still want to see them */
- addtoMalBlkHistory(mb,"sql_append");
+ addtoMalBlkHistory(mb);
return MAL_SUCCEED;
}
actions= OPTsql_appendImplementation(cntxt, mb,stk,p);
@@ -300,6 +300,6 @@ str OPTsql_append(Client cntxt, MalBlkPt
DEBUGoptimizers
mnstr_printf(cntxt->fdout,"#opt_reduce: " LLFMT " ms\n",t);
QOTupdateStatistics("sql_append",actions,t);
- addtoMalBlkHistory(mb,"sql_append");
+ addtoMalBlkHistory(mb);
return msg;
}
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -210,7 +210,6 @@ typedef struct MALBLK {
struct MALBLK *history; /* of optimizer actions */
short keephistory; /* do we need the history at
all */
short dotfile; /* send dot file to
stethoscope? */
- str marker; /* history points are
marked for backtracking */
int maxarg; /* keep track on the
maximal arguments used */
ptr replica; /* for the replicator tests */
sht recycle; /* execution subject to
recycler control */
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -118,7 +118,6 @@ newMalBlk(int maxvars, int maxstmts)
mb->history = NULL;
mb->keephistory = 0;
mb->dotfile = 0;
- mb->marker = 0;
mb->maxarg = MAXARG; /* the minimum for each instruction */
mb->typefixed = 0;
mb->flowfixed = 0;
@@ -233,7 +232,6 @@ copyMalBlk(MalBlkPtr old)
mb->history = NULL;
mb->keephistory = old->keephistory;
mb->dotfile = old->dotfile;
- mb->marker = 0;
mb->var = (VarPtr *) GDKzalloc(sizeof(VarPtr) * old->vsize);
mb->activeClients = 1;
@@ -290,7 +288,7 @@ copyMalBlk(MalBlkPtr old)
}
void
-addtoMalBlkHistory(MalBlkPtr mb, str marker)
+addtoMalBlkHistory(MalBlkPtr mb)
{
MalBlkPtr cpy, h;
if (mb->keephistory) {
@@ -298,7 +296,6 @@ addtoMalBlkHistory(MalBlkPtr mb, str mar
if (cpy == NULL)
return; /* ignore history */
cpy->history = NULL;
- mb->marker = GDKstrdup(marker);
if (mb->history == NULL)
mb->history = cpy;
else {
@@ -318,34 +315,6 @@ getMalBlkHistory(MalBlkPtr mb, int idx)
return h ? h : mb;
}
-/* You can retrieve the history by its marker as well. */
-MalBlkPtr
-getMalBlkMarker(MalBlkPtr mb, str marker)
-{
- MalBlkPtr h = mb;
- while (h && h->marker && strcmp(h->marker, marker))
- h = h->history;
- return h ? h : mb;
-}
-
-/* You can roll back the history to a specific marker. A NULL is
- * returned when the marker can not be found. */
-MalBlkPtr
-gotoMalBlkMarker(MalBlkPtr mb, str marker)
-{
- MalBlkPtr h = mb, g;
- while (h && h->marker && strcmp(h->marker, marker))
- h = h->history;
- if (h == NULL)
- return NULL; /* marker not found */
- while (h && h->marker && strcmp(h->marker, marker)) {
- g = h;
- h = h->history;
- g->history = 0;
- freeMalBlk(g);
- }
- return h;
-}
/* The MalBlk structures potentially consume a lot a of space, because
* it is not possible to precisely estimate the default sizes of the
diff --git a/monetdb5/mal/mal_instruction.h b/monetdb5/mal/mal_instruction.h
--- a/monetdb5/mal/mal_instruction.h
+++ b/monetdb5/mal/mal_instruction.h
@@ -131,10 +131,8 @@ mal_export void resizeMalBlk(MalBlkPtr m
mal_export void prepareMalBlk(MalBlkPtr mb, str s);
mal_export void freeMalBlk(MalBlkPtr mb);
mal_export MalBlkPtr copyMalBlk(MalBlkPtr mb);
-mal_export void addtoMalBlkHistory(MalBlkPtr mb, str marker);
+mal_export void addtoMalBlkHistory(MalBlkPtr mb);
mal_export MalBlkPtr getMalBlkHistory(MalBlkPtr mb, int idx);
-mal_export MalBlkPtr gotoMalBlkMarker(MalBlkPtr mb, str marker);
-mal_export MalBlkPtr getMalBlkMarker(MalBlkPtr mb, str marker);
mal_export void expandMalBlk(MalBlkPtr mb, int lines);
mal_export void trimMalBlk(MalBlkPtr mb);
mal_export void trimMalVariables(MalBlkPtr mb, MalStkPtr stk);
diff --git a/monetdb5/mal/mal_listing.c b/monetdb5/mal/mal_listing.c
--- a/monetdb5/mal/mal_listing.c
+++ b/monetdb5/mal/mal_listing.c
@@ -581,10 +581,6 @@ printSignature(stream *fd, Symbol s, int
} else GDKerror("printSignature"MAL_MALLOC_FAIL);
}
-/*
- * For clarity we show the last optimizer applied
- * also as the last of the list, although it is linked with mb.
-*/
void showMalBlkHistory(stream *out, MalBlkPtr mb)
{
MalBlkPtr m=mb;
@@ -606,13 +602,4 @@ void showMalBlkHistory(stream *out, MalB
}
m= m->history;
}
- p=getInstrPtr(mb,mb->stop-1);
- if( p->token == REMsymbol){
- msg= instruction2str(mb, 0, p, FALSE);
- if (msg) {
- mnstr_printf(out,"%s.%s[%2d] %s\n",
- getModuleId(sig), getFunctionId(sig),j++,msg+3);
- GDKfree(msg);
- }
- }
}
diff --git a/monetdb5/optimizer/opt_wrapper.c b/monetdb5/optimizer/opt_wrapper.c
--- a/monetdb5/optimizer/opt_wrapper.c
+++ b/monetdb5/optimizer/opt_wrapper.c
@@ -97,13 +97,14 @@ opt_export str OPTwrapper(Client cntxt,
#define OPTIMIZERDEBUG if (0)
str OPTwrapper (Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p){
- str modnme = "(NONE)", curmodnme= NULL;
+ str modnme = "(NONE)";
str fcnnme = 0;
str msg= MAL_SUCCEED;
Symbol s= NULL;
lng t,clk= GDKusec();
int i, actions = 0;
char optimizer[256];
+ str curmodnme=0;
if( p == NULL)
throw(MAL, "opt_wrapper", "missing optimizer statement");
@@ -138,7 +139,7 @@ str OPTwrapper (Client cntxt, MalBlkPtr
removeInstruction(mb, p);
if( mb->errors ){
/* when we have errors, we still want to see them */
- addtoMalBlkHistory(mb, curmodnme);
+ addtoMalBlkHistory(mb);
return MAL_SUCCEED;
}
@@ -161,7 +162,7 @@ str OPTwrapper (Client cntxt, MalBlkPtr
((sizeof( MalBlkRecord) +mb->ssize * offsetof(InstrRecord,
argv)+ mb->vtop * sizeof(int) /* argv estimate */ +mb->vtop* sizeof(VarRecord)
+ mb->vsize*sizeof(VarPtr)+1023)/1024),
t);
QOTupdateStatistics(curmodnme,actions,t);
- addtoMalBlkHistory(mb,curmodnme);
+ addtoMalBlkHistory(mb);
return msg;
}
diff --git a/monetdb5/optimizer/optimizer.c b/monetdb5/optimizer/optimizer.c
--- a/monetdb5/optimizer/optimizer.c
+++ b/monetdb5/optimizer/optimizer.c
@@ -87,7 +87,7 @@ QOToptimize(Client cntxt, MalBlkPtr mb,
if (s == NULL)
throw(MAL, "optimizer.optimize", SEMANTIC_OPERATION_MISSING);
removeInstruction(mb, pci);
- addtoMalBlkHistory(s->def,"start optimizer");
+ addtoMalBlkHistory(s->def);
return optimizeMALBlock(cntxt, s->def);
}
diff --git a/monetdb5/scheduler/run_isolate.c b/monetdb5/scheduler/run_isolate.c
--- a/monetdb5/scheduler/run_isolate.c
+++ b/monetdb5/scheduler/run_isolate.c
@@ -38,7 +38,7 @@ RUNisolation(Client cntxt, MalBlkPtr mb,
{
(void) cntxt;
(void) stk;
- addtoMalBlkHistory(mb,"isolation");
+ addtoMalBlkHistory(mb);
removeInstruction(mb, p);
return MAL_SUCCEED;
}
diff --git a/sql/backends/monet5/sql_gencode.c
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -699,7 +699,7 @@ static int
pushInstruction(curBlk, p);
pushEndInstruction(curBlk);
- /* SQL function definitions meant f r inlineing should not be optimized
before */
+ /* SQL function definitions meant for inlineing should not be optimized
before */
curBlk->inlineProp = 1;
addQueryToCache(c);
if (backup)
diff --git a/sql/backends/monet5/sql_optimizer.c
b/sql/backends/monet5/sql_optimizer.c
--- a/sql/backends/monet5/sql_optimizer.c
+++ b/sql/backends/monet5/sql_optimizer.c
@@ -124,8 +124,11 @@ addOptimizers(Client c, MalBlkPtr mb, ch
q->token = REMsymbol; /* they are ignored */
}
}
- if (be->mvc->emod & mod_debug)
- addtoMalBlkHistory(mb, "getStatistics");
+ if (be->mvc->emod & mod_debug){
+ addtoMalBlkHistory(mb);
+ c->curprg->def->keephistory = TRUE;
+ } else
+ c->curprg->def->keephistory = FALSE;
}
static str
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list