]> Cypherpunks repositories - gostls13.git/commit
runtime: cut struct Hmap back to 48-byte allocation
authorRuss Cox <rsc@golang.org>
Wed, 31 Jul 2013 02:48:03 +0000 (22:48 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 31 Jul 2013 02:48:03 +0000 (22:48 -0400)
commit4042b77776fe59c8cff23849745fe9e17146fa66
tree9d3055e226c3e30472a5e13554692fb2810619b7
parent3abaf5cae0557452264272331c7a7e308e14258f
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
src/pkg/runtime/hashmap.c
src/pkg/runtime/map_test.go