• Josh Bleecher Snyder's avatar
    runtime: convert hmap.overflow into hmap.extra · a41b1d50
    Josh Bleecher Snyder authored
    Any change to how we allocate overflow buckets
    will require some extra hmap storage,
    but we don't want hmap to grow,
    particular as small maps usually don't need overflow buckets.
    
    This CL converts the existing hmap overflow field,
    which is usually used for pointer-free maps,
    into a generic extra field.
    
    This extra field can be used to hold data that is optional.
    If it is valuable enough to do have special
    handling of overflow buckets, which are medium-sized,
    it is valuable enough to pay an extra alloc and two extra words for.
    
    Adding fields to extra would entail adding overhead to pointer-free maps;
    any mapextra fields added would need to be weighed against that.
    This CL is just rearrangement, though.
    
    Updates #19931
    Updates #19992
    
    Change-Id: If8537a206905b9d4dc6cd9d886184ece671b3f80
    Reviewed-on: https://go-review.googlesource.com/40976
    Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    a41b1d50
hashmap.go 36.4 KB