Changeset: 2709f0574d2f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2709f0574d2f
Modified Files:
monetdb5/mal/mal.h
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_instruction.h
monetdb5/optimizer/opt_commonTerms.c
monetdb5/optimizer/opt_mitosis.c
monetdb5/optimizer/opt_support.c
sql/backends/monet5/sql_statement.c
Branch: default
Log Message:
Remove old stuff and bailout long collision lists in commonterms.
diffs (154 lines):
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -198,7 +198,6 @@ typedef struct {
int pc; /* location in MAL plan
for profiler*/
MALfcn fcn; /* resolved function
address */
struct MALBLK *blk; /* resolved MAL function
address */
- int mitosis; /* old mtProp value */
/* inline statistics */
lng clock; /* when the last call
was started */
lng ticks; /* total micro seconds
spent in last call */
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
@@ -465,7 +465,6 @@ newInstructionArgs(MalBlkPtr mb, str mod
setFunctionId(p, fcnnme);
p->argc = 1;
p->retc = 1;
- p->mitosis = -1;
p->argv[0] = -1; /* watch out for direct use in
variable table */
/* Flow of control instructions are always marked as an assignment
* with modifier */
@@ -495,7 +494,6 @@ newInstruction(MalBlkPtr mb, str modnme,
setFunctionId(p, fcnnme);
p->argc = 1;
p->retc = 1;
- p->mitosis = -1;
p->argv[0] = -1; /* watch out for direct use in
variable table */
/* Flow of control instructions are always marked as an assignment
* with modifier */
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
@@ -110,9 +110,6 @@
#define setRowCnt(M,I,C) (M)->var[I].rowcnt = C
#define getRowCnt(M,I) ((M)->var[I].rowcnt)
-#define setMitosisPartition(P,C) (P)->mitosis = C
-#define getMitosisPartition(P) ((P)->mitosis)
-
#define getVarSTC(M,I) ((M)->var[I].stc)
#define getDestVar(P) (P)->argv[0]
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
@@ -14,12 +14,16 @@
* at the surface level. It requires the constant optimizer to be ran first.
*/
+/* This hash is simplistic, it links all instructions in which a variable is
used.
+ * Merge table could duplicate an instruction many times, which means that the
last argument becomes a long list.
+ * Then hashing over the other arguments does not help.
+ */
#define HASHinstruction(X) getArg((X), (X)->argc-1)
str
OPTcommonTermsImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci)
{
- int i, j, k, barrier= 0;
+ int i, j, k, barrier= 0, bailout = 0;
InstrPtr p, q;
int actions = 0;
int limit, slimit;
@@ -117,8 +121,9 @@ OPTcommonTermsImplementation(Client cntx
fprintInstruction(stderr, mb, 0, p, LIST_MAL_ALL);
}
+ bailout = 1024 ; // don't run over long collision list
/* Look into the hash structure for matching instructions */
- for (j = hash[HASHinstruction(p)]; j > 0 ; j = list[j])
+ for (j = hash[HASHinstruction(p)]; j > 0 && bailout-- > 0 ; j
= list[j])
if ( (q= getInstrPtr(mb,j)) && getFunctionId(q) ==
getFunctionId(p) && getModuleId(q) == getModuleId(p) ){
if( OPTdebug & OPTcommonterms){
diff --git a/monetdb5/optimizer/opt_mitosis.c b/monetdb5/optimizer/opt_mitosis.c
--- a/monetdb5/optimizer/opt_mitosis.c
+++ b/monetdb5/optimizer/opt_mitosis.c
@@ -222,17 +222,11 @@ OPTmitosisImplementation(Client cntxt, M
}
if (p->retc == 2)
upd = 1;
- if( mt == -1)
- mt = getMitosisPartition(p);
if (mt < 0 && (strcmp(schema, getVarConstant(mb, getArg(p, 2 +
upd)).val.sval) ||
strcmp(table, getVarConstant(mb, getArg(p, 3 +
upd)).val.sval))) {
pushInstruction(mb, p);
continue;
}
- if (mt >= 0 && getMitosisPartition(p) != mt) {
- pushInstruction(mb, p);
- continue;
- }
/* we keep the original bind operation, because it allows for
* easy undo when the mergtable can not do something */
pushInstruction(mb, p);
diff --git a/monetdb5/optimizer/opt_support.c b/monetdb5/optimizer/opt_support.c
--- a/monetdb5/optimizer/opt_support.c
+++ b/monetdb5/optimizer/opt_support.c
@@ -190,18 +190,12 @@ MALoptimizer(Client c)
int hasSameSignature(MalBlkPtr mb, InstrPtr p, InstrPtr q){
int i;
- if ( getFunctionId(q) == getFunctionId(p) &&
- getModuleId(q) == getModuleId(p) &&
- getFunctionId(q) != 0 &&
- getModuleId(q) != 0) {
- if( q->retc != p->retc || q->argc != p->argc)
- return FALSE;
- for( i=0; i < p->argc; i++)
- if (getArgType(mb,p,i) != getArgType(mb,q,i))
- return FALSE;
- return TRUE;
- }
- return FALSE;
+ if( q->retc != p->retc || q->argc != p->argc)
+ return FALSE;
+ for( i=0; i < p->argc; i++)
+ if (getArgType(mb,p,i) != getArgType(mb,q,i))
+ return FALSE;
+ return TRUE;
}
/* Only used by opt_commonTerms! */
diff --git a/sql/backends/monet5/sql_statement.c
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -535,8 +535,6 @@ stmt_tid(backend *be, sql_table *t, int
sql_trans *tr = be->mvc->session->tr;
BUN rows = (BUN) store_funcs.count_col(tr,
t->columns.set->h->data, 1);
setRowCnt(mb,getArg(q,0),rows);
- if (t->p && 0)
- setMitosisPartition(q, t->p->base.id);
}
if (q) {
stmt *s = stmt_create(be->mvc->sa, st_tid);
@@ -606,8 +604,6 @@ stmt_bat(backend *be, sql_column *c, int
if (c && (!isRemote(c->t) && !isMergeTable(c->t))) {
BUN rows = (BUN) store_funcs.count_col(tr, c, 1);
setRowCnt(mb,getArg(q,0),rows);
- if (c->t->p && 0)
- setMitosisPartition(q, c->t->p->base.id);
}
}
if (q) {
@@ -665,8 +661,6 @@ stmt_idxbat(backend *be, sql_idx *i, int
if (i && (!isRemote(i->t) && !isMergeTable(i->t))) {
BUN rows = (BUN) store_funcs.count_idx(tr, i, 1);
setRowCnt(mb,getArg(q,0),rows);
- if (i->t->p && 0)
- setMitosisPartition(q, i->t->p->base.id);
}
}
if (q) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list