Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17763

Modified Files:
        mal_recycle.mx 
Log Message:
Addition of the pattern find search.


Index: mal_recycle.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_recycle.mx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- mal_recycle.mx      2 Mar 2008 11:20:51 -0000       1.4
+++ mal_recycle.mx      2 Mar 2008 12:15:28 -0000       1.5
@@ -301,6 +301,41 @@
        return ((*cmp)(pp, pq));
 
 }
+
+/* check for replica of instruction p in recycle table */
+int
+RECYCLEfindEntry(MalBlkPtr mb, MalStkPtr s, InstrPtr p)
+{
+       int i, j, ridx;
+       InstrPtr q;
+       
+       if( recycleBlk == 0)
+               return -1;
+
+       for (i = 0; i < recycleBlk->stop; i++){
+               q = getInstrPtr(recycleBlk,i);
+               if((p->argc != q->argc) ||
+                  (getModuleId(p) != getFunctionId(q)) ||
+                  (getModuleId(p) != getModuleId(q)))
+                       continue;
+
+               for (j = p->retc; j < p->argc; j++){
+                       ridx = mb->var[getArg(p,j)]->recycle;
+                       if( ridx != getArg(q,j) )
+                                       goto notfound;
+                       else 
+                       if( VALcmp(&s->stk[ridx],
+                               &getVarConstant(recycleBlk,getArg(q,j))) )
+                                       goto notfound;
+               }
+               /* found a match */
+               return i;
+
+               notfound: continue;
+       }
+       return -1;
+
+}
 @-
 The generic wrappers for accessing the recycle variables
 Before the interpreter loop is allowed to execute the instruction
@@ -328,6 +363,13 @@
                VALcopy(lhs,rhs);
                if( lhs->vtype == TYPE_bat)
                        BBPincref(lhs->val.br.id, TRUE);
+       } else
+       if( isVarRecycled(mb, getArg(p,i))){
+               int j= RECYCLEfindEntry(mb,stk,p);
+#ifdef _DEBUG_RECYCLE_
+               stream_printf(GDKout,"RECYCLEentry search %d\n",j);
+#endif
+               /* and from here we should decide how to reuse it */
        }
        stk->clk= GDKusec();
        return cnt == p->retc;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to