Changeset: 91ed294d2ac2 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=91ed294d2ac2
Modified Files:
monetdb5/extras/jaql/jaqlscenario.c
monetdb5/mal/mal_import.c
sql/backends/monet5/sql.mx
sql/backends/monet5/sql_scenario.c
Branch: SciQL-2
Log Message:
Merged with Feb2013 branch.
diffs (141 lines):
diff --git a/monetdb5/extras/jaql/jaqlscenario.c
b/monetdb5/extras/jaql/jaqlscenario.c
--- a/monetdb5/extras/jaql/jaqlscenario.c
+++ b/monetdb5/extras/jaql/jaqlscenario.c
@@ -285,6 +285,7 @@ JAQLengine(Client c)
* workaround */
chkProgram(c->fdout, c->nspace, c->curprg->def);
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak */
c->glb = 0;
if (j->explain) {
printFunction(c->fdout, c->curprg->def, 0, LIST_MAL_STMT |
LIST_MAPI);
@@ -318,6 +319,7 @@ JAQLengine(Client c)
MSresetInstructions(c->curprg->def, 1);
freeVariables(c, c->curprg->def, c->glb, j->vtop);
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak */
c->glb = oldglb;
freetree(j->p);
diff --git a/monetdb5/mal/mal_import.c b/monetdb5/mal/mal_import.c
--- a/monetdb5/mal/mal_import.c
+++ b/monetdb5/mal/mal_import.c
@@ -145,6 +145,7 @@ malLoadScript(Client c, str name, bstrea
c->prompt = oldprompt; \
c->promptlength= (int)strlen(c->prompt);
#define restoreClient2 \
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak */ \
c->glb = oldglb; \
c->nspace = oldnspace; \
c->curprg = oldprg;
diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx
--- a/sql/backends/monet5/sql.mx
+++ b/sql/backends/monet5/sql.mx
@@ -7707,6 +7707,7 @@ RAstatement(Client cntxt, MalBlkPtr mb,
int oldstop = cntxt->curprg->def->stop;
stmt *s;
char *msg;
+ MalStkPtr oldglb = cntxt->glb;
if (*opt)
rel = rel_optimizer(m, rel);
@@ -7724,6 +7725,8 @@ RAstatement(Client cntxt, MalBlkPtr mb,
resetMalBlk(cntxt->curprg->def, oldstop);
freeVariables(cntxt,cntxt->curprg->def, cntxt->glb,
oldvtop);
}
+ assert(cntxt->glb == 0 || cntxt->glb == oldglb); /* detect leak
*/
+ cntxt->glb = oldglb;
}
return msg;
}
diff --git a/sql/backends/monet5/sql_scenario.c
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1007,6 +1007,7 @@ SQLstatementIntern(Client c, str *expr,
sql_rel *r;
stmt *s;
int oldvtop, oldstop;
+ MalStkPtr oldglb = c->glb;
if (!m->sa)
m->sa = sa_create();
@@ -1023,6 +1024,8 @@ SQLstatementIntern(Client c, str *expr,
execute = 0;
if (!err)
continue;
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak
*/
+ c->glb = oldglb;
goto endofcompile;
}
@@ -1033,10 +1036,6 @@ SQLstatementIntern(Client c, str *expr,
* optimize and produce code.
* We don;t search the cache for a previous incarnation yet.
*/
- if (c->glb) {
- /* MSinitClientPrg clears c->glb, so free it here */
- _DELETE(c->glb);
- }
MSinitClientPrg(c,"user",nme);
oldvtop = c->curprg->def->vtop;
oldstop = c->curprg->def->stop;
@@ -1054,6 +1053,8 @@ SQLstatementIntern(Client c, str *expr,
MSresetInstructions(c->curprg->def, oldstop);
freeVariables(c,c->curprg->def, c->glb, oldvtop);
c->curprg->def->errors = 0;
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak
*/
+ c->glb = oldglb;
goto endofcompile;
}
/* generate MAL code */
@@ -1068,6 +1069,8 @@ SQLstatementIntern(Client c, str *expr,
freeVariables(c,c->curprg->def, c->glb, oldvtop);
c->curprg->def->errors = 0;
msg = createException(SQL, "SQLparser","Errors
encountered in query");
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak
*/
+ c->glb = oldglb;
goto endofcompile;
}
@@ -1084,11 +1087,16 @@ SQLstatementIntern(Client c, str *expr,
freeVariables(c,c->curprg->def, c->glb, oldvtop);
}
sqlcleanup(m, 0);
- if (!execute)
+ if (!execute) {
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak
*/
+ c->glb = oldglb;
goto endofcompile;
+ }
#ifdef _SQL_COMPILE
mnstr_printf(c->fdout, "#parse/execute result %d\n", err);
#endif
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak */
+ c->glb = oldglb;
}
/*
* @-
@@ -1947,6 +1955,7 @@ SQLengineIntern(Client c, backend *be)
if( m->emode == m_prepare)
goto cleanup_engine;
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak */
c->glb = 0;
be->language = 'D';
/*
@@ -1969,6 +1978,7 @@ cleanup_engine:
MSresetInstructions(c->curprg->def, 1);
freeVariables(c,c->curprg->def, c->glb, be->vtop);
be->language = oldlang;
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak
*/
c->glb = oldglb;
return SQLrecompile(c, be);
} else {
@@ -2008,6 +2018,7 @@ cleanup_engine:
* Any error encountered during execution should block further
processing
* unless auto_commit has been set.
*/
+ assert(c->glb == 0 || c->glb == oldglb); /* detect leak */
c->glb = oldglb;
return msg;
}
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list