Embed root node into rtree_t.
This avoids one atomic operation per tree access.
This commit is contained in:
@@ -23,7 +23,7 @@ static const rtree_level_t rtree_levels[] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
bool rtree_new(rtree_t *rtree);
|
||||
bool rtree_new(rtree_t *rtree, bool zeroed);
|
||||
#ifdef JEMALLOC_JET
|
||||
typedef rtree_node_elm_t *(rtree_node_alloc_t)(tsdn_t *, rtree_t *, size_t);
|
||||
extern rtree_node_alloc_t *rtree_node_alloc;
|
||||
|
@@ -39,13 +39,17 @@ struct rtree_ctx_s {
|
||||
#ifndef _MSC_VER
|
||||
JEMALLOC_ALIGNED(CACHELINE)
|
||||
#endif
|
||||
rtree_ctx_cache_elm_t cache[RTREE_CTX_NCACHE];
|
||||
rtree_ctx_cache_elm_t cache[RTREE_CTX_NCACHE];
|
||||
};
|
||||
|
||||
struct rtree_s {
|
||||
/* An rtree_{internal,leaf}_elm_t *. */
|
||||
atomic_p_t root;
|
||||
malloc_mutex_t init_lock;
|
||||
malloc_mutex_t init_lock;
|
||||
/* Number of elements based on rtree_levels[0].bits. */
|
||||
#if RTREE_HEIGHT > 1
|
||||
rtree_node_elm_t root[1U << (RTREE_NSB/RTREE_HEIGHT)];
|
||||
#else
|
||||
rtree_leaf_elm_t root[1U << (RTREE_NSB/RTREE_HEIGHT)];
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_RTREE_STRUCTS_H */
|
||||
|
Reference in New Issue
Block a user