Changeset: f77b45f4f2b4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f77b45f4f2b4
Modified Files:
        monetdb5/optimizer/opt_commonTerms.mx
Branch: default
Log Message:

Avoid extreme large linear scans for common instructions.


diffs (23 lines):

diff --git a/monetdb5/optimizer/opt_commonTerms.mx 
b/monetdb5/optimizer/opt_commonTerms.mx
--- a/monetdb5/optimizer/opt_commonTerms.mx
+++ b/monetdb5/optimizer/opt_commonTerms.mx
@@ -110,7 +110,7 @@ comment "Common sub-expression optimizer
 static int
 OPTcommonTermsImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci)
 {
-       int i, j, k, prop, candidate, barrier= 0;
+       int i, j, k, prop, candidate, barrier= 0, cnt;
        InstrPtr p, q;
        int actions = 0;
        int limit, slimit;
@@ -202,8 +202,9 @@ OPTcommonTermsImplementation(Client cntx
                prop = hasSideEffects(p,TRUE) || isUpdateInstruction(p);
                j =     isVarConstant(mb, getArg(p,p->argc-1))? cstlist: 
candidate;
                                
+               cnt = mb->stop / 128 < 32? 32 : mb->stop/128;   /* limit search 
depth */
                if ( !prop)
-               for (; j ; j = list[j]) 
+               for (; cnt > 0 && j ; cnt--, j = list[j]) 
                        if ( (q=getInstrPtr(mb,j))->fcn == p->fcn  ){
 #ifdef DEBUG_OPT_COMMONTERMS_MORE
                        mnstr_printf(cntxt->fdout,"#CANDIDATE %d, %d  %d %d ", 
i, j, 
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to