Changeset: 56b1931f2fab for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=56b1931f2fab
Modified Files:
clients/Tests/exports.stable.out
clients/Tests/malcheck.stable.out
monetdb5/extras/mal_optimizer_template/opt_sql_append.c
monetdb5/extras/mal_optimizer_template/opt_sql_append.h
monetdb5/optimizer/opt_aliases.h
monetdb5/optimizer/opt_candidates.h
monetdb5/optimizer/opt_coercion.h
monetdb5/optimizer/opt_commonTerms.c
monetdb5/optimizer/opt_commonTerms.h
monetdb5/optimizer/opt_constants.c
monetdb5/optimizer/opt_constants.h
monetdb5/optimizer/opt_costModel.h
monetdb5/optimizer/opt_dataflow.h
monetdb5/optimizer/opt_deadcode.c
monetdb5/optimizer/opt_deadcode.h
monetdb5/optimizer/opt_evaluate.c
monetdb5/optimizer/opt_evaluate.h
monetdb5/optimizer/opt_factorize.h
monetdb5/optimizer/opt_garbageCollector.c
monetdb5/optimizer/opt_garbageCollector.h
monetdb5/optimizer/opt_generator.h
monetdb5/optimizer/opt_inline.c
monetdb5/optimizer/opt_inline.h
monetdb5/optimizer/opt_json.h
monetdb5/optimizer/opt_macro.h
monetdb5/optimizer/opt_matpack.h
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_mergetable.h
monetdb5/optimizer/opt_mitosis.c
monetdb5/optimizer/opt_mitosis.h
monetdb5/optimizer/opt_multiplex.c
monetdb5/optimizer/opt_multiplex.h
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_profiler.h
monetdb5/optimizer/opt_projectionpath.c
monetdb5/optimizer/opt_projectionpath.h
monetdb5/optimizer/opt_pushselect.c
monetdb5/optimizer/opt_pushselect.h
monetdb5/optimizer/opt_querylog.h
monetdb5/optimizer/opt_reduce.h
monetdb5/optimizer/opt_remap.c
monetdb5/optimizer/opt_remap.h
monetdb5/optimizer/opt_remoteQueries.c
monetdb5/optimizer/opt_remoteQueries.h
monetdb5/optimizer/opt_reorder.c
monetdb5/optimizer/opt_reorder.h
monetdb5/optimizer/opt_support.c
monetdb5/optimizer/opt_support.h
monetdb5/optimizer/opt_volcano.h
Branch: default
Log Message:
Remove old optimizer debugger
The code contained a never-used piece to manipulate the debugging level
of each optimizer step. Using the mdb and DEBUG phrase gives you all you
need to compare the steps taken by an optimizer.
Debugging a particular optimizer is a local action, controlled by a simple
define.
diffs (truncated from 1645 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
@@ -1567,7 +1567,6 @@ int OPTreduceImplementation(Client cntxt
int OPTremapImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
pci);
int OPTremoteQueriesImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
int OPTreorderImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr p);
-str OPTsetDebugStr(void *ret, str *nme);
int OPTvolcanoImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr p);
str OPTwrapper(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
str PCREilike2(bit *ret, const str *s, const str *pat);
@@ -2312,7 +2311,6 @@ str openRef;
int open_block_stream(Stream *S, Stream *is);
str open_block_streamwrap(Stream *S, Stream *is);
str operatorName(int i);
-lng optDebug;
str optimizeMALBlock(Client cntxt, MalBlkPtr mb);
str optimizerCheck(Client cntxt, MalBlkPtr mb, str name, int actions, lng
usec);
int optimizerIsApplied(MalBlkPtr mb, str name);
@@ -2388,7 +2386,6 @@ str refineRef;
str registerRef;
str remapRef;
str remoteRef;
-void removeDataflow(MalBlkPtr mb);
void removeInstruction(MalBlkPtr mb, InstrPtr p);
void removeInstructionBlock(MalBlkPtr mb, int pc, int cnt);
void renameVariable(MalBlkPtr mb, int i, str pattern, int newid);
diff --git a/clients/Tests/malcheck.stable.out
b/clients/Tests/malcheck.stable.out
--- a/clients/Tests/malcheck.stable.out
+++ b/clients/Tests/malcheck.stable.out
@@ -5,6 +5,7 @@ stdout of test 'malcheck` in directory '
# 15:15:51 > "./malcheck.sh" "malcheck"
# 15:15:51 >
+OPTsetDebugStr: missing for MAL command mdb.traceOptimizer in
monetdb5/optimizer/optimizer.mal
# 15:16:26 >
# 15:16:26 > "Done."
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
@@ -81,6 +81,7 @@ OPTsql_appendImplementation(Client cntxt
InstrPtr *old = NULL;
int i, limit, slimit, actions = 0;
+ (void) cntxt;
(void) pci; /* Tell compilers that we know that we do not */
(void) stk; /* use these function parameters, here. */
@@ -227,9 +228,9 @@ OPTsql_appendImplementation(Client cntxt
GDKfree(old);
/* for statistics we return if/how many patches have been made */
- DEBUGoptimizers
- mnstr_printf(cntxt->fdout,"#opt_sql_append: %d statements
added\n",
- actions);
+#ifdef DEBUG_OPT_OPTIMIZERS
+ mnstr_printf(cntxt->fdout,"#opt_sql_append: %d statements
added\n", actions);
+#endif
return actions;
}
@@ -258,9 +259,12 @@ str OPTsql_append(Client cntxt, MalBlkPt
lng t,clk= GDKusec();
int actions = 0;
+ (void) cntxt;
if( p )
removeInstruction(mb, p);
- OPTDEBUGsql_append mnstr_printf(cntxt->fdout,"=APPLY OPTIMIZER
sql_append\n");
+#ifdef DEBUG_OPT_OPTIMIZERS
+ mnstr_printf(cntxt->fdout,"=APPLY OPTIMIZER sql_append\n");
+#endif
if( p && p->argc > 1 ){
if( getArgType(mb,p,1) != TYPE_str ||
getArgType(mb,p,2) != TYPE_str ||
@@ -293,12 +297,11 @@ str OPTsql_append(Client cntxt, MalBlkPt
}
actions= OPTsql_appendImplementation(cntxt, mb,stk,p);
msg= optimizerCheck(cntxt, mb, "optimizer.sql_append", actions,
t=(GDKusec() - clk));
- OPTDEBUGsql_append {
+#ifdef DEBUG_OPT_OPTIMIZERS
mnstr_printf(cntxt->fdout,"=FINISHED sql_append %d\n",actions);
printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL );
- }
- DEBUGoptimizers
mnstr_printf(cntxt->fdout,"#opt_reduce: " LLFMT " ms\n",t);
+#endif
QOTupdateStatistics("sql_append",actions,t);
addtoMalBlkHistory(mb);
return msg;
diff --git a/monetdb5/extras/mal_optimizer_template/opt_sql_append.h
b/monetdb5/extras/mal_optimizer_template/opt_sql_append.h
--- a/monetdb5/extras/mal_optimizer_template/opt_sql_append.h
+++ b/monetdb5/extras/mal_optimizer_template/opt_sql_append.h
@@ -23,7 +23,4 @@
opt_sql_append_export str OPTsql_append(Client cntxt, MalBlkPtr mb, MalStkPtr
stk, InstrPtr p);
-#define DEBUG_OPT_SQL_APPEND 61
-#define OPTDEBUGsql_append if (optDebug & ((lng)1 << DEBUG_OPT_SQL_APPEND))
-
#endif /* _OPT_SQL_APPEND_ */
diff --git a/monetdb5/optimizer/opt_aliases.h b/monetdb5/optimizer/opt_aliases.h
--- a/monetdb5/optimizer/opt_aliases.h
+++ b/monetdb5/optimizer/opt_aliases.h
@@ -16,5 +16,4 @@ mal_export int OPTisAlias(InstrPtr p);
mal_export void OPTaliasRemap(InstrPtr p, int *alias);
mal_export int OPTaliasesImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr
stk, InstrPtr p);
-#define OPTDEBUGaliases if ( optDebug & ((lng) 1 <<DEBUG_OPT_ALIASES) )
#endif
diff --git a/monetdb5/optimizer/opt_candidates.h
b/monetdb5/optimizer/opt_candidates.h
--- a/monetdb5/optimizer/opt_candidates.h
+++ b/monetdb5/optimizer/opt_candidates.h
@@ -14,6 +14,4 @@
mal_export int OPTcandidatesImplementation(Client cntxt, MalBlkPtr mb,
MalStkPtr stk, InstrPtr p);
-#define OPTDEBUGcandidates if ( optDebug & ((lng) 1 <<DEBUG_OPT_CANDIDATES) )
-
#endif
diff --git a/monetdb5/optimizer/opt_coercion.h
b/monetdb5/optimizer/opt_coercion.h
--- a/monetdb5/optimizer/opt_coercion.h
+++ b/monetdb5/optimizer/opt_coercion.h
@@ -14,6 +14,4 @@
mal_export int OPTcoercionImplementation(Client cntxt,MalBlkPtr mb, MalStkPtr
stk, InstrPtr pci);
-#define OPTDEBUGcoercion if ( optDebug & ((lng)1 << DEBUG_OPT_COERCION) )
-
#endif
diff --git a/monetdb5/optimizer/opt_commonTerms.c
b/monetdb5/optimizer/opt_commonTerms.c
--- a/monetdb5/optimizer/opt_commonTerms.c
+++ b/monetdb5/optimizer/opt_commonTerms.c
@@ -37,22 +37,14 @@ OPTcommonTermsImplementation(Client cntx
alias = (int*) GDKzalloc(sizeof(int) * mb->vtop);
list = (int*) GDKzalloc(sizeof(int) * mb->stop);
vars = (int*) GDKzalloc(sizeof(int) * mb->vtop);
- if ( alias == NULL || list == NULL || vars == NULL){
- if(alias) GDKfree(alias);
- if(list) GDKfree(list);
- if(vars) GDKfree(vars);
- return 0;
- }
+ if ( alias == NULL || list == NULL || vars == NULL)
+ goto wrapup;
old = mb->stmt;
limit = mb->stop;
slimit = mb->ssize;
- if ( newMalBlkStmt(mb, mb->ssize) < 0){
- GDKfree(alias);
- GDKfree(list);
- GDKfree(vars);
- return 0;
- }
+ if ( newMalBlkStmt(mb, mb->ssize) < 0)
+ goto wrapup;
for ( i = 0; i < limit; i++) {
p = old[i];
@@ -178,10 +170,6 @@ OPTcommonTermsImplementation(Client cntx
for(; i<slimit; i++)
if( old[i])
freeInstruction(old[i]);
- GDKfree(list);
- GDKfree(vars);
- GDKfree(old);
- GDKfree(alias);
/* Defense line against incorrect plans */
if( actions > 0){
chkTypes(cntxt->fdout, cntxt->nspace, mb, FALSE);
@@ -192,5 +180,10 @@ OPTcommonTermsImplementation(Client cntx
snprintf(buf,256,"%-20s actions=%2d time=" LLFMT "
usec","commonTerms",actions,GDKusec() - usec);
newComment(mb,buf);
+wrapup:
+ if(alias) GDKfree(alias);
+ if(list) GDKfree(list);
+ if(vars) GDKfree(vars);
+ if(old) GDKfree(old);
return actions;
}
diff --git a/monetdb5/optimizer/opt_commonTerms.h
b/monetdb5/optimizer/opt_commonTerms.h
--- a/monetdb5/optimizer/opt_commonTerms.h
+++ b/monetdb5/optimizer/opt_commonTerms.h
@@ -15,6 +15,5 @@
mal_export int OPTcommonTermsImplementation(Client cntxt, MalBlkPtr mb,
MalStkPtr stk, InstrPtr pci);
/* #define DEBUG_OPT_COMMONTERMS_MORE */
-#define OPTDEBUGcommonTerms if ( optDebug & ((lng) 1 <<DEBUG_OPT_COMMONTERMS)
)
#endif
diff --git a/monetdb5/optimizer/opt_constants.c
b/monetdb5/optimizer/opt_constants.c
--- a/monetdb5/optimizer/opt_constants.c
+++ b/monetdb5/optimizer/opt_constants.c
@@ -31,7 +31,9 @@ OPTconstantsImplementation(Client cntxt,
char buf[256];
lng usec = GDKusec();
- OPTDEBUGconstants mnstr_printf(cntxt->fdout,"#OPT_CONSTANTS: MATCHING
CONSTANTS ELEMENTS\n");
+#ifdef DEBUG_OPT_CONSTANTS
+ mnstr_printf(cntxt->fdout,"#OPT_CONSTANTS: MATCHING CONSTANTS
ELEMENTS\n");
+#endif
alias= (int*) GDKzalloc(sizeof(int) * mb->vtop);
cst= (VarPtr*) GDKzalloc(sizeof(VarPtr) * mb->vtop);
@@ -56,11 +58,11 @@ OPTconstantsImplementation(Client cntxt,
x->rowcnt == y->rowcnt &&
x->value.vtype == y->value.vtype &&
ATOMcmp(x->value.vtype,
VALptr(&x->value), VALptr(&y->value)) == 0){
- OPTDEBUGconstants {
-
mnstr_printf(cntxt->fdout,"#opt_constants: matching elements %s %d %d ",
getVarName(mb,i), i,k);
-
ATOMprint(x->value.vtype,VALptr(&x->value),cntxt->fdout);
- mnstr_printf(cntxt->fdout,"\n");
- }
+#ifdef DEBUG_OPT_CONSTANTS
+
mnstr_printf(cntxt->fdout,"#opt_constants: matching elements %s %d %d ",
getVarName(mb,i), i,k);
+
ATOMprint(x->value.vtype,VALptr(&x->value),cntxt->fdout);
+ mnstr_printf(cntxt->fdout,"\n");
+#endif
/* re-use a constant */
alias[i]= index[k];
fnd=1;
@@ -69,7 +71,9 @@ OPTconstantsImplementation(Client cntxt,
}
}
if ( fnd == 0){
- OPTDEBUGconstants
mnstr_printf(cntxt->fdout,"swith elements %d %d\n", i,n);
+#ifdef DEBUG_OPT_CONSTANTS
+ mnstr_printf(cntxt->fdout,"swith elements %d
%d\n", i,n);
+#endif
cst[n]= x;
index[n]= i;
n++;
diff --git a/monetdb5/optimizer/opt_constants.h
b/monetdb5/optimizer/opt_constants.h
--- a/monetdb5/optimizer/opt_constants.h
+++ b/monetdb5/optimizer/opt_constants.h
@@ -14,6 +14,4 @@
mal_export int OPTconstantsImplementation(Client cntxt, MalBlkPtr mb,
MalStkPtr stk, InstrPtr p);
-#define OPTDEBUGconstants if ( optDebug & ((lng) 1 <<DEBUG_OPT_CONSTANTS) )
-
#endif
diff --git a/monetdb5/optimizer/opt_costModel.h
b/monetdb5/optimizer/opt_costModel.h
--- a/monetdb5/optimizer/opt_costModel.h
+++ b/monetdb5/optimizer/opt_costModel.h
@@ -17,6 +17,4 @@
mal_export int OPTcostModelImplementation(Client cntxt, MalBlkPtr mb,
MalStkPtr stk, InstrPtr pci);
-#define OPTDEBUGcostModel if ( optDebug & ((lng) 1 <<DEBUG_OPT_COSTMODEL) )
-
#endif /* _OPT_COSTMODEL_H_ */
diff --git a/monetdb5/optimizer/opt_dataflow.h
b/monetdb5/optimizer/opt_dataflow.h
--- a/monetdb5/optimizer/opt_dataflow.h
+++ b/monetdb5/optimizer/opt_dataflow.h
@@ -11,7 +11,6 @@
#include "opt_prelude.h"
#include "opt_support.h"
-#define OPTDEBUGdataflow if ( optDebug & ((lng) 1 <<DEBUG_OPT_DATAFLOW) )
mal_export int OPTdataflowImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr
stk, InstrPtr p);
#endif
diff --git a/monetdb5/optimizer/opt_deadcode.c
b/monetdb5/optimizer/opt_deadcode.c
--- a/monetdb5/optimizer/opt_deadcode.c
+++ b/monetdb5/optimizer/opt_deadcode.c
@@ -34,10 +34,8 @@ OPTdeadcodeImplementation(Client cntxt,
limit = mb->stop;
slimit = mb->ssize;
- if (newMalBlkStmt(mb, mb->ssize) < 0){
- GDKfree(varused);
- return 0;
- }
+ if (newMalBlkStmt(mb, mb->ssize) < 0)
+ goto wrapup;
// Calculate the instructions in which a variable is used.
// Variables can be used multiple times in an instruction.
@@ -103,8 +101,6 @@ OPTdeadcodeImplementation(Client cntxt,
for(; i<slimit; i++)
if( old[i])
freeInstruction(old[i]);
- GDKfree(old);
- GDKfree(varused);
/* Defense line against incorrect plans */
/* we don't create or change existing structures */
//if( actions > 0){
@@ -116,5 +112,8 @@ OPTdeadcodeImplementation(Client cntxt,
snprintf(buf,256,"%-20s actions=%2d time=" LLFMT "
usec","deadcode",actions, GDKusec() - usec);
newComment(mb,buf);
+wrapup:
+ if(old) GDKfree(old);
+ if(varused) GDKfree(varused);
return actions;
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list