Changeset: ede5229fbf99 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ede5229fbf99
Modified Files:
gdk/gdk_bat.c
gdk/gdk_calc.c
gdk/gdk_delta.c
gdk/gdk_hash.c
gdk/gdk_heap.c
gdk/gdk_imprints.c
gdk/gdk_orderidx.c
gdk/gdk_project.c
monetdb5/modules/kernel/batstr.c
monetdb5/modules/mal/tablet.c
Branch: Jul2021
Log Message:
A bit of cleanup: don't do double work, but add a few settings of dirty flag.
diffs (181 lines):
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -912,8 +912,7 @@ COLcopy(BAT *b, int tt, bool writable, r
/* convert number of bits to number of bytes,
* and round the latter up to a multiple of
* 4 (copy in units of 4 bytes) */
- bn->theap->free = (bi.count + 7) / 8;
- bn->theap->free = (bn->theap->free + 3) & ~(size_t)3;
+ bn->theap->free = ((bi.count + 31) / 32) * 4;
bn->theap->dirty |= bi.count > 0;
memcpy(Tloc(bn, 0), bi.base, bn->theap->free);
} else {
diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -14668,7 +14668,6 @@ BATcalcifthenelse_intern(BAT *b,
bat_iterator_end(&bi);
BATsetcount(bn, cnt);
- bn->theap->dirty = true;
bn->tsorted = cnt <= 1;
bn->trevsorted = cnt <= 1;
@@ -15549,7 +15548,6 @@ convert_any_str(BAT *b, BAT *bn, struct
}
}
bat_iterator_end(&bi);
- bn->theap->dirty = true;
BATsetcount(bn, ncand);
GDKfree(dst);
return nils;
diff --git a/gdk/gdk_delta.c b/gdk/gdk_delta.c
--- a/gdk/gdk_delta.c
+++ b/gdk/gdk_delta.c
@@ -98,8 +98,6 @@ BATundo(BAT *b)
}
}
}
- b->theap->free = tailsize(b, b->batInserted);
-
BATsetcount(b, b->batInserted);
MT_lock_unset(&b->theaplock);
}
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -143,11 +143,13 @@ HASHnew(Hash *h, int tpe, BUN size, BUN
if (HEAPalloc(&h->heaplink, size, h->width, 0) != GDK_SUCCEED)
return GDK_FAIL;
h->heaplink.free = size * h->width;
+ h->heaplink.dirty = true;
h->Link = h->heaplink.base;
}
if (HEAPalloc(&h->heapbckt, mask + HASH_HEADER_SIZE * SIZEOF_SIZE_T /
h->width, h->width, 0) != GDK_SUCCEED)
return GDK_FAIL;
h->heapbckt.free = mask * h->width + HASH_HEADER_SIZE * SIZEOF_SIZE_T;
+ h->heapbckt.dirty = true;
h->nbucket = mask;
if (mask & (mask - 1)) {
h->mask2 = hashmask(mask);
@@ -239,6 +241,8 @@ HASHupgradehashheap(BAT *b)
BUN2type v = ((BUN2type *) h->Bckt)[i];
((BUN4type *) h->Bckt)[i] = v == BUN2_NONE ?
BUN4_NONE : v;
}
+ h->heapbckt.dirty = true;
+ h->heaplink.dirty = true;
break;
}
#endif
@@ -262,6 +266,8 @@ HASHupgradehashheap(BAT *b)
BUN2type v = ((BUN2type *) h->Bckt)[i];
((BUN8type *) h->Bckt)[i] = v == BUN2_NONE ?
BUN8_NONE : v;
}
+ h->heapbckt.dirty = true;
+ h->heaplink.dirty = true;
break;
#endif
case BUN4:
@@ -279,6 +285,8 @@ HASHupgradehashheap(BAT *b)
BUN4type v = ((BUN4type *) h->Bckt)[i];
((BUN8type *) h->Bckt)[i] = v == BUN4_NONE ?
BUN8_NONE : v;
}
+ h->heapbckt.dirty = true;
+ h->heaplink.dirty = true;
break;
}
break;
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -1040,6 +1040,8 @@ HEAP_empty(Heap *heap, size_t nprivate,
assert(heap->size - head <= VAR_MAX);
headp->size = (size_t) (heap->size - head);
headp->next = 0;
+
+ heap->dirty = true;
}
void
@@ -1121,6 +1123,7 @@ HEAP_malloc(BAT *b, size_t nbytes)
}
heap = b->tvheap;
heap->free = newsize;
+ heap->dirty = true;
hheader = HEAP_index(heap, 0, HEADER);
blockp = HEAP_index(heap, block, CHUNK);
@@ -1359,6 +1362,8 @@ HEAP_recover(Heap *h, const var_t *offse
if (h->storage == STORE_MMAP) {
if (!(GDKdebug & NOSYNCMASK))
(void) MT_msync(h->base, dirty);
+ else
+ h->dirty = true;
} else
h->dirty = true;
}
diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c
--- a/gdk/gdk_imprints.c
+++ b/gdk/gdk_imprints.c
@@ -629,6 +629,7 @@ BATimprints(BAT *b)
((size_t *) imprints->imprints.base)[2] = (size_t)
imprints->dictcnt;
((size_t *) imprints->imprints.base)[3] = (size_t) bi.count;
imprints->imprints.parentid = b->batCacheid;
+ imprints->imprints.dirty = true;
MT_lock_set(&b->theaplock);
if (b->batCount != bi.count) {
/* bat changed under our feet, can't use imprints */
diff --git a/gdk/gdk_orderidx.c b/gdk/gdk_orderidx.c
--- a/gdk/gdk_orderidx.c
+++ b/gdk/gdk_orderidx.c
@@ -150,6 +150,7 @@ createOIDXheap(BAT *b, bool stable)
return NULL;
}
m->free = (BATcount(b) + ORDERIDXOFF) * SIZEOF_OID;
+ m->dirty = true;
mv = (oid *) m->base;
*mv++ = ORDERIDX_VERSION;
@@ -376,6 +377,7 @@ GDKmergeidx(BAT *b, BAT**a, int n_ar)
return GDK_FAIL;
}
m->free = (BATcount(b) + ORDERIDXOFF) * SIZEOF_OID;
+ m->dirty = true;
mv = (oid *) m->base;
*mv++ = ORDERIDX_VERSION;
diff --git a/gdk/gdk_project.c b/gdk/gdk_project.c
--- a/gdk/gdk_project.c
+++ b/gdk/gdk_project.c
@@ -412,6 +412,7 @@ project_str(BAT *restrict l, struct cand
#endif
memcpy(bn->tvheap->base + h1off, r2i->vh->base, r2i->vhfree);
bn->tvheap->free = h1off + r2i->vhfree;
+ bn->tvheap->dirty = true;
}
if (v >= ((var_t) 1 << (8 << bn->tshift)) &&
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
@@ -39,7 +39,7 @@ batstr_func_has_candidates(const char *f
return true;
}
-static void
+static inline void
finalize_ouput(bat *res, BAT *bn, str msg, bool nils, BUN q)
{
if (bn && !msg) {
diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -941,7 +941,6 @@ SQLworker_column(READERtask *task, int c
}
}
BATsetcount(fmt[col].c, BATcount(fmt[col].c));
- fmt[col].c->theap->dirty |= BATcount(fmt[col].c) > 0;
return 0;
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]