Changeset: 135f765649bb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/135f765649bb
Modified Files:
monetdb5/optimizer/opt_reorder.c
Branch: default
Log Message:
improved fix for the reorder optimizer, ie now use the barrier variable also as
input to all statements within a barrier.
diffs (62 lines):
diff --git a/monetdb5/optimizer/opt_reorder.c b/monetdb5/optimizer/opt_reorder.c
--- a/monetdb5/optimizer/opt_reorder.c
+++ b/monetdb5/optimizer/opt_reorder.c
@@ -44,12 +44,12 @@ OPTreorderImplementation(Client cntxt, M
InstrPtr p= NULL, *old = NULL;
int limit, slimit, *depth = NULL;
str msg = MAL_SUCCEED;
- InstrPtr *blocks[MAXSLICES] ={0};
- int top[MAXSLICES] ={0};
+ InstrPtr *blocks[MAXSLICES] = {0};
+ int top[MAXSLICES] = {0};
+ int barriers[MAXSLICES] = {0}, btop = 0, off = 0;
- (void) blocks;
- (void) top;
- for(i=0; i< MAXSLICES; i++) top[i] = 0;
+ for(i=0; i< MAXSLICES; i++)
+ top[i] = 0;
if( isOptimizerUsed(mb, pci, mitosisRef) <= 0){
goto wrapup;
}
@@ -80,7 +80,7 @@ OPTreorderImplementation(Client cntxt, M
}
if( p->token == ENDsymbol)
break;
- k = 0;
+ k = off;
if( getModuleId(p) == sqlRef && getFunctionId(p) == tidRef &&
p->argc == 6){
if (depth[getArg(p,0)] == 0){
k = getVarConstant(mb, getArg(p,
p->argc-2)).val.ival;
@@ -94,17 +94,27 @@ OPTreorderImplementation(Client cntxt, M
assert( k < MAXSLICES);
depth[getArg(p,0)] = k;
}
- } else{
+ } else {
for(j= p->retc; j <p->argc; j++){
if (depth[getArg(p,j)] > k)
k = depth[getArg(p,j)];
}
- if (blockExit(p)) /* The barrier exit has a return
variable which matches the result of the blockBegin
- output, ie we
need too use that for the depth */
- k = depth[getArg(p,0)];
+ assert( k < MAXSLICES);
for(j=0; j< p->retc; j++)
if( depth[getArg(p,j)] == 0)
depth[getArg(p,j)] = k;
+ /* In addition to the input variables of the statements
al statements within a barrier also
+ * depend on the barriers variable */
+ if (blockStart(p)) {
+ assert(btop < MAXSLICES);
+ barriers[btop++] = k;
+ off = k;
+ }
+ if (blockExit(p)) {
+ off = 0;
+ if (btop--)
+ off = barriers[btop];
+ }
}
if( top[k] == 0){
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list