Changeset: 764eee365b0e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=764eee365b0e
Modified Files:
clients/Tests/exports.stable.out
monetdb5/optimizer/opt_evaluate.c
monetdb5/optimizer/opt_multiplex.c
monetdb5/optimizer/opt_multiplex.h
monetdb5/optimizer/opt_remap.c
monetdb5/optimizer/opt_support.c
Branch: default
Log Message:
workaround rand unsafe problem (ie special case in opt_evaluate)
bailout of multiplex will do an extra simple optimize call, such
that functions with inline property set get the multiplex call
rewriten.
diffs (92 lines):
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1519,7 +1519,7 @@ int OPTmergetableImplementation(Client c
int OPTmitosisImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr p);
int OPTmitosisPlanOverdue(Client cntxt, str fname);
int OPTmultiplexImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
-str OPTmultiplexSimple(Client cntxt);
+str OPTmultiplexSimple(Client cntxt, MalBlkPtr mb);
str OPTorcam(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
int OPTorcamImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
p);
int OPTprofilerImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr p);
diff --git a/monetdb5/optimizer/opt_evaluate.c
b/monetdb5/optimizer/opt_evaluate.c
--- a/monetdb5/optimizer/opt_evaluate.c
+++ b/monetdb5/optimizer/opt_evaluate.c
@@ -16,10 +16,12 @@ OPTallConstant(Client cntxt, MalBlkPtr m
int i;
(void)cntxt;
- if ( !( p->token == ASSIGNsymbol ||
- getModuleId(p) == calcRef ||
+ if ( !(p->token == ASSIGNsymbol ||
+ getModuleId(p) == calcRef ||
getModuleId(p) == strRef ||
- getModuleId(p) == mmathRef ))
+ getModuleId(p) == mmathRef))
+ return FALSE;
+ if (getModuleId(p) == mmathRef && strcmp(getFunctionId(p), "rand") == 0)
return FALSE;
for (i = p->retc; i < p->argc; i++)
diff --git a/monetdb5/optimizer/opt_multiplex.c
b/monetdb5/optimizer/opt_multiplex.c
--- a/monetdb5/optimizer/opt_multiplex.c
+++ b/monetdb5/optimizer/opt_multiplex.c
@@ -184,9 +184,9 @@ OPTexpandMultiplex(Client cntxt, MalBlkP
* and interpretation overhead.
*/
str
-OPTmultiplexSimple(Client cntxt)
+OPTmultiplexSimple(Client cntxt, MalBlkPtr mb)
{
- MalBlkPtr mb= cntxt->curprg->def;
+ //MalBlkPtr mb= cntxt->curprg->def;
int i, doit=0;
InstrPtr p;
if(mb)
diff --git a/monetdb5/optimizer/opt_multiplex.h
b/monetdb5/optimizer/opt_multiplex.h
--- a/monetdb5/optimizer/opt_multiplex.h
+++ b/monetdb5/optimizer/opt_multiplex.h
@@ -14,7 +14,7 @@
#include "opt_support.h"
opt_export int OPTmultiplexImplementation(Client cntxt, MalBlkPtr mb,
MalStkPtr stk, InstrPtr pci);
-opt_export str OPTmultiplexSimple(Client cntxt);
+opt_export str OPTmultiplexSimple(Client cntxt, MalBlkPtr mb);
#define OPTDEBUGmultiplex if ( optDebug & ((lng)1 <<DEBUG_OPT_MULTIPLEX) )
diff --git a/monetdb5/optimizer/opt_remap.c b/monetdb5/optimizer/opt_remap.c
--- a/monetdb5/optimizer/opt_remap.c
+++ b/monetdb5/optimizer/opt_remap.c
@@ -15,6 +15,7 @@
#include "monetdb_config.h"
#include "opt_remap.h"
#include "opt_macro.h"
+#include "opt_multiplex.h"
static int
OPTremapDirect(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, Module
scope){
@@ -264,6 +265,10 @@ terminateMX:
}
freeMalBlk(mq);
GDKfree(upgrade);
+
+ /* ugh ugh, fallback to non inline, but optimized code */
+ OPTmultiplexSimple(cntxt, s->def);
+ s->def->inlineProp = 0;
return 0;
}
/*
diff --git a/monetdb5/optimizer/opt_support.c b/monetdb5/optimizer/opt_support.c
--- a/monetdb5/optimizer/opt_support.c
+++ b/monetdb5/optimizer/opt_support.c
@@ -292,7 +292,7 @@ MALoptimizer(Client c)
return MAL_SUCCEED;
msg= optimizeMALBlock(c, c->curprg->def);
if( msg == MAL_SUCCEED)
- OPTmultiplexSimple(c);
+ OPTmultiplexSimple(c, c->curprg->def);
return msg;
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list