diff options
| author | Russ Cox <rsc@golang.org> | 2013-07-30 22:48:03 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2013-07-30 22:48:03 -0400 |
| commit | 4042b77776fe59c8cff23849745fe9e17146fa66 (patch) | |
| tree | 9d3055e226c3e30472a5e13554692fb2810619b7 /src/pkg/runtime/hashmap.c | |
| parent | 3abaf5cae0557452264272331c7a7e308e14258f (diff) | |
| download | go-4042b77776fe59c8cff23849745fe9e17146fa66.tar.xz | |
runtime: cut struct Hmap back to 48-byte allocation
struct Hmap is the header for a map value.
CL 8377046 made flags a uint32 so that it could be updated atomically,
but that bumped the struct to 56 bytes, which allocates as 64 bytes (on amd64).
hash0 is initialized from runtime.fastrand1, which returns a uint32,
so the top 32 bits were always zero anyway. Declare it as a uint32
to reclaim 4 bytes and bring the Hmap size back down to a 48-byte allocation.
Fixes #5237.
R=golang-dev, khr, khr
CC=bradfitz, dvyukov, golang-dev
https://golang.org/cl/12034047
Diffstat (limited to 'src/pkg/runtime/hashmap.c')
| -rw-r--r-- | src/pkg/runtime/hashmap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/runtime/hashmap.c b/src/pkg/runtime/hashmap.c index 898404cba8..b4f940e335 100644 --- a/src/pkg/runtime/hashmap.c +++ b/src/pkg/runtime/hashmap.c @@ -96,12 +96,12 @@ struct Hmap { uintgo count; // # live cells == size of map. Must be first (used by len() builtin) uint32 flags; + uint32 hash0; // hash seed uint8 B; // log_2 of # of buckets (can hold up to LOAD * 2^B items) uint8 keysize; // key size in bytes uint8 valuesize; // value size in bytes uint16 bucketsize; // bucket size in bytes - uintptr hash0; // hash seed byte *buckets; // array of 2^B Buckets. may be nil if count==0. byte *oldbuckets; // previous bucket array of half the size, non-nil only when growing uintptr nevacuate; // progress counter for evacuation (buckets less than this have been evacuated) |
