Changeset: 75da27800e54 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=75da27800e54 Modified Files: clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_bbp.c gdk/gdk_private.h monetdb5/modules/kernel/bat5.c monetdb5/modules/kernel/status.c monetdb5/modules/mal/bbp.c monetdb5/modules/mal/urlbox.c Branch: default Log Message:
Hide implementation details. diffs (221 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -223,7 +223,6 @@ void BBPcold(bat b); int BBPdecref(bat b, int logical); BAT *BBPdescriptor(bat b); int BBPdir(int cnt, bat *subcommit); -BATstore *BBPgetdesc(bat i); void BBPhot(bat b); int BBPin; int BBPincref(bat b, int logical); diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -740,14 +740,7 @@ typedef struct { Heap *heap; /* heap where the hash is stored */ } Hash; -typedef struct { - bte bits; /* how many bits in imprints */ - Heap *bins; /* ranges of bins */ - Heap *imps; /* heap of imprints */ - BUN impcnt; /* counter for imprints*/ - Heap *dict; /* cache dictionary for compressing imprints */ - BUN dictcnt; /* counter for cache dictionary */ -} Imprints; +typedef struct Imprints Imprints; /* @@ -935,11 +928,7 @@ typedef struct { BUN capacity; /* tuple capacity */ } BATrec; -typedef struct PROPrec { - int id; - ValRecord v; - struct PROPrec *next; /* simple chain of properties */ -} PROPrec; +typedef struct PROPrec PROPrec; /* see also comment near BATassertProps() for more information about * the properties */ @@ -996,17 +985,8 @@ typedef struct BATiter { oid hvid, tvid; } BATiter; -/* - * The different parts of which a BAT consists are physically stored - * next to each other in the BATstore type. - */ -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 S; /* the BAT properties */ -} BATstore; +typedef struct BATstore BATstore; +#define BATSTORESIZE (2 * (sizeof(BAT) + sizeof(COLrec)) + sizeof(BATrec)) typedef int (*GDKfcn) (); @@ -1957,7 +1937,6 @@ gdk_export void BBPunlock(const char *s) gdk_export str BBPlogical(bat b, str buf); gdk_export str BBPphysical(bat b, str buf); gdk_export int BBP_curstamp; -gdk_export BATstore *BBPgetdesc(bat i); gdk_export BAT *BBPquickdesc(bat b, int delaccess); /* @@ -3221,7 +3200,7 @@ gdk_export int ALIGNsetH(BAT *b1, BAT *b #define GDK_MAX_VALUE 4 gdk_export void PROPdestroy(PROPrec *p); -gdk_export PROPrec * BATgetprop(BAT *b, int idx); +gdk_export PROPrec *BATgetprop(BAT *b, int idx); gdk_export void BATsetprop(BAT *b, int idx, int type, void *v); gdk_export BAT *BAThistogram(BAT *b); gdk_export int BATtopN(BAT *b, BUN topN); /* used in monet5/src/modules/kernel/algebra.mx */ diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -2961,7 +2961,7 @@ complexatom(int t, int delaccess) BAT * BBPquickdesc(bat bid, int delaccess) { - BAT *b = BBP_cache(bid); + BAT *b; if ( bid == 0) return NULL; @@ -2970,9 +2970,8 @@ BBPquickdesc(bat bid, int delaccess) assert(0); return NULL; } - if (b) { + if ((b = BBP_cache(bid)) != NULL) return b; /* already cached */ - } b = (BAT *) BBPgetdesc(bid); if (b == NULL || complexatom(b->htype, delaccess) || diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -19,6 +19,18 @@ /* This file should not be included in any file outside of this directory */ +/* + * The different parts of which a BAT consists are physically stored + * next to each other in the BATstore type. + */ +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 S; /* the BAT properties */ +} BATstore; + int ALIGNcommit(BAT *b); int ALIGNundo(BAT *b); int ATOMheap(int id, Heap *hp, size_t cap); @@ -44,6 +56,7 @@ size_t BATvmsize(BAT *b, int dirty); void BBPcacheit(BATstore *bs, int lock); void BBPdump(void); /* never called: for debugging only */ void BBPexit(void); +BATstore *BBPgetdesc(bat i); void BBPinit(void); bat BBPinsert(BATstore *bs); void BBPtrim(size_t delta); @@ -100,6 +113,21 @@ void IMPSprint(BAT *b); #define BBP_BATMASK 511 #define BBP_THREADMASK 63 +typedef struct PROPrec { + int id; + ValRecord v; + struct PROPrec *next; /* simple chain of properties */ +} PROPrec; + +typedef struct Imprints { + bte bits; /* how many bits in imprints */ + Heap *bins; /* ranges of bins */ + Heap *imps; /* heap of imprints */ + BUN impcnt; /* counter for imprints*/ + Heap *dict; /* cache dictionary for compressing imprints */ + BUN dictcnt; /* counter for cache dictionary */ +} Imprints; + typedef struct { MT_Lock swap; MT_Lock hash; diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c --- a/monetdb5/modules/kernel/bat5.c +++ b/monetdb5/modules/kernel/bat5.c @@ -51,7 +51,7 @@ static BAT * lock_desc(bat bid) { BBPfix(bid); - return &BBPgetdesc(bid)->B; + return BBPquickdesc(bid, 0); } static void @@ -979,7 +979,7 @@ CMDdestroy(bit *res, const char *input) if (bid) { BBPfix(bid); if (BBPindex(input) == bid) { - BAT *b = &BBPgetdesc(ABS(bid))->B; + BAT *b = BBPquickdesc(ABS(bid), 0); BATmode(b, TRANSIENT); *res = TRUE; @@ -1668,7 +1668,7 @@ str BKCgetSpaceUsed(lng *tot, int *bid) { BAT *b; - size_t size = sizeof(BATstore); + size_t size = BATSTORESIZE; if ((b = BATdescriptor(*bid)) == NULL) throw(MAL, "bat.getSpaceUsed", RUNTIME_OBJECT_MISSING); diff --git a/monetdb5/modules/kernel/status.c b/monetdb5/modules/kernel/status.c --- a/monetdb5/modules/kernel/status.c +++ b/monetdb5/modules/kernel/status.c @@ -309,7 +309,7 @@ SYSmem_usage(int *ret, int *ret2, lng *m s = BBPname(i); sz = 0; if (BBP_desc(i)) - sz += sizeof(BATstore); + sz += BATSTORESIZE; if (BBP_logical(i)) n += strLen(BBP_logical(i)); if (BBP_logical(-i)) diff --git a/monetdb5/modules/mal/bbp.c b/monetdb5/modules/mal/bbp.c --- a/monetdb5/modules/mal/bbp.c +++ b/monetdb5/modules/mal/bbp.c @@ -195,7 +195,7 @@ CMDbbpbind(Client cntxt, MalBlkPtr mb, M if (lhs->vtype == TYPE_bat) { BAT *b; - b = (BAT *) BBPgetdesc(lhs->val.bval); + b = BBPquickdesc(lhs->val.bval, 0); if (b == NULL) throw(MAL, "bbp.bind", INTERNAL_BAT_ACCESS); BBPincref(b->batCacheid, TRUE); diff --git a/monetdb5/modules/mal/urlbox.c b/monetdb5/modules/mal/urlbox.c --- a/monetdb5/modules/mal/urlbox.c +++ b/monetdb5/modules/mal/urlbox.c @@ -505,7 +505,7 @@ URLBOXgetSize(int *r){ BATseqbase(b,0); for(i=0; i<urlDepth; i++){ bn= urlBAT[i]; - size = ROUND_UP(sizeof(BATstore), blksize); + size = ROUND_UP(BATSTORESIZE, blksize); if (!isVIEW(bn)) { BUN cnt = BATcapacity(bn); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list