diff options
| author | Josh Bleecher Snyder <josharian@gmail.com> | 2017-04-13 05:25:20 -0700 |
|---|---|---|
| committer | Josh Bleecher Snyder <josharian@gmail.com> | 2017-04-19 13:41:44 +0000 |
| commit | 619af172055dccfd92a87ec116236ef3a885ac2c (patch) | |
| tree | c864325673e2b16b307e73e804307d2771964ad2 /src/runtime/hashmap_fast.go | |
| parent | dc444418d919b72f7744a521cc898252f3f355df (diff) | |
| download | go-619af172055dccfd92a87ec116236ef3a885ac2c.tar.xz | |
runtime: refactor hmap setoverflow into newoverflow
This simplifies the code, as well as providing
a single place to modify to change the
allocation of new overflow buckets.
Updates #19931
Updates #19992
Change-Id: I77070619f5c8fe449bbc35278278bca5eda780f2
Reviewed-on: https://go-review.googlesource.com/40975
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/hashmap_fast.go')
| -rw-r--r-- | src/runtime/hashmap_fast.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/runtime/hashmap_fast.go b/src/runtime/hashmap_fast.go index 0a625cca56..ebba001d46 100644 --- a/src/runtime/hashmap_fast.go +++ b/src/runtime/hashmap_fast.go @@ -490,8 +490,7 @@ again: if inserti == nil { // all current buckets are full, allocate a new one. - newb := (*bmap)(newobject(t.bucket)) - h.setoverflow(t, b, newb) + newb := h.newoverflow(t, b) inserti = &newb.tophash[0] insertk = add(unsafe.Pointer(newb), dataOffset) val = add(insertk, bucketCnt*4) @@ -579,8 +578,7 @@ again: if inserti == nil { // all current buckets are full, allocate a new one. - newb := (*bmap)(newobject(t.bucket)) - h.setoverflow(t, b, newb) + newb := h.newoverflow(t, b) inserti = &newb.tophash[0] insertk = add(unsafe.Pointer(newb), dataOffset) val = add(insertk, bucketCnt*8) @@ -673,8 +671,7 @@ again: if inserti == nil { // all current buckets are full, allocate a new one. - newb := (*bmap)(newobject(t.bucket)) - h.setoverflow(t, b, newb) + newb := h.newoverflow(t, b) inserti = &newb.tophash[0] insertk = add(unsafe.Pointer(newb), dataOffset) val = add(insertk, bucketCnt*2*sys.PtrSize) |
