Update of /cvsroot/monetdb/MonetDB5/src/optimizer
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25432

Modified Files:
        opt_deadcode.mx opt_support.mx opt_evaluate.mx opt_joinpath.mx 
Log Message:
small cleanups
added procedure detection, used by opt_deadcode


Index: opt_deadcode.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_deadcode.mx,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- opt_deadcode.mx     1 Nov 2007 11:54:31 -0000       1.26
+++ opt_deadcode.mx     6 Nov 2007 18:08:46 -0000       1.27
@@ -128,7 +128,7 @@
                        freeInstruction(p);
                        actions++;
                } else
-               if (se || hasSideEffects(p, FALSE) )
+               if (se || hasSideEffects(p, FALSE) || isProcedure(mb,p) )
                        pushInstruction(mb,p);
                else {
                        freeInstruction(p);

Index: opt_joinpath.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_joinpath.mx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- opt_joinpath.mx     8 Oct 2007 19:00:14 -0000       1.11
+++ opt_joinpath.mx     6 Nov 2007 18:08:46 -0000       1.12
@@ -208,8 +208,8 @@
                        b->batCacheid, joins[j]->batCacheid, joins[j + 
1]->batCacheid);
 #endif
                assert(b);
-               BBPreleaseref(joins[j]->batCacheid);
-               BBPreleaseref(joins[j+1]->batCacheid);
+               BBPdecref(joins[j]->batCacheid, FALSE);
+               BBPdecref(joins[j+1]->batCacheid, FALSE);
                joins[j] = b;
                top--;
                for (i = j + 1; i < top; i++)
@@ -219,6 +219,8 @@
        printf("final join %d and %d\n", joins[0]->batCacheid, 
joins[1]->batCacheid);
 #endif
        b = BATjoin(joins[0], joins[1], oid_nil);
+       BBPdecref(joins[0]->batCacheid, FALSE);
+       BBPdecref(joins[1]->batCacheid, FALSE);
        assert(b);
        return b;
 }
@@ -247,8 +249,6 @@
                joins[top++] = b;
        }
        b= ALGjoinPathBody(top,joins);
-       BBPreleaseref(joins[0]->batCacheid);
-       BBPreleaseref(joins[1]->batCacheid);
        BBPkeepref(b->batCacheid);
        *(int *) getArgReference(stk, pci, 0) = b->batCacheid;
        return MAL_SUCCEED;

Index: opt_support.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_support.mx,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- opt_support.mx      19 Aug 2007 07:36:13 -0000      1.48
+++ opt_support.mx      6 Nov 2007 18:08:46 -0000       1.49
@@ -522,6 +522,7 @@
 opt_export int hasSameArguments(MalBlkPtr mb, InstrPtr p, InstrPtr q);
 opt_export int isUpdated(MalBlkPtr mb, int pc);
 opt_export int hasCommonResults(InstrPtr p, InstrPtr q);
+opt_export int isProcedure(MalBlkPtr mb, InstrPtr p);
 opt_export int hasSideEffects(InstrPtr p, int strict);
 opt_export int isBlocking(InstrPtr p);
 opt_export int isFragmentGroup(InstrPtr q);
@@ -1063,6 +1064,15 @@
 The side effect tests should become part of the signature
 definitions.
 @c
+
+int
+isProcedure(MalBlkPtr mb, InstrPtr p)
+{
+       if (p->retc == 0 || (p->retc == 1 && getArgType(mb,p,0) == TYPE_void))
+               return TRUE;
+       return FALSE;
+}
+
 int
 hasSideEffects(InstrPtr p, int strict)
 {
@@ -1074,6 +1084,7 @@
                getFunctionId(p) == insertRef ||
                getFunctionId(p) == inplaceRef ||
                getFunctionId(p) == appendRef ||
+               getFunctionId(p) == updateRef ||
                getFunctionId(p) == sortTailRef ||
                getFunctionId(p) == setAccessRef ||
                getFunctionId(p) == setWriteModeRef ||
@@ -1171,10 +1182,11 @@
                        (getModuleId(p)== algebraRef && (
                                getFunctionId(p)== selectRef ||
                                getFunctionId(p)==uselectRef ||
+                               getFunctionId(p) == markTRef ||
                                getFunctionId(p)==likeselectRef ||
-                               getFunctionId(p)==markTRef ||
                                getFunctionId(p)== joinRef ||
-                               getFunctionId(p)== semijoinRef
+                               getFunctionId(p)== semijoinRef ||
+                               getFunctionId(p)== kdifferenceRef
                        )       )  ||
                        (getModuleId(p)== batRef && (
                                getFunctionId(p)==reverseRef ||

Index: opt_evaluate.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_evaluate.mx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- opt_evaluate.mx     29 Oct 2007 20:10:10 -0000      1.9
+++ opt_evaluate.mx     6 Nov 2007 18:08:46 -0000       1.10
@@ -83,7 +83,7 @@
        InstrPtr p;
        int first=0, nxt, i, j, k, limit, done=0, again=0;
        Client c= MCgetClient();
-       MalStkPtr env;
+       MalStkPtr env = NULL;
        str msg;
        int debugstate= c->itrace;
        c->itrace= 0;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to