Update of /cvsroot/monetdb/MonetDB5/src/optimizer
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10295
Modified Files:
opt_commonTerms.mx opt_prelude.mx
Log Message:
The commonTerms optimizer has been reduced in scope.
Each optimizer should not contain an open-ended list
Index: opt_prelude.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_prelude.mx,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- opt_prelude.mx 27 Jan 2008 11:11:05 -0000 1.36
+++ opt_prelude.mx 1 Feb 2008 19:36:34 -0000 1.37
@@ -32,6 +32,7 @@
opt_export str batcalcRef;
opt_export str batRef;
opt_export str batstrRef;
+opt_export str batmathRef;
opt_export str bbpRef;
opt_export str binddbatRef;
opt_export str bindidxRef;
@@ -163,6 +164,7 @@
str batcalcRef;
str batRef;
str batstrRef;
+str batmathRef;
str bbpRef;
str binddbatRef;
str bindidxRef;
@@ -290,6 +292,7 @@
batcalcRef = putName("batcalc",7);
batRef = putName("bat",3);
batstrRef = putName("batstr",6);
+ batmathRef = putName("batmath",7);
bbpRef = putName("bbp",3);
binddbatRef = putName("bind_dbat",9);
bindidxRef = putName("bind_idxbat",11);
Index: opt_commonTerms.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_commonTerms.mx,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- opt_commonTerms.mx 11 Jan 2008 10:41:39 -0000 1.26
+++ opt_commonTerms.mx 1 Feb 2008 19:36:34 -0000 1.27
@@ -35,7 +35,6 @@
#include "mal_config.h"
#include "opt_commonTerms.h"
#include "mal_exception.h"
-#include "opt_aliases.h"
@}
@- Common Subexpression Elimination
Common subexpression elimination merely involves a scan through the
@@ -94,7 +93,7 @@
static int
OPTcommonTermsImplementation(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
- int i, j, k, last, n=1;
+ int i, j, k, barrier=0, last, n=1;
InstrPtr p, q;
int actions = 0;
int filter[1024];
@@ -120,34 +119,40 @@
for ( n= i = 0; i < limit; i++) {
p = old[i];
pushInstruction(mb,p);
+ if(p->barrier)
+ barrier= getArg(p,0); /* at least one barrier block */
n++;
[EMAIL PROTECTED]
-First apply alias propagation, before considering a match.
[EMAIL PROTECTED]
if (p->token == ENDsymbol){
for(i++; i<limit; i++)
- if(old[i])
- pushInstruction(mb,old[i]);
+ if( old[i])
+ pushInstruction(mb,old[i]);
break;
}
if (p->token == NOOPsymbol)
continue;
- if (OPTisAlias(p)){
- if (getLastUpdate(span,getArg(p,0)) == i &&
- getBeginLifespan(span,getArg(p,0)) == i &&
- getLastUpdate(span,getArg(p,1)) < i){
[EMAIL PROTECTED]
+First recognize simple assignments for alias removal
+and apply alias propagation, before considering a match.
[EMAIL PROTECTED]
+ if( p->token == ASSIGNsymbol &&
+ barrier== 0 &&
+ p->argc == 2 &&
+ /* type compatible to be added */
+ getArgType(mb,p,0)== getArgType(mb,p,1) &&
+ getLastUpdate(span,getArg(p,0)) == i &&
+ getBeginLifespan(span,getArg(p,0)) == i &&
+ getLastUpdate(span,getArg(p,1) < i) ){
alias[getArg(p,0)] = alias[getArg(p,1)];
+/* can be handled by the deadcode optimizer
freeInstruction(p);
mb->stop--;
mb->stmt[mb->stop]=0;
n--;
+*/
continue;
- } else {
- OPTaliasRemap(p,alias);
- }
- } else {
- OPTaliasRemap(p,alias);
- }
+ }
+ for(j=0; j<p->argc; j++)
+ getArg(p,j) = alias[getArg(p,j)];
@-
Use a hash filter to speed up matching
@c
@@ -195,13 +200,21 @@
Simple assignments are not replaced either. They should be
handled by the alias removal part
@c
- if (q->token != ASSIGNsymbol &&
+ if (q->token != ASSIGNsymbol && q->retc == 1 &&
+ ( getModuleId(p)== batcalcRef ||
+ getModuleId(p)== batstrRef ||
+ getModuleId(p)== batmathRef ||
+ getModuleId(p)== mmathRef ||
+ getModuleId(p)== algebraRef ||
+ getModuleId(p)== strRef ||
+ getModuleId(p)== calcRef) &&
hasSameSignature(p, q) &&
hasSameArguments(mb, p, q) &&
- !isUpdated(mb, i) &&
+ getLastUpdate(span, getArg(p,0)) <= i &&
!hasCommonResults(p, q) &&
!hasSideEffects(p, TRUE) &&
isLinearFlow(p) &&
+ isLinearFlow(q) &&
allTargetsVisible(mb,span,j,n-1)
) {
#ifdef DEBUG_OPT_COMMONTERMS
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins