Changeset: 7391d12966aa for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7391d12966aa Modified Files: gdk/gdk_imprints.c monetdb5/modules/mal/batExtensions.c Branch: bloomfilters Log Message:
fixing new signatures of old code
diffs (148 lines):
diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c
--- a/gdk/gdk_imprints.c
+++ b/gdk/gdk_imprints.c
@@ -779,12 +779,12 @@ BATbloom(BAT *b) {
return b; /* do nothing */
}
- BATcheck(b, "BATblooms");
+ BATcheck(b, "BATblooms", GDK_FAIL);
cnt = BATcount(b);
- mn = 4 * cnt; /* make it power of 2 for faster modulo */
+ mn = 4 * cnt; /* TODO: make it power of 2 for faster modulo */
- bn = BATnew(TYPE_void, TYPE_bit, mn);
+ bn = BATnew(TYPE_void, TYPE_bit, mn, TRANSIENT);
if (bn == NULL) {
GDKerror("#BATbloom: memory allocation error");
return NULL;
@@ -796,11 +796,11 @@ BATbloom(BAT *b) {
}
#define BLOOM_BUILD(TYPE) \
-do {
\
- oid key,hv,x,y,z; /* for hashing */ \
- TYPE *ob = (TYPE *)Tloc(b, BUNfirst(b)); \
+do { \
+ oid key,hv,x,y,z; /* for hashing */ \
+ TYPE *ob = (TYPE *)Tloc(b, BUNfirst(b)); \
for (p = 0; p < cnt; p++) { \
- key = (oid) ob[p];
\
+ key = (oid) ob[p]; \
hash_init(key, x,y,z); \
next_hash(hv, x,y,z); \
o[hash_mod(hv,mn)] = 1; \
@@ -808,8 +808,9 @@ do {
\
o[hash_mod(hv,mn)] = 1; \
next_hash(hv, x,y,z); \
o[hash_mod(hv,mn)] = 1; \
- }
\
+ } \
} while (0)
+
switch (ATOMstorage(b->T->type)) {
case TYPE_bte:
BLOOM_BUILD(bte);
@@ -885,7 +886,7 @@ BLOOMselect(BAT *b, BAT *s, BAT *bf) {
if (start == end) {
/* trivial: empty result */
- bn = BATnew(TYPE_void, TYPE_void, 0);
+ bn = BATnew(TYPE_void, TYPE_void, 0, TRANSIENT);
if (bn == NULL) {
return NULL;
}
@@ -895,43 +896,44 @@ BLOOMselect(BAT *b, BAT *s, BAT *bf) {
return bn;
}
- bn = BATnew(TYPE_void, TYPE_oid, 1024);
+ bn = BATnew(TYPE_void, TYPE_oid, 1024, TRANSIENT);
if (bn == NULL) {
return NULL;
}
#define TEST_BLOOM(TYPE) \
-do {
\
- oid key,hv,x,y,z; /* for hashing */ \
- oid i, o;
\
- TYPE *ob = (TYPE *)Tloc(b, BUNfirst(b)); \
- for (;;) {
\
- if (cand) {
\
+do { \
+ oid key,hv,x,y,z; /* for hashing */ \
+ oid i, o; \
+ TYPE *ob = (TYPE *)Tloc(b, BUNfirst(b)); \
+ for (;;) { \
+ if (cand) { \
if (cand == candend) \
- break;
\
+ break; \
i = *cand++ - b->hseqbase; \
- if (i >= end)
\
- break;
\
- } else {
\
- i = start++;
\
- if (i == end)
\
- break;
\
- }
\
- key = ob[i];
\
+ if (i >= end) \
+ break; \
+ } else { \
+ i = start++; \
+ if (i == end) \
+ break; \
+ } \
+ key = ob[i]; \
hash_init(key, x,y,z); \
next_hash(hv, x,y,z); \
- if (bloom[hash_mod(hv,mn)]) { \
+ if (bloom[hash_mod(hv,mn)]) { \
next_hash(hv, x,y,z); \
- if (bloom[hash_mod(hv,mn)]) { \
+ if (bloom[hash_mod(hv,mn)]) { \
next_hash(hv, x,y,z); \
- if (bloom[hash_mod(hv,mn)]) {\
+ if (bloom[hash_mod(hv,mn)]) { \
o = i + b->hseqbase; \
- bunfastapp(bn, &o);
\
- }
\
- }
\
- }
\
- }
\
+ bunfastapp(bn, &o); \
+ } \
+ } \
+ } \
+ } \
} while (0)
+
switch (ATOMstorage(b->T->type)) {
case TYPE_bte:
TEST_BLOOM(bte);
diff --git a/monetdb5/modules/mal/batExtensions.c
b/monetdb5/modules/mal/batExtensions.c
--- a/monetdb5/modules/mal/batExtensions.c
+++ b/monetdb5/modules/mal/batExtensions.c
@@ -312,7 +312,7 @@ CMDBATbloom(int *ret, int *bid)
bn = BATbloom(b);
BBPkeepref(*ret = bn->batCacheid);
- BBPreleaseref(b->batCacheid);
+ BBPunfix(b->batCacheid);
return MAL_SUCCEED;
}
@@ -338,8 +338,8 @@ CMDBLOOMselect(int *ret, int *bid, int *
throw(MAL,"bat.bloom", INTERNAL_OBJ_CREATE);
}
BBPkeepref(*ret = bn->batCacheid);
- BBPreleaseref(b->batCacheid);
- BBPreleaseref(s->batCacheid);
- BBPreleaseref(bf->batCacheid);
+ BBPunfix(b->batCacheid);
+ BBPunfix(s->batCacheid);
+ BBPunfix(bf->batCacheid);
return MAL_SUCCEED;
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list
