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

Modified Files:
        opt_joinpath.mx opt_replicator.mx 
Log Message:
Beware, during joinpath optimization there are new variables
and instructions being introduced.


Index: opt_replicator.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_replicator.mx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- opt_replicator.mx   27 Jan 2008 11:11:05 -0000      1.1
+++ opt_replicator.mx   27 Jan 2008 18:55:26 -0000      1.2
@@ -44,9 +44,13 @@
 pattern replicator.prelude(dst:bat[:any,:any]):void
 address REPprelude
 comment "Prepare for re-using an intermediate result.";
-pattern replicator.postlude(dst:bat[:any,:any]):void
-address REPpostlude
-comment "Keep the new intermediate and manage the pool.";
+
+pattern 
replicator.select(dst:bat[:any_1,:any_2],low:any_2,hgh:any_2):bat[:any_1,:any_2]
+address REPselect
+comment "The overloaded select operator for replicated operations";
+pattern 
replicator.uselect(dst:bat[:any_1,:any_2],low:any_2,hgh:any_2):bat[:any_1,:any_2]
+address REPuselect
+comment "The overloaded uselect operator for replicated operations";
 @h
 #ifndef _OPT_REPLICATOR_
 #define _OPT_REPLICATOR_
@@ -85,11 +89,12 @@
                        ( getFunctionId(p) == uselectRef ||
                          getFunctionId(p) == selectRef
                        ) && pc[getArg(p,1)]){
-                               q= newStmt(mb,replicatorRef,preludeRef);
+                               
q=copyInstruction(getInstrPtr(mb,pc[getArg(p,1)]));
+                               setModuleId(q,replicatorRef);
+                               setFunctionId(q,preludeRef);
                                q= pushArgument(mb,q,getArg(p,1));
                                pushInstruction(mb,p);
-                               q= newStmt(mb,replicatorRef,postludeRef);
-                               q= pushArgument(mb,q,getArg(p,0));
+                               setModuleId(q,replicatorRef);
                } else
                        pushInstruction(mb,p);
        }
@@ -109,12 +114,12 @@
 @:wrapOptimizer(replicator,OPT_CHECK_ALL)@
 
 str
-REPpostlude(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+REPuselect(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
        (void) mb;
        (void) stk;
        (void) pci;
-       throw(MAL,"replicator.postlude","nyi");
+       throw(MAL,"replicator.uselect","nyi");
 }
 str
 REPprelude(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
@@ -124,4 +129,12 @@
        (void) pci;
        throw(MAL,"replicator.postlude","nyi");
 }
+str
+REPselect(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+       (void) mb;
+       (void) stk;
+       (void) pci;
+       throw(MAL,"replicator.select","nyi");
+}
 @}

Index: opt_joinpath.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_joinpath.mx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- opt_joinpath.mx     27 Jan 2008 08:21:29 -0000      1.18
+++ opt_joinpath.mx     27 Jan 2008 18:55:26 -0000      1.19
@@ -108,13 +108,14 @@
        if (varGetProp(mb, getArg(mb->stmt[0], 0), inlineProp) != NULL)
                return 0;
 
-       pc= (int*) alloca(sizeof(int)* mb->vtop); /* to find last assignment */
-       memset((char*) pc, 0, sizeof(int)* mb->vtop);
+       /* beware, new variables and instructions are introduced */
+       pc= (int*) GDKmalloc(sizeof(int)* mb->vtop * 2); /* to find last 
assignment */
+       memset((char*) pc, 0, sizeof(int)* mb->vtop *2);
 
        /* calculate how often each variable is used ,
           we are only expanding when a variable is used once. */
-       used= (int*) alloca(sizeof(int)* mb->vtop); 
-       memset((char*) used, 0, sizeof(int)* mb->vtop);
+       used= (int*) GDKmalloc(sizeof(int)* mb->vtop * 2); /* beware, new 
variables are introduced */
+       memset((char*) used, 0, sizeof(int)* mb->vtop * 2);
 
        old= mb->stmt;
        limit= mb->stop;
@@ -207,6 +208,8 @@
        if(old[i])
                freeInstruction(old[i]);
        GDKfree(old);
+       GDKfree(pc);
+       GDKfree(used);
        return actions;
 }
 @include optimizerWrapper.mx


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