Changeset: 3b53b866855a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3b53b866855a
Modified Files:
gdk/gdk_posix.c
monetdb5/mal/mal_box.c
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_resolve.c
monetdb5/mal/mal_stack.c
monetdb5/mal/mal_stack.h
monetdb5/optimizer/opt_cluster.c
Branch: headless
Log Message:
Merge with default branch.
diffs (truncated from 314 to 300 lines):
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -1934,28 +1934,27 @@
char *color;
char *info;
} Encoding[] = {
- {
- '.', "0x00FFFDFE", "free"}, {
- '0', "0x000035FC", "thread stack space of thread 0"}, {
- '1', "0x000067FE", "thread stack space of thread 1"}, {
- '2', "0x000095FE", "thread stack space of thread 2"}, {
- '3', "0x0000BDFC", "thread stack space of thread 3"}, {
- '4', "0x0000DCF8", "thread stack space of thread 4"}, {
- '5', "0x002735FC", "thread stack space of thread 5"}, {
- '6', "0x002767FE", "thread stack space of thread 6"}, {
- '7', "0x002795FE", "thread stack space of thread 7"}, {
- '8', "0x0027BDFC", "thread stack space of thread 8"}, {
- '9', "0x0027DCF8", "thread stack space of thread 9"}, {
- 'B', "0x0000672D", "in use for a large COL heap."}, {
- 'b', "0x004EF2A7", "free (last usage was B)"}, {
- 'S', "0x00B4006E", "in use for a malloc block"}, {
- 's', "0x00F2BDE0", "free (last usage was S)"}, {
- 'P', "0x00F26716", "in use for the CBP array"}, {
- 'p', "0x00F2BD16", "free (last usage was P)"}, {
- 'M', "0x00959516", "in use as memory mapped region"}, {
- 'm', "0x00CEDC16", "free (last usage was M)"}, {
- 'c', "0x00FFFD2D", "free (last usage was M)"}, {
- 0, "0x00FFFDFE", "free"}
+ {'.', "0x00FFFDFE", "free"},
+ {'0', "0x000035FC", "thread stack space of thread 0"},
+ {'1', "0x000067FE", "thread stack space of thread 1"},
+ {'2', "0x000095FE", "thread stack space of thread 2"},
+ {'3', "0x0000BDFC", "thread stack space of thread 3"},
+ {'4', "0x0000DCF8", "thread stack space of thread 4"},
+ {'5', "0x002735FC", "thread stack space of thread 5"},
+ {'6', "0x002767FE", "thread stack space of thread 6"},
+ {'7', "0x002795FE", "thread stack space of thread 7"},
+ {'8', "0x0027BDFC", "thread stack space of thread 8"},
+ {'9', "0x0027DCF8", "thread stack space of thread 9"},
+ {'B', "0x0000672D", "in use for a large COL heap."},
+ {'b', "0x004EF2A7", "free (last usage was B)"},
+ {'S', "0x00B4006E", "in use for a malloc block"},
+ {'s', "0x00F2BDE0", "free (last usage was S)"},
+ {'P', "0x00F26716", "in use for the CBP array"},
+ {'p', "0x00F2BD16", "free (last usage was P)"},
+ {'M', "0x00959516", "in use as memory mapped region"},
+ {'m', "0x00CEDC16", "free (last usage was M)"},
+ {'c', "0x00FFFD2D", "free (last usage was M)"},
+ {0, "0x00FFFDFE", "free"}
};
#endif
diff --git a/monetdb5/mal/mal_box.c b/monetdb5/mal/mal_box.c
--- a/monetdb5/mal/mal_box.c
+++ b/monetdb5/mal/mal_box.c
@@ -377,8 +377,8 @@
return 0;
if (i < 0) {
i = newVariable(box->sym, GDKstrdup(name), type);
- if (box->val->stksize <= i)
- box->val = reallocStack(box->val, STACKINCR);
+ if (box->val->stksize <= i)
+ box->val =reallocStack(box->val, STACKINCR);
}
v = &box->val->stk[i];
VALclear(v);
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -494,9 +494,9 @@
InstrPtr pci = 0;
int exceptionVar, prevpc = 0;
str ret = 0;
- bat *backup = (bat*)alloca(mb->maxarg * sizeof(bat));
- str *sbackup = (str*)alloca(mb->maxarg * sizeof(str));
- int *garbage = (int*)alloca(mb->maxarg * sizeof(int));
+ bat *backup = (bat*)GDKzalloc(mb->maxarg * sizeof(bat));
+ str *sbackup = (str*)GDKzalloc(mb->maxarg * sizeof(str));
+ int *garbage = (int*)GDKzalloc(mb->maxarg * sizeof(int));
lng oldtimer = 0;
struct Mallinfo oldMemory;
int stkpc = 0;
@@ -1081,6 +1081,9 @@
}
}
}
+ GDKfree(backup);
+ GDKfree(sbackup);
+ GDKfree(garbage);
return ret;
}
/* The interpreter loop
diff --git a/monetdb5/mal/mal_resolve.c b/monetdb5/mal/mal_resolve.c
--- a/monetdb5/mal/mal_resolve.c
+++ b/monetdb5/mal/mal_resolve.c
@@ -109,7 +109,7 @@
InstrPtr sig;
int i, k, unmatched = 0, s1;
MALtype polytype[MAXTYPEVAR];
- MALtype *returntype;
+ MALtype *returntype= NULL;
MALtype ret;
/* Within a module find the subscope to locate the element in its list
* of symbols. A skiplist is used to speed up the search for the
@@ -312,7 +312,7 @@
* the resulting type can not be determined.
*/
s1 = 0;
- returntype = (MALtype*)alloca(p->retc * sizeof(MALtype));
+ returntype = (MALtype*)GDKzalloc(p->retc * sizeof(MALtype));
if (sig->polymorphic)
for (k = i = 0; i < p->retc; k++, i++) {
MALtype actual = getArgType(mb, p, i);
@@ -373,7 +373,7 @@
showScriptException(mb, getPC(mb, p), TYPE,
"Assignment to constant");
p->typechk = TYPE_UNKNOWN;
mb->errors++;
- return -3;
+ goto wrapup;
}
if (!isVarFixed(mb, getArg(p, i))) {
setVarType(mb, getArg(p, i), ts);
@@ -412,7 +412,8 @@
}
if (cnt == 0 && s->kind != COMMANDsymbol && s->kind !=
PATTERNsymbol) {
s = cloneFunction(scope, s, mb, p);
- if (s->def->errors) return -3;
+ if (s->def->errors)
+ goto wrapup;
}
}
/*
@@ -423,7 +424,7 @@
if (s->def->errors) {
p->typechk = TYPE_UNKNOWN;
mb->errors++;
- return -3;
+ goto wrapup;
}
if (p->token == ASSIGNsymbol) {
switch (getSignature(s)->token) {
@@ -436,7 +437,7 @@
p->modname, p->fcnname);
p->typechk = TYPE_UNKNOWN;
mb->errors++;
- return -3;
+ goto wrapup;
}
break;
case PATTERNsymbol:
@@ -457,7 +458,7 @@
showScriptException(mb, getPC(mb, p),
MAL,
"MALresolve: unexpected token
type");
mb->errors++;
- return -3;
+ goto wrapup;
}
}
p->blk = s->def;
@@ -469,6 +470,8 @@
mnstr_printf(GDKout, "Finished matching\n");
}
#endif
+ if ( returntype)
+ GDKfree(returntype);
return s1;
} /* while */
/*
@@ -476,6 +479,9 @@
* that we found an instruction with the proper arguments, but that clashes
* with one of the target variables.
*/
+wrapup:
+ if ( returntype)
+ GDKfree(returntype);
return -3;
}
diff --git a/monetdb5/mal/mal_stack.c b/monetdb5/mal/mal_stack.c
--- a/monetdb5/mal/mal_stack.c
+++ b/monetdb5/mal/mal_stack.c
@@ -64,7 +64,6 @@
return s;
k = ((cnt / STACKINCR) + 1) * STACKINCR;
s = (MalStkPtr) GDKzalloc(stackSize(k));
- assert(s);
memcpy(s, old, stackSize(old->stksize));
s->stksize = k;
GDKfree(old);
diff --git a/monetdb5/optimizer/opt_cluster.c b/monetdb5/optimizer/opt_cluster.c
--- a/monetdb5/optimizer/opt_cluster.c
+++ b/monetdb5/optimizer/opt_cluster.c
@@ -59,7 +59,7 @@
{
int i, j = 0;
InstrPtr q;
- int *grp = (int*) alloca(sizeof(int) * MAX_STMTS);
+ int *grp = (int*) GDKzalloc(sizeof(int) * MAX_STMTS);
int state = GRP_NEW;
int h = 0, g = 0, cnts = 0, cntl = 0, cntr = 0;
@@ -134,6 +134,7 @@
/* lets cluster */
}
#endif
+ GDKfree(grp);
return 1;
}
#endif
@@ -207,7 +208,7 @@
s = pushArgument( mb, s, getArg(c, 0) ); /* psum */
/* order these parts then pack2 */
- no = (InstrPtr*)alloca(sizeof(InstrPtr)*nr_parts);
+ no = (InstrPtr*)GDKzalloc(sizeof(InstrPtr)*nr_parts);
o = old[ord[0]];
for (p = 0; p<nr_parts; p++) {
no[p] = copyInstruction(o);
@@ -295,6 +296,7 @@
if (old[i])
freeInstruction(old[i]);
GDKfree(old);
+ GDKfree(no);
}
return 1;
}
@@ -303,8 +305,8 @@
cluster_orderby(MalBlkPtr mb)
{
int i, j = 0, k = 0, o = 0, state = ORDERBY_NONE, actions = 0;
- int *ord = (int*) alloca(sizeof(int) * MAX_STMTS);
- int *prj = (int*) alloca(sizeof(int) * MAX_STMTS);
+ int *ord = (int*) GDKzalloc(sizeof(int) * MAX_STMTS);
+ int *prj = (int*) GDKzalloc(sizeof(int) * MAX_STMTS);
InstrPtr q;
/* TODO only cluster on large inputs */
@@ -357,6 +359,8 @@
}
if (k && j && state == ORDERBY_JOIN)
actions = _cluster_orderby(mb, ord, j, prj, k);
+ GDKfree(ord);
+ GDKfree(prj);
return actions;
}
@@ -447,9 +451,9 @@
/* join these parts */
njn0 = getArg(q, 0);
- njn = (InstrPtr*)alloca(sizeof(InstrPtr)*nr_parts);
- mr = (InstrPtr*)alloca(sizeof(InstrPtr)*nr_parts);
- rmr = (InstrPtr*)alloca(sizeof(InstrPtr)*nr_parts);
+ njn = (InstrPtr*)GDKzalloc(sizeof(InstrPtr)*nr_parts);
+ mr = (InstrPtr*)GDKzalloc(sizeof(InstrPtr)*nr_parts);
+ rmr = (InstrPtr*)GDKzalloc(sizeof(InstrPtr)*nr_parts);
jn = old[join[0]];
for (p = 0; p<nr_parts; p++) {
InstrPtr r = newStmt2( mb, colRef, reverseRef);
@@ -547,6 +551,9 @@
if (old[i])
freeInstruction(old[i]);
GDKfree(old);
+ GDKfree(njn);
+ GDKfree(mr);
+ GDKfree(rmr);
}
return 1;
}
@@ -555,8 +562,8 @@
cluster_join(MalBlkPtr mb)
{
int i, j = 0, k = 0, jn = 0, mr = -1, rmr = -1, state = JOIN_NONE,
state_mr = JOIN_NONE, state_rmr = JOIN_NONE, actions = 0;
- int *join = (int*) alloca(sizeof(int) * MAX_STMTS);
- int *prj = (int*) alloca(sizeof(int) * MAX_STMTS);
+ int *join = (int*) GDKzalloc(sizeof(int) * MAX_STMTS);
+ int *prj = (int*) GDKzalloc(sizeof(int) * MAX_STMTS);
InstrPtr q;
/* locate the a sequence of group.new/derive statements */
@@ -629,6 +636,8 @@
}
if (k && j && (state_mr == JOIN_PRJ || state_rmr == JOIN_PRJ))
actions = _cluster_join(mb, join, j, prj, k);
+ GDKfree(join);
+ GDKfree(prj);
return actions;
}
diff --git a/sql/backends/monet5/datacell/datacell.c
b/sql/backends/monet5/datacell/datacell.c
--- a/sql/backends/monet5/datacell/datacell.c
+++ b/sql/backends/monet5/datacell/datacell.c
@@ -87,12 +87,20 @@
sql_func *f;
sql_trans *tr;
+ if ( msg) {
+ fprintf(stdout, "# MonetDB/DataCell module not loaded\n");
+ fprintf(stdout, "# %s\n",msg);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list