Changeset: 689b6c3fc207 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=689b6c3fc207
Modified Files:
        clients/R/MonetDB.R/src/mapi.c
        configure.ag
        monetdb5/modules/mal/tablet.c
        monetdb5/modules/mal/tokenizer.c
        monetdb5/optimizer/opt_dataflow.c
        monetdb5/optimizer/opt_evaluate.c
        monetdb5/optimizer/opt_octopus.c
        monetdb5/optimizer/opt_qep.c
        monetdb5/optimizer/opt_remoteQueries.c
        monetdb5/optimizer/opt_reorder.c
        monetdb5/optimizer/opt_strengthReduction.c
        monetdb5/optimizer/opt_wrapper.c
        monetdb5/scheduler/run_octopus.c
Branch: default
Log Message:

Merge with Jan2014 branch.


diffs (truncated from 417 to 300 lines):

diff --git a/clients/R/MonetDB.R/src/mapi.c b/clients/R/MonetDB.R/src/mapi.c
--- a/clients/R/MonetDB.R/src/mapi.c
+++ b/clients/R/MonetDB.R/src/mapi.c
@@ -257,8 +257,8 @@ SEXP mapiRead(SEXP conn) {
                while (response_buf_offset + block_length > response_buf_len) {
                        response_buf_len += ALLOCSIZE;
                        if (DEBUG) {
-                               printf("II: Reallocating memory, new size 
%lu\n",
-                                               (unsigned long) 
response_buf_len);
+                               printf("II: Reallocating memory, new size 
"SZFMT"\n",
+                                               response_buf_len);
                        }
                        response_buf = realloc(response_buf, response_buf_len);
                        if (response_buf == NULL) {
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -377,11 +377,11 @@ icc_ver=""
 CC_ver=""
 CC_version="`$CC --version 2>&1`"
 case "$CC_version" in
-*gcc*GCC*)
+*\(GCC\)*)
        gcc_ver="`$CC -dumpversion 2>/dev/null`"
        CC_ver="gcc-$gcc_ver"
        ;;
-*icc*ICC*)
+*\(ICC\)*)
        icc_ver="`$CC -dumpversion 2>/dev/null`"
        CC_ver="icc-$icc_ver"
        ;;
diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -247,6 +247,7 @@ TABLETcollect(Tablet *as)
                        if (as->error == NULL && (as->error = 
GDKstrdup(errbuf)) == NULL)
                                as->error = M5OutOfMemory;
                        MT_lock_unset(&errorlock, "TABLETcollect");
+                       GDKfree(bats);
                        return NULL;
                }
        }
@@ -294,6 +295,7 @@ TABLETcollect_parts(Tablet *as, BUN offs
                        if (as->error == NULL && (as->error = 
GDKstrdup(errbuf)) == NULL)
                                as->error = M5OutOfMemory;
                        MT_lock_unset(&errorlock, "TABLETcollect_parts");
+                       GDKfree(bats);
                        return NULL;
                }
        }
@@ -537,8 +539,11 @@ output_file_default(Tablet *as, BAT *ord
        BUN offset = BUNfirst(order) + as->offset;
        BATiter orderi = bat_iterator(order);
 
-       if (buf == NULL)
+       if (buf == NULL || localbuf == NULL){
+               if( buf) GDKfree(buf);
+               if( localbuf) GDKfree(localbuf);
                return -1;
+       }
        for (q = offset + as->nr, p = offset; p < q; p++) {
                ptr h = BUNhead(orderi, p);
 
@@ -566,8 +571,11 @@ output_file_dense(Tablet *as, stream *fd
        char *localbuf = GDKmalloc(len);
        BUN i = 0;
 
-       if (buf == NULL)
+       if (buf == NULL || localbuf == NULL){
+               if( buf) GDKfree(buf);
+               if( localbuf) GDKfree(localbuf);
                return -1;
+       }
        for (i = 0; i < as->nr; i++) {
                if ((res = output_line_dense(&buf, &len, &localbuf, &locallen, 
as->format, fd, as->nr_attrs)) < 0) {
                        GDKfree(buf);
diff --git a/monetdb5/modules/mal/tokenizer.c b/monetdb5/modules/mal/tokenizer.c
--- a/monetdb5/modules/mal/tokenizer.c
+++ b/monetdb5/modules/mal/tokenizer.c
@@ -438,7 +438,12 @@ TKNZRdepositFile(int *r, str *fnme)
                        /* found a string to be processed */
                        *t = 0;
                        msg = TKNZRappend(&pos, &s);
-                       if (msg ) break;
+                       if (msg ) {
+                               bstream_destroy(bs);
+                               mnstr_close(fs);
+                               mnstr_destroy(fs);
+                               return msg;
+                       }
                        *t = '\n';
                        s = t + 1;
                        t = s;
@@ -448,7 +453,7 @@ TKNZRdepositFile(int *r, str *fnme)
        bstream_destroy(bs);
        mnstr_close(fs);
        mnstr_destroy(fs);
-       return msg;
+       return MAL_SUCCEED;
 }
 
 str
diff --git a/monetdb5/optimizer/opt_dataflow.c 
b/monetdb5/optimizer/opt_dataflow.c
--- a/monetdb5/optimizer/opt_dataflow.c
+++ b/monetdb5/optimizer/opt_dataflow.c
@@ -86,8 +86,12 @@ void removeDataflow(MalBlkPtr mb)
        }
        old = mb->stmt;
        limit = mb->stop;
-       if ( newMalBlkStmt(mb, mb->ssize) <0 )
+       if ( newMalBlkStmt(mb, mb->ssize) <0 ){
+               GDKfree(delete);
+               GDKfree(used);
+               GDKfree(init);
                return;
+       }
        /* remove the inlined dataflow barriers */
        for (i = 1; i<limit; i++) {
                p = old[i];
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
@@ -219,8 +219,10 @@ OPTevaluateImplementation(Client cntxt, 
                                setVarFixed(mb,getArg(p,1));
                                setVarUDFtype(mb,getArg(p,1));
                                OPTDEBUGevaluate {
+                                       str tpename;
                                        mnstr_printf(cntxt->fdout, "Evaluated 
new constant=%d -> %d:%s\n",
-                                               getArg(p, 0), getArg(p, 1), 
getTypeName(getArgType(mb, p, 1)));
+                                               getArg(p, 0), getArg(p, 1), 
tpename = getTypeName(getArgType(mb, p, 1)));
+                                       GDKfree(tpename);
                                }
                        } else {
                                /* if there is an error, we should postpone 
message handling,
diff --git a/monetdb5/optimizer/opt_octopus.c b/monetdb5/optimizer/opt_octopus.c
--- a/monetdb5/optimizer/opt_octopus.c
+++ b/monetdb5/optimizer/opt_octopus.c
@@ -1024,8 +1024,10 @@ OPToctopusImplementation(Client cntxt, M
                        break;
                }
        }
-       if ( !tblname )
+       if ( !tblname ){
+               GDKfree(mod);
                return 0;
+       }
 
        mb->legid = octopusSeq++;
 
diff --git a/monetdb5/optimizer/opt_qep.c b/monetdb5/optimizer/opt_qep.c
--- a/monetdb5/optimizer/opt_qep.c
+++ b/monetdb5/optimizer/opt_qep.c
@@ -31,17 +31,22 @@ QEPnew(int p, int c){
        qep->plimit = p;
        if( p ) {
                qep->parents = (QEP*) GDKzalloc( sizeof(QEP) * p);
-               if( qep->parents == NULL)
+               if( qep->parents == NULL){
+                       GDKfree(qep);
                        return NULL;
+               }
        }
        qep->climit = c;
        if( c){
                qep->children = (QEP *) GDKzalloc( sizeof(QEP) * c);
-               if( qep->children == NULL)
+               if( qep->children == NULL){
+                       GDKfree(qep);
                        return NULL;
+               }
        }
        return qep;
 }
+
 static QEP
 QEPnewNode(MalBlkPtr mb,InstrPtr p){
        QEP q;
@@ -164,6 +169,16 @@ QEPdump(stream *f, QEP qep, int indent){
                QEPdump(f,qep->children[i], indent+ inc);
 }
 
+static void
+QEPfree(QEP qep)
+{
+       int i;
+       for(i=0; i< qep->climit; i++)
+       if( qep->children[i])
+               QEPfree(qep->children[i]);
+       GDKfree(qep);
+}
+
 int
 OPTdumpQEPImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
p){
        QEP qep;
@@ -173,5 +188,6 @@ OPTdumpQEPImplementation(Client cntxt, M
 
        qep= QEPbuild(mb);
        QEPdump(cntxt->fdout,qep,0);
+       QEPfree(qep);
        return 1;
 }
diff --git a/monetdb5/optimizer/opt_remoteQueries.c 
b/monetdb5/optimizer/opt_remoteQueries.c
--- a/monetdb5/optimizer/opt_remoteQueries.c
+++ b/monetdb5/optimizer/opt_remoteQueries.c
@@ -278,12 +278,13 @@ OPTremoteQueriesImplementation(Client cn
                                prepareRemote(TYPE_void)
                                putRemoteVariables()
                                remoteAction()
-                       } else
+                       } else {
+#ifdef DEBUG_OPT_REMOTE
+                               printf("found remote variable %s ad %d\n",
+                                       getVarName(mb,getArg(p,0)), 
location[getArg(p,0)]);
+#endif
                                pushInstruction(mb,p);
-#ifdef DEBUG_OPT_REMOTE
-                       printf("found remote variable %s ad %d\n",
-                               getVarName(mb,getArg(p,0)), 
location[getArg(p,0)]);
-#endif
+                       }
                } else
                if( getModuleId(p) && strcmp(getModuleId(p),"optimizer")==0 &&
                    getFunctionId(p) && 
strcmp(getFunctionId(p),"remoteQueries")==0 )
diff --git a/monetdb5/optimizer/opt_reorder.c b/monetdb5/optimizer/opt_reorder.c
--- a/monetdb5/optimizer/opt_reorder.c
+++ b/monetdb5/optimizer/opt_reorder.c
@@ -226,6 +226,7 @@ OPTreorderImplementation(Client cntxt, M
        old = mb->stmt;
        if ( newMalBlkStmt(mb, mb->ssize) < 0) {
                GDKfree(uselist);
+               GDKfree(dep);
                return 0;
        }
        
diff --git a/monetdb5/optimizer/opt_strengthReduction.c 
b/monetdb5/optimizer/opt_strengthReduction.c
--- a/monetdb5/optimizer/opt_strengthReduction.c
+++ b/monetdb5/optimizer/opt_strengthReduction.c
@@ -22,7 +22,7 @@
 #include "mal_interpreter.h"   /* for showErrors() */
 
 /*
- * @+ Strength reduction implementation
+ * Strength reduction implementation
  * Strength reduction of the code is defensive.
  * This first shot assumes a single loop, so we do not have to
  * maintain a complex administration. We simply split the code
@@ -67,7 +67,7 @@ OPTstrengthReductionImplementation(Clien
        int i, j = 0, k, se= FALSE;
        InstrPtr p;
        int bk, ik, blk, blkbegin, blkexit, actions = 0;
-       InstrPtr *before, *within, *old = mb->stmt;
+       InstrPtr *before, *within, *newstmt;
        Lifespan span;
 
        (void) cntxt;
@@ -90,8 +90,11 @@ OPTstrengthReductionImplementation(Clien
        before[bk++] = getInstrPtr(mb, 0);
 
        span =setLifespan(mb);
-       if( span == NULL)
+       if( span == NULL){
+               GDKfree(before);
+               GDKfree(within);
                return 0;
+       }
 
        for (i = 1; i < mb->stop - 1; i++) {
                p = getInstrPtr(mb, i);
@@ -122,7 +125,6 @@ OPTstrengthReductionImplementation(Clien
                        continue;
                }
                /*
-                * @-
                 * Strength reduction is only relevant inside a block;
                 */
                if( blkexit == 0) {
@@ -130,7 +132,6 @@ OPTstrengthReductionImplementation(Clien
                        continue;
                }
                /*
-                * @-
                 * Flow control statements may not be moved around
                 */
                if ( p->barrier != 0){
@@ -138,7 +139,6 @@ OPTstrengthReductionImplementation(Clien
                        continue;
                }
                /*
-                * @-
                 * Limit strength reduction to the type modules and the 
batcalc, batstr, batcolor
                 * and sql.bind.
                 */
@@ -147,7 +147,6 @@ OPTstrengthReductionImplementation(Clien
                        continue;
                }
                /*
-                * @-
                 * Search the prospective new block and make sure that
                 * none of the arguments is assigned a value.
                 */
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to