Changeset: d46984f14d71 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d46984f14d71
Modified Files:
        monetdb5/optimizer/opt_prelude.c
        monetdb5/optimizer/opt_prelude.h
        monetdb5/scheduler/run_mutation.c
Branch: mutation
Log Message:

Toggle the mutation scheduler
To avoid recursive calls, we have to temporarily turn the
mutation optimizer into a comment.


diffs (94 lines):

diff --git a/monetdb5/optimizer/opt_prelude.c b/monetdb5/optimizer/opt_prelude.c
--- a/monetdb5/optimizer/opt_prelude.c
+++ b/monetdb5/optimizer/opt_prelude.c
@@ -129,6 +129,7 @@ str likeuselectRef;
 str ilikeuselectRef;
 str likeRef;
 str ilikeRef;
+str mutationRef;
 str not_likeRef;
 str not_ilikeRef;
 str listRef;
@@ -390,6 +391,7 @@ void optimizerInit(void){
                listRef = putName("list",4);
                likeRef = putName("like",4);
                ilikeRef = putName("ilike",5);
+               mutationRef = putName("mutation",8);
                not_likeRef = putName("not_like",8);
                not_ilikeRef = putName("not_ilike",9);
                lockRef = putName("lock",4);
diff --git a/monetdb5/optimizer/opt_prelude.h b/monetdb5/optimizer/opt_prelude.h
--- a/monetdb5/optimizer/opt_prelude.h
+++ b/monetdb5/optimizer/opt_prelude.h
@@ -129,6 +129,7 @@ opt_export  str ilikeuselectRef;
 opt_export  str listRef;
 opt_export  str likeRef;
 opt_export  str ilikeRef;
+opt_export  str mutationRef;
 opt_export  str not_likeRef;
 opt_export  str not_ilikeRef;
 opt_export  str lockRef;
diff --git a/monetdb5/scheduler/run_mutation.c 
b/monetdb5/scheduler/run_mutation.c
--- a/monetdb5/scheduler/run_mutation.c
+++ b/monetdb5/scheduler/run_mutation.c
@@ -142,6 +142,23 @@ mutationSum(Client cntxt, Mutant m, int 
        }
     GDKfree(old);
 }
+
+static void
+RUNtoggleMutation(MalBlkPtr mb)
+{
+       int i;
+       InstrPtr p;
+       for ( i =0; i < mb->stop; i++){
+               p = getInstrPtr(mb,i);
+               if ( getModuleId(p) == schedulerRef && getFunctionId(p) == 
mutationRef){
+                       if ( p->token == REMsymbol)
+                               p->token = PATcall;
+                       else
+                               p->token = REMsymbol;
+               }
+       }
+}
+
 static str
 RUNmutationInternal(Client cntxt, MalStkPtr stk, str modnme, str fcnnme)
 {
@@ -172,12 +189,18 @@ RUNmutationInternal(Client cntxt, MalStk
                mutant->stk = stk;
                mutant->calls = 0;
                src->mutants = (void*) mutant;
+
+               // turn off the scheduler call
+               RUNtoggleMutation(src);
+
                clk = GDKusec();
                // assume scheduler call is at line 1
                //      msg = runMALsequence(cntxt, src, 2,src->stop,stk,0,0);
                msg = runMAL(cntxt, src, 0, 0);
                mutant->calls++;
                mutant->runtime += GDKusec()- clk;
+               // turn on the scheduler call
+               RUNtoggleMutation(src);
                return msg;
        }
        
@@ -231,11 +254,17 @@ RUNmutationInternal(Client cntxt, MalStk
                        printFunction(cntxt->fdout, src,0,LIST_MAL_ALL);
        } 
        
+       // turn off the scheduler call
+       RUNtoggleMutation(src);
+
        clk = GDKusec();
        // assume scheduler call is at line 1
        //msg = runMALsequence(cntxt, src, 2,src->stop,stk,0, 0);
        msg = runMAL(cntxt, src, 0, 0);
        mutant->runtime += GDKusec()- clk;
+       
+       // turn on the scheduler call
+       RUNtoggleMutation(src);
        return msg;
 }
 
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to