Skip to content

Commit ca4a8f1

Browse files
committed
a
1 parent 1fb932d commit ca4a8f1

File tree

5 files changed

+10
-35
lines changed

5 files changed

+10
-35
lines changed

benchmark/benchmark.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ UMF_BENCHMARK_TEMPLATE_DEFINE(multiple_malloc_free_benchmark,
9696
pool_allocator<disjoint_pool<os_provider>>);
9797
UMF_BENCHMARK_REGISTER_F(multiple_malloc_free_benchmark, disjoint_pool_uniform)
9898
->Apply(&default_multiple_alloc_uniform_size)
99-
->Apply(&singlethreaded)
10099
->Apply(&multithreaded);
101100

102101
#ifdef UMF_POOL_JEMALLOC_ENABLED

src/critnib/critnib.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ struct critnib_leaf {
119119

120120
struct critnib {
121121
struct critnib_node *root;
122-
uint64_t remove_count;
123122

124123
/* pool of freed nodes: singly linked list, next at child[0] */
125124
struct critnib_node *deleted_node;
@@ -129,6 +128,8 @@ struct critnib {
129128
struct critnib_node *pending_del_nodes[DELETED_LIFE];
130129
struct critnib_leaf *pending_del_leaves[DELETED_LIFE];
131130

131+
uint64_t remove_count;
132+
132133
struct utils_mutex_t mutex; /* writes/removes */
133134
};
134135

src/pool/pool_disjoint.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ static bool bucket_can_pool(bucket_t *bucket) {
444444
&bucket->shared_limits->total_size, size_to_add);
445445

446446
if (previous_size + size_to_add <= bucket->shared_limits->max_size) {
447-
448447
++bucket->chunked_slabs_in_pool;
449448
bucket_update_stats(bucket, -1, 1);
450449
return true;

src/utils/utils_concurrency.h

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,12 @@
2121
#include "utils_windows_intrin.h"
2222

2323
#pragma intrinsic(_BitScanForward64)
24-
#else
25-
#include <pthread.h>
24+
#else // !_WIN32
2625

27-
#ifndef __cplusplus
26+
#include <pthread.h>
2827
#include <stdatomic.h>
29-
#else /* __cplusplus */
30-
#include <atomic>
31-
#define _Atomic(X) std::atomic<X>
32-
33-
using std::memory_order_acq_rel;
34-
using std::memory_order_acquire;
35-
using std::memory_order_relaxed;
36-
using std::memory_order_release;
3728

38-
#endif /* __cplusplus */
39-
40-
#endif /* _WIN32 */
29+
#endif /* !_WIN32 */
4130

4231
#include "utils_common.h"
4332
#include "utils_sanitizers.h"
@@ -118,14 +107,6 @@ static __inline void utils_atomic_load_acquire_ptr(void **ptr, void **out) {
118107
*(uintptr_t *)out = ret;
119108
}
120109

121-
static __inline void utils_atomic_store_release_u64(uint64_t *ptr,
122-
uint64_t *val) {
123-
ASSERT_IS_ALIGNED((uintptr_t)ptr, 8);
124-
ASSERT_IS_ALIGNED((uintptr_t)val, 8);
125-
utils_annotate_release(ptr);
126-
InterlockedExchange64((LONG64 volatile *)ptr, *(LONG64 *)val);
127-
}
128-
129110
static __inline void utils_atomic_store_release_ptr(void **ptr, void *val) {
130111
ASSERT_IS_ALIGNED((uintptr_t)ptr, 8);
131112
utils_annotate_release(ptr);
@@ -146,14 +127,12 @@ static __inline uint64_t utils_atomic_decrement_u64(uint64_t *ptr) {
146127

147128
static __inline uint64_t utils_fetch_and_add_u64(uint64_t *ptr, uint64_t val) {
148129
ASSERT_IS_ALIGNED((uintptr_t)ptr, 8);
149-
ASSERT_IS_ALIGNED((uintptr_t)&val, 8);
150130
// return the value that had previously been in *ptr
151131
return InterlockedExchangeAdd64((LONG64 volatile *)(ptr), val);
152132
}
153133

154134
static __inline uint64_t utils_fetch_and_sub_u64(uint64_t *ptr, uint64_t val) {
155135
ASSERT_IS_ALIGNED((uintptr_t)ptr, 8);
156-
ASSERT_IS_ALIGNED((uintptr_t)&val, 8);
157136
// return the value that had previously been in *ptr
158137
// NOTE: on Windows there is no *Sub* version of InterlockedExchange
159138
return InterlockedExchangeAdd64((LONG64 volatile *)(ptr), -(LONG64)val);
@@ -203,14 +182,6 @@ static inline void utils_atomic_load_acquire_ptr(void **ptr, void **out) {
203182
utils_annotate_acquire((void *)ptr);
204183
}
205184

206-
static inline void utils_atomic_store_release_u64(uint64_t *ptr,
207-
uint64_t *val) {
208-
ASSERT_IS_ALIGNED((uintptr_t)ptr, 8);
209-
ASSERT_IS_ALIGNED((uintptr_t)val, 8);
210-
utils_annotate_release(ptr);
211-
__atomic_store(ptr, val, memory_order_release);
212-
}
213-
214185
static inline void utils_atomic_store_release_ptr(void **ptr, void *val) {
215186
ASSERT_IS_ALIGNED((uintptr_t)ptr, 8);
216187
utils_annotate_release(ptr);

test/common/base.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212

1313
#include <gtest/gtest.h>
1414

15+
using std::memory_order_acq_rel;
16+
using std::memory_order_acquire;
17+
using std::memory_order_relaxed;
18+
using std::memory_order_release;
19+
1520
namespace umf_test {
1621

1722
#define IS_SKIPPED_OR_FAILED() (HasFatalFailure() || IsSkipped())

0 commit comments

Comments
 (0)