Commit 776c33ee authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

runtime: make evacDst a top level type

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: default avatarDaniel Martí <mvdan@mvdan.cc>
Reviewed-by: default avatarAvelino <t@avelino.xxx>
Reviewed-by: default avatarKeith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent e0b34e7b
...@@ -1021,6 +1021,14 @@ func bucketEvacuated(t *maptype, h *hmap, bucket uintptr) bool { ...@@ -1021,6 +1021,14 @@ func bucketEvacuated(t *maptype, h *hmap, bucket uintptr) bool {
return evacuated(b) 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) { func evacuate(t *maptype, h *hmap, oldbucket uintptr) {
b := (*bmap)(add(h.oldbuckets, oldbucket*uintptr(t.bucketsize))) b := (*bmap)(add(h.oldbuckets, oldbucket*uintptr(t.bucketsize)))
newbit := h.noldbuckets() newbit := h.noldbuckets()
...@@ -1028,14 +1036,6 @@ func evacuate(t *maptype, h *hmap, oldbucket uintptr) { ...@@ -1028,14 +1036,6 @@ func evacuate(t *maptype, h *hmap, oldbucket uintptr) {
// TODO: reuse overflow buckets instead of using new ones, if there // TODO: reuse overflow buckets instead of using new ones, if there
// is no iterator using the old buckets. (If !oldIterator.) // 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. // xy contains the x and y (low and high) evacuation destinations.
var xy [2]evacDst var xy [2]evacDst
x := &xy[0] x := &xy[0]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment