Changeset: 53463d15ceb9 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=53463d15ceb9 Modified Files: monetdb5/optimizer/opt_wrapper.c Branch: default Log Message:
Clean up some code diffs (83 lines): diff --git a/monetdb5/optimizer/opt_wrapper.c b/monetdb5/optimizer/opt_wrapper.c --- a/monetdb5/optimizer/opt_wrapper.c +++ b/monetdb5/optimizer/opt_wrapper.c @@ -97,19 +97,19 @@ opt_export str OPTwrapper(Client cntxt, #define OPTIMIZERDEBUG if (0) str OPTwrapper (Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p){ - str modnme = "(NONE)"; + str modnme = "(NONE)", curmodnme= NULL; str fcnnme = 0; str msg= MAL_SUCCEED; Symbol s= NULL; lng t,clk= GDKusec(); int i, actions = 0; char optimizer[256]; - InstrPtr q; if( p == NULL) throw(MAL, "opt_wrapper", "missing optimizer statement"); snprintf(optimizer,256,"%s", fcnnme = getFunctionId(p)); - q= copyInstruction(p); + + curmodnme = getModuleId(p); OPTIMIZERDEBUG mnstr_printf(cntxt->fdout,"=APPLY OPTIMIZER %s\n",fcnnme); if( p && p->argc > 1 ){ @@ -117,10 +117,8 @@ str OPTwrapper (Client cntxt, MalBlkPtr getArgType(mb,p,2) != TYPE_str || !isVarConstant(mb,getArg(p,1)) || !isVarConstant(mb,getArg(p,2)) - ) { - freeInstruction(q); + ) throw(MAL, optimizer, ILLARG_CONSTANTS); - } if( stk != 0){ modnme= *getArgReference_str(stk,p,1); @@ -132,18 +130,15 @@ str OPTwrapper (Client cntxt, MalBlkPtr removeInstruction(mb, p); s= findSymbol(cntxt->nspace, putName(modnme),putName(fcnnme)); - if( s == NULL) { - freeInstruction(q); + if( s == NULL) throw(MAL, optimizer, RUNTIME_OBJECT_UNDEFINED ":%s.%s", modnme, fcnnme); - } mb = s->def; stk= 0; } else if( p ) removeInstruction(mb, p); if( mb->errors ){ /* when we have errors, we still want to see them */ - addtoMalBlkHistory(mb,getModuleId(q)); - freeInstruction(q); + addtoMalBlkHistory(mb, curmodnme); return MAL_SUCCEED; } @@ -153,10 +148,8 @@ str OPTwrapper (Client cntxt, MalBlkPtr actions = (int)(*(codes[i].fcn))(cntxt, mb, stk,0); break; } - if ( codes[i].nme == 0){ - freeInstruction(q); + if ( codes[i].nme == 0) throw(MAL, optimizer, RUNTIME_OBJECT_UNDEFINED ":%s.%s", modnme, fcnnme); - } msg= optimizerCheck(cntxt, mb, optimizer, actions, t=(GDKusec() - clk)); OPTIMIZERDEBUG { @@ -167,9 +160,8 @@ str OPTwrapper (Client cntxt, MalBlkPtr mnstr_printf(cntxt->fdout,"#optimizer %-11s %3d actions %5d MAL instructions ("SZFMT" K) " LLFMT" usec\n", optimizer, actions, mb->stop, ((sizeof( MalBlkRecord) +mb->ssize * offsetof(InstrRecord, argv)+ mb->vtop * sizeof(int) /* argv estimate */ +mb->vtop* sizeof(VarRecord) + mb->vsize*sizeof(VarPtr)+1023)/1024), t); - QOTupdateStatistics(getModuleId(q),actions,t); - addtoMalBlkHistory(mb,getModuleId(q)); - freeInstruction(q); + QOTupdateStatistics(curmodnme,actions,t); + addtoMalBlkHistory(mb,curmodnme); return msg; } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list