Changeset: 549d74577d3b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=549d74577d3b
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
clients/Tests/exports.stable.out
common/options/monet_getopt.h
common/options/monet_options.h
monetdb5/mal/Tests/tst050.malC
monetdb5/mal/Tests/tst050.stable.err
monetdb5/mal/Tests/tst161.stable.err
monetdb5/mal/mal_instruction.c
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_session.c
monetdb5/mal/mal_stack.c
monetdb5/modules/atoms/xml.c
monetdb5/modules/atoms/xml.h
monetdb5/modules/atoms/xml.mal
monetdb5/modules/mal/orderidx.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_gencode.h
sql/backends/monet5/sql_scenario.c
Branch: gdk_tracer
Log Message:
merged with default
diffs (truncated from 495 to 300 lines):
diff --git a/clients/Tests/MAL-signatures.stable.out
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -12233,6 +12233,7 @@ stdout of test 'MAL-signatures` in direc
[ "xml", "document", "command xml.document(val:str):xml ",
"XMLdocument;", "Check the value for compliance as XML document" ]
[ "xml", "element", "command xml.element(name:str, ns:xml,
attr:xml, s:xml):xml ", "XMLelement;", "The basic building block for XML
elements are namespaces, attributes and a sequence of xml elements. The name
space and the attributes may be left unspecified(=nil:bat)." ]
[ "xml", "element", "command xml.element(name:str, s:xml):xml ",
"XMLelementSmall;", "The basic building block for XML elements are
namespaces, attributes and a sequence of xml elements. The name space and the
attributes may be left unspecified(=nil:bat)." ]
+[ "xml", "epilogue", "command xml.epilogue():void ", "XMLepilogue;",
"" ]
[ "xml", "forest", "pattern xml.forest(val:xml...):xml ",
"XMLforest;", "Construct an element list" ]
[ "xml", "isdocument", "command xml.isdocument(val:str):bit ",
"XMLisdocument;", "Validate the string as a document" ]
[ "xml", "parse", "command xml.parse(doccont:str, val:str,
option:str):xml ", "XMLparse;", "Parse the XML document or element
string values " ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -16653,6 +16653,7 @@ stdout of test 'MAL-signatures` in direc
[ "xml", "document", "command xml.document(val:str):xml ",
"XMLdocument;", "Check the value for compliance as XML document" ]
[ "xml", "element", "command xml.element(name:str, ns:xml,
attr:xml, s:xml):xml ", "XMLelement;", "The basic building block for XML
elements are namespaces, attributes and a sequence of xml elements. The name
space and the attributes may be left unspecified(=nil:bat)." ]
[ "xml", "element", "command xml.element(name:str, s:xml):xml ",
"XMLelementSmall;", "The basic building block for XML elements are
namespaces, attributes and a sequence of xml elements. The name space and the
attributes may be left unspecified(=nil:bat)." ]
+[ "xml", "epilogue", "command xml.epilogue():void ", "XMLepilogue;",
"" ]
[ "xml", "forest", "pattern xml.forest(val:xml...):xml ",
"XMLforest;", "Construct an element list" ]
[ "xml", "isdocument", "command xml.isdocument(val:str):bit ",
"XMLisdocument;", "Validate the string as a document" ]
[ "xml", "parse", "command xml.parse(doccont:str, val:str,
option:str):xml ", "XMLparse;", "Parse the XML document or element
string values " ]
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1980,6 +1980,7 @@ str XMLcontent(xml *x, str *s);
str XMLdocument(xml *x, str *s);
str XMLelement(xml *ret, str *name, xml *nspace, xml *attr, xml *val);
str XMLelementSmall(xml *ret, str *name, xml *val);
+str XMLepilogue(void *ret);
str XMLforest(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
ssize_t XMLfromString(const char *src, size_t *len, xml *x, bool external);
str XMLisdocument(bit *x, str *s);
diff --git a/common/options/monet_getopt.h b/common/options/monet_getopt.h
--- a/common/options/monet_getopt.h
+++ b/common/options/monet_getopt.h
@@ -47,16 +47,7 @@ extern "C" {
#endif
#ifndef moptions_export
-/* avoid using "#ifdef WIN32" so that this file does not need our config.h */
-//#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
-//#if !defined(LIBMOPTIONS) && !defined(LIBGDK) && !defined(LIBMAPI)
-//#define moptions_export extern __declspec(dllimport)
-//#else
-//#define moptions_export extern __declspec(dllexport)
-//#endif
-//#else
#define moptions_export extern
-//#endif
#endif
/* For communication from `getopt' to the caller.
diff --git a/common/options/monet_options.h b/common/options/monet_options.h
--- a/common/options/monet_options.h
+++ b/common/options/monet_options.h
@@ -26,16 +26,7 @@ extern "C" {
#endif
#ifndef moptions_export
-/* avoid using "#ifdef WIN32" so that this file does not need our config.h */
-//#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)
-//#if !defined(LIBMOPTIONS) && !defined(LIBGDK) && !defined(LIBMAPI)
-//#define moptions_export extern __declspec(dllimport)
-//#else
-//#define moptions_export extern __declspec(dllexport)
-//#endif
-//#else
#define moptions_export extern
-//#endif
#endif
/* mo_print_options will print the option set on stderr */
diff --git a/monetdb5/mal/Tests/tst050.malC b/monetdb5/mal/Tests/tst050.malC
--- a/monetdb5/mal/Tests/tst050.malC
+++ b/monetdb5/mal/Tests/tst050.malC
@@ -10,15 +10,15 @@ z:bat[:int]:= bat.new(:int);
end f;
# type resolver should complain on the rest
-function f();
+function g();
j:sht := 1:lng;
-end f;
-function f();
+end g;
+function h();
k:lng := 1:sht;
-end f;
-function f();
+end h;
+function k();
y:bat[:str]:= bat.new(:int);
-end f;
-function f();
-f:flt := "wrong";
-end f;
+end k;
+function l();
+l:flt := "wrong";
+end l;
diff --git a/monetdb5/mal/Tests/tst050.stable.err
b/monetdb5/mal/Tests/tst050.stable.err
--- a/monetdb5/mal/Tests/tst050.stable.err
+++ b/monetdb5/mal/Tests/tst050.stable.err
@@ -43,24 +43,24 @@ QUERY = # Variables names may be tagged
end f;
# type resolver should complain on the rest
- function f();
+ function g();
j:sht := 1:lng;
- end f;
- function f();
+ end g;
+ function h();
k:lng := 1:sht;
- end f;
- function f();
+ end h;
+ function k();
y:bat[:str]:= bat.new(:int);
- end f;
- function f();
- f:flt := "wrong";
- end f;
-ERROR = !TypeException:user.f[1]:type mismatch sht := lng
- !TypeException:user.f[1]:type mismatch lng := sht
- !TypeException:user.f[1]:'bat.new' undefined in: y:bat[:str] :=
bat.new(:int);
- !TypeException:user.f[1]:type mismatch flt := str
+ end k;
+ function l();
+ l:flt := "wrong";
+ end l;
+ERROR = !TypeException:user.g[1]:type mismatch sht := lng
+ !TypeException:user.h[1]:type mismatch lng := sht
+ !TypeException:user.k[1]:'bat.new' undefined in: y:bat[:str] :=
bat.new(:int);
+ !TypeException:user.l[1]:type mismatch flt := str
-# 13:48:37 >
-# 13:48:37 > "Done."
-# 13:48:37 >
+# 22:14:56 >
+# 22:14:56 > "Done."
+# 22:14:56 >
diff --git a/monetdb5/mal/Tests/tst161.stable.err
b/monetdb5/mal/Tests/tst161.stable.err
--- a/monetdb5/mal/Tests/tst161.stable.err
+++ b/monetdb5/mal/Tests/tst161.stable.err
@@ -42,6 +42,7 @@ QUERY = # testing definition of new atom
z:= mytype.l();
io.print(z);
ERROR = !TypeException:mytype.l[0]:constant coercion error from int to mytype
+ !TypeException:mytype.l[0]:improper variable id
# 13:20:34 >
# 13:20:34 > "Done."
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -489,7 +489,7 @@ newInstruction(MalBlkPtr mb, str modnme,
InstrPtr
copyInstruction(InstrPtr p)
{
- InstrPtr new = (InstrPtr) GDKmalloc(offsetof(InstrRecord, argv) +
p->maxarg * sizeof(p->maxarg));
+ InstrPtr new = (InstrPtr) GDKmalloc(offsetof(InstrRecord, argv) +
p->maxarg * sizeof(p->argv[0]));
if(new == NULL)
return new;
oldmoveInstruction(new, p);
@@ -1077,6 +1077,7 @@ defConstant(MalBlkPtr mb, int type, ValP
GDKfree(ft);
GDKfree(tt);
freeException(msg);
+ return -1;
} else {
assert(cst->vtype == type);
}
@@ -1112,7 +1113,8 @@ static InstrPtr
extendInstruction(MalBlkPtr mb, InstrPtr p)
{
InstrPtr pn = p;
- if (p->argc + 1 == p->maxarg) {
+
+ if (p->argc == p->maxarg) {
int space = p->maxarg * sizeof(p->argv[0]) +
offsetof(InstrRecord, argv);
pn = (InstrPtr) GDKrealloc(p,space + MAXARG *
sizeof(p->argv[0]));
@@ -1134,6 +1136,7 @@ InstrPtr
pushArgument(MalBlkPtr mb, InstrPtr p, int varid)
{
InstrPtr pn;
+
if (p == NULL)
return NULL;
if (varid < 0) {
@@ -1141,34 +1144,27 @@ pushArgument(MalBlkPtr mb, InstrPtr p, i
mb->errors = createMalException(mb, 0, TYPE,"improper variable
id");
return p;
}
-
- if (p->argc + 1 == p->maxarg) {
- int i = 0;
+ if (p->argc == p->maxarg) {
pn = extendInstruction(mb, p);
- if ( mb->errors)
+ if (mb->errors)
return p;
/* if the instruction is already stored in the MAL block
* it should be replaced by an extended version.
*/
- if( p != pn)
- for (i = mb->stop - 1; i >= 0; i--)
+ if (p != pn) {
+ for (int i = mb->stop - 1; i >= 0; i--)
if (mb->stmt[i] == p) {
mb->stmt[i] = pn;
break;
}
-
+ }
p = pn;
- /* we have to keep track on the maximal arguments/block
- * because it is needed by the interpreter */
- if (mb->maxarg < pn->maxarg)
- mb->maxarg = pn->maxarg;
}
/* protect against the case that the instruction is malloced
* in isolation */
if( mb->maxarg < p->maxarg)
mb->maxarg= p->maxarg;
-
p->argv[p->argc++] = varid;
return p;
}
@@ -1191,10 +1187,15 @@ addArgument(MalBlkPtr mb, InstrPtr p, in
return p;
}
- if (p->argc + 1 == p->maxarg) {
+ if (p->argc == p->maxarg) {
pn = extendInstruction(mb, p);
if ( mb->errors)
return p;
+#ifndef NDEBUG
+ if( p != pn)
+ for (int i = mb->stop - 1; i >= 0; i--)
+ assert(mb->stmt[i] != p);
+#endif
p = pn;
}
/* protect against the case that the instruction is malloced in
isolation */
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
@@ -257,11 +257,8 @@ prepareMALstack(MalBlkPtr mb, int size)
ValPtr lhs, rhs;
stk = newGlobalStack(size);
- if (!stk) {
+ if (!stk)
return NULL;
- }
- //memset((char *)stk, 0, stackSize(size)); already set
- //stk->stksize = size;
stk->stktop = mb->vtop;
stk->blk = mb;
stk->workers = 0;
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -583,7 +583,8 @@ MALparser(Client c)
c->curprg->def->errors = 0;
oldstate = *c->curprg->def;
- prepareMalBlk(c->curprg->def, CURRENT(c));
+ if( prepareMalBlk(c->curprg->def, CURRENT(c)) < 0)
+ throw(MAL, "mal.parser", "Failed to prepare");
parseMAL(c, c->curprg, 0, INT_MAX);
/* now the parsing is done we should advance the stream */
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
@@ -59,7 +59,7 @@ newGlobalStack(int size)
{
MalStkPtr s;
- s = (MalStkPtr) GDKzalloc(stackSize(size) + offsetof(MalStack, stk));
+ s = (MalStkPtr) GDKzalloc(stackSize(size));
if (!s)
return NULL;
s->stksize = size;
@@ -108,9 +108,8 @@ clearStack(MalStkPtr s)
if (!s) return;
- i = s->stktop;
-
- for (v = s->stk; i >= 0; i--, v++)
+ i = s->stktop - 1;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list