summaryrefslogtreecommitdiffstats
path: root/include/jemalloc/internal/witness.h
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2016-04-17 19:55:10 (GMT)
committerJason Evans <jasone@canonware.com>2016-06-03 19:27:41 (GMT)
commite75e9be130910a7344f553e5e6c664047a0d0464 (patch)
tree8528159c3ba8848d9e83ab553f47918f842a5fc5 /include/jemalloc/internal/witness.h
parent8c9be3e83732883e852d43bca2cf7724c465f93e (diff)
downloadjemalloc-e75e9be130910a7344f553e5e6c664047a0d0464.zip
jemalloc-e75e9be130910a7344f553e5e6c664047a0d0464.tar.gz
jemalloc-e75e9be130910a7344f553e5e6c664047a0d0464.tar.bz2
Add rtree element witnesses.
Diffstat (limited to 'include/jemalloc/internal/witness.h')
-rw-r--r--include/jemalloc/internal/witness.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/include/jemalloc/internal/witness.h b/include/jemalloc/internal/witness.h
index c68c969..f15665b 100644
--- a/include/jemalloc/internal/witness.h
+++ b/include/jemalloc/internal/witness.h
@@ -4,7 +4,8 @@
typedef struct witness_s witness_t;
typedef unsigned witness_rank_t;
typedef ql_head(witness_t) witness_list_t;
-typedef int witness_comp_t (const witness_t *, const witness_t *);
+typedef int witness_comp_t (const witness_t *, void *, const witness_t *,
+ void *);
/*
* Lock ranks. Witnesses with rank WITNESS_RANK_OMIT are completely ignored by
@@ -26,7 +27,8 @@ typedef int witness_comp_t (const witness_t *, const witness_t *);
#define WITNESS_RANK_ARENA_CHUNKS 9U
#define WITNESS_RANK_ARENA_EXTENT_CACHE 10
-#define WITNESS_RANK_BASE 11U
+#define WITNESS_RANK_RTREE_ELM 11U
+#define WITNESS_RANK_BASE 12U
#define WITNESS_RANK_LEAF 0xffffffffU
#define WITNESS_RANK_ARENA_BIN WITNESS_RANK_LEAF
@@ -38,7 +40,7 @@ typedef int witness_comp_t (const witness_t *, const witness_t *);
#define WITNESS_RANK_PROF_NEXT_THR_UID WITNESS_RANK_LEAF
#define WITNESS_RANK_PROF_THREAD_ACTIVE_INIT WITNESS_RANK_LEAF
-#define WITNESS_INITIALIZER(rank) {"initializer", rank, NULL, {NULL, NULL}}
+#define WITNESS_INITIALIZER(name, rank) {name, rank, NULL, NULL, {NULL, NULL}}
#endif /* JEMALLOC_H_TYPES */
/******************************************************************************/
@@ -61,6 +63,9 @@ struct witness_s {
*/
witness_comp_t *comp;
+ /* Opaque data, passed to comp(). */
+ void *opaque;
+
/* Linkage for thread's currently owned locks. */
ql_elm(witness_t) link;
};
@@ -70,7 +75,7 @@ struct witness_s {
#ifdef JEMALLOC_H_EXTERNS
void witness_init(witness_t *witness, const char *name, witness_rank_t rank,
- witness_comp_t *comp);
+ witness_comp_t *comp, void *opaque);
#ifdef JEMALLOC_JET
typedef void (witness_lock_error_t)(const witness_list_t *, const witness_t *);
extern witness_lock_error_t *witness_lock_error;
@@ -211,7 +216,8 @@ witness_lock(tsdn_t *tsdn, witness_t *witness)
/* Not forking, rank order reversal. */
witness_lock_error(witnesses, witness);
} else if (w->rank == witness->rank && (w->comp == NULL || w->comp !=
- witness->comp || w->comp(w, witness) > 0)) {
+ witness->comp || w->comp(w, w->opaque, witness, witness->opaque) >
+ 0)) {
/*
* Missing/incompatible comparison function, or comparison
* function indicates rank order reversal.