2017-01-11 10:06:31 +08:00
|
|
|
#ifndef JEMALLOC_INTERNAL_RTREE_EXTERNS_H
|
|
|
|
#define JEMALLOC_INTERNAL_RTREE_EXTERNS_H
|
|
|
|
|
2017-02-07 05:17:12 +08:00
|
|
|
/*
|
|
|
|
* Split the bits into one to three partitions depending on number of
|
|
|
|
* significant bits. It the number of bits does not divide evenly into the
|
|
|
|
* number of levels, place one remainder bit per level starting at the leaf
|
|
|
|
* level.
|
|
|
|
*/
|
|
|
|
static const rtree_level_t rtree_levels[] = {
|
2017-03-17 00:46:42 +08:00
|
|
|
#if RTREE_HEIGHT == 1
|
2017-02-07 05:17:12 +08:00
|
|
|
{RTREE_NSB, RTREE_NHIB + RTREE_NSB}
|
2017-03-17 00:46:42 +08:00
|
|
|
#elif RTREE_HEIGHT == 2
|
2017-02-07 05:17:12 +08:00
|
|
|
{RTREE_NSB/2, RTREE_NHIB + RTREE_NSB/2},
|
|
|
|
{RTREE_NSB/2 + RTREE_NSB%2, RTREE_NHIB + RTREE_NSB}
|
2017-03-17 00:46:42 +08:00
|
|
|
#elif RTREE_HEIGHT == 3
|
2017-02-07 05:17:12 +08:00
|
|
|
{RTREE_NSB/3, RTREE_NHIB + RTREE_NSB/3},
|
|
|
|
{RTREE_NSB/3 + RTREE_NSB%3/2,
|
|
|
|
RTREE_NHIB + RTREE_NSB/3*2 + RTREE_NSB%3/2},
|
|
|
|
{RTREE_NSB/3 + RTREE_NSB%3 - RTREE_NSB%3/2, RTREE_NHIB + RTREE_NSB}
|
|
|
|
#else
|
2017-03-17 00:46:42 +08:00
|
|
|
# error Unsupported rtree height
|
2017-02-07 05:17:12 +08:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2017-03-23 07:38:03 +08:00
|
|
|
bool rtree_new(rtree_t *rtree, bool zeroed);
|
2017-01-11 10:06:31 +08:00
|
|
|
#ifdef JEMALLOC_JET
|
2017-03-17 00:46:42 +08:00
|
|
|
typedef rtree_node_elm_t *(rtree_node_alloc_t)(tsdn_t *, rtree_t *, size_t);
|
2017-01-11 10:06:31 +08:00
|
|
|
extern rtree_node_alloc_t *rtree_node_alloc;
|
2017-03-17 00:46:42 +08:00
|
|
|
typedef rtree_leaf_elm_t *(rtree_leaf_alloc_t)(tsdn_t *, rtree_t *, size_t);
|
|
|
|
extern rtree_leaf_alloc_t *rtree_leaf_alloc;
|
|
|
|
typedef void (rtree_node_dalloc_t)(tsdn_t *, rtree_t *, rtree_node_elm_t *);
|
2017-01-11 10:06:31 +08:00
|
|
|
extern rtree_node_dalloc_t *rtree_node_dalloc;
|
2017-03-17 00:46:42 +08:00
|
|
|
typedef void (rtree_leaf_dalloc_t)(tsdn_t *, rtree_t *, rtree_leaf_elm_t *);
|
|
|
|
extern rtree_leaf_dalloc_t *rtree_leaf_dalloc;
|
2017-02-04 11:44:33 +08:00
|
|
|
void rtree_delete(tsdn_t *tsdn, rtree_t *rtree);
|
2017-01-11 10:06:31 +08:00
|
|
|
#endif
|
2017-03-17 00:46:42 +08:00
|
|
|
rtree_leaf_elm_t *rtree_leaf_elm_lookup_hard(tsdn_t *tsdn, rtree_t *rtree,
|
2017-02-04 12:12:49 +08:00
|
|
|
rtree_ctx_t *rtree_ctx, uintptr_t key, bool dependent, bool init_missing);
|
2017-03-17 00:46:42 +08:00
|
|
|
void rtree_leaf_elm_witness_acquire(tsdn_t *tsdn, const rtree_t *rtree,
|
|
|
|
uintptr_t key, const rtree_leaf_elm_t *elm);
|
|
|
|
void rtree_leaf_elm_witness_access(tsdn_t *tsdn, const rtree_t *rtree,
|
|
|
|
const rtree_leaf_elm_t *elm);
|
|
|
|
void rtree_leaf_elm_witness_release(tsdn_t *tsdn, const rtree_t *rtree,
|
|
|
|
const rtree_leaf_elm_t *elm);
|
2017-04-05 02:09:45 +08:00
|
|
|
void rtree_ctx_data_init(rtree_ctx_t *ctx);
|
|
|
|
bool tsd_rtree_ctx_data_init(tsd_t *tsd);
|
2017-01-11 10:06:31 +08:00
|
|
|
|
|
|
|
#endif /* JEMALLOC_INTERNAL_RTREE_EXTERNS_H */
|