Changeset: fa96b6359cf5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fa96b6359cf5
Modified Files:
        MonetDB5/src/mal/mal_interpreter.mx
Branch: default
Log Message:

Refine dataflow processing
Repeated assignments to the same variable should block subsequent use.


diffs (57 lines):

diff -r 1f76cdad9704 -r fa96b6359cf5 MonetDB5/src/mal/mal_interpreter.mx
--- a/MonetDB5/src/mal/mal_interpreter.mx       Wed Sep 01 22:17:17 2010 +0200
+++ b/MonetDB5/src/mal/mal_interpreter.mx       Thu Sep 02 21:37:25 2010 +0200
@@ -1212,11 +1212,27 @@
        }
        GDKfree(assign);
 }
-
+...@-
+The liberal use of MAL to construct programs complicate proper dataflow
+dependency analysis. For example, consider the following fragment of
+a remote execution
+...@verbatim
+barrier go:=language.dataflow()
+con:= remote.connect(...)
+res:= remote.put(con, v:int)
+inp:= remote.put(con, i:int)
+res:= remote.exe(con,m,f,inp);
+ans:= remote.get(con,res)
+exit go
+...@end verbatim
+Naive interpretation could lead to execution of either 'res:=' operation in 
non-determined order.
+Moreover, the result 'ans:' should be obtained after the corresponding 'res:=' 
has been executed.
+...@c
 static int
 DFLOWeligible(DataFlow flow, FlowStep fs, int i, InstrPtr p, int pc)
 {
-       int j, blocked = 0;
+       int j, k, l, blocked = 0;
+       InstrPtr q;
        (void) pc;
 
        for(j=0; j<p->argc && !blocked; j++) {
@@ -1228,12 +1244,22 @@
                if ( getEndOfLife(flow->mb,getArg(p,j))  == fs[i].pc ) {
                        /* make sure all instructions interested have already 
been executed */
                        /* and the eoscope variables are not used anymore */
-                       int k;
 
                        blocked += flow->inuse[getArg(p,j)] != 0;
                        for ( k=0; k < i && !blocked; k++)
                        if (fs[k].status != DFLOWwrapup && fs[k].pc >= 0 ) /* 
pc = -1 could be the case before wrapup is set*/
                                blocked += !isNotUsedIn(getInstrPtr(flow->mb, 
fs[k].pc), 0, getArg(p,j));
+               } else {
+                       /* handle the dependencies sketched above */
+                       /* search the statement that assigns a value to the 
argument or target */
+                       /* it should have been finished already */
+                       for (l = i-1 ; l >= 0 && !blocked; l--)
+                       if ( fs[l].status != DFLOWwrapup){
+                               q= getInstrPtr(flow->mb, fs[l].pc);
+                               for ( k=0; k < q->retc && !blocked; k++)
+                               if ( getArg(q,k) == getArg(p,j) )
+                                       blocked = 1;
+                       }
                }
        }
        return blocked == 0;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to