Changeset: 012e33d3bca1 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=012e33d3bca1
Modified Files:
gdk/gdk.h
gdk/gdk_align.c
gdk/gdk_bat.c
gdk/gdk_bbp.c
gdk/gdk_logger.c
gdk/gdk_private.h
gdk/gdk_storage.c
monetdb5/extras/pyapi/connection.c
monetdb5/extras/pyapi/pyapi.c
monetdb5/modules/kernel/algebra.c
monetdb5/modules/kernel/status.c
Branch: default
Log Message:
Removed BATstore structure. We now just have the BAT which contains everything.
diffs (truncated from 1193 to 300 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -886,9 +886,9 @@ typedef struct BAT {
oid hseqbase; /* head seq base */
/* dynamic column properties */
- COLrec *T; /* column info */
+ COLrec T; /* column info */
- BATrec *S; /* the BAT properties */
+ BATrec S; /* the BAT properties */
} BAT;
typedef struct BATiter {
@@ -896,51 +896,48 @@ typedef struct BATiter {
oid tvid;
} BATiter;
-typedef struct BATstore BATstore;
-#define BATSTORESIZE (sizeof(BAT) + sizeof(COLrec) + sizeof(BATrec))
-
typedef int (*GDKfcn) ();
/* macros's to hide complexity of BAT structure */
-#define batPersistence S->persistence
-#define batCopiedtodisk S->copiedtodisk
-#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 batRole S->role
-#define creator_tid S->tid
-#define ttype T->type
-#define tkey T->key
-#define tvarsized T->varsized
-#define tseqbase T->seq
-#define tsorted T->sorted
-#define trevsorted T->revsorted
-#define tdense T->dense
-#define tident T->id
-#define talign T->align
-#define torderidx T->orderidx
-#define twidth T->width
-#define tshift T->shift
-#define tnonil T->nonil
-#define tnil T->nil
-#define tnokey T->nokey
-#define tnosorted T->nosorted
-#define tnorevsorted T->norevsorted
-#define tnodense T->nodense
-#define theap T->heap
-#define tvheap T->vheap
-#define thash T->hash
-#define timprints T->imprints
-#define tprops T->props
+#define batPersistence S.persistence
+#define batCopiedtodisk S.copiedtodisk
+#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 batRole S.role
+#define creator_tid S.tid
+#define ttype T.type
+#define tkey T.key
+#define tvarsized T.varsized
+#define tseqbase T.seq
+#define tsorted T.sorted
+#define trevsorted T.revsorted
+#define tdense T.dense
+#define tident T.id
+#define talign T.align
+#define torderidx T.orderidx
+#define twidth T.width
+#define tshift T.shift
+#define tnonil T.nonil
+#define tnil T.nil
+#define tnokey T.nokey
+#define tnosorted T.nosorted
+#define tnorevsorted T.norevsorted
+#define tnodense T.nodense
+#define theap T.heap
+#define tvheap T.vheap
+#define thash T.hash
+#define timprints T.imprints
+#define tprops T.props
@@ -1703,7 +1700,7 @@ typedef struct {
str logical; /* logical name */
str bak; /* logical name backup */
bat next; /* next BBP slot in linked list */
- BATstore *desc; /* the BAT descriptor */
+ BAT *desc; /* the BAT descriptor */
str physical; /* dir + basename for storage */
str options; /* A string list of options */
int refs; /* in-memory references on which the loaded
status of a BAT relies */
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -170,16 +170,14 @@ ALIGNsynced(BAT *b1, BAT *b2)
BAT *
VIEWcreate_(oid seq, BAT *b, int slice_view)
{
- BATstore *bs;
BAT *bn;
bat tp = 0;
BATcheck(b, "VIEWcreate_", NULL);
- bs = BATcreatedesc(seq, b->ttype, FALSE, TRANSIENT);
- if (bs == NULL)
+ bn = BATcreatedesc(seq, b->ttype, FALSE, TRANSIENT);
+ if (bn == NULL)
return NULL;
- bn = &bs->B;
tp = -VIEWtparent(b);
if ((tp == 0 && b->ttype != TYPE_void) || b->theap.copied)
@@ -194,7 +192,7 @@ VIEWcreate_(oid seq, BAT *b, int slice_v
bn->batInserted = b->batInserted;
bn->batCount = b->batCount;
bn->batCapacity = b->batCapacity;
- *bn->T = *b->T;
+ bn->T = b->T;
if (bn->batFirst > 0) {
bn->theap.base += b->batFirst * b->twidth;
bn->batFirst = 0;
@@ -208,7 +206,7 @@ VIEWcreate_(oid seq, BAT *b, int slice_v
BBPshare(bn->tvheap->parentid);
}
- /* note: theap points into bs which was just overwritten
+ /* note: theap points into bn which was just overwritten
* with a copy from the parent. Clear the copied flag since
* our heap was not copied from our parent(s) even if our
* parent's heap was copied from its parent. */
@@ -231,7 +229,7 @@ VIEWcreate_(oid seq, BAT *b, int slice_v
bn->timprints = NULL;
/* Order OID index */
bn->torderidx = NULL;
- BBPcacheit(bs, 1); /* enter in BBP */
+ BBPcacheit(bn, 1); /* enter in BBP */
return bn;
}
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -65,11 +65,10 @@ BATinit_idents(BAT *bn)
bn->tident = BATstring_t;
}
-BATstore *
+BAT *
BATcreatedesc(oid hseq, int tt, int heapnames, int role)
{
BAT *bn;
- BATstore *bs;
/*
* Alloc space for the BAT and its dependent records.
@@ -77,21 +76,12 @@ BATcreatedesc(oid hseq, int tt, int heap
assert(tt >= 0);
assert(role >= 0 && role < 32);
- bs = (BATstore *) GDKzalloc(sizeof(BATstore));
+ bn = GDKzalloc(sizeof(BAT));
- if (bs == NULL)
+ if (bn == NULL)
return NULL;
/*
- * assert needed in the kernel to get symbol eprintf resolved.
- * Else modules using assert fail to load.
- */
- bs->B.T = &bs->T;
- bs->B.S = &bs->S;
-
- bn = &bs->B;
-
- /*
* Fill in basic column info
*/
bn->hseqbase = hseq;
@@ -111,7 +101,7 @@ BATcreatedesc(oid hseq, int tt, int heap
/*
* add to BBP
*/
- BBPinsert(bs);
+ BBPinsert(bn);
/*
* Default zero for order oid index
*/
@@ -141,7 +131,7 @@ BATcreatedesc(oid hseq, int tt, int heap
}
}
bn->batDirty = TRUE;
- return bs;
+ return bn;
bailout:
if (tt)
HEAPfree(&bn->theap, 1);
@@ -149,7 +139,7 @@ BATcreatedesc(oid hseq, int tt, int heap
HEAPfree(bn->tvheap, 1);
GDKfree(bn->tvheap);
}
- GDKfree(bs);
+ GDKfree(bn);
return NULL;
}
@@ -186,10 +176,9 @@ BATsetdims(BAT *b)
* and memory map it. To make this possible, we must provide it with
* filenames.
*/
-static BATstore *
+static BAT *
BATnewstorage(oid hseq, int tt, BUN cap, int role)
{
- BATstore *bs;
BAT *bn;
/* and in case we don't have assertions enabled: limit the size */
@@ -198,10 +187,9 @@ BATnewstorage(oid hseq, int tt, BUN cap,
assert(0);
cap = BUN_MAX;
}
- bs = BATcreatedesc(hseq, tt, tt != TYPE_void, role);
- if (bs == NULL)
+ bn = BATcreatedesc(hseq, tt, tt != TYPE_void, role);
+ if (bn == NULL)
return NULL;
- bn = &bs->B;
BATsetdims(bn);
bn->batCapacity = cap;
@@ -218,15 +206,13 @@ BATnewstorage(oid hseq, int tt, BUN cap,
return NULL;
}
DELTAinit(bn);
- BBPcacheit(bs, 1);
- return bs;
+ BBPcacheit(bn, 1);
+ return bn;
}
BAT *
COLnew(oid hseq, int tt, BUN cap, int role)
{
- BATstore *bs;
-
assert(cap <= BUN_MAX);
assert(hseq <= oid_nil);
assert(tt != TYPE_bat);
@@ -241,10 +227,7 @@ COLnew(oid hseq, int tt, BUN cap, int ro
/* and in case we don't have assertions enabled: limit the size */
if (cap > BUN_MAX)
cap = BUN_MAX;
- bs = BATnewstorage(hseq, tt, cap, role);
- if (bs == NULL)
- return NULL;
- return &bs->B;
+ return BATnewstorage(hseq, tt, cap, role);
}
BAT *
@@ -263,7 +246,6 @@ BATdense(oid hseq, oid tseq, BUN cnt)
BAT *
BATattach(int tt, const char *heapfile, int role)
{
- BATstore *bs;
BAT *bn;
struct stat st;
int atomsize;
@@ -284,10 +266,9 @@ BATattach(int tt, const char *heapfile,
ERRORcheck(st.st_size % atomsize != 0, "BATattach: heapfile size not
integral number of atoms\n", NULL);
ERRORcheck((size_t) (st.st_size / atomsize) > (size_t) BUN_MAX,
"BATattach: heapfile too large\n", NULL);
cap = (BUN) (st.st_size / atomsize);
- bs = BATcreatedesc(0, tt, 1, role);
- if (bs == NULL)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list