Skip to content

Commit 900d1d6

Browse files
committed
Disable hashmap memory fence.
1 parent 84c7dda commit 900d1d6

2 files changed

Lines changed: 19 additions & 19 deletions

File tree

include/bitcoin/database/impl/primitives/hashhead.ipp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,15 @@ inline Link CLASS::top(const Link& index) const NOEXCEPT
129129
if (is_null(raw))
130130
return {};
131131

132-
if constexpr (Align)
133-
{
134-
// Reads full padded word.
135-
// xcode clang++16 does not support C++20 std::atomic_ref.
136-
////const std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
137-
const auto& head = *pointer_cast<std::atomic<integer>>(raw);
138-
return head.load(std::memory_order_acquire);
139-
}
140-
else
132+
////if constexpr (Align)
133+
////{
134+
//// // Reads full padded word.
135+
//// // xcode clang++16 does not support C++20 std::atomic_ref.
136+
//// ////const std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
137+
//// const auto& head = *pointer_cast<std::atomic<integer>>(raw);
138+
//// return head.load(std::memory_order_acquire);
139+
////}
140+
////else
141141
{
142142
const auto& head = to_array<size_>(raw);
143143
mutex_.lock_shared();
@@ -163,15 +163,15 @@ inline bool CLASS::push(const Link& current, bytes& next,
163163
if (is_null(raw))
164164
return false;
165165

166-
if constexpr (Align)
167-
{
168-
// Writes full padded word (0x00 fill).
169-
// xcode clang++16 does not support C++20 std::atomic_ref.
170-
////const std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
171-
auto& head = *pointer_cast<std::atomic<integer>>(raw);
172-
next = Link(head.exchange(current, std::memory_order_acq_rel));
173-
}
174-
else
166+
////if constexpr (Align)
167+
////{
168+
//// // Writes full padded word (0x00 fill).
169+
//// // xcode clang++16 does not support C++20 std::atomic_ref.
170+
//// ////const std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
171+
//// auto& head = *pointer_cast<std::atomic<integer>>(raw);
172+
//// next = Link(head.exchange(current, std::memory_order_acq_rel));
173+
////}
174+
////else
175175
{
176176
auto& head = to_array<size_>(raw);
177177
mutex_.lock();

include/bitcoin/database/primitives/hashhead.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class hashhead
6767
private:
6868
using integer = Link::integer;
6969
static_assert(std::atomic<integer>::is_always_lock_free);
70-
static constexpr auto size_ = Align ? sizeof(integer) : Link::size;
70+
static constexpr auto size_ = /*Align ? sizeof(integer) :*/ Link::size;
7171

7272
template <size_t Bytes>
7373
static inline auto& to_array(memory::iterator it) NOEXCEPT

0 commit comments

Comments
 (0)