Changeset: a80ada9928c6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a80ada9928c6
Modified Files:
        monetdb5/extras/dvf/dvf.c
        monetdb5/mal/mal_recycle.c
        monetdb5/optimizer/opt_recycler.c
Branch: DVframework
Log Message:

DVf caching with recycler. Mount instructions are cached.


diffs (154 lines):

diff --git a/monetdb5/extras/dvf/dvf.c b/monetdb5/extras/dvf/dvf.c
--- a/monetdb5/extras/dvf/dvf.c
+++ b/monetdb5/extras/dvf/dvf.c
@@ -76,7 +76,8 @@ str plan_modifier(Client cntxt, MalBlkPt
 
        BATiter fli;
        
-       int run_dataflow_opt = 1;
+       int run_dataflow_opt = 0;
+       int run_recycle_opt = 1;
 
        VarRecord low, high;
 
@@ -279,13 +280,19 @@ str plan_modifier(Client cntxt, MalBlkPt
                typeChecker(cntxt->fdout, cntxt->nspace, mb, o, FALSE);
        }
        
+       if(run_recycle_opt)
+       {
+               o = newFcnCall(mb, "optimizer", "recycle");
+               typeChecker(cntxt->fdout, cntxt->nspace, mb, o, FALSE);
+       }
+       
        if(run_dataflow_opt)
        {
                o = newFcnCall(mb, "optimizer", "dataflow");
                typeChecker(cntxt->fdout, cntxt->nspace, mb, o, FALSE);
        }
 
-       if(run_mergetable_opt || run_dataflow_opt)
+       if(run_mergetable_opt || run_recycle_opt || run_dataflow_opt)
                optimizeMALBlock(cntxt, mb);
 
        /* New variables might have been created by the optimizers, so their 
values has to be copied into the stack. However, there might not be enough 
space in stack for them. We cannot reallocate the stack, but we may create our 
own enlarged stack, then run the rest of the plan with our own stack. */
@@ -336,8 +343,8 @@ str plan_modifier(Client cntxt, MalBlkPt
        /* adjust variable lifetimes */
        malGarbageCollector(mb);
 
-       /* chkProgram(cntxt->fdout, cntxt->nspace, mb);
-       printFunction(cntxt->fdout,mb, 0, LIST_MAL_EXPLAIN); */
+       /*chkProgram(cntxt->fdout, cntxt->nspace, mb);
+       printFunction(cntxt->fdout,mb, 0, LIST_MAL_ALL); */
 
        /* relocate the startpc, the instruction to proceed with the execution. 
Because it might be changed by the optimizers. */
        for (i = 0; i < limit; i++)
diff --git a/monetdb5/mal/mal_recycle.c b/monetdb5/mal/mal_recycle.c
--- a/monetdb5/mal/mal_recycle.c
+++ b/monetdb5/mal/mal_recycle.c
@@ -74,6 +74,8 @@
 static MT_Lock recycleLock MT_LOCK_INITIALIZER("recycleLock");
 MalBlkPtr recycleBlk = NULL;
 
+str RECYCLEprelude(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
+
 #define set1(x,i) ( x | ((lng)1 << i) )
 #define set0(x,i) ( x & ~((lng)1 << i) )
 #define getbit(x,i) ( x & ((lng)1 << i) )
@@ -121,7 +123,7 @@ aggrFun minAggr = NULL, maxAggr = NULL;
  * REUSE_COVER exploits potentional overlap in range selects
  * to reduce the amount of scanning.
  */
-int reusePolicy = REUSE_COVER; /* recycle reuse policy
+int reusePolicy = REUSE_EXACT; /* recycle reuse policy
                        REUSE_NONE: baseline, keeps stat, no admission, no reuse
                        REUSE_COVER: reuse smallest select covering
                        REUSE_EXACT: exact covering
@@ -140,7 +142,7 @@ int reusePolicy = REUSE_COVER;      /* recycl
  * If we run low on memory, we either deploy the LRU or
  * BENEFIT algorithm to determine the victims.
  */
-int rcachePolicy = RCACHE_BENEFIT;  /* recycle cache management policy
+int rcachePolicy = RCACHE_LRU;  /* recycle cache management policy
                        RCACHE_ALL: baseline, do nothing
                        RCACHE_LRU: evict the LRU
                        RCACHE_BENEFIT: evict items with smallest benefit= 
weight * cost
@@ -2273,8 +2275,12 @@ RECYCLEentry(Client cntxt, MalBlkPtr mb,
        if ( p->recycle == NO_RECYCLING )
                return 0;       /* don't count subsumption instructions */
        cntxt->rcc->statements++;
-       if ( recycleBlk == NULL )
-               return 0;
+//     if ( recycleBlk == NULL )
+//             return 0;
+//     if ( recycleBlk == NULL )
+//             RECYCLEprelude(cntxt, mb, stk, p);
+//     if ( cntxt->rcc->curQ < 0 )
+//             RECYCLEprelude(cntxt, mb, stk, p);
        if ( !RECYCLEinterest(p) )  /* don't scan RP for non-monitored 
instructions */
                return 0;
        if ( cntxt->rcc->curQ < 0 )     /* don't use recycling before 
initialization
diff --git a/monetdb5/optimizer/opt_recycler.c 
b/monetdb5/optimizer/opt_recycler.c
--- a/monetdb5/optimizer/opt_recycler.c
+++ b/monetdb5/optimizer/opt_recycler.c
@@ -46,7 +46,7 @@
 #include "mal_instruction.h"
 
 static lng recycleSeq = 0;             /* should become part of MAL block 
basics */
-static bte baseTableMode = 0;  /* only recycle base tables */
+static bte baseTableMode = 1;  /* only recycle base tables */
 
 int
 OPTrecyclerImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
p)
@@ -58,6 +58,10 @@ OPTrecyclerImplementation(Client cntxt, 
        char *recycled;
        short app_sc = -1, in = 0;
        ValRecord cst;
+       
+       int preluded = 0;
+       
+       str mountRef = putName("mount", 5);
 
        (void) cntxt;
        (void) stk;
@@ -91,8 +95,12 @@ OPTrecyclerImplementation(Client cntxt, 
        pushInstruction(mb, old[0]);
        mb->recid = recycleSeq++;
 
-       /* create a handle for recycler */
-       (void) newFcnCall(mb, "recycle", "prelude");
+       if(!baseTableMode)
+       {
+               /* create a handle for recycler */
+               (void) newFcnCall(mb, "recycle", "prelude");
+       }
+       
        in = 1;
        for (i = 1; i < limit; i++) {
                p = old[i];
@@ -181,11 +189,23 @@ OPTrecyclerImplementation(Client cntxt, 
                        continue;
                }
 
-               if (getModuleId(p) == octopusRef &&
-                       (getFunctionId(p) == bindRef || getFunctionId(p) == 
bindidxRef)) {
+//             if (getModuleId(p) == octopusRef &&
+//                     (getFunctionId(p) == bindRef || getFunctionId(p) == 
bindidxRef)) {
+//                     recycled[getArg(p, 0)] = 1;
+//                     p->recycle = recycleMaxInterest;
+//                     marks++;
+//             }
+               
+               if (getFunctionId(p) == mountRef) {
                        recycled[getArg(p, 0)] = 1;
                        p->recycle = recycleMaxInterest;
                        marks++;
+                       
+                       if(!preluded) {
+                               /* create a handle for recycler */
+                               (void) newFcnCall(mb, "recycle", "prelude");
+                               preluded = 1;
+                       }
                }
                /* During base table recycling skip marking instructions other 
than octopus.bind */
                if (baseTableMode) {
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to