diff options
Diffstat (limited to 'src/runtime/hashmap.go')
| -rw-r--r-- | src/runtime/hashmap.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/runtime/hashmap.go b/src/runtime/hashmap.go index f537098854..dee5dd5816 100644 --- a/src/runtime/hashmap.go +++ b/src/runtime/hashmap.go @@ -281,7 +281,16 @@ func makemap64(t *maptype, hint int64, h *hmap) *hmap { return makemap(t, int(hint), h) } -// makemap implements a Go map creation make(map[k]v, hint) +// makehmap_small implements Go map creation for make(map[k]v) and +// make(map[k]v, hint) when hint is known to be at most bucketCnt +// at compile time and the map needs to be allocated on the heap. +func makemap_small() *hmap { + h := new(hmap) + h.hash0 = fastrand() + return h +} + +// makemap implements Go map creation for make(map[k]v, hint). // If the compiler has determined that the map or the first bucket // can be created on the stack, h and/or bucket may be non-nil. // If h != nil, the map can be created directly in h. |
