From: Jeff Preshing Date: Tue, 16 Feb 2016 01:54:07 +0000 (-0500) Subject: Eliminate redundant load in insert constructors X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7f4ec6de1dab3d24cc83217b8a3485c8be8d1378;p=junction.git Eliminate redundant load in insert constructors --- 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 {