Update of /cvsroot/monetdb/MonetDB/src/gdk
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv518/src/gdk
Modified Files:
Tag: GDK-2
gdk.mx gdk_align.mx gdk_bat.mx gdk_batop.mx gdk_bbp.mx
Log Message:
Got rid of macro batLview (just be explicit).
Split BATrestricted into BAThrestricted and BATtrestricted (since
columns can come from different parents).
parentid now always refers to the BAT whose head column the relevant
column is a view on. In other words, it can be negative which means
that the view is on the head of the reverse(), or the tail of the
original. In yet other words, the view is always based on the head of
BBP_cache(...->parentid).
Fixed various issues rising from these changes.
Typo: writeable -> writable.
Approved availability test.
Index: gdk_bbp.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk_bbp.mx,v
retrieving revision 1.201.2.6
retrieving revision 1.201.2.7
diff -u -d -r1.201.2.6 -r1.201.2.7
--- gdk_bbp.mx 15 Aug 2007 09:37:18 -0000 1.201.2.6
+++ gdk_bbp.mx 17 Aug 2007 08:49:58 -0000 1.201.2.7
@@ -2419,7 +2419,7 @@
b->batCopiedtodisk ||
(b->H->heap.storage & STORE_MMAP) ||
(b->T->heap.storage & STORE_MMAP) ||
- b->batLview ||
+ b->P->lview ||
BBPtmpcheck(s) == 0 ||
b->htype > TYPE_str ||
b->ttype > TYPE_str) {
@@ -2548,6 +2548,7 @@
b->H->heap.free = 0;
b->T->heap.free = 0;
b->batDirty = TRUE;
+ b->batStamp = 0;
BATsetcount(b, 0);
Index: gdk.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk.mx,v
retrieving revision 1.237.2.12
retrieving revision 1.237.2.13
diff -u -d -r1.237.2.12 -r1.237.2.13
--- gdk.mx 15 Aug 2007 22:19:10 -0000 1.237.2.12
+++ gdk.mx 17 Aug 2007 08:49:54 -0000 1.237.2.13
@@ -970,7 +970,6 @@
#define batDeleted U->deleted
#define batCount U->count
#define batCapacity U->capacity
-#define batLview P->lview
#define batStamp P->stamp
#define batSharecnt P->sharecnt
#define batRestricted P->restricted
@@ -2775,10 +2774,8 @@
#define ALIGNinp(x,y,f) {if (!(f))
VIEWchk(x,y,BAT_READ|BAT_APPEND);(x)->talign=0; }
#define ALIGNapp(x,y,f) {if (!(f)) VIEWchk(x,y,BAT_READ);(x)->talign=0; }
-#define BATrestricted(b) \
- (!isVIEW(b)?(b)->batRestricted: \
- (VIEWhparent(b)?BBP_cache(VIEWhparent(b))->batRestricted:\
- (VIEWtparent(b)?BBP_cache(VIEWtparent(b))->batRestricted:0)))
+#define BAThrestricted(b) (VIEWhparent(b) ?
BBP_cache(VIEWhparent(b))->batRestricted : (b)->batRestricted)
+#define BATtrestricted(b) (VIEWtparent(b) ?
BBP_cache(VIEWtparent(b))->batRestricted : (b)->batRestricted)
/* The batRestricted field indicates whether a BAT is readonly.
* we have modes: BAT_WRITE = all permitted
@@ -2798,8 +2795,8 @@
*/
#define isVIEW(x) (!(x)->P->lview && ((x)->H->parentid || (x)->T->parentid))
#define isVIEWCOMBINE(x) ((x)->H == (x)->T)
-#define VIEWhparent(x)
((x)->P->lview?0:((x)->batCacheid>0?(x)->H->parentid:-(x)->H->parentid))
-#define VIEWtparent(x)
((x)->P->lview?0:((x)->batCacheid>0?(x)->T->parentid:-(x)->T->parentid))
+#define VIEWhparent(x) ((x)->P->lview?0:(x)->H->parentid)
+#define VIEWtparent(x) ((x)->P->lview?0:(x)->T->parentid)
/* VIEWparentcol(b) tells whether the head column was inherited from the parent
* "as is". We must check whether the type was not overridden in the view.
Index: gdk_align.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk_align.mx,v
retrieving revision 1.83.4.10
retrieving revision 1.83.4.11
diff -u -d -r1.83.4.10 -r1.83.4.11
--- gdk_align.mx 15 Aug 2007 15:49:37 -0000 1.83.4.10
+++ gdk_align.mx 17 Aug 2007 08:49:56 -0000 1.83.4.11
@@ -262,7 +262,7 @@
if ((hp == 0 && h->htype != TYPE_void) || h->H->heap.copied)
hp = h->batCacheid;
if ((tp == 0 && t->ttype != TYPE_void) || t->T->heap.copied)
- tp = t->batCacheid;
+ tp = -t->batCacheid;
assert(h->htype != TYPE_void || !hp);
assert(t->ttype != TYPE_void || !tp);
@-
@@ -482,19 +482,19 @@
/* unlink heaps shared with parent */
if (hpb && b->H->vheap && b->H->vheap == hpb->H->vheap)
b->H->vheap = NULL;
- if (tpb && b->T->vheap && b->T->vheap == tpb->T->vheap)
+ if (tpb && b->T->vheap && b->T->vheap == tpb->H->vheap)
b->T->vheap = NULL;
/* unlink properties shared with parent */
if (hpb && b->H->props && b->H->props == hpb->H->props)
b->H->props = NULL;
- if (tpb && b->T->props && b->T->props == tpb->T->props)
+ if (tpb && b->T->props && b->T->props == tpb->H->props)
b->T->props = NULL;
/* unlink hash accelerators shared with parent */
if (hpb && b->H->hash && b->H->hash == hpb->H->hash)
b->H->hash = NULL;
- if (tpb && b->T->hash && b->T->hash == tpb->T->hash)
+ if (tpb && b->T->hash && b->T->hash == tpb->H->hash)
b->T->hash = NULL;
}
}
@@ -629,34 +629,41 @@
void
VIEWbounds(BAT *view, size_t l, size_t h)
{
- bat bid = VIEWhparent(view);
- BAT *b = BBP_cache(bid);
+ bat hp = VIEWhparent(view);
+ bat tp = VIEWtparent(view);
+ BAT *hb;
+ BAT *tb;
+ BAT *b;
- if (view == NULL || bid == 0) {
+ if (view == NULL || (hp == 0 && tp == 0)) {
GDKerror("VIEWbounds: bat required");
return;
}
+ hb = hp ? BBP_cache(hp) : NULL;
+ tb = tp ? BBP_cache(tp) : NULL;
+ b = hb ? hb : tb;
if (l < BUNfirst(b))
l = BUNfirst(b);
- view->H->heap.base = b->H->heap.base + headsize(b,l);
- view->T->heap.base = b->T->heap.base + tailsize(b,l);
view->batFirst = view->batDeleted = view->batInserted = 0;
- if (BUNlast(b) < h + 1)
+ if (h > BUNlast(b) - 1)
h = BUNlast(b) - 1;
- view->H->heap.maxsize = view->H->heap.size = view->H->heap.free =
headsize(b,h + 1);
- view->T->heap.maxsize = view->T->heap.size = view->T->heap.free =
tailsize(b,h + 1);
BATsetcount(view, h + 1 - l);
- view->hsorted = BAThordered(b);
- view->tsorted = BATtordered(b);
-
- BATkey(view, BAThkey(b));
- BATkey(BATmirror(view), BATtkey(b));
- if (BAThdense(b)) {
- BATseqbase(view, b->hseqbase + l);
+ if (hb) {
+ view->H->heap.base = hb->H->heap.base + headsize(hb,l);
+ view->H->heap.maxsize = view->H->heap.size = headsize(hb,h + 1);
+ view->hsorted = BAThordered(hb);
+ BATkey(view, BAThkey(hb));
+ if (BAThdense(hb))
+ BATseqbase(view, hb->hseqbase + l);
}
- if (BATtdense(b)) {
- BATseqbase(BATmirror(view), b->tseqbase + l);
+ if (tb) {
+ view->T->heap.base = tb->H->heap.base + headsize(tb,l);
+ view->T->heap.maxsize = view->T->heap.size = headsize(tb,h + 1);
+ view->tsorted = BAThordered(tb);
+ BATkey(BATmirror(view), BAThkey(tb));
+ if (BAThdense(tb))
+ BATseqbase(BATmirror(view), tb->hseqbase + l);
}
}
Index: gdk_batop.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk_batop.mx,v
retrieving revision 1.138.4.10
retrieving revision 1.138.4.11
diff -u -d -r1.138.4.10 -r1.138.4.11
--- gdk_batop.mx 15 Aug 2007 09:37:18 -0000 1.138.4.10
+++ gdk_batop.mx 17 Aug 2007 08:49:57 -0000 1.138.4.11
@@ -236,7 +236,6 @@
ssize_t sz = BATcount(n);
ssize_t needed = 0;
int fastpath = 1;
- int countonly = (b->htype == TYPE_void && b->ttype == TYPE_void);
if (b == NULL || n == NULL || sz == 0) {
return b;
@@ -247,7 +246,7 @@
b->batDirty = 1;
needed = sz - (BATcapacity(b) - BUNlast(b));
- if (!countonly && needed > 0) {
+ if (needed > 0) {
/* if needed exceeds a normal growth extend just with needed */
size_t ncap = BATcapacity(b) + needed;
size_t grows = BATgrows(b);
@@ -534,7 +533,7 @@
If the source BAT is readonly, then we can obtain a VIEW
that just reuses the memory of the source.
@c
- if (BATrestricted(b) == BAT_READ) {
+ if (BAThrestricted(b) == BAT_READ && BATtrestricted(b) == BAT_READ) {
int cnt = h-l;
bn = VIEWcreate_(b, b, TRUE);
bn->batFirst = bn->batDeleted = bn->batInserted = 0;
@@ -2040,7 +2039,7 @@
bn = VIEWhead(b);
if (bn) {
BATseqbase(BATmirror(bn), oid_base);
- if (BATrestricted(b) != BAT_READ) {
+ if (BAThrestricted(b) != BAT_READ) {
BAT *v = bn;
bn = BATcopy(v, v->htype, v->ttype, TRUE);
@@ -2322,7 +2321,7 @@
BATiter bi = bat_iterator(b);
BATcheck(b, "BATconst");
- if (BATrestricted(b) == BAT_READ && tailtype == TYPE_void) {
+ if (BAThrestricted(b) == BAT_READ && tailtype == TYPE_void) {
oid seqbase = (tailtype == TYPE_void) ? oid_nil : *(oid *) v;
bn = VIEWhead(b);
Index: gdk_bat.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk_bat.mx,v
retrieving revision 1.181.4.11
retrieving revision 1.181.4.12
diff -u -d -r1.181.4.11 -r1.181.4.12
--- gdk_bat.mx 15 Aug 2007 15:50:17 -0000 1.181.4.11
+++ gdk_bat.mx 17 Aug 2007 08:49:56 -0000 1.181.4.12
@@ -148,16 +148,16 @@
GDKfilepath(bn->T->heap.filename, NULL, nme, "tail");
if (ATOMneedheap(ht)) {
- bn->hheap = (Heap *) GDKzalloc(sizeof(Heap));
- bn->hheap->filename = (str) GDKmalloc(strlen(nme) + 12);
- GDKfilepath(bn->hheap->filename, NULL, nme, "hheap");
+ bn->H->vheap = (Heap *) GDKzalloc(sizeof(Heap));
+ bn->H->vheap->filename = (str) GDKmalloc(strlen(nme) +
12);
+ GDKfilepath(bn->H->vheap->filename, NULL, nme, "hheap");
bn->batMaphheap = STORE_UNSET;
}
if (ATOMneedheap(tt)) {
- bn->theap = (Heap *) GDKzalloc(sizeof(Heap));
- bn->theap->filename = (str) GDKmalloc(strlen(nme) + 12);
- GDKfilepath(bn->theap->filename, NULL, nme, "theap");
+ bn->T->vheap = (Heap *) GDKzalloc(sizeof(Heap));
+ bn->T->vheap->filename = (str) GDKmalloc(strlen(nme) +
12);
+ GDKfilepath(bn->T->vheap->filename, NULL, nme, "theap");
bn->batMaptheap = STORE_UNSET;
}
}
@@ -222,22 +222,22 @@
return NULL;
}
- if (ATOMheap(ht, bn->hheap, cap) < 0) {
+ if (ATOMheap(ht, bn->H->vheap, cap) < 0) {
if (ht) HEAPfree(&bn->H->heap);
if (tt) HEAPfree(&bn->T->heap);
- GDKfree(bn->hheap);
- if (bn->theap)
- GDKfree(bn->theap);
+ GDKfree(bn->H->vheap);
+ if (bn->T->vheap)
+ GDKfree(bn->T->vheap);
return NULL;
}
- if (ATOMheap(tt, bn->theap, cap) < 0) {
+ if (ATOMheap(tt, bn->T->vheap, cap) < 0) {
if (ht) HEAPfree(&bn->H->heap);
if (tt) HEAPfree(&bn->T->heap);
- if (bn->hheap) {
- HEAPfree(bn->hheap);
- GDKfree(bn->hheap);
+ if (bn->H->vheap) {
+ HEAPfree(bn->H->vheap);
+ GDKfree(bn->H->vheap);
}
- GDKfree(bn->theap);
+ GDKfree(bn->T->vheap);
return NULL;
}
DELTAinit(bn);
@@ -433,22 +433,22 @@
size_t cap = 0;
hh.filename = th.filename = NULL;
- if (b->hheap && b->hheap->free > 0) {
+ if (b->H->vheap && b->H->vheap->free > 0) {
if (ATOMheap(b->htype, &hh, cap) < 0)
return NULL;
}
- if (b->theap && b->theap->free > 0 && ATOMheap(b->ttype, &th,
cap) < 0) {
- if (b->hheap && b->hheap->free > 0)
+ if (b->T->vheap && b->T->vheap->free > 0 && ATOMheap(b->ttype,
&th, cap) < 0) {
+ if (b->H->vheap && b->H->vheap->free > 0)
HEAPfree(&hh);
return NULL;
}
- if (b->hheap && b->hheap->free > 0) {
- HEAPfree(b->hheap);
- *b->hheap = hh;
+ if (b->H->vheap && b->H->vheap->free > 0) {
+ HEAPfree(b->H->vheap);
+ *b->H->vheap = hh;
}
- if (b->theap && b->theap->free > 0) {
- HEAPfree(b->theap);
- *b->theap = th;
+ if (b->T->vheap && b->T->vheap->free > 0) {
+ HEAPfree(b->T->vheap);
+ *b->T->vheap = th;
}
} else {
/* do heap-delete of all inserted atoms */
@@ -460,9 +460,9 @@
for(p = b->batInserted, q = BUNlast(b); p < q; p++) {
if (hatmdel)
- (*hatmdel)(b->hheap, (var_t*)
BUNhloc(bi,p));
+ (*hatmdel)(b->H->vheap, (var_t*)
BUNhloc(bi,p));
if (tatmdel)
- (*tatmdel)(b->theap, (var_t*)
BUNtloc(bi,p));
+ (*tatmdel)(b->T->vheap, (var_t*)
BUNtloc(bi,p));
}
}
}
@@ -499,10 +499,10 @@
HEAPfree(&b->H->heap);
if (b->ttype)
HEAPfree(&b->T->heap);
- if (b->hheap)
- HEAPfree(b->hheap);
- if (b->theap)
- HEAPfree(b->theap);
+ if (b->H->vheap)
+ HEAPfree(b->H->vheap);
+ if (b->T->vheap)
+ HEAPfree(b->T->vheap);
b = BBP_cache(-b->batCacheid);
if (b) {
@@ -522,10 +522,10 @@
if (b->tident && !default_ident(b->tident))
GDKfree(b->tident);
b->tident = BATstring_t;
- if (b->hheap)
- GDKfree(b->hheap);
- if (b->theap)
- GDKfree(b->theap);
+ if (b->H->vheap)
+ GDKfree(b->H->vheap);
+ if (b->T->vheap)
+ GDKfree(b->T->vheap);
if (b->H->props)
PROPdestroy(b->H->props);
if (b->T->props)
@@ -549,17 +549,17 @@
@item access mode. If we want a read-only copy of a read-only BAT, a
VIEW may do (in this case, the user may be after just an independent BAT
-header and id). This is indicated by the parameter (writeable = FALSE).
+header and id). This is indicated by the parameter (writable = FALSE).
-In other cases, we really want an independent physical copy (writeable = TRUE).
+In other cases, we really want an independent physical copy (writable = TRUE).
Note that in the MIL interpreter (as opposed to the C/C++ GDK API), the result
of MIL-copy() will by default be BAT_READ, the default mode for all new BATs.
However, changing the mode to BAT_WRITE will be a zero-cost operation if the
-BAT was copied with (writeable = TRUE), such as done by MIL-copy().
+BAT was copied with (writable = TRUE), such as done by MIL-copy().
@end itemize
-In GDK, the result is a BAT that is BAT_WRITE iff (writeable == TRUE).
+In GDK, the result is a BAT that is BAT_WRITE iff (writable == TRUE).
-NEW: there is now a special parameter setting (writeable == 2), which does
create
+NEW: there is now a special parameter setting (writable == 2), which does
create
an independent BAT (not a view that shares the same heaps), however tries
to share VM heap resources using copy-on-write maps. Note that the result of
this is a read-only BAT (BAT_READ). The copy-on-write VM tricks can be used,
@@ -642,7 +642,7 @@
@c
/* TODO make it simpler, ie copy per column */
BAT *
-BATcopy(BAT *b, int ht, int tt, int writeable)
+BATcopy(BAT *b, int ht, int tt, int writable)
{
ssize_t bunstocopy = -1;
size_t cnt;
@@ -652,9 +652,9 @@
cnt = BATcount(b);
/* maybe a bit ugly to change the requested bat types?? */
- if (b->htype == TYPE_void && !writeable)
+ if (b->htype == TYPE_void && !writable)
ht = TYPE_void;
- if (b->ttype == TYPE_void && !writeable)
+ if (b->ttype == TYPE_void && !writable)
tt = TYPE_void;
if (ht != b->htype && wrongtype(ht, b->htype)) {
@@ -667,7 +667,7 @@
}
/* first try case (1); create a view, possibly with different
atom-types */
- if (BATrestricted(b) == BAT_READ && !writeable) {
+ if (BAThrestricted(b) == BAT_READ && BATtrestricted(b) == BAT_READ &&
!writable) {
bn = VIEWcreate(b, b);
if (bn == NULL)
return NULL;
@@ -693,17 +693,12 @@
} else if (isVIEW(b)) {
/* extra checks needed for views */
bat hp = VIEWhparent(b), tp = VIEWtparent(b);
- BAT *pb = NULL;
-
- if (pb)
- pb = BBP_cache(hp);
- if (tp)
- pb = BBP_cache(tp);
- if (b->H->heap.base == b->T->heap.base || /*
oops, mirror view! */
- (pb && BATcount(pb) > cnt + cnt)) { /* reduced
slice view: do not copy too much garbage */
+ if (isVIEWCOMBINE(b) || /* oops, mirror view! */
+ /* reduced slice view: do not copy too much garbage
*/
+ (hp != 0 && BATcount(BBP_cache(hp)) > cnt + cnt) ||
+ (tp != 0 && BATcount(BBP_cache(tp)) > cnt + cnt))
bunstocopy = cnt;
- }
}
bn = BATnew(ht, tt, MAX(1, bunstocopy));
@@ -716,19 +711,21 @@
bn->T->heap.free = 0;
} else if (bunstocopy < 0) {
/* case (3): just copy the heaps; if possible with
copy-on-write VM support */
- int remap = (writeable == 2) && (BATrestricted(b) !=
BAT_WRITE);
- int hremap = remap && (ATOMstorage(ht) == TYPE_str) &&
!GDK_ELIMDOUBLES(b->hheap);
- int tremap = remap && (ATOMstorage(tt) == TYPE_str) &&
!GDK_ELIMDOUBLES(b->theap);
+ int remap = writable == 2;
+ int hremap = remap && BAThrestricted(b) != BAT_WRITE;
+ int tremap = remap && BATtrestricted(b) != BAT_WRITE;
+ int hvremap = hremap && ATOMstorage(ht) == TYPE_str &&
!GDK_ELIMDOUBLES(b->H->vheap);
+ int tvremap = tremap && ATOMstorage(tt) == TYPE_str &&
!GDK_ELIMDOUBLES(b->T->vheap);
Heap bhhp, bthp, hhp, thp;
memset(&bhhp, 0, sizeof(Heap));
memset(&bthp, 0, sizeof(Heap));
memset(&hhp, 0, sizeof(Heap));
memset(&thp, 0, sizeof(Heap));
- if ((b->htype && heapcopy(&bhhp, &b->H->heap, &remap) <
0)||
- (b->ttype && heapcopy(&bthp, &b->T->heap, &remap) <
0)||
- (bn->hheap && heapcopy(&hhp, b->hheap, &hremap) <
0) ||
- (bn->theap && heapcopy(&thp, b->theap, &tremap) <
0)) {
+ if ((b->htype && heapcopy(&bhhp, &b->H->heap, &hremap)
< 0)||
+ (b->ttype && heapcopy(&bthp, &b->T->heap, &tremap)
< 0)||
+ (bn->H->vheap && heapcopy(&hhp, b->H->vheap,
&hvremap) < 0) ||
+ (bn->T->vheap && heapcopy(&thp, b->T->vheap,
&tvremap) < 0)) {
if (hhp.base)
HEAPfree(&hhp);
if (bthp.base)
@@ -741,10 +738,10 @@
/* succeeded; replace dummy small heaps by the real
ones */
heapfree(&bn->H->heap, &bhhp);
heapfree(&bn->T->heap, &bthp);
- if (bn->hheap)
- heapfree(bn->hheap, &hhp);
- if (bn->theap)
- heapfree(bn->theap, &thp);
+ if (bn->H->vheap)
+ heapfree(bn->H->vheap, &hhp);
+ if (bn->T->vheap)
+ heapfree(bn->T->vheap, &thp);
if (bn->htype)
bn->U->capacity =
bn->H->heap.size>>bn->H->shift;
@@ -757,10 +754,13 @@
bn->batInserted = b->batInserted;
/* if we have copy-on-write heaps, bn is a logical view
on b to ensure the heaps stay stable */
- if (remap || hremap || tremap) {
- bn->batLview = TRUE;
+ if (hremap || hvremap) {
+ bn->P->lview = TRUE;
BBPshare(bn->H->parentid = b->batCacheid);
- BBPshare(bn->T->parentid = b->batCacheid);
+ }
+ if (tremap || tvremap) {
+ bn->P->lview = TRUE;
+ BBPshare(bn->T->parentid = -b->batCacheid);
}
} else if (BATatoms[ht].atomFix || BATatoms[tt].atomFix || (ht
&& tt) || ATOMstorage(MAX(ht, tt)) >= TYPE_str) {
/* case (4): one-by-one BUN insert (really slow) */
@@ -852,7 +852,7 @@
} else {
bn->tsorted = bn->tdense = 0;
}
- if (writeable != TRUE)
+ if (writable != TRUE)
bn->batRestricted = BAT_READ;
return bn;
bunins_failed:
@@ -990,10 +990,10 @@
size_t hsize = 0, tsize = 0;
BATiter bi = bat_iterator(b);
- if (b->H->hash && b->hheap)
- hsize = b->hheap->size;
- if (b->T->hash && b->theap)
- tsize = b->theap->size;
+ if (b->H->hash && b->H->vheap)
+ hsize = b->H->vheap->size;
+ if (b->T->hash && b->T->vheap)
+ tsize = b->T->vheap->size;
ALIGNins(b, "BUNins", force);
b->batDirty = 1;
@@ -1120,14 +1120,14 @@
if (b->H->hash) {
HASHins(b, (hash_t) i, h);
- if (hsize && hsize != b->hheap->size)
- HEAPwarm(b->hheap);
+ if (hsize && hsize != b->H->vheap->size)
+ HEAPwarm(b->H->vheap);
}
if (b->T->hash) {
HASHins(bm, (hash_t) i, t);
- if (tsize && tsize != b->theap->size)
- HEAPwarm(b->theap);
+ if (tsize && tsize != b->T->vheap->size)
+ HEAPwarm(b->T->vheap);
}
}
return b;
@@ -1171,10 +1171,10 @@
int countonly;
size_t hsize = 0, tsize = 0;
- if (b->H->hash && b->hheap)
- hsize = b->hheap->size;
- if (b->T->hash && b->theap)
- tsize = b->theap->size;
+ if (b->H->hash && b->H->vheap)
+ hsize = b->H->vheap->size;
+ if (b->T->hash && b->T->vheap)
+ tsize = b->T->vheap->size;
BATcheck(b, "BUNappend");
bm = BBP_cache(-b->batCacheid);
@@ -1315,14 +1315,14 @@
*/
if (b->H->hash && h) {
HASHins(b, (hash_t) i, h);
- if (hsize && hsize != b->hheap->size)
- HEAPwarm(b->hheap);
+ if (hsize && hsize != b->H->vheap->size)
+ HEAPwarm(b->H->vheap);
}
if (b->T->hash) {
HASHins(bm, (hash_t) i, t);
- if (tsize && tsize != b->theap->size)
- HEAPwarm(b->theap);
+ if (tsize && tsize != b->T->vheap->size)
+ HEAPwarm(b->T->vheap);
}
return b;
bunins_failed:
@@ -1424,10 +1424,10 @@
(*tunfix) (BUNtail(bi, p));
}
if (hatmdel) {
- (*hatmdel) (b->hheap, (var_t *) BUNhloc(bi, p));
+ (*hatmdel) (b->H->vheap, (var_t *) BUNhloc(bi, p));
}
if (tatmdel) {
- (*tatmdel) (b->theap, (var_t *) BUNtloc(bi, p));
+ (*tatmdel) (b->T->vheap, (var_t *) BUNtloc(bi, p));
}
idx1 = p;
@:hacc_update(del,head,p,idx1)@
@@ -1543,7 +1543,7 @@
@= uncommit_replace
@:tacc_update(del,[EMAIL PROTECTED],p,pit)@
- ATOMreplace(b->ttype, b->theap, BUNtloc(bi, p), t);
+ ATOMreplace(b->ttype, b->T->vheap, BUNtloc(bi, p), t);
@:tacc_update(ins,[EMAIL PROTECTED],p,pit)@
if (BATtordered(b) & 1 || BATtordered(b) == (bit) GDK_SORTED_REV) {
int tt = b->ttype;
@@ -1585,11 +1585,11 @@
ALIGNinp(b, "BUNreplace", force); /* zap alignment info */
if (b->tvarsized) {
- size_t tsize = b->theap->size;
+ size_t tsize = b->T->vheap->size;
@:uncommit_replace(var)@
- if (b->T->hash && tsize != b->theap->size)
- HEAPwarm(b->theap);
+ if (b->T->hash && tsize != b->T->vheap->size)
+ HEAPwarm(b->T->vheap);
} else {
@:uncommit_replace(loc)@
}
@@ -1851,8 +1851,8 @@
/* exploit string double elimination, when present */
htpe = ATOMstorage(b->htype);
ttpe = ATOMstorage(b->ttype);
- if (htpe == TYPE_str && GDK_ELIMDOUBLES(b->hheap)) {
- hidx = strLocate(b->hheap, x);
+ if (htpe == TYPE_str && GDK_ELIMDOUBLES(b->H->vheap)) {
+ hidx = strLocate(b->H->vheap, x);
if (hidx == 0)
return BUN_NONE; /* x does not occur */
if (b->H->hash == NULL) {
@@ -1860,8 +1860,8 @@
x = &hidx;
}
}
- if (ttpe == TYPE_str && GDK_ELIMDOUBLES(b->theap)) {
- tidx = strLocate(b->theap, y);
+ if (ttpe == TYPE_str && GDK_ELIMDOUBLES(b->T->vheap)) {
+ tidx = strLocate(b->T->vheap, y);
if (tidx == 0)
return BUN_NONE; /* y does not occur */
ttpe = TYPE_oid;
@@ -1992,8 +1992,8 @@
((dirty == 0 || b->batDirtybuns) ? HEAPvmsize(&b->T->heap) : 0)
+
(((dirty == 0 || b->batDirtybuns) && b->H->hash) ?
HEAPvmsize(b->H->hash->heap) : 0) +
(((dirty == 0 || b->batDirtybuns) && b->T->hash) ?
HEAPvmsize(b->T->hash->heap) : 0) +
- (((dirty == 0 || b->hheapdirty) && b->hheap) ?
HEAPvmsize(b->hheap) : 0) +
- (((dirty == 0 || b->theapdirty) && b->theap) ?
HEAPvmsize(b->theap) : 0);
+ (((dirty == 0 || b->hheapdirty) && b->H->vheap) ?
HEAPvmsize(b->H->vheap) : 0) +
+ (((dirty == 0 || b->theapdirty) && b->T->vheap) ?
HEAPvmsize(b->T->vheap) : 0);
}
size_t
@@ -2007,8 +2007,8 @@
((dirty == 0 || b->batDirtybuns) ? HEAPmemsize(&b->T->heap) :
0) +
(((dirty == 0 || b->batDirtybuns) && b->H->hash) ?
HEAPmemsize(b->H->hash->heap) : 0) +
(((dirty == 0 || b->batDirtybuns) && b->T->hash) ?
HEAPmemsize(b->T->hash->heap) : 0) +
- (((dirty == 0 || b->hheapdirty) && b-> hheap) ? HEAPmemsize(b->
hheap) : 0) +
- (((dirty == 0 || b->theapdirty) && b->theap) ?
HEAPmemsize(b->theap) : 0);
+ (((dirty == 0 || b->hheapdirty) && b-> H->vheap) ?
HEAPmemsize(b-> H->vheap) : 0) +
+ (((dirty == 0 || b->theapdirty) && b->T->vheap) ?
HEAPmemsize(b->T->vheap) : 0);
}
@
@@ -2243,10 +2243,10 @@
b->batMaptheap = thp;
b->H->heap.newstorage = bns;
b->T->heap.newstorage = bns;
- if (b->hheap)
- b->hheap->newstorage = hhp;
- if (b->theap)
- b->theap->newstorage = thp;
+ if (b->H->vheap)
+ b->H->vheap->newstorage = hhp;
+ if (b->T->vheap)
+ b->T->vheap->newstorage = thp;
b->batDirtydesc = 1;
return 0;
}
@@ -2269,8 +2269,8 @@
BATcheck(b, "BATmadvise");
@:madvise(bns,(&b->H->heap))@
@:madvise(bns,(&b->T->heap))@
- @:madvise(hhp,b->hheap)@
- @:madvise(thp,b->theap)@
+ @:madvise(hhp,b->H->vheap)@
+ @:madvise(thp,b->T->vheap)@
return 0;
}
@@ -2280,8 +2280,8 @@
BATcheck(b, "BATmmap_pin");
@:pin(pin,(&b->H->heap))@
@:pin(pin,(&b->T->heap))@
- @:pin(pin,b->hheap)@
- @:pin(pin,b->theap)@
+ @:pin(pin,b->H->vheap)@
+ @:pin(pin,b->T->vheap)@
return 0;
}
@@ -2291,8 +2291,8 @@
BATcheck(b, "BATmmap_unpin");
@:pin(unpin,(&b->H->heap))@
@:pin(unpin,(&b->T->heap))@
- @:pin(unpin,b->hheap)@
- @:pin(unpin,b->theap)@
+ @:pin(unpin,b->H->vheap)@
+ @:pin(unpin,b->T->vheap)@
return 0;
}
@@ -2305,10 +2305,10 @@
@{
@c
static int
-HEAPcheckmode(Heap *h, int persistent, int unloadable, int writeable)
+HEAPcheckmode(Heap *h, int persistent, int unloadable, int writable)
{
/* user may have requested illegal or system-wise unwanted mmap modes.
correct this */
- if (h->size > 0 && h->storage == STORE_MMAP && persistent && writeable)
{
+ if (h->size > 0 && h->storage == STORE_MMAP && persistent && writable) {
/* in a commit, we are sometimes forced to start treating MMAP
heaps as PRIV */
if (!unloadable)
h->storage = STORE_PRIV;
@@ -2331,11 +2331,11 @@
b->batMapbuns = STORE_PRIV;
dirty = b->batMapdirty = TRUE;
}
- if (b->hheap && (HEAPcheckmode(b->hheap, persistent, unloadable,
b->batRestricted == BAT_WRITE || (b->batRestricted == BAT_APPEND &&
ATOMappendpriv(b->htype, b->hheap))))) {
+ if (b->H->vheap && (HEAPcheckmode(b->H->vheap, persistent, unloadable,
b->batRestricted == BAT_WRITE || (b->batRestricted == BAT_APPEND &&
ATOMappendpriv(b->htype, b->H->vheap))))) {
b->batMaphheap = STORE_PRIV;
dirty = TRUE;
}
- if (b->theap && (HEAPcheckmode(b->theap, persistent, unloadable,
b->batRestricted == BAT_WRITE || (b->batRestricted == BAT_APPEND &&
ATOMappendpriv(b->ttype, b->theap))))) {
+ if (b->T->vheap && (HEAPcheckmode(b->T->vheap, persistent, unloadable,
b->batRestricted == BAT_WRITE || (b->batRestricted == BAT_APPEND &&
ATOMappendpriv(b->ttype, b->T->vheap))))) {
b->batMaptheap = STORE_PRIV;
dirty = TRUE;
}
@@ -2511,11 +2511,11 @@
@:heap_unshare((&b->H->heap),head)@
if (b->T->heap.base)
@:heap_unshare((&b->T->heap),tail)@
- if (b->hheap)
- @:heap_unshare(b->H->vheap,hheap)@
- if (b->theap)
- @:heap_unshare(b->T->vheap,theap)@
- b->batLview = 0;
+ if (b->H->vheap)
+ @:heap_unshare(b->H->vheap,H->vheap)@
+ if (b->T->vheap)
+ @:heap_unshare(b->T->vheap,T->vheap)@
+ b->P->lview = 0;
if (b->H->parentid)
BBPunshare(b->H->parentid);
if (b->T->parentid)
@@ -2533,16 +2533,16 @@
}
if (b->batRestricted != mode) {
int m1 = 0, bak1 = b->H->heap.storage;
- int m2 = 0, bak2 = b->hheap ? b->hheap->storage : -1;
- int m3 = 0, bak3 = b->theap ? b->theap->storage : -1;
+ int m2 = 0, bak2 = b->H->vheap ? b->H->vheap->storage : -1;
+ int m3 = 0, bak3 = b->T->vheap ? b->T->vheap->storage : -1;
int committed = BBP_status(b->batCacheid) & BBPEXISTING;
int bak = b->batRestricted;
int dirty = BATdirty(b);
int reload = FALSE;
int remap = FALSE;
- /* copy-on-write isolated bats that are changed mode should be
made independent */
- if (b->batLview) {
+ /* copy-on-write isolated bats that change mode should be made
independent */
+ if (b->P->lview) {
if (batunshare(b, "BATsetaccess") < 0)
return NULL;
}
@@ -2566,17 +2566,17 @@
m1 = HEAPsetmmap(&b->T->heap, committed,
&remap);
}
if (bak2 >= 0) {
- if (mode == BAT_WRITE || (mode == BAT_APPEND &&
ATOMappendpriv(b->htype, b->hheap))) {
- m2 = HEAPsetpriv(b->hheap, committed,
&remap, &reload);
- } else if (bak == BAT_WRITE || (bak ==
BAT_APPEND && ATOMappendpriv(b->htype, b->hheap))) {
- m2 = HEAPsetmmap(b->hheap, committed,
&remap);
+ if (mode == BAT_WRITE || (mode == BAT_APPEND &&
ATOMappendpriv(b->htype, b->H->vheap))) {
+ m2 = HEAPsetpriv(b->H->vheap,
committed, &remap, &reload);
+ } else if (bak == BAT_WRITE || (bak ==
BAT_APPEND && ATOMappendpriv(b->htype, b->H->vheap))) {
+ m2 = HEAPsetmmap(b->H->vheap,
committed, &remap);
}
}
if (bak3 >= 0) {
- if (mode == BAT_WRITE || (mode == BAT_APPEND &&
ATOMappendpriv(b->ttype, b->theap))) {
- m3 = HEAPsetpriv(b->theap, committed,
&remap, &reload);
- } else if (bak == BAT_WRITE || (bak ==
BAT_APPEND && ATOMappendpriv(b->ttype, b->theap))) {
- m3 = HEAPsetmmap(b->theap, committed,
&remap);
+ if (mode == BAT_WRITE || (mode == BAT_APPEND &&
ATOMappendpriv(b->ttype, b->T->vheap))) {
+ m3 = HEAPsetpriv(b->T->vheap,
committed, &remap, &reload);
+ } else if (bak == BAT_WRITE || (bak ==
BAT_APPEND && ATOMappendpriv(b->ttype, b->T->vheap))) {
+ m3 = HEAPsetmmap(b->T->vheap,
committed, &remap);
}
}
}
@@ -2661,7 +2661,7 @@
if (mode != b->batPersistence) {
bat bid = ABS(b->batCacheid);
- if (b->batLview) {
+ if (b->P->lview) {
if (batunshare(b, "BATmode") < 0)
return NULL;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins