Changeset: 6fd6a1329deb for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6fd6a1329deb Modified Files: monetdb5/scheduler/mut_pack.c Branch: mutation Log Message:
Handle the language pass instructions better diffs (120 lines): diff --git a/monetdb5/scheduler/mut_pack.c b/monetdb5/scheduler/mut_pack.c --- a/monetdb5/scheduler/mut_pack.c +++ b/monetdb5/scheduler/mut_pack.c @@ -58,6 +58,7 @@ validswitch(InstrPtr p, InstrPtr q) return 1; } +// search real usage of the matpack in the remainder of the plan static int nextUsage(InstrPtr *old, int start, int limit, int mvar){ int i; @@ -74,8 +75,8 @@ int mutationPack(Client cntxt, Mutant m){ MalBlkPtr mb = m->src; MalStkPtr stk= m->stk; - int pc = m->target, i, j, mvar, limit, pos=0, pass=1; - InstrPtr p=0, *old= mb->stmt, q, newpack=0, newpack1=0, newpack2 = 0; + int pc = m->target, i, j, mvar, limit, pos=0; + InstrPtr p=0, *old= mb->stmt, q, newpack=0, newpack1=0, newpack2 = 0, sink=0; int profiler=0, modified= 0; (void) cntxt; @@ -86,6 +87,7 @@ mutationPack(Client cntxt, Mutant m){ // replace a single (!) mat.pack // first phase, see if we need to undo a bat.partition + sink = newInstruction(NULL,REMsymbol); mvar = -1; for (i = 1; i < limit; i++) { p= old[i]; @@ -118,6 +120,12 @@ mutationPack(Client cntxt, Mutant m){ printInstruction(cntxt->fdout,mb,0,newpack,LIST_MAL_DEBUG); printInstruction(cntxt->fdout,mb,0,q,LIST_MAL_DEBUG); } + if ( getModuleId(q) == languageRef && getFunctionId(q) == passRef && getArg(newpack,0) == getArg(q,1)){ + // the pack operation can be removed + i++; + modified++; + continue; + } else if( getModuleId(q) == batRef && getFunctionId(q) == partitionRef && getArgPos(q,mvar) > 0){ // we bounced upon a partition over a packed variable // this means we replace the partitions by the matpack components @@ -198,8 +206,10 @@ mutationPack(Client cntxt, Mutant m){ if ( pos == 2 && getFunctionId(q) == subselectRef) setFunctionId(newpack1, putName("mergepack",9)); pushInstruction(mb, newpack1); + sink = pushArgument(mb,sink,getArg(newpack1,0)); if ( newpack2){ pushInstruction(mb, newpack2); + sink = pushArgument(mb,sink,getArg(newpack1,1)); modified++; } modified++; @@ -210,7 +220,7 @@ mutationPack(Client cntxt, Mutant m){ continue; } } else - if(getModuleId(q) == sqlRef && + if( getModuleId(q) == sqlRef && ( getFunctionId(q) == subdeltaRef /* || getFunctionId(q) == projectdeltaRef*/ )){ int tpe = getTailType(getArgType(mb,q,0)); profiler = mb->profiler[i].trace; @@ -235,13 +245,13 @@ mutationPack(Client cntxt, Mutant m){ else setFunctionId(newpack1, putName("pack",4)); pushInstruction(mb, newpack1); + sink = pushArgument(mb,sink,getArg(newpack1,0)); m->target = mb->stop-1; modified++; i++; // if the target variable is used more often then we should retain the pack if( nextUsage(old,i+1,limit,mvar)) pushInstruction(mb,newpack); - DEBUG_MULTICORE printFunction(cntxt->fdout,mb,0,LIST_MAL_DEBUG); continue; } else pushInstruction(mb,p); @@ -249,19 +259,22 @@ mutationPack(Client cntxt, Mutant m){ } if( p) pushInstruction(mb,p); - } else { - if (i > pc && p->barrier && pass){ - for(j = 0; j< q->retc; j++){ - InstrPtr qq= newStmt(m->src, languageRef, passRef); - qq = pushArgument(m->src,qq,getArg(q,j)); + } else { + if( p->barrier){ +/* + for( j= sink->retc; j<sink->argc; j++){ + q= newStmt(mb, languageRef, passRef); + q = pushArgument(mb,q,getArg(sink, j)); } - pass= 0; +*/ + sink->argc=sink->retc; } if( p) pushInstruction(mb,p); } } GDKfree(old); + GDKfree(sink); if( modified) mutationMerge(cntxt,m); return modified; @@ -305,9 +318,10 @@ mutationMerge(Client cntxt, Mutant m ) pushInstruction(mb,p); } OPTdeadcodeImplementation (cntxt,m->src,0,0); + DEBUG_MULTICORE if( action){ - DEBUG_MULTICORE mnstr_printf(cntxt->fdout,"#MUTATION FINAL\n"); - DEBUG_MULTICORE printFunction(cntxt->fdout,mb,0,LIST_MAL_DEBUG); + mnstr_printf(cntxt->fdout,"#MUTATION FINAL\n"); + printFunction(cntxt->fdout,mb,0,LIST_MAL_DEBUG); } GDKfree(old); return 1; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list