Changeset: 08a01a308e54 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=08a01a308e54
Modified Files:
monetdb5/scheduler/mut_policy.c
monetdb5/scheduler/mut_transforms.c
Branch: mutation
Log Message:
Merge the mat packs in selection mutation.
For the time being, assemble all pieces directly into 1 mat.pack
diffs (63 lines):
diff --git a/monetdb5/scheduler/mut_policy.c b/monetdb5/scheduler/mut_policy.c
--- a/monetdb5/scheduler/mut_policy.c
+++ b/monetdb5/scheduler/mut_policy.c
@@ -76,7 +76,7 @@ MUTpolicy(Client cntxt, Mutant m)
DEBUG_MUTATION if ( src->profiler && m->target) {
mnstr_printf(cntxt->fdout,"#mutation calls %d cost "LLFMT"\n",
src->calls, src->runtime/src->calls);
mnstr_printf(cntxt->fdout,"#mutation target instruction %d cost
"LLFMT"\n", m->target, src->profiler[target].ticks/src->calls);
-
printInstruction(cntxt->fdout,src,0,getInstrPtr(src,target),LIST_MAL_ALL);
+
printInstruction(cntxt->fdout,src,0,getInstrPtr(src,m->target),LIST_MAL_ALL);
}
/* At this point we have a target instruction to be replaced */
/* safe the previous version in the history list */
diff --git a/monetdb5/scheduler/mut_transforms.c
b/monetdb5/scheduler/mut_transforms.c
--- a/monetdb5/scheduler/mut_transforms.c
+++ b/monetdb5/scheduler/mut_transforms.c
@@ -31,11 +31,14 @@
/* Sample plan mutation actions
* The select mutation simply splits the target instruction
* and glues the result using matpack.
+ * If the target is already input to a mat.pack, then we should add
+ * the pieces produced to that instruction instead of making a new mat.pack.
*/
void
mutationSelect(Client cntxt, Mutant m){
- int pc = m->target, i,limit, b1,b2, v1,v2;
+ int pc = m->target, i, j, k, limit, b1,b2, v1,v2;
InstrPtr p=0, *old= m->src->stmt, q;
+ int matpc = 0;
(void) cntxt;
limit= m->src->stop;
@@ -80,10 +83,27 @@ mutationSelect(Client cntxt, Mutant m){
v2 = getArg(q,0)= newTmpVariable(m->src,TYPE_any);
pushInstruction(m->src,q);
- q= newStmt(m->src,matRef,packRef);
- getArg(q,0)= getArg(p,0);
- q= pushArgument(m->src,q,v1);
- q= pushArgument(m->src,q,v2);
+ // replace its use in other mat packs
+ for (j = i; j < limit; j++) {
+ q= old[j];
+ if ( getModuleId(q) == matRef &&
getFunctionId(q) == packRef){
+ for( k= q->retc; k < q->argc; k++)
+ if ( getArg(q,k) ==
getArg(p,0)){
+ /* replace this
argument */
+ matpc++;
+ delArgument(old[j],k);
+ old[j] =
setArgument(m->src,old[j],k, v2);
+ old[j] =
setArgument(m->src,old[j],k, v1);
+ }
+ }
+ }
+
+ if ( matpc == 0){
+ q= newStmt(m->src,matRef,packRef);
+ getArg(q,0)= getArg(p,0);
+ q= pushArgument(m->src,q,v1);
+ q= pushArgument(m->src,q,v2);
+ }
//pushInstruction(m->src,p);
m->target = pc;
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list