Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/jemalloc/include/jemalloc/internal Fix debuggin...



details:   https://anonhg.NetBSD.org/src/rev/388bc20c8453
branches:  trunk
changeset: 839771:388bc20c8453
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Mar 05 22:45:11 2019 +0000

description:
Fix debugging compilation

diffstat:

 external/bsd/jemalloc/include/jemalloc/internal/mutex.h   |  42 ++++++++++-----
 external/bsd/jemalloc/include/jemalloc/internal/witness.h |   6 +-
 2 files changed, 31 insertions(+), 17 deletions(-)

diffs (85 lines):

diff -r 9f5c1580927f -r 388bc20c8453 external/bsd/jemalloc/include/jemalloc/internal/mutex.h
--- a/external/bsd/jemalloc/include/jemalloc/internal/mutex.h   Tue Mar 05 22:39:21 2019 +0000
+++ b/external/bsd/jemalloc/include/jemalloc/internal/mutex.h   Tue Mar 05 22:45:11 2019 +0000
@@ -61,6 +61,9 @@
 #if defined(JEMALLOC_DEBUG)
        witness_t                       witness;
        malloc_mutex_lock_order_t       lock_order;
+#define LOCK_ORDER_INITIALIZER(field, a)       field = a,
+#else
+#define LOCK_ORDER_INITIALIZER(field, a)
 #endif
 };
 
@@ -97,24 +100,35 @@
 #ifdef _WIN32
 #  define MALLOC_MUTEX_INITIALIZER
 #elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
-#  define MALLOC_MUTEX_INITIALIZER                                     \
-     {{{MUTEX_PROF_DATA_INITIALIZER, OS_UNFAIR_LOCK_INIT}},            \
-      WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT)}
+#  define MALLOC_MUTEX_INITIALIZER {{{                                 \
+       .prof_data = MUTEX_PROF_DATA_INITIALIZER,                       \
+       .lock = OS_UNFAIR_LOCK_INIT,                                    \
+       }},                                                             \
+       WITNESS_INITIALIZER(.witness, "mutex", WITNESS_RANK_OMIT)       \
+       LOCK_ORDER_INITIALIZER(.lock_order, malloc_mutex_rank_exclusive)}
 #elif (defined(JEMALLOC_OSSPIN))
-#  define MALLOC_MUTEX_INITIALIZER                                     \
-     {{{MUTEX_PROF_DATA_INITIALIZER, 0}},                              \
-      WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT)}
+#  define MALLOC_MUTEX_INITIALIZER {{{                                 \
+       .prof_data = MUTEX_PROF_DATA_INITIALIZER,                       \
+       .lock = 0,                                                      \
+       }},                                                             \
+       WITNESS_INITIALIZER(.witness, "mutex", WITNESS_RANK_OMIT)       \
+       LOCK_ORDER_INITIALIZER(.lock_order, malloc_mutex_rank_exclusive)}
 #elif (defined(JEMALLOC_MUTEX_INIT_CB))
-#  define MALLOC_MUTEX_INITIALIZER                                     \
-     {{{MUTEX_PROF_DATA_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, NULL}},        \
-      WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT)}
+#  define MALLOC_MUTEX_INITIALIZER {{{                                 \
+       .prof_data = MUTEX_PROF_DATA_INITIALIZER,                       \
+       .lock = PTHREAD_MUTEX_INITIALIZER,                              \
+       .postponed_next = NULL,                                         \
+       }},     \
+       WITNESS_INITIALIZER(.witness, "mutex", WITNESS_RANK_OMIT)       \
+       LOCK_ORDER_INITIALIZER(.lock_order, malloc_mutex_rank_exclusive)}
 #else
 #    define MALLOC_MUTEX_TYPE PTHREAD_MUTEX_DEFAULT
-#    define MALLOC_MUTEX_INITIALIZER {{{ \
-       .prof_data = MUTEX_PROF_DATA_INITIALIZER, \
-       .lock = PTHREAD_MUTEX_INITIALIZER, \
-       }},     \
-        WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT)}
+#    define MALLOC_MUTEX_INITIALIZER {{{                               \
+       .prof_data = MUTEX_PROF_DATA_INITIALIZER,                       \
+       .lock = PTHREAD_MUTEX_INITIALIZER,                              \
+       }},                                                             \
+        WITNESS_INITIALIZER(.witness, "mutex", WITNESS_RANK_OMIT)      \
+       LOCK_ORDER_INITIALIZER(.lock_order, malloc_mutex_rank_exclusive)}
 #endif
 
 #ifdef JEMALLOC_LAZY_LOCK
diff -r 9f5c1580927f -r 388bc20c8453 external/bsd/jemalloc/include/jemalloc/internal/witness.h
--- a/external/bsd/jemalloc/include/jemalloc/internal/witness.h Tue Mar 05 22:39:21 2019 +0000
+++ b/external/bsd/jemalloc/include/jemalloc/internal/witness.h Tue Mar 05 22:45:11 2019 +0000
@@ -65,15 +65,15 @@
 /* PER-WITNESS DATA */
 /******************************************************************************/
 #if defined(JEMALLOC_DEBUG)
-#  define WITNESS_INITIALIZER(_name, _rank) { \
+#  define WITNESS_INITIALIZER(_field, _name, _rank) _field = { \
        .name = _name, \
        .rank = _rank, \
        .comp = NULL, \
        .opaque = NULL, \
        .link = { .qre_prev = NULL, .qre_next = NULL }, \
-}
+},
 #else
-#  define WITNESS_INITIALIZER(name, rank)
+#  define WITNESS_INITIALIZER(field, name, rank)
 #endif
 
 typedef struct witness_s witness_t;



Home | Main Index | Thread Index | Old Index