]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: make evacDst a top level type
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 18 Aug 2017 01:25:54 +0000 (18:25 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 18 Aug 2017 18:21:10 +0000 (18:21 +0000)
This will reduce duplication when evacuate is specialized.

Change-Id: I34cdfb7103442d3e0ea908c970fb46334b86d5c4
Reviewed-on: https://go-review.googlesource.com/56934
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Avelino <t@avelino.xxx>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/runtime/hashmap.go

index f53f7087d8e50253743d1f184d9747a8a6a62fd2..17a69646ca07156e51e97239c8543668a175e1a5 100644 (file)
@@ -1021,6 +1021,14 @@ func bucketEvacuated(t *maptype, h *hmap, bucket uintptr) bool {
        return evacuated(b)
 }
 
+// evacDst is an evacuation destination.
+type evacDst struct {
+       b *bmap          // current destination bucket
+       i int            // key/val index into b
+       k unsafe.Pointer // pointer to current key storage
+       v unsafe.Pointer // pointer to current value storage
+}
+
 func evacuate(t *maptype, h *hmap, oldbucket uintptr) {
        b := (*bmap)(add(h.oldbuckets, oldbucket*uintptr(t.bucketsize)))
        newbit := h.noldbuckets()
@@ -1028,14 +1036,6 @@ func evacuate(t *maptype, h *hmap, oldbucket uintptr) {
                // TODO: reuse overflow buckets instead of using new ones, if there
                // is no iterator using the old buckets.  (If !oldIterator.)
 
-               // evacDst is an evacuation destination.
-               type evacDst struct {
-                       b *bmap          // current destination bucket
-                       i int            // key/val index into b
-                       k unsafe.Pointer // pointer to current key storage
-                       v unsafe.Pointer // pointer to current value storage
-               }
-
                // xy contains the x and y (low and high) evacuation destinations.
                var xy [2]evacDst
                x := &xy[0]