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

Modified Files:
        opt_prelude.mx opt_replicator.mx 
Log Message:
Fixed calls to replicator.start and stop with inlined functions.
Temporarily switch the profiler off to check its overhead.


Index: opt_prelude.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_prelude.mx,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- opt_prelude.mx      1 Feb 2008 19:36:34 -0000       1.37
+++ opt_prelude.mx      5 Mar 2008 21:51:08 -0000       1.38
@@ -93,6 +93,7 @@
 opt_export  str printRef;
 opt_export  str preludeRef;
 opt_export  str postludeRef;
+opt_export  str profilerRef;
 opt_export  str projectRef;
 opt_export  str putRef;
 opt_export  str queryRef;
@@ -119,6 +120,8 @@
 opt_export  str sortTHRef;
 opt_export  str sqlRef;
 opt_export  str streamsRef;
+opt_export  str startRef;
+opt_export  str stopRef;
 opt_export  str strRef;
 opt_export  str sumRef;
 opt_export  str sunionRef;
@@ -225,6 +228,7 @@
 str printRef;
 str preludeRef;
 str postludeRef;
+str profilerRef;
 str projectRef;
 str putRef;
 str queryRef;
@@ -251,6 +255,8 @@
 str sortTHRef;
 str sqlRef;
 str streamsRef;
+str startRef;
+str stopRef;
 str strRef;
 str sumRef;
 str sunionRef;
@@ -352,6 +358,7 @@
                plusRef = putName("+",1);
                printRef = putName("print",5);
                preludeRef = putName("prelude",7);
+               profilerRef = putName("profiler",8);
                postludeRef = putName("postlude",8);
                projectRef = putName("project",7);
                putRef = putName("put",3);
@@ -378,6 +385,8 @@
                sortTHRef = putName("sortTH",6);
                sqlRef = putName("sql",3);
                streamsRef = putName("streams",7);
+               startRef = putName("start",5);
+               stopRef = putName("stop",4);
                strRef = putName("str",3);
                sumRef = putName("sum",3);
                sunionRef= putName("sunion",6);

Index: opt_replicator.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_replicator.mx,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- opt_replicator.mx   5 Mar 2008 10:22:59 -0000       1.33
+++ opt_replicator.mx   5 Mar 2008 21:51:08 -0000       1.34
@@ -157,7 +157,7 @@
 @h
 #ifndef _OPT_REPLICATOR_
 #define _OPT_REPLICATOR_
-#define _DEBUG_REPLICATOR_
+/*#define _DEBUG_REPLICATOR_*/
 #include "mal.h"
 #include "opt_prelude.h"
 #include "opt_support.h"
@@ -216,6 +216,7 @@
 static int replver = 0;  /* version of replica table */
 static int replref = 0;  /* queries currently using repl */
 static StatPtr replstat = NULL;  /* statistics for stored intermediates */
+static int use_profiler = 0;
 
 /*static int replnr = 0;  number of replicas */
 static sht retain = 0;  /* replica retainment policy
@@ -310,7 +311,6 @@
                        r = getDestVar(p);
                        ps = instruction2str(repl,p, LIST_MAL_ALL);
 
-                       stream_printf(GDKout,"%d %d\t", i,isResStored(repl,i));
                        if( isVarStored(repl,r))
                                stream_printf(GDKout,"%5.2f  %d  %d\t", 
replstat[r].ticks, replstat[r].cnt,replstat[r].reuse);
                        else stream_printf(GDKout,"Not stored   \t");
@@ -357,14 +357,11 @@
        InstrPtr *old;
        int limit,slimit, no_pr, rprof = 0, rs =0;
        sht *rep ;
-       bit t = TRUE;
-       ValRecord v;
 
        (void) stk;
                 /* vars bound to replicator commands */
        rep = (sht*) alloca(sizeof(sht)* mb->vtop);
        memset((char*) rep, 0, sizeof(sht)* mb->vtop);
-       VALset(&v,TYPE_bit,&t);
 
        no_pr = (mb->profiler == NULL? 1:0);
        old= mb->stmt;
@@ -377,7 +374,7 @@
                if( getModuleId(p)== sqlRef &&
                        ((getFunctionId(p)== bindRef) ||
                        (getFunctionId(p)== bindidxRef)) ){
-                       if(no_pr && rprof ==0){
+                       if(no_pr && rprof ==0 && use_profiler){
                                InstrPtr q;
                                q = newStmt(mb,"profiler","start");
                                setDestType(mb,q,TYPE_void);
@@ -386,7 +383,6 @@
                        if(rs == 0){
                                InstrPtr q;
                                q = newStmt(mb,"replicator","start");
-                               varSetProp(mb, getArg(q,0), unsafeProp, op_eq, 
&v); 
                                setDestType(mb,q,TYPE_void);
                                rs = 1;
                        }
@@ -432,6 +428,19 @@
                                setModuleId(p,replicatorRef);
                                pushInstruction(mb,p);
                                rep[getArg(p,0)] = 1;
+               } else  /* avoid multiple starts of replicator due to inlining 
*/
+               if( getModuleId(p)== replicatorRef && 
+                       ( getFunctionId(p) == startRef ||
+                         getFunctionId(p) == stopRef)){
+                               if( rs == 1) freeInstruction(p);
+                               else {  pushInstruction(mb,p);
+                                       rs = 1;
+                               }
+               } else  /* avoid multiple starts of profiler due to inlining */
+               if( getModuleId(p)== profilerRef && 
+                       ( getFunctionId(p) == startRef ||
+                         getFunctionId(p) == stopRef)){
+                               freeInstruction(p);
                } else {        
                        if((getModuleId(p)== sqlRef && 
                                getFunctionId(p)==resultSetRef) ||
@@ -442,7 +451,7 @@
                                        setDestType(mb,q,TYPE_void);    
                                        rs = 0;
                                }
-                               if (no_pr && rprof == 1){
+                               if (no_pr && rprof == 1 && use_profiler){
                                        InstrPtr q;
                                        q = newStmt(mb,"profiler","stop");
                                        setDestType(mb,q,TYPE_void);


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