Changeset: 5c000e77468b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5c000e77468b Modified Files: gdk/gdk.h gdk/gdk_batop.c gdk/gdk_hash.c gdk/gdk_heap.c gdk/gdk_private.h gdk/gdk_utils.c Branch: Dec2023 Log Message:
Cleanup: remove some unused functions, turned some others into static. diffs (200 lines): diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -893,9 +893,6 @@ mskGetVal(BAT *b, BUN p) * @item int * @tab * HEAPcopy (Heap *dst,*src); - * @item int - * @tab - * HEAPwarm (Heap *h); * @end multitable * * diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -665,7 +665,7 @@ append_msk_bat(BAT *b, BATiter *ni, stru /* Append the contents of BAT n (subject to the optional candidate * list s) to BAT b. If b is empty, b will get the seqbase of s if it * was passed in, and else the seqbase of n. */ -gdk_return +static gdk_return BATappend2(BAT *b, BAT *n, BAT *s, bool force, bool mayshare) { struct canditer ci; diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c --- a/gdk/gdk_hash.c +++ b/gdk/gdk_hash.c @@ -1407,32 +1407,3 @@ HASHfree(BAT *b) MT_rwlock_wrunlock(&b->thashlock); } } - -bool -HASHgonebad(BAT *b, const void *v) -{ - Hash *h = b->thash; - BUN cnt, hit; - - if (h == NULL) - return true; /* no hash is bad hash? */ - - BATiter bi = bat_iterator(b); - if (h->nbucket * 2 < BATcount(b)) { - int (*cmp) (const void *, const void *) = ATOMcompare(bi.type); - BUN i = HASHget(h, (BUN) HASHprobe(h, v)); - for (cnt = hit = 1; i != BUN_NONE; i = HASHgetlink(h, i), cnt++) - hit += ((*cmp) (v, BUNtail(bi, (BUN) i)) == 0); - - if (cnt / hit > 4) { - bat_iterator_end(&bi); - return true; /* linked list too long */ - } - - /* in this case, linked lists are long but contain the - * desired values such hash tables may be useful for - * locating all duplicates */ - } - bat_iterator_end(&bi); - return false; /* a-ok */ -} diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c --- a/gdk/gdk_heap.c +++ b/gdk/gdk_heap.c @@ -439,57 +439,6 @@ HEAPextend(Heap *h, size_t size, bool ma return GDK_FAIL; } -gdk_return -HEAPshrink(Heap *h, size_t size) -{ - char *p = NULL; - - assert(size >= h->free); - assert(size <= h->size); - if (h->storage == STORE_MEM) { - p = GDKrealloc(h->base, size); - TRC_DEBUG(HEAP, "Shrinking malloced heap %s %zu %zu %p %p\n", - h->filename, h->size, size, h->base, p); - } else { - char *path; - - assert(h->hasfile); - /* shrink memory mapped file */ - /* round up to multiple of GDK_mmap_pagesize with - * minimum of one */ - size = (size + GDK_mmap_pagesize - 1) & ~(GDK_mmap_pagesize - 1); - if (size == 0) - size = GDK_mmap_pagesize; - if (size >= h->size) { - /* don't grow */ - return GDK_SUCCEED; - } - if ((path = GDKfilepath(h->farmid, BATDIR, h->filename, NULL)) == NULL) - return GDK_FAIL; - p = GDKmremap(path, - h->storage == STORE_PRIV ? - MMAP_COPY | MMAP_READ | MMAP_WRITE : - MMAP_READ | MMAP_WRITE, - h->base, h->size, &size); - GDKfree(path); - TRC_DEBUG(HEAP, "Shrinking %s mmapped " - "heap (%s) %zu %zu %p %p\n", - h->storage == STORE_MMAP ? "shared" : "privately", - h->filename, h->size, size, h->base, p); - } - if (p) { - if (h->farmid == 1) { - QryCtx *qc = MT_thread_get_qry_ctx(); - if (qc) - ATOMIC_SUB(&qc->datasize, h->size - size); - } - h->size = size; - h->base = p; - return GDK_SUCCEED; - } - return GDK_FAIL; -} - /* grow the string offset heap so that the value v fits (i.e. wide * enough to fit the value), and it has space for at least cap elements; * copy ncopy BUNs, or up to the heap size, whichever is smaller */ @@ -972,22 +921,6 @@ HEAPsave(Heap *h, const char *nme, const return HEAPsave_intern(h, nme, ext, ".new", dosync, free, lock); } -int -HEAPwarm(Heap *h) -{ - int bogus_result = 0; - - if (h->storage != STORE_MEM) { - /* touch the heap sequentially */ - int *cur = (int *) h->base; - int *lim = (int *) (h->base + h->free) - 4096; - - for (; cur < lim; cur += 4096) /* try to schedule 4 parallel memory accesses */ - bogus_result |= cur[0] | cur[1024] | cur[2048] | cur[3072]; - } - return bogus_result; -} - /* Return the (virtual) size of the heap. */ size_t diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -58,8 +58,6 @@ const char *ATOMunknown_name(int a) __attribute__((__visibility__("hidden"))); void ATOMunknown_clean(void) __attribute__((__visibility__("hidden"))); -gdk_return BATappend2(BAT *b, BAT *n, BAT *s, bool force, bool mayshare) - __attribute__((__visibility__("hidden"))); bool BATcheckhash(BAT *b) __attribute__((__visibility__("hidden"))); bool BATcheckimprints(BAT *b) @@ -152,9 +150,6 @@ FILE *GDKfileopen(int farmid, const char __attribute__((__visibility__("hidden"))); char *GDKload(int farmid, const char *nme, const char *ext, size_t size, size_t *maxsize, storage_t mode) __attribute__((__visibility__("hidden"))); -void GDKlog(_In_z_ _Printf_format_string_ FILE * fl, const char *format, ...) - __attribute__((__format__(__printf__, 2, 3))) - __attribute__((__visibility__("hidden"))); gdk_return GDKmove(int farmid, const char *dir1, const char *nme1, const char *ext1, const char *dir2, const char *nme2, const char *ext2, bool report) __attribute__((__warn_unused_result__)) __attribute__((__visibility__("hidden"))); @@ -189,8 +184,6 @@ void HASHappend_locked(BAT *b, BUN i, co __attribute__((__visibility__("hidden"))); void HASHfree(BAT *b) __attribute__((__visibility__("hidden"))); -bool HASHgonebad(BAT *b, const void *v) - __attribute__((__visibility__("hidden"))); BUN HASHdelete(BATiter *bi, BUN p, const void *v) __attribute__((__visibility__("hidden"))); void HASHdelete_locked(BATiter *bi, BUN p, const void *v) @@ -222,11 +215,6 @@ void HEAP_recover(Heap *, const var_t *, gdk_return HEAPsave(Heap *h, const char *nme, const char *ext, bool dosync, BUN free, MT_Lock *lock) __attribute__((__warn_unused_result__)) __attribute__((__visibility__("hidden"))); -gdk_return HEAPshrink(Heap *h, size_t size) - __attribute__((__warn_unused_result__)) - __attribute__((__visibility__("hidden"))); -int HEAPwarm(Heap *h) - __attribute__((__visibility__("hidden"))); void IMPSdecref(Imprints *imprints, bool remove) __attribute__((__visibility__("hidden"))); void IMPSfree(BAT *b) diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -339,7 +339,7 @@ GDKcopyenv(BAT **key, BAT **val, bool wr * Single-lined comments can now be logged safely, together with * process, thread and user ID, and the current time. */ -void +static void __attribute__((__format__(__printf__, 2, 3))) GDKlog(FILE *lockFile, const char *format, ...) { va_list ap; _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org