Commit 02c73ee3 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

compile newbrt with icc. addresses #1185

git-svn-id: file:///svn/tokudb.1131b+1080a+1185@6330 c7de825b-a66e-492c-adef-691d508d4ae1
parent 5ef2e3e5
......@@ -26,7 +26,7 @@ typedef struct brt_search {
} brt_search_t;
/* initialize the search compare object */
static inline brt_search_t *brt_search_init(brt_search_t *so, brt_search_compare_func_t compare, int direction, DBT *k, DBT *v, void *context) {
static inline brt_search_t *brt_search_init(brt_search_t *so, brt_search_compare_func_t compare, enum brt_search_direction_e direction, DBT *k, DBT *v, void *context) {
so->compare = compare; so->direction = direction; so->k = k; so->v = v; so->context = context;
return so;
}
......
......@@ -59,6 +59,56 @@ static int compare_leafentries (BRT brt, LEAFENTRY a, LEAFENTRY b) {
return cmp;
}
// all this because we dont have nested functions
struct verify_pair_arg {
BRT brt;
int i;
bytevec thislorange;
ITEMLEN thislolen;
bytevec thishirange;
ITEMLEN thishilen;
int *resultp;
};
static void verify_pair (bytevec key, unsigned int keylen,
bytevec data __attribute__((__unused__)),
unsigned int datalen __attribute__((__unused__)),
int type __attribute__((__unused__)),
TXNID xid __attribute__((__unused__)),
void *arg) {
struct verify_pair_arg *vparg = (struct verify_pair_arg *)arg;
BRT brt = vparg->brt;
int i = vparg->i;
bytevec thislorange = vparg->thislorange; ITEMLEN thislolen = vparg->thislolen;
bytevec thishirange = vparg->thishirange; ITEMLEN thishilen = vparg->thishilen;
DBT k1,k2;
if (thislorange) assert(brt->compare_fun(brt->db,
toku_fill_dbt(&k1,thislorange,thislolen),
toku_fill_dbt(&k2,key,keylen)) < 0);
if (thishirange && (brt->compare_fun(brt->db,
toku_fill_dbt(&k1,key,keylen),
toku_fill_dbt(&k2,thishirange,thishilen)) > 0)) {
printf("%s:%d in buffer %d key %s is bigger than %s\n", __FILE__, __LINE__, i, (char*)key, (char*)thishirange);
*vparg->resultp = 1;
}
}
struct check_increasing_arg {
BRT brt;
LEAFENTRY prev;
};
// Make sure that they are in increasing order.
static int check_increasing (OMTVALUE lev, u_int32_t idx, void *arg) {
struct check_increasing_arg *ciarg = (struct check_increasing_arg *)arg;
LEAFENTRY v=lev;
LEAFENTRY prev = ciarg->prev;
if (idx>0)
assert(compare_leafentries(ciarg->brt, prev, v)<0);
ciarg->prev=v;
return 0;
}
int toku_verify_brtnode (BRT brt, BLOCKNUM blocknum, bytevec lorange, ITEMLEN lolen, bytevec hirange, ITEMLEN hilen, int recurse) {
int result=0;
BRTNODE node;
......@@ -91,28 +141,8 @@ int toku_verify_brtnode (BRT brt, BLOCKNUM blocknum, bytevec lorange, ITEMLEN lo
thishirange=kv_pair_key(node->u.n.childkeys[i]);
thishilen =toku_brt_pivot_key_len(brt, node->u.n.childkeys[i]);
}
{
void verify_pair (bytevec key, unsigned int keylen,
bytevec data __attribute__((__unused__)),
unsigned int datalen __attribute__((__unused__)),
int type __attribute__((__unused__)),
TXNID xid __attribute__((__unused__)),
void *ignore __attribute__((__unused__))) {
DBT k1,k2;
if (thislorange) assert(brt->compare_fun(brt->db,
toku_fill_dbt(&k1,thislorange,thislolen),
toku_fill_dbt(&k2,key,keylen))
<0);
if (thishirange && (brt->compare_fun(brt->db,
toku_fill_dbt(&k1,key,keylen),
toku_fill_dbt(&k2,thishirange,thishilen))
>0)) {
printf("%s:%d in buffer %d key %s is bigger than %s\n", __FILE__, __LINE__, i, (char*)key, (char*)thishirange);
result=1;
}
}
toku_fifo_iterate(BNC_BUFFER(node,i), verify_pair, 0);
}
struct verify_pair_arg vparg = { brt, i, thislorange, thislolen, thishirange, thishilen, &result };
toku_fifo_iterate(BNC_BUFFER(node,i), verify_pair, &vparg);
}
//if (lorange) printf("%s:%d lorange=%s\n", __FILE__, __LINE__, (char*)lorange);
//if (hirange) printf("%s:%d lorange=%s\n", __FILE__, __LINE__, (char*)hirange);
......@@ -137,17 +167,8 @@ int toku_verify_brtnode (BRT brt, BLOCKNUM blocknum, bytevec lorange, ITEMLEN lo
}
}
} else {
// Make sure that they are in increasing order.
int check_increasing (OMTVALUE lev, u_int32_t idx, void *vprevp) {
LEAFENTRY v=lev;
LEAFENTRY *prevp = vprevp;
if (idx>0)
assert(compare_leafentries(brt, *prevp, v)<0);
*prevp=v;
return 0;
}
LEAFENTRY prev=0;
toku_omt_iterate(node->u.l.buffer, check_increasing, &prev);
struct check_increasing_arg ciarg = { brt , 0 };
toku_omt_iterate(node->u.l.buffer, check_increasing, &ciarg);
}
if ((r = toku_cachetable_unpin(brt->cf, blocknum, fullhash, 0, 0))) return r;
return result;
......
......@@ -1855,10 +1855,8 @@ static int brt_nonleaf_cmd_many (BRT t, BRTNODE node, BRT_CMD cmd,
/* find all children that need a copy of the command */
int sendchild[TREE_FANOUT], delidx = 0;
inline void sendchild_append(int i) {
if (delidx == 0 || sendchild[delidx-1] != i)
sendchild[delidx++] = i;
}
#define sendchild_append(i) \
if (delidx == 0 || sendchild[delidx-1] != i) sendchild[delidx++] = i;
int i;
for (i = 0; i < node->u.n.n_children-1; i++) {
int cmp = brt_compare_pivot(t, cmd->u.id.key, 0, node->u.n.childkeys[i]);
......
......@@ -38,12 +38,12 @@ void *toku_mempool_malloc(struct mempool *mp, size_t size, int alignment) {
if (offset + size > mp->size) {
vp = 0;
} else {
vp = mp->base + offset;
vp = (char *)mp->base + offset;
mp->free_offset = offset + size;
}
assert(mp->free_offset <= mp->size);
assert(((long)vp & (alignment-1)) == 0);
assert(vp == 0 || (mp->base <= vp && vp + size <= mp->base + mp->size));
assert(vp == 0 || toku_mempool_inrange(mp, vp, size));
//printf("mempool returning %p\n", vp);
return vp;
}
......
......@@ -45,7 +45,7 @@ void toku_mempool_mfree(struct mempool *mp, void *vp, size_t size);
/* verify that a memory range is contained within a mempool */
static inline int toku_mempool_inrange(struct mempool *mp, void *vp, size_t size) {
return (mp->base <= vp) && (vp + size <= mp->base + mp->size);
return (mp->base <= vp) && ((char *)vp + size <= (char *)mp->base + mp->size);
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment