From 7f4ec6de1dab3d24cc83217b8a3485c8be8d1378 Mon Sep 17 00:00:00 2001 From: Jeff Preshing <filter-github@preshing.com> Date: Mon, 15 Feb 2016 20:54:07 -0500 Subject: [PATCH] Eliminate redundant load in insert constructors --- junction/ConcurrentMap_LeapFrog.h | 9 ++++----- junction/ConcurrentMap_Linear.h | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/junction/ConcurrentMap_LeapFrog.h b/junction/ConcurrentMap_LeapFrog.h index f6b1e6c..bfbef61 100644 --- a/junction/ConcurrentMap_LeapFrog.h +++ b/junction/ConcurrentMap_LeapFrog.h @@ -74,7 +74,7 @@ public: // Constructor: Find existing cell Mutator(ConcurrentMap_LeapFrog& map, Key key, bool) : m_map(map), m_value(Value(ValueTraits::NullValue)) { - TURF_TRACE(ConcurrentMap_LeapFrog, 0, "[Mutator] find constructor called", uptr(m_table), uptr(key)); + TURF_TRACE(ConcurrentMap_LeapFrog, 0, "[Mutator] find constructor called", uptr(0), uptr(key)); Hash hash = KeyTraits::hash(key); for (;;) { m_table = m_map.m_root.load(turf::Consume); @@ -92,9 +92,8 @@ public: } // Constructor: Insert cell - Mutator(ConcurrentMap_LeapFrog& map, Key key) - : m_map(map), m_table(map.m_root.load(turf::Consume)), m_value(Value(ValueTraits::NullValue)) { - TURF_TRACE(ConcurrentMap_LeapFrog, 2, "[Mutator] insert constructor called", uptr(m_table), uptr(key)); + Mutator(ConcurrentMap_LeapFrog& map, Key key) : m_map(map), m_value(Value(ValueTraits::NullValue)) { + TURF_TRACE(ConcurrentMap_LeapFrog, 2, "[Mutator] insert constructor called", uptr(0), uptr(key)); Hash hash = KeyTraits::hash(key); for (;;) { m_table = m_map.m_root.load(turf::Consume); @@ -319,7 +318,7 @@ public: } // That's the end of the map. m_hash = KeyTraits::NullHash; - m_value = ValueTraits::NullValue; + m_value = Value(ValueTraits::NullValue); } bool isValid() const { diff --git a/junction/ConcurrentMap_Linear.h b/junction/ConcurrentMap_Linear.h index b93d86e..387fb6c 100644 --- a/junction/ConcurrentMap_Linear.h +++ b/junction/ConcurrentMap_Linear.h @@ -74,7 +74,7 @@ public: // Constructor: Find existing cell Mutator(ConcurrentMap_Linear& map, Key key, bool) : m_map(map), m_value(Value(ValueTraits::NullValue)) { - TURF_TRACE(ConcurrentMap_Linear, 0, "[Mutator] find constructor called", uptr(m_table), uptr(key)); + TURF_TRACE(ConcurrentMap_Linear, 0, "[Mutator] find constructor called", uptr(0), uptr(key)); Hash hash = KeyTraits::hash(key); for (;;) { m_table = m_map.m_root.load(turf::Consume); @@ -92,9 +92,8 @@ public: } // Constructor: Insert cell - Mutator(ConcurrentMap_Linear& map, Key key) - : m_map(map), m_table(map.m_root.load(turf::Consume)), m_value(Value(ValueTraits::NullValue)) { - TURF_TRACE(ConcurrentMap_Linear, 2, "[Mutator] insert constructor called", uptr(m_table), uptr(key)); + Mutator(ConcurrentMap_Linear& map, Key key) : m_map(map), m_value(Value(ValueTraits::NullValue)) { + TURF_TRACE(ConcurrentMap_Linear, 2, "[Mutator] insert constructor called", uptr(0), uptr(key)); Hash hash = KeyTraits::hash(key); bool mustDouble = false; for (;;) { @@ -321,7 +320,7 @@ public: } // That's the end of the map. m_hash = KeyTraits::NullHash; - m_value = ValueTraits::NullValue; + m_value = Value(ValueTraits::NullValue); } bool isValid() const { -- 2.34.1