Changeset: 2b7eec81b411 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2b7eec81b411
Modified Files:
MonetDB5/src/optimizer/opt_dataflow.mx
Branch: Jun2010
Log Message:
Protect dataflow against multi-assignments
MAL variables are preferrable used once. In a dataflow setting
we should avoid possible confusion by considering any variable
that is assigned a value more then once as a blocking instruction.
The same holds for entering a new dataflow block.
diffs (42 lines):
diff -r 203a7f84f1de -r 2b7eec81b411 MonetDB5/src/optimizer/opt_dataflow.mx
--- a/MonetDB5/src/optimizer/opt_dataflow.mx Tue Jul 27 08:55:33 2010 +0200
+++ b/MonetDB5/src/optimizer/opt_dataflow.mx Tue Jul 27 18:02:50 2010 +0200
@@ -89,6 +89,19 @@
#include "mal_interpreter.h"
static int
+dflowAssignTest(Lifespan span, InstrPtr p, int i)
+{
+ int j;
+ /* flow blocks should be closed (and not opened) when we reach a point
+ where a variable is assigned that is not the last
+ */
+ for(j=0; j<p->retc; j++)
+ if (getLastUpdate(span, getArg(p,j)) != i)
+ return 1;
+ return 0;
+}
+
+static int
OPTdataflowImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
p)
{
int i,j, cnt, start=1,entries=0, actions=0;
@@ -143,7 +156,7 @@
if (p->token == ENDsymbol)
break;
- if (hasSideEffects(p,TRUE) || isUnsafeFunction(p) ||
blockCntrl(p) || (!dumbcopy && blockExit(p))){
+ if (hasSideEffects(p,TRUE) || isUnsafeFunction(p) ||
blockCntrl(p) || (!dumbcopy && blockExit(p)) || dflowAssignTest(span,p,i) ){
@:flowblock@
pushInstruction(mb,p);
continue;
@@ -177,6 +190,9 @@
for(j=p->retc; j<p->argc; j++)
if (getLastUpdate(span, getArg(p,j)) <= start)
cnt++;
+ if ( dflowAssignTest(span,p,i))
+ cnt = 0;
+
if (cnt && cnt == p->argc-p->retc)
entries++;
}
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list