]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: tiny refactor in evacuate
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 17 Aug 2017 17:24:13 +0000 (10:24 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 18 Aug 2017 18:20:32 +0000 (18:20 +0000)
Since oldbucket == h.nevacuate, we can just increment h.nevacuate here.
This removes oldbucket from scope, which will be useful shortly.

Change-Id: I70f81ec3995f17845ebf5d77ccd20ea4338f23e6
Reviewed-on: https://go-review.googlesource.com/56932
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 f3434eb788c37418c15c00ccb3e0b550a93355fa..dcaab8c185995c0f1f3883926f008325fbbd7a87 100644 (file)
@@ -1140,7 +1140,7 @@ func evacuate(t *maptype, h *hmap, oldbucket uintptr) {
 
        // Advance evacuation mark
        if oldbucket == h.nevacuate {
-               h.nevacuate = oldbucket + 1
+               h.nevacuate++
                // Experiments suggest that 1024 is overkill by at least an order of magnitude.
                // Put it in there as a safeguard anyway, to ensure O(1) behavior.
                stop := h.nevacuate + 1024