]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: CSE some function arguments in evacuate
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 7 Jun 2017 18:35:17 +0000 (11:35 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 14 Aug 2017 00:51:14 +0000 (00:51 +0000)
Shrinks evacuate's machine code a little.

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

index e8e61a7fd15dc8f515b512f8a254c63fcd9c3132..c36ff470d6bd0c6d7844d813b901d9b6c2e7d209 100644 (file)
@@ -1166,10 +1166,12 @@ func evacuate(t *maptype, h *hmap, oldbucket uintptr) {
                        b = (*bmap)(add(h.oldbuckets, oldbucket*uintptr(t.bucketsize)))
                        // Preserve b.tophash because the evacuation
                        // state is maintained there.
+                       ptr := add(unsafe.Pointer(b), dataOffset)
+                       n := uintptr(t.bucketsize) - dataOffset
                        if t.bucket.kind&kindNoPointers == 0 {
-                               memclrHasPointers(add(unsafe.Pointer(b), dataOffset), uintptr(t.bucketsize)-dataOffset)
+                               memclrHasPointers(ptr, n)
                        } else {
-                               memclrNoHeapPointers(add(unsafe.Pointer(b), dataOffset), uintptr(t.bucketsize)-dataOffset)
+                               memclrNoHeapPointers(ptr, n)
                        }
                }
        }