Changeset: cf23eca10b26 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cf23eca10b26
Modified Files:
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
monetdb5/optimizer/opt_recycler.c
Branch: default
Log Message:
Be conservative in allowing for optimization steps
There is no guarantee that UDFs or MAL blocks recursively
influence the recycler pool. Therefore, we are conservative
by making explicit what to allow
diffs (99 lines):
diff --git a/monetdb5/optimizer/opt_prelude.c b/monetdb5/optimizer/opt_prelude.c
--- a/monetdb5/optimizer/opt_prelude.c
+++ b/monetdb5/optimizer/opt_prelude.c
@@ -35,6 +35,7 @@ str appendRef;
str assertRef;
str attachRef;
str avgRef;
+str arrayRef;
str basketRef;
str batcalcRef;
str batRef;
@@ -299,6 +300,7 @@ void optimizerInit(void){
assertRef = putName("assert",6);
attachRef = putName("attach",6);
avgRef = putName("avg",3);
+ arrayRef = putName("array",4);
batcalcRef = putName("batcalc",7);
basketRef = putName("basket",6);
boxRef = putName("box",3);
diff --git a/monetdb5/optimizer/opt_prelude.h b/monetdb5/optimizer/opt_prelude.h
--- a/monetdb5/optimizer/opt_prelude.h
+++ b/monetdb5/optimizer/opt_prelude.h
@@ -34,6 +34,7 @@ opt_export str appendRef;
opt_export str assertRef;
opt_export str attachRef;
opt_export str avgRef;
+opt_export str arrayRef;
opt_export str basketRef;
opt_export str batcalcRef;
opt_export str batRef;
diff --git a/monetdb5/optimizer/opt_recycler.c
b/monetdb5/optimizer/opt_recycler.c
--- a/monetdb5/optimizer/opt_recycler.c
+++ b/monetdb5/optimizer/opt_recycler.c
@@ -63,32 +63,19 @@ OPTrecyclerImplementation(Client cntxt,
return 0;
}
pushInstruction(mb, old[0]);
- /* create a handle for the recycler */
- (void) newFcnCall(mb, "recycle", "start");
for (i = 1; i < limit; i++) {
p = old[i];
- if (p->token == ENDsymbol ){
- (void) newFcnCall(mb, "recycle", "stop");
+ if (p->token == ENDsymbol )
break;
- }
- if (p->barrier == RETURNsymbol)
- (void) newFcnCall(mb, "recycle", "stop");
/* the first non-dataflow barrier breaks the recycler code*/
- if (blockStart(p) && !(getFunctionId(p) && getFunctionId(p) ==
dataflowRef) ){
- (void) newFcnCall(mb, "recycle", "stop");
+ if (blockStart(p) && !(getFunctionId(p) && getFunctionId(p) ==
dataflowRef) )
break;
- }
- if ( getModuleId(p) == languageRef){
- pushInstruction(mb,p);
- continue;
- }
if ( isUpdateInstruction(p) || hasSideEffects(p,TRUE)){
/* update instructions are not recycled but monitored*/
pushInstruction(mb, p);
if (isUpdateInstruction(p)) {
if (getModuleId(p) == batRef &&
isaBatType(getArgType(mb, p, 1))) {
- recycled[getArg(p, 1)] = 0;
q = newFcnCall(mb, "recycle", "reset");
pushArgument(mb, q, getArg(p, 1));
actions++;
@@ -101,6 +88,21 @@ OPTrecyclerImplementation(Client cntxt,
}
continue;
}
+ // Not all instruction may be recycled. In particular, we
should avoid
+ // MAL function with implicit/recursive side effects.
+ // This can not always be detected easily. Likewise, we ignore
cheap operations
+ // Therefore, we use a safe subset to start with
+ if ( ! (getModuleId(p) == sqlRef || getModuleId(p)== batRef ||
+ getModuleId(p) == algebraRef ||
getModuleId(p)==batcalcRef ||
+ getModuleId(p)== aggrRef || getModuleId(p)==
groupRef ||
+ getModuleId(p)== arrayRef || getModuleId(p)==
batmtimeRef ||
+ getModuleId(p)== batstrRef || getModuleId(p)==
batmmathRef ||
+ getModuleId(p)== batcalcRef || getModuleId(p)==
pcreRef ||
+ getModuleId(p)== matRef )
+ ){
+ pushInstruction(mb,p);
+ continue;
+ }
/* general rule: all arguments should be constants or recycled*/
cnt = 0;
@@ -117,7 +119,7 @@ OPTrecyclerImplementation(Client cntxt,
printInstruction(cntxt->fdout, mb, 0, p,
LIST_MAL_DEBUG);
}
marks++;
- p->recycle = recycleMaxInterest; /* this instruction is
to be monitored */
+ p->recycle = RECYCLING; /* this instruction is to be
monitored */
for (j = 0; j < p->retc; j++)
recycled[getArg(p, j)] = 1;
}
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list