Changeset: 2197fd52fbac for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2197fd52fbac
Modified Files:
        
Branch: default
Log Message:

Merge heads.


diffs (134 lines):

diff -r 1b7f20958b89 -r 2197fd52fbac MonetDB5/src/mal/mal_interpreter.mx
--- a/MonetDB5/src/mal/mal_interpreter.mx       Thu Oct 07 16:14:43 2010 +0200
+++ b/MonetDB5/src/mal/mal_interpreter.mx       Thu Oct 07 16:15:40 2010 +0200
@@ -1210,8 +1210,8 @@
                }
        }
 
-       for( i=0; i<flow->mb->vtop; i++)
-               flow->inuse[i] = 0;
+       memset(flow->inuse, 0, flow->mb->vtop * sizeof(flow->inuse[0]));
+
        PARDEBUG
        for (i=0; i < flow->mb->vtop; i++) 
        if ( flow->blocked[i] || flow->inuse[i] || flow->assign[i] ){
@@ -1246,30 +1246,44 @@
 
        for(j=0; j<p->argc && !blocked; j++) {
                int var = getArg(p,j);
-               if ( j >= p->retc && flow->blocked[var] )
-                       blocked++;
-               if (j < p->retc && flow->inuse[var] )
-                       blocked++;
+               if ( j >= p->retc && flow->blocked[var] ) {
+                       blocked = 1;
+                       break;
+               }
+               else
+               if ( j < p->retc && flow->inuse[var] ) {
+                       blocked = 1;
+                       break;
+               }
                else
                if ( getEndOfLife(flow->mb,var)  == fs[i].pc ) {
                        /* make sure all instructions interested have already 
been executed */
                        /* and the eoscope variables are not used anymore */
 
-                       blocked += flow->inuse[var] != 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, var);
+                       if (flow->inuse[var] != 0) {
+                               blocked = 1;
+                               break;
+                       }
+                       else
+                                for ( k=0; k < i ; k++)
+                                        if ( fs[k].status != DFLOWwrapup && 
fs[k].pc >= 0  /* pc = -1 could be the case before wrapup is set*/
+                                            && 
!isNotUsedIn(getInstrPtr(flow->mb, fs[k].pc), 0, var) ) {
+                                               blocked = 1;
+                                               break;
+                                       }
                } 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 >= flow->assign[var] && !blocked; l--)
-                       if ( fs[l].status != DFLOWwrapup && fs[l].pc >= 0){
-                               q= getInstrPtr(flow->mb, fs[l].pc);
-                               for ( k=0; k < q->retc && !blocked; k++)
-                               if ( getArg(q,k) == var )
-                                       blocked = 1;
-                       }
+                       for (l = flow->assign[var]; l < i && !blocked; l++)
+                               if ( fs[l].status != DFLOWwrapup && fs[l].pc >= 
0){
+                                       q= getInstrPtr(flow->mb, fs[l].pc);
+                                       for ( k=0; k < q->retc; k++)
+                                               if ( getArg(q,k) == var ) {
+                                                       blocked = 1;
+                                                       break;
+                                               }
+                               }
                }
        }
        return blocked == 0;
@@ -1384,32 +1398,35 @@
                                break;
                /* first try to find all instructions that use the released 
target */
                candidates = 0;
-               for(i = limit-1; i >= pc ; i--)
-               if (fs[i].status == DFLOWpending ) {
-                       p = getInstrPtr(flow->mb, fs[i].pc);
-                       for ( j= p->retc; j < p->argc; j++)
-                       if ( getArg(p,j)== oa && DFLOWeligible(flow,fs,i,p,pc))
-                if(flow->stk->admit == 0 || (*flow->stk->admit)(flow->cntxt, 
flow->mb, flow->stk, p) ) {
-                               queued++;
-                               todo++;
-                               candidates ++;
-                               DFLOWactivate(flow,fs,i,p);
-                               q_enqueue(flow->todo, fs+i);
-                               break;
+               for(i = pc; i < limit ; i++)
+                       if (fs[i].status == DFLOWpending ) {
+                               p = getInstrPtr(flow->mb, fs[i].pc);
+                               for ( j= p->retc; j < p->argc; j++)
+                                        if ( getArg(p,j)== oa ) {
+                                                if ( flow->stk->admit == 0 || 
(*flow->stk->admit)(flow->cntxt, flow->mb, flow->stk, p) )
+                                                        if ( 
DFLOWeligible(flow,fs,i,p,pc) ) {
+                                                                queued++;
+                                                                todo++;
+                                                                candidates = 1;
+                                                                
DFLOWactivate(flow,fs,i,p);
+                                                                
q_enqueue(flow->todo, fs+i);
+                                                        }
+                                                break;
+                                        }
                        }
-               }
                /* if all work done then inspect rest */
-               for(i = limit-1 ; i >= pc && (candidates == 0 && queued < 
flow->nway) ; i--)
-               if (fs[i].status == DFLOWpending ) {
-                       p = getInstrPtr(flow->mb, fs[i].pc);
-                       if ( DFLOWeligible(flow,fs,i,p,pc))
-                if(flow->stk->admit == 0 || (*flow->stk->admit)(flow->cntxt, 
flow->mb, flow->stk, p) ) {
-                               queued++;
-                               todo++;
-                               DFLOWactivate(flow,fs,i,p);
-                               q_enqueue(flow->todo, fs+i);
-                       }
-               }
+               if (candidates == 0)
+                        for(i = pc ; i < limit && queued < flow->nway ; i++)
+                                if (fs[i].status == DFLOWpending ) {
+                                        p = getInstrPtr(flow->mb, fs[i].pc);
+                                        if ( flow->stk->admit == 0 || 
(*flow->stk->admit)(flow->cntxt, flow->mb, flow->stk, p) )
+                                                if ( 
DFLOWeligible(flow,fs,i,p,pc) ) {
+                                                        queued++;
+                                                        todo++;
+                                                        
DFLOWactivate(flow,fs,i,p);
+                                                        q_enqueue(flow->todo, 
fs+i);
+                                                }
+                                }
        } 
        PARDEBUG {
                int candidates = 0;
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to