Changeset: 733dd3266674 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=733dd3266674
Modified Files:
gdk/gdk.h
gdk/gdk_align.c
gdk/gdk_bat.c
gdk/gdk_batop.c
gdk/gdk_bbp.c
gdk/gdk_delta.c
gdk/gdk_delta.h
gdk/gdk_group.c
gdk/gdk_imprints.c
gdk/gdk_logger.c
gdk/gdk_orderidx.c
gdk/gdk_private.h
gdk/gdk_storage.c
gdk/gdk_unique.c
monetdb5/modules/kernel/bat5.c
monetdb5/modules/kernel/status.c
sql/backends/monet5/sql.c
Branch: default
Log Message:
Cleanup: remove some macros, remove code for non-existing head structures.
All stuff that's not needed anymore since head columns are always VOID.
diffs (truncated from 826 to 300 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1337,14 +1337,10 @@ gdk_export BUN BUNfnd(BAT *b, const void
TYPE_oid : (b)->htype)
#define BATttype(b) ((b)->ttype == TYPE_void && (b)->tseqbase != oid_nil ? \
TYPE_oid : (b)->ttype)
-#define Hbase(b) ((b)->H->vheap->base)
#define Tbase(b) ((b)->T->vheap->base)
-#define Hsize(b) ((b)->H->width)
#define Tsize(b) ((b)->T->width)
-/* new semantics ! */
-#define headsize(b,p) ((b)->H->type?((size_t)(p))<<(b)->H->shift:0)
#define tailsize(b,p) ((b)->T->type?((size_t)(p))<<(b)->T->shift:0)
#define Tloc(b,p) ((b)->T->heap.base+((p)<<(b)->T->shift))
@@ -1486,7 +1482,6 @@ gdk_export int BATgetaccess(BAT *b);
#define BATdirty(b) ((b)->batCopiedtodisk == 0 || (b)->batDirty || \
(b)->batDirtydesc || \
(b)->H->heap.dirty || (b)->T->heap.dirty || \
- ((b)->H->vheap?(b)->H->vheap->dirty:0) || \
((b)->T->vheap?(b)->T->vheap->dirty:0))
#define PERSISTENT 0
@@ -1668,8 +1663,11 @@ gdk_export void GDKqsort_rev(void *h, vo
} while (0)
#define BATsettrivprop(b) \
do { \
+ assert((b)->htype == TYPE_void); \
+ assert((b)->hseqbase != oid_nil); \
(b)->batDirtydesc = 1; /* likely already set */ \
- COLsettrivprop((b), (b)->H); \
+ (b)->hrevsorted = (b)->batCount <= 1; \
+ /* the other head properties should already be correct */ \
COLsettrivprop((b), (b)->T); \
} while (0)
@@ -2783,7 +2781,6 @@ gdk_export void ALIGNsetT(BAT *b1, BAT *
((x)->T->heap.parentid || \
((x)->T->vheap && (x)->T->vheap->parentid != (x)->batCacheid)))
-#define isVIEWCOMBINE(x) ((x)->H == (x)->T)
#define VIEWtparent(x) ((x)->T->heap.parentid)
#define VIEWvtparent(x) ((x)->T->vheap == NULL ||
(x)->T->vheap->parentid == (x)->batCacheid ? 0 : (x)->T->vheap->parentid)
@@ -2856,7 +2853,7 @@ gdk_export void ALIGNsetT(BAT *b1, BAT *
/*
* @- hash-table supported loop over BUNs
* The first parameter `b' is a BAT, the second (`h') should point to
- * `b->H->hash', and `v' a pointer to an atomic value (corresponding
+ * `b->T->hash', and `v' a pointer to an atomic value (corresponding
* to the head column of `b'). The 'hb' is an integer index, pointing
* out the `hb'-th BUN.
*/
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -204,9 +204,9 @@ VIEWcreate_(oid seq, BAT *b, int slice_v
return NULL;
bn = &bs->B;
- tp = VIEWtparent(b);
+ tp = -VIEWtparent(b);
if ((tp == 0 && b->ttype != TYPE_void) || b->T->heap.copied)
- tp = -b->batCacheid;
+ tp = b->batCacheid;
assert(b->ttype != TYPE_void || !tp);
/* the H and T column descriptors are fully copied. We need
* copies because in case of a mark, we are going to override
@@ -224,7 +224,7 @@ VIEWcreate_(oid seq, BAT *b, int slice_v
}
if (tp)
- BBPshare(-tp);
+ BBPshare(tp);
if (bn->T->vheap) {
assert(b->T->vheap);
assert(bn->T->vheap->parentid > 0);
@@ -240,7 +240,7 @@ VIEWcreate_(oid seq, BAT *b, int slice_v
/* correct values after copy of head and tail info */
if (tp)
- bn->T->heap.parentid = tp;
+ bn->T->heap.parentid = -tp;
BATinit_idents(bn);
/* Some bits must be copied individually. */
bn->batDirty = BATdirty(b);
@@ -339,7 +339,7 @@ static void
VIEWunlink(BAT *b)
{
if (b) {
- bat tp = VIEWtparent(b);
+ bat tp = -VIEWtparent(b);
bat vtp = VIEWvtparent(b);
BAT *tpb = NULL;
BAT *vtpb = NULL;
@@ -347,9 +347,9 @@ VIEWunlink(BAT *b)
assert(b->batCacheid > 0);
assert(b->htype == TYPE_void);
if (tp)
- tpb = BBP_cache(-tp);
+ tpb = BBP_cache(tp);
if (tp && !vtp)
- vtp = -tp;
+ vtp = tp;
if (vtp)
vtpb = BBP_cache(vtp);
@@ -455,6 +455,7 @@ VIEWreset(BAT *b)
b->H->shift = 0;
b->H->width = 0;
b->H->seq = v->H->seq;
+ b->H->key = BOUND2BTRUE | 1;
b->T->type = v->T->type;
b->T->varsized = v->T->varsized;
@@ -465,8 +466,7 @@ VIEWreset(BAT *b)
b->T->heap.parentid = 0;
b->batRestricted = BAT_WRITE;
- /* reset BOUND2KEY */
- b->H->key = BAThkey(v);
+ /* reset BOUND2BTRUE */
b->T->key = BATtkey(v);
/* copy the heaps */
@@ -481,7 +481,7 @@ VIEWreset(BAT *b)
b->T->vheap->parentid = b->batCacheid;
}
- if (v->T->heap.parentid == -b->batCacheid) {
+ if (-v->T->heap.parentid == b->batCacheid) {
assert(tp == 0);
assert(b->batSharecnt > 0);
BBPunshare(b->batCacheid);
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -540,12 +540,10 @@ BATdestroy( BATstore *bs )
if (bs->T.id && !default_ident(bs->T.id))
GDKfree(bs->T.id);
bs->T.id = BATstring_t;
- if (bs->H.vheap)
- GDKfree(bs->H.vheap);
+ assert(bs->H.vheap == NULL);
+ assert(bs->H.props == NULL);
if (bs->T.vheap)
GDKfree(bs->T.vheap);
- if (bs->H.props)
- PROPdestroy(bs->H.props);
if (bs->T.props)
PROPdestroy(bs->T.props);
GDKfree(bs);
@@ -685,12 +683,11 @@ COLcopy(BAT *b, int tt, int writable, in
bunstocopy = cnt;
} else if (isVIEW(b)) {
/* extra checks needed for views */
- bat tp = VIEWtparent(b);
+ bat tp = -VIEWtparent(b);
- if (isVIEWCOMBINE(b) || /* oops, mirror view! */
- /* reduced slice view: do not copy too
- * much garbage */
- (tp != 0 && BATcapacity(BBP_cache(-tp)) > cnt +
cnt))
+ if (tp != 0 && BATcapacity(BBP_cache(tp)) > cnt + cnt)
+ /* reduced slice view: do not copy too
+ * much garbage */
bunstocopy = cnt;
}
@@ -1397,11 +1394,8 @@ BATvmsize(BAT *b, int dirty)
BATcheck(b, "BATvmsize", 0);
if (b->batDirty || (b->batPersistence != TRANSIENT &&
!b->batCopiedtodisk))
dirty = 0;
- return (!dirty || b->H->heap.dirty ? HEAPvmsize(&b->H->heap) : 0) +
- (!dirty || b->T->heap.dirty ? HEAPvmsize(&b->T->heap) : 0) +
- ((!dirty || b->H->heap.dirty) && b->H->hash && b->H->hash !=
(Hash *) 1 ? HEAPvmsize(b->H->hash->heap) : 0) +
+ return (!dirty || b->T->heap.dirty ? HEAPvmsize(&b->T->heap) : 0) +
((!dirty || b->T->heap.dirty) && b->T->hash && b->T->hash !=
(Hash *) 1 ? HEAPvmsize(b->T->hash->heap) : 0) +
- (b->H->vheap && (!dirty || b->H->vheap->dirty) ?
HEAPvmsize(b->H->vheap) : 0) +
(b->T->vheap && (!dirty || b->T->vheap->dirty) ?
HEAPvmsize(b->T->vheap) : 0);
}
@@ -1413,11 +1407,8 @@ BATmemsize(BAT *b, int dirty)
(b->batPersistence != TRANSIENT && !b->batCopiedtodisk))
dirty = 0;
return (!dirty || b->batDirtydesc ? sizeof(BATstore) : 0) +
- (!dirty || b->H->heap.dirty ? HEAPmemsize(&b->H->heap) : 0) +
(!dirty || b->T->heap.dirty ? HEAPmemsize(&b->T->heap) : 0) +
- ((!dirty || b->H->heap.dirty) && b->H->hash && b->H->hash !=
(Hash *) 1 ? HEAPmemsize(b->H->hash->heap) : 0) +
((!dirty || b->T->heap.dirty) && b->T->hash && b->T->hash !=
(Hash *) 1 ? HEAPmemsize(b->T->hash->heap) : 0) +
- (b->H->vheap && (!dirty || b->H->vheap->dirty) ?
HEAPmemsize(b->H->vheap) : 0) +
(b->T->vheap && (!dirty || b->T->vheap->dirty) ?
HEAPmemsize(b->T->vheap) : 0);
}
@@ -1807,41 +1798,27 @@ gdk_return
BATcheckmodes(BAT *b, int existing)
{
int wr = (b->batRestricted == BAT_WRITE);
- storage_t m0 = STORE_MEM, m1 = STORE_MEM, m2 = STORE_MEM, m3 =
STORE_MEM;
+ storage_t m1 = STORE_MEM, m3 = STORE_MEM;
int dirty = 0;
BATcheck(b, "BATcheckmodes", GDK_FAIL);
- if (b->htype) {
- m0 = HEAPcommitpersistence(&b->H->heap, wr, existing);
- dirty |= (b->H->heap.newstorage != m0);
- }
-
if (b->ttype) {
m1 = HEAPcommitpersistence(&b->T->heap, wr, existing);
dirty |= (b->T->heap.newstorage != m1);
}
- if (b->H->vheap) {
- int ha = (b->batRestricted == BAT_APPEND) &&
ATOMappendpriv(b->htype, b->H->vheap);
- m2 = HEAPcommitpersistence(b->H->vheap, wr || ha, existing);
- dirty |= (b->H->vheap->newstorage != m2);
- }
if (b->T->vheap) {
int ta = (b->batRestricted == BAT_APPEND) &&
ATOMappendpriv(b->ttype, b->T->vheap);
m3 = HEAPcommitpersistence(b->T->vheap, wr || ta, existing);
dirty |= (b->T->vheap->newstorage != m3);
}
- if (m0 == STORE_INVALID || m1 == STORE_INVALID ||
- m2 == STORE_INVALID || m3 == STORE_INVALID)
+ if (m1 == STORE_INVALID || m3 == STORE_INVALID)
return GDK_FAIL;
if (dirty) {
b->batDirtydesc = 1;
- b->H->heap.newstorage = m0;
b->T->heap.newstorage = m1;
- if (b->H->vheap)
- b->H->vheap->newstorage = m2;
if (b->T->vheap)
b->T->vheap->newstorage = m3;
}
@@ -1863,8 +1840,8 @@ BATsetaccess(BAT *b, int newmode)
int existing = BBP_status(b->batCacheid) & BBPEXISTING;
int wr = (newmode == BAT_WRITE);
int rd = (bakmode == BAT_WRITE);
- storage_t m0, m1, m2 = STORE_MEM, m3 = STORE_MEM;
- storage_t b0, b1, b2 = STORE_MEM, b3 = STORE_MEM;
+ storage_t m1, m3 = STORE_MEM;
+ storage_t b1, b3 = STORE_MEM;
if (b->batSharecnt && newmode != BAT_READ) {
BATDEBUG THRprintf(GDKout, "#BATsetaccess: %s has %d
views; try creating a copy\n", BATgetId(b), b->batSharecnt);
@@ -1873,31 +1850,20 @@ BATsetaccess(BAT *b, int newmode)
return GDK_FAIL;
}
- b0 = b->H->heap.newstorage;
- m0 = HEAPchangeaccess(&b->H->heap, ACCESSMODE(wr, rd),
existing);
b1 = b->T->heap.newstorage;
m1 = HEAPchangeaccess(&b->T->heap, ACCESSMODE(wr, rd),
existing);
- if (b->H->vheap) {
- int ha = (newmode == BAT_APPEND &&
ATOMappendpriv(b->htype, b->H->vheap));
- b2 = b->H->vheap->newstorage;
- m2 = HEAPchangeaccess(b->H->vheap, ACCESSMODE(wr && ha,
rd && ha), existing);
- }
if (b->T->vheap) {
int ta = (newmode == BAT_APPEND &&
ATOMappendpriv(b->ttype, b->T->vheap));
b3 = b->T->vheap->newstorage;
m3 = HEAPchangeaccess(b->T->vheap, ACCESSMODE(wr && ta,
rd && ta), existing);
}
- if (m0 == STORE_INVALID || m1 == STORE_INVALID ||
- m2 == STORE_INVALID || m3 == STORE_INVALID)
+ if (m1 == STORE_INVALID || m3 == STORE_INVALID)
return GDK_FAIL;
/* set new access mode and mmap modes */
b->batRestricted = newmode;
b->batDirtydesc = TRUE;
- b->H->heap.newstorage = m0;
b->T->heap.newstorage = m1;
- if (b->H->vheap)
- b->H->vheap->newstorage = m2;
if (b->T->vheap)
b->T->vheap->newstorage = m3;
@@ -1905,10 +1871,7 @@ BATsetaccess(BAT *b, int newmode)
/* roll back all changes */
b->batRestricted = bakmode;
b->batDirtydesc = bakdirty;
- b->H->heap.newstorage = b0;
b->T->heap.newstorage = b1;
- if (b->H->vheap)
- b->H->vheap->newstorage = b2;
if (b->T->vheap)
b->T->vheap->newstorage = b3;
return GDK_FAIL;
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -412,9 +412,7 @@ BATappend(BAT *b, BAT *n, bit force)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list