Changeset: 2755c9a0af3f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2755c9a0af3f
Modified Files:
monetdb5/mal/mal_function.c
monetdb5/modules/mal/remote.c
tools/monetdbe/monetdbe.c
Branch: Sep2022
Log Message:
If newFunctionArgs is called with a negative number of args, don't create
instruction.
Sometimes the MAL block is deleted right after creation, so this saves
some unnecessary allocations.
diffs (66 lines):
diff --git a/monetdb5/mal/mal_function.c b/monetdb5/mal/mal_function.c
--- a/monetdb5/mal/mal_function.c
+++ b/monetdb5/mal/mal_function.c
@@ -39,15 +39,17 @@ Symbol newFunctionArgs(const char *mod,
return NULL;
}
- p = newInstructionArgs(NULL, mod, nme, args);
- if (p == NULL) {
- freeSymbol(s);
- return NULL;
+ if (args > 0) {
+ p = newInstructionArgs(NULL, mod, nme, args);
+ if (p == NULL) {
+ freeSymbol(s);
+ return NULL;
+ }
+ p->token = kind;
+ p->barrier = 0;
+ setDestVar(p, varid);
+ pushInstruction(s->def,p);
}
- p->token = kind;
- p->barrier = 0;
- setDestVar(p, varid);
- pushInstruction(s->def,p);
return s;
}
@@ -335,7 +337,7 @@ cloneFunction(Module scope, Symbol proc,
InstrPtr pp;
str msg = MAL_SUCCEED;
- new = newFunction(scope->name, proc->name, getSignature(proc)->token);
+ new = newFunctionArgs(scope->name, proc->name,
getSignature(proc)->token, -1);
if( new == NULL){
return NULL;
}
diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -1217,7 +1217,7 @@ static str RMTregisterInternal(Client cn
}
Symbol prg;
- if ((prg = newFunction(putName(mod), putName(*fcn_id), FUNCTIONsymbol))
== NULL) {
+ if ((prg = newFunctionArgs(putName(mod), putName(*fcn_id),
FUNCTIONsymbol, -1)) == NULL) {
MT_lock_unset(&c->lock);
throw(MAL, "Remote register", MAL_MALLOC_FAIL);
}
diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c
--- a/tools/monetdbe/monetdbe.c
+++ b/tools/monetdbe/monetdbe.c
@@ -1340,10 +1340,11 @@ monetdbe_prepare_cb(void* context, char*
*/
prg->def = NULL;
freeSymbol(prg);
- if ((prg = newFunction(userRef, putName(be->q->name), FUNCTIONsymbol))
== NULL) {
+ if ((prg = newFunctionArgs(userRef, putName(be->q->name),
FUNCTIONsymbol, -1)) == NULL) {
msg = createException(MAL, "monetdbe.monetdbe_prepare_cb",
MAL_MALLOC_FAIL);
goto cleanup;
}
+ freeMalBlk(prg->def);
prg->def = mb;
setFunctionId(getSignature(prg), be->q->name);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]