]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove handling of non-reflexive key types in evacuate_fastX
authorJosh Bleecher Snyder <josharian@gmail.com>
Sat, 19 Aug 2017 04:17:40 +0000 (21:17 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 28 Aug 2017 18:54:54 +0000 (18:54 +0000)
All of the mapfast key types are reflexive.

Change-Id: I8595aed2a9d945cda1b5d08e2067dce0f1c0d585
Reviewed-on: https://go-review.googlesource.com/59132
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
src/runtime/hashmap_fast.go

index 626b3531f5c17b94deeddda84526cf630f571dea..3315c95ad60cf7e9ed2221e3bda57e51d45fa712 100644 (file)
@@ -827,24 +827,8 @@ func evacuate_fast32(t *maptype, h *hmap, oldbucket uintptr) {
                                        // Compute hash to make our evacuation decision (whether we need
                                        // to send this key/value to bucket x or bucket y).
                                        hash := t.key.alg.hash(k2, uintptr(h.hash0))
-                                       if h.flags&iterator != 0 && !t.reflexivekey && !t.key.alg.equal(k2, k2) {
-                                               // If key != key (NaNs), then the hash could be (and probably
-                                               // will be) entirely different from the old hash. Moreover,
-                                               // it isn't reproducible. Reproducibility is required in the
-                                               // presence of iterators, as our evacuation decision must
-                                               // match whatever decision the iterator made.
-                                               // Fortunately, we have the freedom to send these keys either
-                                               // way. Also, tophash is meaningless for these kinds of keys.
-                                               // We let the low bit of tophash drive the evacuation decision.
-                                               // We recompute a new random tophash for the next level so
-                                               // these keys will get evenly distributed across all buckets
-                                               // after multiple grows.
-                                               useY = top & 1
-                                               top = tophash(hash)
-                                       } else {
-                                               if hash&newbit != 0 {
-                                                       useY = 1
-                                               }
+                                       if hash&newbit != 0 {
+                                               useY = 1
                                        }
                                }
 
@@ -948,24 +932,8 @@ func evacuate_fast64(t *maptype, h *hmap, oldbucket uintptr) {
                                        // Compute hash to make our evacuation decision (whether we need
                                        // to send this key/value to bucket x or bucket y).
                                        hash := t.key.alg.hash(k2, uintptr(h.hash0))
-                                       if h.flags&iterator != 0 && !t.reflexivekey && !t.key.alg.equal(k2, k2) {
-                                               // If key != key (NaNs), then the hash could be (and probably
-                                               // will be) entirely different from the old hash. Moreover,
-                                               // it isn't reproducible. Reproducibility is required in the
-                                               // presence of iterators, as our evacuation decision must
-                                               // match whatever decision the iterator made.
-                                               // Fortunately, we have the freedom to send these keys either
-                                               // way. Also, tophash is meaningless for these kinds of keys.
-                                               // We let the low bit of tophash drive the evacuation decision.
-                                               // We recompute a new random tophash for the next level so
-                                               // these keys will get evenly distributed across all buckets
-                                               // after multiple grows.
-                                               useY = top & 1
-                                               top = tophash(hash)
-                                       } else {
-                                               if hash&newbit != 0 {
-                                                       useY = 1
-                                               }
+                                       if hash&newbit != 0 {
+                                               useY = 1
                                        }
                                }
 
@@ -1069,24 +1037,8 @@ func evacuate_faststr(t *maptype, h *hmap, oldbucket uintptr) {
                                        // Compute hash to make our evacuation decision (whether we need
                                        // to send this key/value to bucket x or bucket y).
                                        hash := t.key.alg.hash(k2, uintptr(h.hash0))
-                                       if h.flags&iterator != 0 && !t.reflexivekey && !t.key.alg.equal(k2, k2) {
-                                               // If key != key (NaNs), then the hash could be (and probably
-                                               // will be) entirely different from the old hash. Moreover,
-                                               // it isn't reproducible. Reproducibility is required in the
-                                               // presence of iterators, as our evacuation decision must
-                                               // match whatever decision the iterator made.
-                                               // Fortunately, we have the freedom to send these keys either
-                                               // way. Also, tophash is meaningless for these kinds of keys.
-                                               // We let the low bit of tophash drive the evacuation decision.
-                                               // We recompute a new random tophash for the next level so
-                                               // these keys will get evenly distributed across all buckets
-                                               // after multiple grows.
-                                               useY = top & 1
-                                               top = tophash(hash)
-                                       } else {
-                                               if hash&newbit != 0 {
-                                                       useY = 1
-                                               }
+                                       if hash&newbit != 0 {
+                                               useY = 1
                                        }
                                }