Changeset: 85be973cf0a7 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=85be973cf0a7
Modified Files:
gdk/gdk.h
gdk/gdk_align.c
gdk/gdk_bat.c
gdk/gdk_bbp.c
gdk/gdk_storage.c
Branch: default
Log Message:
Small cleanup in BATstore: no separate U and P structures, but unified S.
This requires a COMPLETE recompilation.
diffs (truncated from 315 to 300 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -909,6 +909,7 @@ gdk_export int VALisnil(const ValRecord
*/
typedef struct {
+ /* dynamic bat properties */
MT_Id tid; /* which thread created it */
int stamp; /* BAT recent creation stamp */
unsigned int
@@ -925,16 +926,14 @@ typedef struct {
char map_tail; /* mmap mode for tail bun heap */
char map_hheap; /* mmap mode for head atom heap */
char map_theap; /* mmap mode for tail atom heap */
-} BATrec;
-typedef struct {
/* delta status administration */
BUN deleted; /* start of deleted elements */
BUN first; /* to store next deletion */
BUN inserted; /* start of inserted elements */
BUN count; /* tuple count */
BUN capacity; /* tuple capacity */
-} BUNrec;
+} BATrec;
typedef struct PROPrec {
int id;
@@ -989,9 +988,7 @@ typedef struct BAT {
COLrec *H; /* column info */
COLrec *T; /* column info */
- /* dynamic bat properties */
- BATrec *P; /* cache and sort info */
- BUNrec *U; /* cache and sort info */
+ BATrec *S; /* the BAT properties */
} BAT;
typedef struct BATiter {
@@ -1003,34 +1000,33 @@ typedef struct BATiter {
* The different parts of which a BAT consists are physically stored
* next to each other in the BATstore type.
*/
-typedef struct {
+typedef struct BATstore {
BAT B; /* storage for BAT descriptor */
BAT BM; /* mirror (reverse) BAT */
COLrec H; /* storage for head column */
COLrec T; /* storage for tail column */
- BATrec P; /* storage for BATrec */
- BUNrec U; /* storage for BUNrec */
+ BATrec S; /* the BAT properties */
} BATstore;
typedef int (*GDKfcn) ();
/* macros's to hide complexity of BAT structure */
-#define batPersistence P->persistence
-#define batCopiedtodisk P->copiedtodisk
-#define batSet P->set
-#define batDirty P->dirty
-#define batConvert P->convert
-#define batDirtyflushed P->dirtyflushed
-#define batDirtydesc P->descdirty
-#define batFirst U->first
-#define batInserted U->inserted
-#define batDeleted U->deleted
-#define batCount U->count
-#define batCapacity U->capacity
-#define batStamp P->stamp
-#define batSharecnt P->sharecnt
-#define batRestricted P->restricted
-#define creator_tid P->tid
+#define batPersistence S->persistence
+#define batCopiedtodisk S->copiedtodisk
+#define batSet S->set
+#define batDirty S->dirty
+#define batConvert S->convert
+#define batDirtyflushed S->dirtyflushed
+#define batDirtydesc S->descdirty
+#define batFirst S->first
+#define batInserted S->inserted
+#define batDeleted S->deleted
+#define batCount S->count
+#define batCapacity S->capacity
+#define batStamp S->stamp
+#define batSharecnt S->sharecnt
+#define batRestricted S->restricted
+#define creator_tid S->tid
#define htype H->type
#define ttype T->type
#define hkey H->key
@@ -1050,10 +1046,10 @@ typedef int (*GDKfcn) ();
#define halign H->align
#define talign T->align
-#define batMaphead P->map_head
-#define batMaptail P->map_tail
-#define batMaphheap P->map_hheap
-#define batMaptheap P->map_theap
+#define batMaphead S->map_head
+#define batMaptail S->map_tail
+#define batMaphheap S->map_hheap
+#define batMaptheap S->map_theap
/*
* @- Heap Management
* Heaps are the low-level entities of mass storage in
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -223,7 +223,11 @@ VIEWhcreate(BAT *h)
if (hp)
BBPshare(hp);
*bn->H = *h->H;
- *bn->U = *h->U;
+ bn->batDeleted = h->batDeleted;
+ bn->batFirst = h->batFirst;
+ bn->batInserted = h->batInserted;
+ bn->batCount = h->batCount;
+ bn->batCapacity = h->batCapacity;
if (bn->H->vheap) {
assert(bn->H->vheap->parentid != 0);
BBPshare(bn->H->vheap->parentid);
@@ -237,8 +241,7 @@ VIEWhcreate(BAT *h)
if (hp && isVIEW(h))
bn->H->hash = NULL;
BATinit_idents(bn);
- /* The b->P structure cannot be shared and must be copied
- * individually. */
+ /* some bits must be copied individually. */
bn->batSet = h->batSet;
bn->batDirty = BATdirty(h);
bn->batRestricted = BAT_READ;
@@ -277,8 +280,12 @@ VIEWcreate_(BAT *h, BAT *t, int slice_vi
* copies because in case of a mark, we are going to override
* a column with a void. Take care to zero the accelerator
* data, though. */
- *bn->U = *h->U;
*bn->H = *h->H;
+ bn->batDeleted = h->batDeleted;
+ bn->batFirst = h->batFirst;
+ bn->batInserted = h->batInserted;
+ bn->batCount = h->batCount;
+ bn->batCapacity = h->batCapacity;
if (bn->batFirst > 0) {
bn->H->heap.base += h->batFirst * h->H->width;
bn->batFirst = 0;
@@ -325,16 +332,10 @@ VIEWcreate_(BAT *h, BAT *t, int slice_vi
if (tp)
bn->T->heap.parentid = tp;
BATinit_idents(bn);
- /* The b->P structure cannot be shared and must be copied
- * individually. */
+ /* Some bits must be copied individually. */
bn->batSet = h->batSet;
bn->batDirty = BATdirty(h);
bn->batRestricted = BAT_READ;
- /* The U record may be shared with the parent; in that case,
- * the search accelerators of the parent can be used. If,
- * however, we want to take a horizontal fragment
- * (stable=false), this cannot be done, and we need to put
- * different information in U (so we can't use a copy. */
if (slice_view || !hp || isVIEW(h))
/* slices are unequal to their parents; cannot use accs */
bn->H->hash = NULL;
@@ -668,8 +669,7 @@ VIEWreset(BAT *b)
}
/* make sure everything points there */
- m->U = n->U = &bs->U;
- m->P = n->P = &bs->P;
+ m->S = n->S = &bs->S;
m->T = n->H = &bs->H;
m->H = n->T = &bs->T;
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -101,12 +101,10 @@ BATcreatedesc(int ht, int tt, int heapna
assert(ht >= 0 && tt >= 0);
bs->BM.H = &bs->T;
bs->BM.T = &bs->H;
- bs->BM.P = &bs->P;
- bs->BM.U = &bs->U;
+ bs->BM.S = &bs->S;
bs->B.H = &bs->H;
bs->B.T = &bs->T;
- bs->B.P = &bs->P;
- bs->B.U = &bs->U;
+ bs->B.S = &bs->S;
bn = &bs->B;
@@ -2988,8 +2986,7 @@ BATassertProps(BAT *b)
assert(bm != NULL);
assert(b->H == bm->T);
assert(b->T == bm->H);
- assert(b->U == bm->U);
- assert(b->P == bm->P);
+ assert(b->S == bm->S);
assert(b->batDeleted < BUN_MAX);
assert(b->batFirst >= b->batDeleted);
assert(b->batInserted >= b->batFirst);
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -846,28 +846,26 @@ BBPreadEntries(FILE *fp, int *min_stamp,
GDKfatal("BBPinit: cannot allocate memory for
BATstore.");
bs->B.H = &bs->H;
bs->B.T = &bs->T;
- bs->B.P = &bs->P;
- bs->B.U = &bs->U;
+ bs->B.S = &bs->S;
bs->B.batCacheid = bid;
bs->BM.H = &bs->T;
bs->BM.T = &bs->H;
- bs->BM.P = &bs->P;
- bs->BM.U = &bs->U;
+ bs->BM.S = &bs->S;
bs->BM.batCacheid = -bid;
BATroles(&bs->B, NULL, NULL);
- bs->P.persistence = PERSISTENT;
- bs->P.copiedtodisk = 1;
- bs->P.set = properties & 0x01;
- bs->P.restricted = (properties & 0x06) >> 1;
- bs->U.inserted = (BUN) inserted;
- bs->U.deleted = (BUN) deleted;
- bs->U.first = (BUN) first;
- bs->U.count = (BUN) count;
- bs->U.capacity = (BUN) capacity;
- bs->P.map_head = (char) map_head;
- bs->P.map_tail = (char) map_tail;
- bs->P.map_hheap = (char) map_hheap;
- bs->P.map_theap = (char) map_theap;
+ bs->S.persistence = PERSISTENT;
+ bs->S.copiedtodisk = 1;
+ bs->S.set = properties & 0x01;
+ bs->S.restricted = (properties & 0x06) >> 1;
+ bs->S.inserted = (BUN) inserted;
+ bs->S.deleted = (BUN) deleted;
+ bs->S.first = (BUN) first;
+ bs->S.count = (BUN) count;
+ bs->S.capacity = (BUN) capacity;
+ bs->S.map_head = (char) map_head;
+ bs->S.map_tail = (char) map_tail;
+ bs->S.map_hheap = (char) map_hheap;
+ bs->S.map_theap = (char) map_theap;
nread += heapinit(&bs->H, buf + nread, &Hhashash, "H", oidsize,
bbpversion, batid);
nread += heapinit(&bs->T, buf + nread, &Thashash, "T", oidsize,
bbpversion, batid);
@@ -1156,16 +1154,16 @@ new_bbpentry(stream *s, bat i)
BBP_logical(-i) ? BBP_logical(-i) : BBPNONAME,
BBP_physical(i),
BBP_lastused(i),
- (BBP_desc(i)->P.restricted << 1) | BBP_desc(i)->P.set,
- BBP_desc(i)->U.inserted,
- BBP_desc(i)->U.deleted,
- BBP_desc(i)->U.first,
- BBP_desc(i)->U.count,
- BBP_desc(i)->U.capacity,
- (unsigned char) BBP_desc(i)->P.map_head,
- (unsigned char) BBP_desc(i)->P.map_tail,
- (unsigned char) BBP_desc(i)->P.map_hheap,
- (unsigned char) BBP_desc(i)->P.map_theap) < 0)
+ (BBP_desc(i)->S.restricted << 1) | BBP_desc(i)->S.set,
+ BBP_desc(i)->S.inserted,
+ BBP_desc(i)->S.deleted,
+ BBP_desc(i)->S.first,
+ BBP_desc(i)->S.count,
+ BBP_desc(i)->S.capacity,
+ (unsigned char) BBP_desc(i)->S.map_head,
+ (unsigned char) BBP_desc(i)->S.map_tail,
+ (unsigned char) BBP_desc(i)->S.map_hheap,
+ (unsigned char) BBP_desc(i)->S.map_theap) < 0)
return -1;
t = BBP_desc(i)->H.type;
if (mnstr_printf(s, " %s %u %u %u " BUNFMT " " BUNFMT " " BUNFMT " "
@@ -1680,8 +1678,8 @@ BBPinsert(BATstore *bs)
BBP_curstamp = 0;
bs->B.batCacheid = i;
bs->BM.batCacheid = -i;
- bs->P.stamp = BBP_curstamp;
- bs->P.tid = MT_getpid();
+ bs->S.stamp = BBP_curstamp;
+ bs->S.tid = MT_getpid();
BBP_status_set(i, BBPDELETING, "BBPentry");
BBP_cache(i) = NULL;
@@ -2088,7 +2086,7 @@ decref(bat i, int logical, int releaseSh
MT_lock_set(&GDKswapLock(i), "BBPdecref");
assert(!BBP_cache(i) || BBP_cache(i)->batSharecnt >= releaseShare);
if (releaseShare) {
- --BBP_desc(i)->P.sharecnt;
+ --BBP_desc(i)->S.sharecnt;
if (lock)
MT_lock_unset(&GDKswapLock(i), "BBPdecref");
return refs;
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list