Changeset: 0f933a8aeace for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0f933a8aeace
Modified Files:
monetdb5/scheduler/mut_transforms.c
Branch: mutation
Log Message:
Cleanup the code.
diffs (91 lines):
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
@@ -395,10 +395,36 @@ mutationJoin(Client cntxt, Mutant m){
* 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.
*/
+static int
+mutationSelect_(MalBlkPtr mb, MalStkPtr stk, InstrPtr p, int partitions, int
slice, int profiler)
+{
+ int v, b1;
+ InstrPtr q;
+
+ q= newStmt(mb, batRef, partitionRef);
+ setVarType(mb, getArg(q,0), getArgType(mb, p, p->retc));
+ b1 = getArg(q,0);
+ q = pushArgument(mb,q,getArg(p,1));
+ q = pushInt(mb,q,partitions);
+ // update the stack as well, because we are executing
+ stk->stk[getArg(q, q->argc-1)].val.ival = partitions;
+ q = pushInt(mb,q,0);
+ stk->stk[getArg(q, q->argc-1)].val.ival = slice;
+ // inherit profiling
+ mb->profiler[mb->stop-1].trace = profiler;
+
+ q= copyInstruction(p);
+ getArg(q,1)= b1;
+ v = getArg(q,0)= newTmpVariable(mb,TYPE_any);
+ pushInstruction(mb,q);
+ // inherit profiling
+ mb->profiler[getPC(mb,q)].trace = profiler;
+ return v;
+}
void
mutationSelect(Client cntxt, Mutant m){
- int pc = m->target, i, j, k, limit, b1,b2, v1,v2;
+ int pc = m->target, i, j, k, limit, b2, v1,v2;
InstrPtr p=0, *old= m->src->stmt, q;
int matpc = 0, profiler=0;
@@ -430,47 +456,14 @@ mutationSelect(Client cntxt, Mutant m){
}
profiler = m->src->profiler[i].trace;
- q= newStmt(m->src, batRef, partitionRef);
- setVarType(m->src, getArg(q,0), getArgType(m->src, p,
p->retc));
- b1 = getArg(q,0);
- q = pushArgument(m->src,q,getArg(p,1));
- q = pushInt(m->src,q,2);
- // update the stack as well, because we are executing
- m->stk->stk[getArg(q, q->argc-1)].val.ival = 2;
- q = pushInt(m->src,q,0);
- m->stk->stk[getArg(q, q->argc-1)].val.ival = 0;
- // inherit profiling
- m->src->profiler[m->src->stop-1].trace = profiler;
-
- q= newStmt(m->src, batRef, partitionRef);
- setVarType(m->src, getArg(q,0), getArgType(m->src, p,
p->retc));
- b2 = getArg(q,0);
- q = pushArgument(m->src,q,getArg(p,1));
- q = pushInt(m->src,q,2);
- q = pushInt(m->src,q,1);
- m->stk->stk[getArg(q, q->argc-1)].val.ival = 1;
- // inherit profiling
- m->src->profiler[m->src->stop-1].trace = profiler;
+ v1 = mutationSelect_(m->src, m->stk, p, 2, 0, profiler);
+ v2 = mutationSelect_(m->src, m->stk, p, 2, 1, profiler);
q= newStmt(m->src, languageRef, passRef);
q = pushArgument(m->src,q,getArg(p, p->retc));
// inherit profiling
m->src->profiler[m->src->stop-1].trace = profiler;
- q= copyInstruction(p);
- getArg(q,1)= b1;
- v1 = getArg(q,0)= newTmpVariable(m->src,TYPE_any);
- pushInstruction(m->src,q);
- // inherit profiling
- m->src->profiler[getPC(m->src,q)].trace = profiler;
-
- q= copyInstruction(p);
- getArg(q,1)= b2;
- v2 = getArg(q,0)= newTmpVariable(m->src,TYPE_any);
- pushInstruction(m->src,q);
- // inherit profiling
- m->src->profiler[m->src->stop-1].trace = profiler;
-
// replace its use in other mat packs
for (j = i; j < limit; j++) {
q= old[j];
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list