mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: split advanceEvacuationMark from evacuate
Minor refactoring. This is a step towards specializing evacuate for mapfast key types. Change-Id: Icffe2759b7d38e5c008d03941918d5a912ce62f6 Reviewed-on: https://go-review.googlesource.com/56933 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
43d4c9f4f1
commit
e0b34e7be7
1 changed files with 23 additions and 20 deletions
|
|
@ -1138,8 +1138,12 @@ func evacuate(t *maptype, h *hmap, oldbucket uintptr) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Advance evacuation mark
|
|
||||||
if oldbucket == h.nevacuate {
|
if oldbucket == h.nevacuate {
|
||||||
|
advanceEvacuationMark(h, t, newbit)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func advanceEvacuationMark(h *hmap, t *maptype, newbit uintptr) {
|
||||||
h.nevacuate++
|
h.nevacuate++
|
||||||
// Experiments suggest that 1024 is overkill by at least an order of magnitude.
|
// 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.
|
// Put it in there as a safeguard anyway, to ensure O(1) behavior.
|
||||||
|
|
@ -1161,7 +1165,6 @@ func evacuate(t *maptype, h *hmap, oldbucket uintptr) {
|
||||||
}
|
}
|
||||||
h.flags &^= sameSizeGrow
|
h.flags &^= sameSizeGrow
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ismapkey(t *_type) bool {
|
func ismapkey(t *_type) bool {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue