Changeset: 6e184989de57 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6e184989de57
Modified Files:
monetdb5/modules/kernel/batstr.c
monetdb5/modules/mal/txtsim.c
Branch: txtsim
Log Message:
Use BBPreclaim, finalize_output. Clean up bat functions.
diffs (truncated from 992 to 300 lines):
diff --git a/monetdb5/modules/kernel/batstr.c b/monetdb5/modules/kernel/batstr.c
--- a/monetdb5/modules/kernel/batstr.c
+++ b/monetdb5/modules/kernel/batstr.c
@@ -8,16 +8,6 @@
* Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V.
*/
-/*
- * M.L. Kersten
- * String multiplexes
- * [TODO: property propagations]
- * The collection of routines provided here are map operations
- * for the atom string primitives.
- *
- * In line with the batcalc module, we assume that if two bat operands
- * are provided that they are aligned.
- */
#include "monetdb_config.h"
#include "gdk.h"
#include <ctype.h>
@@ -45,7 +35,7 @@ batstr_func_has_candidates(const char *f
}
static inline void
-finalize_ouput(bat *res, BAT *bn, str msg, bool nils, BUN q)
+finalize_output(bat *res, BAT *bn, str msg, bool nils, BUN q)
{
if (bn && !msg) {
BATsetcount(bn, q);
@@ -54,6 +44,7 @@ finalize_ouput(bat *res, BAT *bn, str ms
bn->tkey = BATcount(bn) <= 1;
bn->tsorted = BATcount(bn) <= 1;
bn->trevsorted = BATcount(bn) <= 1;
+ bn->theap->dirty |= BATcount(bn) > 0;
*res = bn->batCacheid;
BBPkeepref(bn);
} else if (bn)
@@ -138,7 +129,7 @@ do_batstr_int(Client cntxt, MalBlkPtr mb
}
bat_iterator_end(&bi);
bailout:
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(2, b, bs);
return msg;
}
@@ -211,7 +202,7 @@ STRbatAscii(Client cntxt, MalBlkPtr mb,
bailout1:
bat_iterator_end(&bi);
bailout:
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(2, b, bs);
return msg;
}
@@ -305,7 +296,7 @@ STRbatFromWChr(Client cntxt, MalBlkPtr m
bat_iterator_end(&bi);
bailout:
GDKfree(buf);
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(2, b, bs);
return msg;
}
@@ -392,7 +383,7 @@ STRbatSpace(Client cntxt, MalBlkPtr mb,
bat_iterator_end(&bi);
bailout:
GDKfree(buf);
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(2, b, bs);
return msg;
}
@@ -477,7 +468,7 @@ bailout1:
bat_iterator_end(&bi);
bailout:
GDKfree(buf);
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(2, b, bs);
return msg;
}
@@ -565,7 +556,7 @@ bailout1:
bat_iterator_end(&bi);
bailout:
GDKfree(buf);
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(2, b, bs);
return msg;
}
@@ -653,7 +644,7 @@ bailout1:
bat_iterator_end(&bi);
bailout:
GDKfree(buf);
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(2, b, bs);
return msg;
}
@@ -752,7 +743,7 @@ bailout1:
bat_iterator_end(&righti);
bailout:
GDKfree(buf);
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(4, left, lefts, right, rights);
return msg;
}
@@ -841,7 +832,7 @@ bailout1:
bat_iterator_end(&bi);
bailout:
GDKfree(buf);
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(2, b, bs);
return msg;
}
@@ -931,7 +922,7 @@ do_batstr_int_conststr(Client cntxt, Mal
bat_iterator_end(&bi);
bailout:
GDKfree(buf);
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(2, b, bs);
return msg;
}
@@ -1035,7 +1026,7 @@ bailout1:
bat_iterator_end(&lefti);
bailout:
GDKfree(buf);
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(4, left, ls, right, rs);
return msg;
}
@@ -1125,7 +1116,7 @@ bailout1:
bat_iterator_end(&bi);
bailout:
GDKfree(buf);
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(2, b, bs);
return msg;
}
@@ -1230,7 +1221,7 @@ bailout1:
bat_iterator_end(&lefti);
bailout:
GDKfree(buf);
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(4, left, ls, right, rs);
return msg;
}
@@ -1332,7 +1323,7 @@ bailout1:
bat_iterator_end(&righti);
bailout:
GDKfree(buf);
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(4, left, ls, right, rs);
return msg;
}
@@ -1442,7 +1433,7 @@ bailout1:
bat_iterator_end(&bi);
bailout:
GDKfree(buf);
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(6, arg1, arg1s, arg2, arg2s, arg3, arg3s);
return msg;
}
@@ -1652,21 +1643,21 @@ prefix_or_suffix(Client cntxt, MalBlkPtr
if (!(left = BATdescriptor(*l)) || !(right = BATdescriptor(*r))) {
msg = createException(MAL, name, SQLSTATE(HY002)
RUNTIME_OBJECT_MISSING);
- goto bailout;
+ goto exit2;
}
if ((sid1 && !is_bat_nil(*sid1) && !(lefts = BATdescriptor(*sid1))) ||
(sid2 && !is_bat_nil(*sid2) && !(rights = BATdescriptor(*sid2)))) {
msg = createException(MAL, name, SQLSTATE(HY002)
RUNTIME_OBJECT_MISSING);
- goto bailout;
+ goto exit2;
}
canditer_init(&ci1, left, lefts);
canditer_init(&ci2, right, rights);
if (ci2.ncand != ci1.ncand || ci1.hseq != ci2.hseq) {
msg = createException(MAL, name, ILLEGAL_ARGUMENT " Requires
bats of identical size");
- goto bailout;
+ goto exit2;
}
if (!(bn = COLnew(ci1.hseq, TYPE_bit, ci1.ncand, TRANSIENT))) {
msg = createException(MAL, name, SQLSTATE(HY013)
MAL_MALLOC_FAIL);
- goto bailout;
+ goto exit2;
}
off1 = left->hseqbase;
@@ -1687,7 +1678,7 @@ prefix_or_suffix(Client cntxt, MalBlkPtr
if (icase && *icase) {
if ((msg = STRlower(&x, &x)) !=
MAL_SUCCEED ||
(msg = STRlower(&y, &y)) !=
MAL_SUCCEED)
- goto bailout;
+ goto exit1;
}
vals[i] = func(x, y);
}
@@ -1705,16 +1696,17 @@ prefix_or_suffix(Client cntxt, MalBlkPtr
if (icase && *icase) {
if ((msg = STRlower(&x, &x)) !=
MAL_SUCCEED ||
(msg = STRlower(&y, &y)) !=
MAL_SUCCEED)
- goto bailout;
+ goto exit1;
}
vals[i] = func(x, y);
}
}
}
+ exit1:
bat_iterator_end(&lefti);
bat_iterator_end(&righti);
-bailout:
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ exit2:
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(4, left, lefts, right, rights);
return msg;
}
@@ -1779,20 +1771,20 @@ prefix_or_suffix_cst(Client cntxt, MalBl
if (icase && *icase) {
if ((msg = STRlower(&y, &y)) != MAL_SUCCEED)
- goto bailout;
+ goto exit2;
}
if (!(b = BATdescriptor(*bid))) {
msg = createException(MAL, name, SQLSTATE(HY002)
RUNTIME_OBJECT_MISSING);
- goto bailout;
+ goto exit2;
}
if (sid1 && !is_bat_nil(*sid1) && !(bs = BATdescriptor(*sid1))) {
msg = createException(MAL, name, SQLSTATE(HY002)
RUNTIME_OBJECT_MISSING);
- goto bailout;
+ goto exit2;
}
canditer_init(&ci1, b, bs);
if (!(bn = COLnew(ci1.hseq, TYPE_bit, ci1.ncand, TRANSIENT))) {
msg = createException(MAL, name, SQLSTATE(HY013)
MAL_MALLOC_FAIL);
- goto bailout;
+ goto exit2;
}
off1 = b->hseqbase;
@@ -1809,7 +1801,7 @@ prefix_or_suffix_cst(Client cntxt, MalBl
} else {
if (icase && *icase) {
if ((msg = STRlower(&x, &x)) !=
MAL_SUCCEED)
- goto bailout;
+ goto exit1;
}
vals[i] = func(x, y);
}
@@ -1825,15 +1817,16 @@ prefix_or_suffix_cst(Client cntxt, MalBl
} else {
if(icase && *icase) {
if ((msg = STRlower(&x, &x)) !=
MAL_SUCCEED)
- goto bailout;
+ goto exit1;
}
vals[i] = func(x, y);
}
}
}
+ exit1:
bat_iterator_end(&bi);
-bailout:
- finalize_ouput(res, bn, msg, nils, ci1.ncand);
+ exit2:
+ finalize_output(res, bn, msg, nils, ci1.ncand);
unfix_inputs(2, b, bs);
return msg;
}
@@ -1903,20 +1896,20 @@ prefix_or_suffix_strcst(Client cntxt, Ma
if (icase && *icase) {
if ((msg = STRlower(&x, &x)) != MAL_SUCCEED)
- goto bailout;
+ goto exit2;
}
if (!(b = BATdescriptor(*bid))) {
msg = createException(MAL, name, SQLSTATE(HY002)
RUNTIME_OBJECT_MISSING);
- goto bailout;
+ goto exit2;
}
if (sid1 && !is_bat_nil(*sid1) && !(bs = BATdescriptor(*sid1))) {
msg = createException(MAL, name, SQLSTATE(HY002)
RUNTIME_OBJECT_MISSING);
- goto bailout;
+ goto exit2;
}
canditer_init(&ci1, b, bs);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]