Changeset: cb4d330478ff for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cb4d330478ff Modified Files: clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_bat.c gdk/gdk_private.h monetdb5/extras/sphinx/sphinx.c monetdb5/modules/kernel/batcolor.c monetdb5/modules/kernel/batstr.c monetdb5/modules/mal/tablet.c Branch: default Log Message:
Removed BUNfastins, avoid bunfastins, and turn the latter into a gdk private
macro.
diffs (truncated from 724 to 300 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
@@ -210,7 +210,6 @@ void BBPunlock(const char *s);
gdk_return BUNappend(BAT *b, const void *right, bit force);
gdk_return BUNdel(BAT *b, const void *left, const void *right, bit force);
BUN BUNdelete(BAT *b, BUN p, bit force);
-gdk_return BUNfastins(BAT *b, const void *left, const void *right);
BUN BUNfnd(BAT *b, const void *right);
gdk_return BUNinplace(BAT *b, BUN p, const void *left, const void *right, bit
force);
gdk_return BUNreplace(BAT *b, const void *left, const void *right, bit force);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1113,11 +1113,6 @@ gdk_export bte ATOMelmshift(int sz);
* can use BUNins, BUNappend, BUNreplace, and BUNdel. The
* batch update operations are BATins, BATappend and BATdel.
*
- * Only experts interested in speed may use BUNfastins, since it skips
- * most consistency checks, does not update search accelerators, and
- * does not maintain properties such as the hsorted and tsorted
- * flags. Beware!
- *
* The routine BUNfnd provides fast access to a single BUN providing a
* value for the tail of the binary association.
*
@@ -1183,7 +1178,6 @@ gdk_export bte ATOMelmshift(int sz);
ATOMputFIX((b)->HT->type, (p), v); \
} \
} while (0)
-#define Hputvalue(b, p, v, copyall) HTputvalue(b, p, v, copyall, H)
#define Tputvalue(b, p, v, copyall) HTputvalue(b, p, v, copyall, T)
#define HTreplacevalue(b, p, v, HT) \
do { \
@@ -1231,7 +1225,6 @@ gdk_export bte ATOMelmshift(int sz);
ATOMreplaceFIX((b)->HT->type, (p), v); \
} \
} while (0)
-#define Hreplacevalue(b, p, v) HTreplacevalue(b, p, v, H)
#define Treplacevalue(b, p, v) HTreplacevalue(b, p, v, T)
#define HTfastins_nocheck(b, p, v, s, HT) \
do { \
@@ -1239,36 +1232,8 @@ gdk_export bte ATOMelmshift(int sz);
(b)->HT->heap.free += (s); \
HTputvalue((b), HT##loc((b), (p)), (v), 0, HT); \
} while (0)
-#define hfastins_nocheck(b, p, v, s) HTfastins_nocheck(b, p, v, s, H)
#define tfastins_nocheck(b, p, v, s) HTfastins_nocheck(b, p, v, s, T)
-#define bunfastins_nocheck(b, p, h, t, hs, ts) \
- do { \
- hfastins_nocheck(b, p, h, hs); \
- tfastins_nocheck(b, p, t, ts); \
- (b)->batCount++; \
- } while (0)
-
-#define bunfastins_nocheck_inc(b, p, h, t) \
- do { \
- bunfastins_nocheck(b, p, h, t, Hsize(b), Tsize(b)); \
- p++; \
- } while (0)
-
-#define bunfastins(b, h, t) \
- do { \
- register BUN _p = BUNlast(b); \
- if (_p >= BATcapacity(b)) { \
- if (_p == BUN_MAX || BATcount(b) == BUN_MAX) { \
- GDKerror("bunfastins: too many elements to
accomodate (" BUNFMT ")\n", BUN_MAX); \
- goto bunins_failed; \
- } \
- if (BATextend((b), BATgrows(b)) != GDK_SUCCEED) \
- goto bunins_failed; \
- } \
- bunfastins_nocheck(b, _p, h, t, Hsize(b), Tsize(b)); \
- } while (0)
-
#define bunfastapp_nocheck(b, p, t, ts) \
do { \
tfastins_nocheck(b, p, t, ts); \
@@ -1297,7 +1262,6 @@ gdk_export bte ATOMelmshift(int sz);
} while (0)
gdk_export gdk_return GDKupgradevarheap(COLrec *c, var_t v, int copyall, int
mayshare);
-gdk_export gdk_return BUNfastins(BAT *b, const void *left, const void *right);
gdk_export gdk_return BUNappend(BAT *b, const void *right, bit force);
gdk_export gdk_return BATins(BAT *b, BAT *c, bit force);
gdk_export gdk_return BATappend(BAT *b, BAT *c, bit force);
@@ -3131,17 +3095,4 @@ gdk_export BAT *BATsample(BAT *b, BUN n)
*/
#define MAXPARAMS 32
-#ifndef NDEBUG
-#ifdef __GNUC__
-/* in debug builds, complain (warn) about usage of legacy functions */
-
-#define _COL_TYPE(c) ((c)->type == TYPE_void ? \
- (c)->seq == oid_nil ? "nil" : "void" : \
- (c)->type == TYPE_oid ? \
- (c)->dense ? "dense" : "oid" : \
- ATOMname((c)->type))
-
-#endif
-#endif
-
#endif /* _GDK_H_ */
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -1001,28 +1001,6 @@ BATcopy(BAT *b, int ht, int tt, int writ
un_move(tmpp, Tloc(b, p), ts); \
} while (0)
-/*
- * @- BUN Insertion
- * Insertion into a BAT is split into two operations BUNins and
- * BUNfastins. The former should be used when integrity enforcement
- * and index maintenance is required. The latter is used to quickly
- * insert the BUN into the result without any additional check. For
- * those cases where speed is required, the type decoding can be
- * circumvented by asking for a BUN using BATbunalloc and fill it
- * directly. See gdk.mx for the bunfastins(b,h,t) macros.
- */
-gdk_return
-BUNfastins(BAT *b, const void *h, const void *t)
-{
- bunfastins(b, h, t);
- if (!b->batDirty)
- b->batDirty = TRUE;
- return GDK_SUCCEED;
- bunins_failed:
- return GDK_FAIL;
-}
-
-
static void
setcolprops(BAT *b, COLrec *col, const void *x)
{
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -347,6 +347,37 @@ extern MT_Lock MT_system_lock;
#define SORTloop_bit(b,p,q,tl,th) SORTloop_bte(b,p,q,tl,th)
+#define Hputvalue(b, p, v, copyall) HTputvalue(b, p, v, copyall, H)
+
+#define hfastins_nocheck(b, p, v, s) HTfastins_nocheck(b, p, v, s, H)
+
+#define bunfastins_nocheck(b, p, h, t, hs, ts) \
+ do { \
+ hfastins_nocheck(b, p, h, hs); \
+ tfastins_nocheck(b, p, t, ts); \
+ (b)->batCount++; \
+ } while (0)
+
+#define bunfastins_nocheck_inc(b, p, h, t) \
+ do { \
+ bunfastins_nocheck(b, p, h, t, Hsize(b), Tsize(b)); \
+ p++; \
+ } while (0)
+
+#define bunfastins(b, h, t) \
+ do { \
+ register BUN _p = BUNlast(b); \
+ if (_p >= BATcapacity(b)) { \
+ if (_p == BUN_MAX || BATcount(b) == BUN_MAX) { \
+ GDKerror("bunfastins: too many elements to
accomodate (" BUNFMT ")\n", BUN_MAX); \
+ goto bunins_failed; \
+ } \
+ if (BATextend((b), BATgrows(b)) != GDK_SUCCEED) \
+ goto bunins_failed; \
+ } \
+ bunfastins_nocheck(b, _p, h, t, Hsize(b), Tsize(b)); \
+ } while (0)
+
/* extra space in front of strings in string heaps when hashash is set
* if at least (2*SIZEOF_BUN), also store length (heaps are then
* incompatible) */
diff --git a/monetdb5/extras/sphinx/sphinx.c b/monetdb5/extras/sphinx/sphinx.c
--- a/monetdb5/extras/sphinx/sphinx.c
+++ b/monetdb5/extras/sphinx/sphinx.c
@@ -32,7 +32,6 @@ sphinx_searchIndexLimit(BAT **ret, /* pu
BAT *bn;
sphinx_client *client;
sphinx_result *res;
- oid o = 0;
client = sphinx_create ( SPH_TRUE );
if (client == NULL)
@@ -51,8 +50,7 @@ sphinx_searchIndexLimit(BAT **ret, /* pu
throw(MAL, "sphinx.searchIndex", MAL_MALLOC_FAIL);
for ( i = 0; i < res->num_matches; i++ ) {
lng sphinx_id = sphinx_get_id ( res, i );
- o++;
- BUNfastins(bn, &o, &sphinx_id);
+ bunfastapp(bn, &sphinx_id);
}
}
@@ -66,6 +64,10 @@ sphinx_searchIndexLimit(BAT **ret, /* pu
*ret = bn;
return MAL_SUCCEED;
+ bunins_failed:
+ BBPunfix(bn->batCacheid);
+ sphinx_destroy(client);
+ throw(MAL, "sphinx.searchIndex", MAL_MALLOC_FAIL);
}
str
diff --git a/monetdb5/modules/kernel/batcolor.c
b/monetdb5/modules/kernel/batcolor.c
--- a/monetdb5/modules/kernel/batcolor.c
+++ b/monetdb5/modules/kernel/batcolor.c
@@ -34,15 +34,13 @@ str CLRbat##NAME(bat *ret, const bat *l)
\
if( (b= BATdescriptor(*l)) == NULL )
\
throw(MAL, "batcolor." #NAME, RUNTIME_OBJECT_MISSING);
\
- bn= BATnew(b->htype,getTypeIndex(#TYPE2,-1,TYPE_int),BATcount(b),
TRANSIENT); \
+ bn= BATnew(TYPE_void,getTypeIndex(#TYPE2,-1,TYPE_int),BATcount(b),
TRANSIENT); \
if( bn == NULL){
\
BBPunfix(b->batCacheid);
\
throw(MAL, "batcolor." #NAME, MAL_MALLOC_FAIL);
\
}
\
if( b->htype== TYPE_void)
\
BATseqbase(bn, b->hseqbase);
\
- bn->hsorted=b->hsorted;
\
- bn->hrevsorted=b->hrevsorted;
\
bn->tsorted=0;
\
bn->trevsorted=0;
\
bn->T->nil = 0;
\
@@ -51,7 +49,6 @@ str CLRbat##NAME(bat *ret, const bat *l)
bi = bat_iterator(b);
\
\
BATloop(b, p, q) {
\
- ptr h = BUNhead(bi,p);
\
x= (TYPE1 *) BUNtail(bi,p);
\
if (x== 0 || *x == TYPE1##_nil) {
\
y = (TYPE2) TYPE2##_nil;
\
@@ -59,10 +56,16 @@ str CLRbat##NAME(bat *ret, const bat *l)
bn->T->nil = 1;
\
} else
\
FUNC(yp,x);
\
- bunfastins(bn, h, yp);
\
+ bunfastapp(bn, yp);
\
}
\
- bn->H->nonil = b->H->nonil;
\
- bn->H->nil = b->H->nil;
\
+ if (!BAThdense(b)) {
\
+ /* legacy */
\
+ BAT *b2 = VIEWcreate(b, bn);
\
+ BBPunfix(bn->batCacheid);
\
+ bn = b2;
\
+ } else {
\
+ BATseqbase(bn, b->hseqbase);
\
+ }
\
if (!(bn->batDirty & 2))
\
BATsetaccess(bn, BAT_READ);
\
*ret = bn->batCacheid;
\
@@ -115,17 +118,13 @@ str CLRbat##NAME(bat *ret, const bat *l,
BBPunfix(b3->batCacheid);
\
throw(MAL, "batcolor." #NAME, RUNTIME_OBJECT_MISSING);
\
}
\
- bn= BATnew(b->htype,getTypeIndex("color",5,TYPE_int),BATcount(b),
TRANSIENT); \
+ bn= BATnew(TYPE_void,getTypeIndex("color",5,TYPE_int),BATcount(b),
TRANSIENT); \
if( bn == NULL){
\
BBPunfix(b->batCacheid);
\
BBPunfix(b2->batCacheid);
\
BBPunfix(b3->batCacheid);
\
throw(MAL, "batcolor." #NAME, MAL_MALLOC_FAIL);
\
}
\
- if( b->htype== TYPE_void)
\
- BATseqbase(bn, b->hseqbase);
\
- bn->hsorted=b->hsorted;
\
- bn->hrevsorted=b->hrevsorted;
\
bn->tsorted=0;
\
bn->trevsorted=0;
\
bn->T->nil = 0;
\
@@ -138,7 +137,6 @@ str CLRbat##NAME(bat *ret, const bat *l,
p2= BUNfirst(b2);
\
p3= BUNfirst(b3);
\
BATloop(b, p, q) {
\
- ptr h = BUNhead(bi,p);
\
x= (TYPE *) BUNtail(bi,p);
\
x2= (TYPE *) BUNtail(b2i,p);
\
x3= (TYPE *) BUNtail(b3i,p);
\
@@ -150,12 +148,18 @@ str CLRbat##NAME(bat *ret, const bat *l,
bn->T->nil = 1;
\
} else
\
FUNC(yp,x,x2,x3);
\
- bunfastins(bn, h, yp);
\
+ bunfastapp(bn, yp);
\
p2++;
\
p3++;
\
}
\
- bn->H->nonil = b->H->nonil;
\
- bn->H->nil = b->H->nil;
\
+ if (!BAThdense(b)) {
\
+ /* legacy */
\
+ BAT *b2 = VIEWcreate(b, bn);
\
+ BBPunfix(bn->batCacheid);
\
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list
