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

Modified Files:
        opt_recycler.mx 
Log Message:
The generic recycler framework.
The recycler optimizer marks all variables that are potential useful
for recycling. This applies to expressions over constants and side-effect free
operations.
The instruction is also marked as relevant to be monitored.
The recycle version is set such that it become automatically initialized.

The interpreter has been wrapped with calls to the recycler, looking
for a cheap way to get the result. If not, the instruction is executed
and the result values become available for recycling.
Currently, all values are retained. The timing and other properties
are now available for more precise policies.

Note, the recycler works on identical execution of instructions only.
For example, optimization of select calls against stored results
should still be handled in a specialized operation, which redirects
the search against the base table to one already kept.


Index: opt_recycler.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_recycler.mx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- opt_recycler.mx     1 Mar 2008 22:52:37 -0000       1.1
+++ opt_recycler.mx     2 Mar 2008 11:20:56 -0000       1.2
@@ -19,9 +19,9 @@
 The recycler optimizer marks the variables subject to recycling control.
 @{
 @mal
-pattern optimizer.recycler():str
+pattern optimizer.recycle():str
 address OPTrecycler;
-pattern optimizer.recycler(mod:str, fcn:str):str
+pattern optimizer.recycle(mod:str, fcn:str):str
 address OPTrecycler
 comment "Replicator code injection";
 
@@ -51,34 +51,35 @@
        Lifespan span= newLifespan(mb);
 
        (void) stk;
-                /* vars bound to replicator commands */
-
        setLifespan(mb,span);
-       for (i = 0; i<mb->vtop; i++)
-       if( !isVarRecycled(mb,i)){
+       for (i = 1; i<mb->stop; i++) {
                p= getInstrPtr(mb,i);
-               if( (getModuleId(p)== sqlRef && getFunctionId(p)==bindRef) ){
-                       setVarRecycled(mb, getArg(p,0));
-                       actions++;
-               } else {
-                       cnt= 0;
-                       for( j=p->retc; j<p->argc; j++)
-                       if( isVarRecycled(mb, getArg(p,j)) ||
-                               isVarConstant(mb, getArg(p,j)) )
-                               cnt++;
-                       
-                       if( cnt == p->argc-p->retc){
-                               actions ++;
-                               for( j= 0; j < p->retc; j++)
-                               if( getLastUpdate(span, getArg(p,j)) == i ){
-                                       setVarRecycled(mb, getArg(p,j));
[EMAIL PROTECTED]
+Functions with side effects can not be subject to recycle actions.
[EMAIL PROTECTED]
+               if( hasSideEffects(p,TRUE))
+                       continue;
+               cnt= 0;
+               for( j=p->retc; j<p->argc; j++)
+               if( isVarRecycled(mb, getArg(p,j)) ||
+                       isVarConstant(mb, getArg(p,j)) )
+                       cnt++;
+               
+               if( cnt == p->argc-p->retc){
+                       actions ++;
+                       p->recycle = 1; /* this instruction is to be monitored 
*/
+                       for( j= 0; j < p->retc; j++)
+                       if( getLastUpdate(span, getArg(p,j)) == i ){
+                               setVarRecycled(mb, getArg(p,j));
 #ifdef DEBUG_OPT_RECYCLER  
-                                       stream_printf(GDKout,"recyle 
%d\n",getArg(p,j));
+                               stream_printf(GDKout,"recyle %d\n",getArg(p,j));
+                               printInstruction(GDKout,mb,p,LIST_MAL_ALL);
 #endif
-                               }
                        }
                }
        }
+       if( actions)
+               mb->version= -1;        /* will trigger the recycler runtime 
support */
        GDKfree(span);
        return actions;
 }


-------------------------------------------------------------------------
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