Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv4925

Modified Files:
        sql_gencode.mx 
Log Message:
Detect SQL functions that have side effects. They should be handled
with care in the dead-code optimizer, i.e. not be removed silently.


U sql_gencode.mx
Index: sql_gencode.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_gencode.mx,v
retrieving revision 1.334
retrieving revision 1.335
diff -u -d -r1.334 -r1.335
--- sql_gencode.mx      9 Aug 2009 07:19:11 -0000       1.334
+++ sql_gencode.mx      22 Sep 2009 20:56:49 -0000      1.335
@@ -2089,16 +2089,21 @@
        /* selectively make functions available for inlineing */
        /* for the time being we only inline scalar functions */
        /* and only if we see a single return value */
+       /* check the function for side effects and make that explicit */
+       sideeffects =0;
        for( i= 1; i<curBlk->stop; i++){
                InstrPtr p = getInstrPtr(curBlk,i);
                if ( getFunctionId(p)== bindRef || getFunctionId(p)== 
bindidxRef)
                        break;
+               sideeffects = sideeffects || hasSideEffects(p,FALSE);
                if ( p->token == RETURNsymbol || p->token == YIELDsymbol ||
                                         p->barrier == RETURNsymbol || 
p->barrier == YIELDsymbol)
             retseen++;
        }
        if (i == curBlk->stop && retseen == 1)
                varSetProp(curBlk, getArg(curInstr, 0), inlineProp, op_eq, 
NULL);
+       if ( sideeffects)
+               varSetProp(curBlk, getArg(curInstr, 0), unsafeProp, op_eq, 
NULL);
        stmt_destroy(s);
        addQueryToCache(c);
        if (backup) 


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to