Changeset: 41a2cba2a0b4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/41a2cba2a0b4
Modified Files:
        clients/Tests/exports.stable.out
        gdk/gdk_batop.c
        gdk/gdk_group.c
        gdk/gdk_hash.c
        gdk/gdk_hash.h
        gdk/gdk_heap.c
        gdk/gdk_join.c
        gdk/gdk_project.c
        gdk/gdk_select.c
        gdk/gdk_unique.c
        monetdb5/modules/mal/mat.c
        monetdb5/modules/mal/pcre.c
Branch: ustr
Log Message:

Merge with default branch.


diffs (truncated from 1087 to 300 lines):

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
@@ -391,7 +391,7 @@ bool MT_thread_init(void);
 gdk_return MT_thread_init_add_callback(void (*init)(void *), void 
(*destroy)(void *), void *data);
 bool MT_thread_register(void);
 void MT_thread_set_qry_ctx(QryCtx *ctx);
-void MT_thread_setalgorithm(const char *algo);
+void MT_thread_setalgorithm(const char *algo, const char *func);
 void MT_thread_setallocator(allocator *ma);
 void MT_thread_setdata(void *data);
 void MT_thread_setlockwait(MT_Lock *lock);
@@ -1356,8 +1356,8 @@ char *prompt_getlogin(void);
 struct dirent *readdir(DIR *dir);
 void rewinddir(DIR *dir);
 char *simple_prompt(const char *prompt, int maxlen, int echo, const char *def);
-size_t strlconcat(char *restrict dst, size_t n, const char *restrict src, ...) 
__attribute__((__access__(write_only, 1, 2))) __attribute__(()) 
__attribute__((__sentinel__));
-ssize_t strtconcat(char *restrict dst, size_t n, const char *restrict src, 
...) __attribute__((__access__(write_only, 1, 2))) __attribute__(()) 
__attribute__((__sentinel__));
+size_t strlconcat(char *restrict dst, size_t n, const char *restrict src, ...) 
__attribute__((__access__(write_only, 1, 2))) __attribute__((__nonnull__(1))) 
__attribute__((__sentinel__));
+ssize_t strtconcat(char *restrict dst, size_t n, const char *restrict src, 
...) __attribute__((__access__(write_only, 1, 2))) 
__attribute__((__nonnull__(1))) __attribute__((__sentinel__));
 char *utf16toutf8(const uint16_t *src);
 const uint8_t utf8d[364];
 uint16_t *utf8toutf16(const char *src);
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -957,7 +957,7 @@ BATgroupsum(BAT *b, BAT *g, BAT *e, BAT 
        }
 
        if (algo)
-               MT_thread_setalgorithm(algo);
+               MT_thread_setalgorithm(algo, __func__);
        TRC_DEBUG(ALGO, "b=" ALGOBATFMT ",g=" ALGOOPTBATFMT ","
                  "e=" ALGOOPTBATFMT ",s=" ALGOOPTBATFMT " -> " ALGOOPTBATFMT
                  "; start " OIDFMT ", count " BUNFMT " (%s -- " LLFMT " 
usec)\n",
@@ -1168,7 +1168,7 @@ BATsum(void *res, int tp, BAT *b, BAT *s
                         skip_nils, nil_if_empty, __func__, &algo);
        bat_iterator_end(&bi);
        if (algo)
-               MT_thread_setalgorithm(algo);
+               MT_thread_setalgorithm(algo, __func__);
        TRC_DEBUG(ALGO, "b=" ALGOBATFMT ",s=" ALGOOPTBATFMT "; "
                  "start " OIDFMT ", count " BUNFMT " (%s -- " LLFMT " usec)\n",
                  ALGOBATPAR(b), ALGOOPTBATPAR(s),
@@ -3686,7 +3686,7 @@ BATmin_skipnil(allocator *ma, BAT *b, vo
                                const oid *ords = (const oid *) oidxh->base + 
ORDERIDXOFF;
                                BUN r;
                                if (skipnil && !bi.nonil) {
-                                       MT_thread_setalgorithm(usepoidx ? 
"binsearch on parent oidx" : "binsearch on oidx");
+                                       MT_thread_setalgorithm(usepoidx ? 
"binsearch on parent oidx" : "binsearch on oidx", __func__);
                                        r = binsearch(ords, bi.type, bi.base,
                                                      bi.vh ? bi.vh->base : 
NULL,
                                                      bi.width, 0, bi.count,
@@ -3706,7 +3706,7 @@ BATmin_skipnil(allocator *ma, BAT *b, vo
                                        /* no non-nil values */
                                        pos = oid_nil;
                                } else {
-                                       MT_thread_setalgorithm(usepoidx ? 
"using parent oidx" : "using oidx");
+                                       MT_thread_setalgorithm(usepoidx ? 
"using parent oidx" : "using oidx", __func__);
                                        pos = ords[r];
                                }
                                HEAPdecref(oidxh, false);
@@ -3828,7 +3828,7 @@ BATmax_skipnil(allocator *ma, BAT *b, vo
                        if (oidxh != NULL) {
                                const oid *ords = (const oid *) oidxh->base + 
ORDERIDXOFF;
 
-                               MT_thread_setalgorithm(usepoidx ? "using parent 
oidx" : "using oids");
+                               MT_thread_setalgorithm(usepoidx ? "using parent 
oidx" : "using oids", __func__);
                                pos = ords[bi.count - 1];
                                /* nils are first, ie !skipnil, check for nils 
*/
                                if (!skipnil) {
@@ -4162,7 +4162,7 @@ doBATgroupquantile(BAT *b, BAT *g, BAT *
                        BBPunfix(pb->batCacheid);
                }
                if (oidxh != NULL) {
-                       MT_thread_setalgorithm(pb ? "using parent oidx" : 
"using oids");
+                       MT_thread_setalgorithm(pb ? "using parent oidx" : 
"using oids", __func__);
                        ords = (const oid *) oidxh->base + ORDERIDXOFF;
                } else {
                        if (BATsort(NULL, &t1, NULL, b, NULL, g, false, false, 
false) != GDK_SUCCEED)
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -46,7 +46,7 @@ unshare_varsized_heap(BAT *b)
                MT_lock_set(&GDKswapLock(b->batCacheid));
                if (BBP_refs(b->batCacheid) == 1 &&
                    BATcount(BBP_desc(b->tvheap->parentid)) > 2 * BATcount(b)) {
-                       MT_thread_setalgorithm("unshare vheap reinsert 
strings");
+                       MT_thread_setalgorithm("unshare vheap reinsert 
strings", __func__);
                        MT_lock_set(&b->theaplock);
                        BATatoms[b->ttype].atomHeap(h, b->batCapacity);
                        Heap *oh = b->tvheap;
@@ -113,7 +113,7 @@ unshare_varsized_heap(BAT *b)
                        return GDK_FAIL;
                }
                MT_lock_unset(&GDKswapLock(b->batCacheid));
-               MT_thread_setalgorithm("unshare vheap by copying");
+               MT_thread_setalgorithm("unshare vheap by copying", __func__);
                if (HEAPcopy(h, b->tvheap, 0) != GDK_SUCCEED) {
                        HEAPfree(h, true);
                        GDKfree(h);
@@ -159,9 +159,9 @@ insert_string_bat(BAT *b, BATiter *ni, s
                 * need to append the offsets */
                toff = 0;
                b->tvkey |= ni->vkey;
-               MT_thread_setalgorithm("shared vheap");
+               MT_thread_setalgorithm("shared vheap", __func__);
        } else if (b->ustr) {
-               MT_thread_setalgorithm("individual inserts into ustr");
+               MT_thread_setalgorithm("individual inserts into ustr", 
__func__);
        } else if (mayshare && b->batRole == TRANSIENT && oldcnt == 0) {
                /* we can share the vheaps, so we then only need to
                 * append the offsets */
@@ -177,7 +177,7 @@ insert_string_bat(BAT *b, BATiter *ni, s
                if (bid != b->batCacheid)
                        BBPrelease(bid);
                toff = 0;
-               MT_thread_setalgorithm("share vheap");
+               MT_thread_setalgorithm("share vheap", __func__);
        } else {
                /* no heap sharing, so also make sure the heap isn't
                 * shared currently (we're not allowed to write in
@@ -218,10 +218,10 @@ insert_string_bat(BAT *b, BATiter *ni, s
                                /* we copy the string heap, perhaps appending */
                                if (oldcnt == 0) {
                                        toff = 0;
-                                       MT_thread_setalgorithm("copy vheap");
+                                       MT_thread_setalgorithm("copy vheap", 
__func__);
                                } else {
                                        toff = (b->tvheap->free + GDK_VARALIGN 
- 1) & ~(GDK_VARALIGN - 1);
-                                       MT_thread_setalgorithm("append vheap");
+                                       MT_thread_setalgorithm("append vheap", 
__func__);
                                }
 
                                MT_lock_set(&b->theaplock);
@@ -257,7 +257,7 @@ insert_string_bat(BAT *b, BATiter *ni, s
        if (toff == 0 && ni->width == b->twidth && ci->tpe == cand_dense) {
                /* we don't need to do any translation of offset
                 * values, so we can use fast memcpy */
-               MT_thread_setalgorithm("memcpy offsets");
+               MT_thread_setalgorithm("memcpy offsets", __func__);
                memcpy(Tloc(b, BATcount(b)), (const char *) ni->base + 
((ci->seq - ni->b->hseqbase) << ni->shift), cnt << ni->shift);
        } else if (toff != ~(size_t) 0) {
                /* we don't need to insert any actual strings since we
@@ -277,7 +277,7 @@ insert_string_bat(BAT *b, BATiter *ni, s
                const uint64_t *restrict tlp = (const uint64_t *) ni->base;
 #endif
 
-               MT_thread_setalgorithm("copy offset values");
+               MT_thread_setalgorithm("copy offset values", __func__);
                r = b->batCount;
                TIMEOUT_LOOP(cnt, qry_ctx) {
                        p = canditer_next(ci) - ni->b->hseqbase;
@@ -346,7 +346,7 @@ insert_string_bat(BAT *b, BATiter *ni, s
                 * to use the double elimination mechanism */
                r = b->batCount;
                oid hseq = ni->b->hseqbase;
-               MT_thread_setalgorithm("insert string values");
+               MT_thread_setalgorithm("insert string values", __func__);
                TIMEOUT_LOOP(cnt, qry_ctx) {
                        p = canditer_next(ci) - hseq;
                        tp = BUNtvar(ni, p);
@@ -363,7 +363,7 @@ insert_string_bat(BAT *b, BATiter *ni, s
                 * n's).  If this is the case, we just copy the
                 * offset, otherwise we insert normally.  */
                r = b->batCount;
-               MT_thread_setalgorithm("insert string values with check");
+               MT_thread_setalgorithm("insert string values with check", 
__func__);
                const void *nil = ATOMnilptr(ni->type);
                TIMEOUT_LOOP(cnt, qry_ctx) {
                        p = canditer_next(ci) - ni->b->hseqbase;
@@ -473,6 +473,7 @@ append_varsized_bat(BAT *b, BATiter *ni,
                    b->batRole == TRANSIENT &&
                    ni->restricted == BAT_READ &&
                    b->tvheap != ni->vh) {
+                       MT_thread_setalgorithm("share vheap", __func__);
                        /* if b is still empty, in the transient farm,
                         * and n is read-only, we replace b's vheap with
                         * a reference to n's */
@@ -490,12 +491,14 @@ append_varsized_bat(BAT *b, BATiter *ni,
                /* if b and n use the same vheap, we only need to copy
                 * the offsets from n to b */
                if (ci->tpe == cand_dense) {
+                       MT_thread_setalgorithm("memcpy tail", __func__);
                        /* fast memcpy since we copy a consecutive
                         * chunk of memory */
                        memcpy(Tloc(b, BATcount(b)),
                               (const var_t *) ni->base + (ci->seq - hseq),
                               cnt << b->tshift);
                } else {
+                       MT_thread_setalgorithm("copy tail", __func__);
                        var_t *restrict dst = (var_t *) Tloc(b, BATcount(b));
                        const var_t *restrict src = (const var_t *) ni->base;
                        while (cnt > 0) {
@@ -555,6 +558,7 @@ append_varsized_bat(BAT *b, BATiter *ni,
        if (BATcount(b) == 0 &&
            ci->tpe == cand_dense && ci->ncand == ni->count) {
                /* just copy the heaps */
+               MT_thread_setalgorithm("memcpy tail and vheap", __func__);
                MT_lock_set(&b->theaplock);
                if (HEAPgrow(&b->tvheap, ni->vhfree, false) != GDK_SUCCEED) {
                        MT_lock_unset(&b->theaplock);
@@ -584,6 +588,7 @@ append_varsized_bat(BAT *b, BATiter *ni,
                return GDK_SUCCEED;
        }
        /* copy data from n to b */
+       MT_thread_setalgorithm("insert values", __func__);
        r = BATcount(b);
        for (BUN i = 0; i < cnt; i++) {
                BUN p = canditer_next(ci) - hseq;
@@ -621,6 +626,7 @@ append_msk_bat(BAT *b, BATiter *ni, stru
        if (BATextend(b, BATcount(b) + ci->ncand) != GDK_SUCCEED)
                return GDK_FAIL;
 
+       MT_thread_setalgorithm("append msk bat", __func__);
        MT_lock_set(&b->theaplock);
 
        uint32_t boff = b->batCount % 32;
@@ -1076,15 +1082,19 @@ BATappend2(BAT *b, BAT *n, BAT *s, bool 
                if (b->ttype != TYPE_void &&
                    ni.type != TYPE_void &&
                    ci.tpe == cand_dense) {
+                       MT_thread_setalgorithm("memcpy tail", __func__);
                        /* use fast memcpy if we can */
                        memcpy(Tloc(b, BATcount(b)),
                               (const char *) ni.base + ((ci.seq - hseq) << 
ni.shift),
                               ci.ncand << ni.shift);
+                       if (b->thash)
+                               MT_thread_setalgorithm("hash maintenance", 
__func__);
                        for (BUN i = 0; b->thash && i < ci.ncand; i++) {
                                HASHappend_locked(&bi, r, Tloc(b, r));
                                r++;
                        }
                } else {
+                       MT_thread_setalgorithm("insert values", __func__);
                        const void *atomnil = ATOMnilptr(b->ttype);
                        TIMEOUT_LOOP(ci.ncand, qry_ctx) {
                                BUN p = canditer_next(&ci) - hseq;
diff --git a/gdk/gdk_firstn.c b/gdk/gdk_firstn.c
--- a/gdk/gdk_firstn.c
+++ b/gdk/gdk_firstn.c
@@ -221,7 +221,7 @@ BATfirstn_unique(BATiter *bi, BAT *s, BU
        oid item;
        BUN pos, childpos;
 
-       MT_thread_setalgorithm(__func__);
+       MT_thread_setalgorithm(__func__, NULL);
        canditer_init(&ci, bi->b, s);
 
        if (n >= ci.ncand) {
@@ -729,7 +729,7 @@ BATfirstn_unique_with_groups(BATiter *bi
        oid item;
        BUN pos, childpos;
 
-       MT_thread_setalgorithm(__func__);
+       MT_thread_setalgorithm(__func__, NULL);
        canditer_init(&ci, bi->b, s);
 
        if (n > ci.ncand)
@@ -1030,7 +1030,7 @@ BATfirstn_grouped(BAT **topn, BAT **gids
        oid last;
        gdk_return rc;
 
-       MT_thread_setalgorithm(__func__);
+       MT_thread_setalgorithm(__func__, NULL);
        if (distinct && !bi->key) {
                su = s;
                s = BATunique(bi->b, s);
@@ -1130,7 +1130,7 @@ BATfirstn_grouped_with_groups(BAT **topn
        oid last, lastg;
        gdk_return rc;
 
-       MT_thread_setalgorithm(__func__);
+       MT_thread_setalgorithm(__func__, NULL);
        if (distinct) {
                BAT *bn1, *bn2, *bn3, *bn4, *bn5, *bn6, *bn7;
                if (BATgroup(&bn1, &bn2, NULL, bi->b, s, g, NULL, NULL) != 
GDK_SUCCEED)
diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -102,7 +102,7 @@
                INIT_0;                                                 \
                if (ci.tpe == cand_dense) {                             \
                        if (grps) {                                     \
-                               
MT_thread_setalgorithm("GRP_compare_consecutive_values, dense, groups"); \
+                               
MT_thread_setalgorithm("GRP_compare_consecutive_values, dense, groups", 
__func__); \
                                TIMEOUT_LOOP_IDX(r, ci.ncand, qry_ctx) { \
                                        p = canditer_next_dense(&ci) - hseqb; \
                                        INIT_1;                         \
@@ -119,7 +119,7 @@
                                TIMEOUT_CHECK(qry_ctx,                  \
                                              GOTO_LABEL_TIMEOUT_HANDLER(error, 
qry_ctx)); \
                        } else {                                        \
-                               
MT_thread_setalgorithm("GRP_compare_consecutive_values, dense, !groups"); \
+                               
MT_thread_setalgorithm("GRP_compare_consecutive_values, dense, !groups", 
__func__); \
                                TIMEOUT_LOOP_IDX(r, ci.ncand, qry_ctx) { \
                                        p = canditer_next_dense(&ci) - hseqb; \
                                        INIT_1;                         \
@@ -137,7 +137,7 @@
                        }                                               \
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to