Update of /cvsroot/monetdb/MonetDB5/src/optimizer
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25089/optimizer
Modified Files:
opt_inline.mx opt_macro.mx optimizer.mx optimizerWrapper.mx
Log Message:
preparing for handling multiplexed inline functions.
minor code cleanup, saving 1.5 page of code.
Index: opt_macro.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_macro.mx,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- opt_macro.mx 31 Oct 2007 12:31:53 -0000 1.22
+++ opt_macro.mx 24 Dec 2007 12:28:25 -0000 1.23
@@ -513,10 +513,7 @@
} else {
mod= getArgDefault(mb,p,1);
fcn= getArgDefault(mb,p,2);
- s = findModule(MCgetClient()->nspace, putName(mod,
strlen(mod)));
- if (s == 0)
- return 0;
- t= findSymbolInModule(s, fcn);
+ t= findSymbol(putName(mod, strlen(mod)), fcn);
if( t == 0)
return 0;
target= t->def;
@@ -558,7 +555,6 @@
@= wrapOptimizer
str [EMAIL PROTECTED](MalBlkPtr mb, MalStkPtr stk, InstrPtr p){
- Module s;
Symbol t;
str msg,mod,fcn;
lng clk= GDKusec();
@@ -572,10 +568,7 @@
mod= getArgDefault(mb,p,3);
fcn= getArgDefault(mb,p,4);
}
- s = findModule(MCgetClient()->nspace, putName(mod, strlen(mod)));
- if (s == 0)
- return 0;
- t= findSymbolInModule(s, fcn);
+ t= findSymbol(putName(mod, strlen(mod)), fcn);
if( t == 0)
return 0;
Index: optimizerWrapper.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/optimizerWrapper.mx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- optimizerWrapper.mx 16 Jul 2007 21:54:53 -0000 1.13
+++ optimizerWrapper.mx 24 Dec 2007 12:28:25 -0000 1.14
@@ -34,7 +34,6 @@
str [EMAIL PROTECTED](MalBlkPtr mb, MalStkPtr stk, InstrPtr p){
str modnme;
str fcnnme;
- Module scope=NULL;
Symbol s= NULL;
lng t,clk= GDKusec();
int actions = 0;
@@ -66,9 +65,7 @@
modnme= getArgDefault(mb,p,1);
fcnnme= getArgDefault(mb,p,2);
}
- scope =
findModule(MCgetClient()->nspace,putName(modnme,strlen(modnme)) );
- if( scope)
- s=
findSymbolInModule(scope,putName(fcnnme,strlen(fcnnme)));
+ s=
findSymbol(putName(modnme,strlen(modnme)),putName(fcnnme,strlen(fcnnme)));
if( s == NULL) {
char buf[1024];
Index: optimizer.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/optimizer.mx,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- optimizer.mx 1 Jun 2007 06:48:29 -0000 1.70
+++ optimizer.mx 24 Dec 2007 12:28:25 -0000 1.71
@@ -146,9 +146,7 @@
modnme = getArgDefault(mb, pci, 1);
fcnnme = getArgDefault(mb, pci, 2);
}
- s = findSymbolInModule(
- findModule(MCgetClient()->nspace,
getName(modnme,strlen(modnme))),
- fcnnme);
+ s = findSymbol( getName(modnme,strlen(modnme)), fcnnme);
if (s == NULL)
throw(MAL, "optimizer.optimize", "operation not found\n");
removeInstruction(mb, pci);
@@ -161,9 +159,7 @@
str fname;
str modnme;
str fcnnme;
- Module scope = NULL;
Symbol s = NULL;
- Client c = MCgetClient();
if (stk != 0) {
modnme = (str) getArgValue(stk, p, 1);
@@ -175,10 +171,8 @@
fname = getArgDefault(mb, p, 3);
}
- scope = findModule(c->nspace, putName(modnme, strlen(modnme)));
- if (scope)
- s = findSymbolInModule(scope, putName(fcnnme, strlen(fcnnme)));
+ s = findSymbol(putName(modnme, strlen(modnme)), putName(fcnnme,
strlen(fcnnme)));
if (s == NULL) {
char buf[1024];
@@ -194,7 +188,6 @@
{
str modnme;
str fcnnme;
- Module scope = NULL;
Symbol s = NULL;
Client c = MCgetClient();
@@ -209,10 +202,7 @@
stream_printf(c->fdout,"#showPlan()\n");
removeInstruction(mb, p);
if( modnme ) {
- scope = findModule(c->nspace, putName(modnme, strlen(modnme)));
-
- if (scope)
- s = findSymbolInModule(scope, putName(fcnnme,
strlen(fcnnme)));
+ s = findSymbol(putName(modnme, strlen(modnme)), putName(fcnnme,
strlen(fcnnme)));
if (s == NULL) {
char buf[1024];
Index: opt_inline.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_inline.mx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- opt_inline.mx 9 Dec 2007 16:21:11 -0000 1.5
+++ opt_inline.mx 24 Dec 2007 12:28:25 -0000 1.6
@@ -39,12 +39,28 @@
#include "mal_interpreter.h"
#include "opt_macro.h"
-/* #define DEBUG_OPT_INLINE show partial result */
+/*#define DEBUG_OPT_INLINE show partial result */
@c
#include "mal_config.h"
#include "opt_inline.h"
+static int OPTinlineMultiplex(MalBlkPtr mb, InstrPtr p){
+ Symbol s;
+ str mod,fcn;
+ mod = VALget(&getVar(mb, getArg(p, 1))->value);
+ fcn = VALget(&getVar(mb, getArg(p, 2))->value);
+ if( (s= findSymbol(mod,fcn)) ==0 )
+ return FALSE;
[EMAIL PROTECTED]
+Before we decide to propagate the inline request
+to the multiplex operation, we check some basic properties
+of the target function.
[EMAIL PROTECTED]
+ return varGetProp(s->def , getArg(getInstrPtr(s->def,0), 0),
+ inlineProp) != NULL;
+}
+
static int
OPTinlineImplementation(MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
{
@@ -57,6 +73,27 @@
q = getInstrPtr(mb, i);
if( q->blk ){
sig = getInstrPtr(q->blk,0);
[EMAIL PROTECTED]
+Time for inlining functions that are used in multiplex operations.
+They are produced by SQL compiler.
[EMAIL PROTECTED]
+#ifdef DEBUG_OPT_INLINE
+ stream_printf(GDKout,"check inline function\n");
+ printInstruction(GDKout,mb,q,LIST_MAL_ALL);
+ printInstruction(GDKout,q->blk,sig,LIST_MAL_ALL);
+#endif
+ if( getModuleId(q) == malRef &&
+ getFunctionId(q)== multiplexRef &&
+ OPTinlineMultiplex(mb,q)){
+#ifdef DEBUG_OPT_INLINE
+ stream_printf(GDKout,"multiplex inline
function\n");
+
printInstruction(GDKout,mb,q,LIST_MAL_ALL);
+#endif
+ varSetProp(mb, getArg(q,0), inlineProp, op_eq,
NULL);
+ } else
[EMAIL PROTECTED]
+Check if the function definition is tagged as being inlined.
[EMAIL PROTECTED]
if (sig->token == FUNCTIONsymbol &&
varGetProp(q->blk, getArg(sig, 0), inlineProp) !=
NULL) {
(void) inlineMALblock(mb,i,q->blk);
@@ -64,13 +101,17 @@
#ifdef DEBUG_OPT_INLINE
printFunction(GDKout, mb, LIST_MAL_ALL);
#endif
- } else if (varGetProp(mb, getArg(q,0), inlineProp) !=
NULL) {
+ } else
[EMAIL PROTECTED]
+Check if the local call is tagged as being inlined.
[EMAIL PROTECTED]
+ if (varGetProp(mb, getArg(q,0), inlineProp) != NULL) {
inlineMALblock(mb,i,q->blk);
actions++;
#ifdef DEBUG_OPT_INLINE
printFunction(GDKout, mb, LIST_MAL_ALL);
#endif
- }
+ }
}
}
(void)stk;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins