mirror of
https://github.com/golang/go
synced 2024-11-19 14:24:47 -07:00
runtime: replace some uses of newarray with newobject for maps
This avoids the never triggered capacity checks in newarray. Change-Id: Ib72b204adcb9e3fd3ab963defe0cd40e22d5d492 Reviewed-on: https://go-review.googlesource.com/54731 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
7df29b50b2
commit
248a7c7c42
@ -542,7 +542,7 @@ func mapassign(t *maptype, h *hmap, key unsafe.Pointer) unsafe.Pointer {
|
||||
h.flags |= hashWriting
|
||||
|
||||
if h.buckets == nil {
|
||||
h.buckets = newarray(t.bucket, 1)
|
||||
h.buckets = newobject(t.bucket) // newarray(t.bucket, 1)
|
||||
}
|
||||
|
||||
again:
|
||||
|
@ -426,7 +426,7 @@ func mapassign_fast32(t *maptype, h *hmap, key uint32) unsafe.Pointer {
|
||||
h.flags |= hashWriting
|
||||
|
||||
if h.buckets == nil {
|
||||
h.buckets = newarray(t.bucket, 1)
|
||||
h.buckets = newobject(t.bucket) // newarray(t.bucket, 1)
|
||||
}
|
||||
|
||||
again:
|
||||
@ -514,7 +514,7 @@ func mapassign_fast64(t *maptype, h *hmap, key uint64) unsafe.Pointer {
|
||||
h.flags |= hashWriting
|
||||
|
||||
if h.buckets == nil {
|
||||
h.buckets = newarray(t.bucket, 1)
|
||||
h.buckets = newobject(t.bucket) // newarray(t.bucket, 1)
|
||||
}
|
||||
|
||||
again:
|
||||
@ -603,7 +603,7 @@ func mapassign_faststr(t *maptype, h *hmap, ky string) unsafe.Pointer {
|
||||
h.flags |= hashWriting
|
||||
|
||||
if h.buckets == nil {
|
||||
h.buckets = newarray(t.bucket, 1)
|
||||
h.buckets = newobject(t.bucket) // newarray(t.bucket, 1)
|
||||
}
|
||||
|
||||
again:
|
||||
|
Loading…
Reference in New Issue
Block a user