summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Dougherty <sdougherty@barracuda.com>2015-09-11 21:56:28 (GMT)
committerJason Evans <je@fb.com>2015-11-09 23:44:30 (GMT)
commitbd418ce11efe908d0edfbe66d5af17e78582c377 (patch)
tree419229944a7f3f1320ba49561043a038d60851f4
parentf97298bfc1c6edbb4fd00820e9e028e8d213af73 (diff)
downloadjemalloc-bd418ce11efe908d0edfbe66d5af17e78582c377.zip
jemalloc-bd418ce11efe908d0edfbe66d5af17e78582c377.tar.gz
jemalloc-bd418ce11efe908d0edfbe66d5af17e78582c377.tar.bz2
Assert compact color bit is unused
Signed-off-by: Joshua Kahn <jkahn@barracuda.com> This resolves #280.
-rw-r--r--include/jemalloc/internal/rb.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/jemalloc/internal/rb.h b/include/jemalloc/internal/rb.h
index 2ca8e59..b460d74 100644
--- a/include/jemalloc/internal/rb.h
+++ b/include/jemalloc/internal/rb.h
@@ -79,6 +79,15 @@ struct { \
(a_node)->a_field.rbn_right_red = (a_type *) (((intptr_t) \
(a_node)->a_field.rbn_right_red) & ((ssize_t)-2)); \
} while (0)
+
+/* Node initializer. */
+#define rbt_node_new(a_type, a_field, a_rbt, a_node) do { \
+ /* Bookkeeping bit cannot be used by node pointer. */ \
+ assert(((uintptr_t)(a_node) & 0x1) == 0); \
+ rbtn_left_set(a_type, a_field, (a_node), &(a_rbt)->rbt_nil); \
+ rbtn_right_set(a_type, a_field, (a_node), &(a_rbt)->rbt_nil); \
+ rbtn_red_set(a_type, a_field, (a_node)); \
+} while (0)
#else
/* Right accessors. */
#define rbtn_right_get(a_type, a_field, a_node) \
@@ -99,7 +108,6 @@ struct { \
#define rbtn_black_set(a_type, a_field, a_node) do { \
(a_node)->a_field.rbn_red = false; \
} while (0)
-#endif
/* Node initializer. */
#define rbt_node_new(a_type, a_field, a_rbt, a_node) do { \
@@ -107,6 +115,7 @@ struct { \
rbtn_right_set(a_type, a_field, (a_node), &(a_rbt)->rbt_nil); \
rbtn_red_set(a_type, a_field, (a_node)); \
} while (0)
+#endif
/* Tree initializer. */
#define rb_new(a_type, a_field, a_rbt) do { \