Re: [Monetdb-developers] [Monetdb-checkins] MonetDB5/src/optimizer opt_history.mx, , 1.1, 1.2
Martin Kersten wrote:
Update of /cvsroot/monetdb/MonetDB5/src/optimizer In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv32362
Modified Files: opt_history.mx Log Message: Added the missing information.
U opt_history.mx Index: opt_history.mx =================================================================== RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_history.mx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- opt_history.mx 3 Nov 2008 06:35:34 -0000 1.1 +++ opt_history.mx 3 Nov 2008 12:36:44 -0000 1.2 @@ -32,7 +32,7 @@ time you use the history without initialization. The keepcall can be used to check for initialization of the cache. @mal -module user; +module sql; function keepquery{unsafe}(qid:int,qry:str,parse:lng,optimize:lng):void; raise SQLexception:= "SQL history script should be run first"; end keepquery; @@ -44,6 +44,10 @@ function queryId{unsafe}(qid:int):void; end queryId;
+pattern forgetPrevious():void +address OPTforgetPrevious +comment "invalidate the previous instruction from future execution"; + pattern optimizer.history():str address OPThistory; pattern optimizer.history(mod:str, fcn:str):str @@ -61,6 +65,7 @@ #include "mal_instruction.h" #include "mal_function.h"
+opt_export str OPTforgetPrevious(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); /* #define _DEBUG_OPT_QUERYHISTORY_ trace its behavior */
@- @@ -79,12 +84,23 @@ @c #include "opt_history.h"
+str +OPTforgetPrevious(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){ + int pc; + (void) cntxt; + (void) stk; + pc= getPC(mb,pci); + assert ( pc > 0 && pc < mb->stop); + mb->stmt[pc-1]->token = REMsymbol; + return MAL_SUCCEED; +} + static int OPThistoryImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { int i, limit,slimit; InstrPtr p=0, *old= mb->stmt, q,r; - int qid, argc, elaps, inblock, oublock, arg, ctime; + int qid=0, argc, elaps, inblock, oublock, arg, ctime; int returnseen=0;
@@ -97,6 +113,17 @@ #else (void) cntxt; #endif + if ( findSymbol(userRef,"keepQuery") == 0){ + /* initialization script has not been ran */ + return 0; + } + /* gather information and recast the call handel*/ + for (i = 1; i < limit; i++) { Using limit here and...
+ p= getInstrPtr(mb,i); + if ( getModuleId(p)== sqlRef && idcmp(getFunctionId(p),"queryId")==0){ + qid= getArg(p,1); + } + }
limit= mb->stop;
You initialize it here :S Romulo
slimit= mb->ssize; @@ -109,6 +136,11 @@ for (i = 1; i < limit; i++) { p= old[i];
+ if ( getModuleId(p)== sqlRef && idcmp(getFunctionId(p),"keepQuery")==0){ + getModuleId(p) = userRef; + pushInstruction(mb,p); + q= newStmt(mb,sqlRef,"forgetPrevious"); + } if ( p->token== ENDsymbol || p->barrier == RETURNsymbol || p->barrier == YIELDsymbol){ if (returnseen && p->token == ENDsymbol) { pushInstruction(mb,p);
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Monetdb-checkins mailing list Monetdb-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
participants (1)
-
Romulo Goncalves