Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(746)

Issue 12034047: code review 12034047: runtime: cut struct Hmap back to 48-byte allocation (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 11 months ago by rsc
Modified:
11 years, 11 months ago
Reviewers:
khr1, dvyukov
CC:
golang-dev, khr, khr1, bradfitz, dvyukov
Visibility:
Public.

Description

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 issue 5237.

Patch Set 1 #

Patch Set 2 : diff -r 3fd9ca3ab815 https://code.google.com/p/go/ #

Patch Set 3 : diff -r 3fd9ca3ab815 https://code.google.com/p/go/ #

Patch Set 4 : diff -r 3fd9ca3ab815 https://code.google.com/p/go/ #

Patch Set 5 : diff -r a4702a268683 https://code.google.com/p/go/ #

Patch Set 6 : diff -r a4702a268683 https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+39 lines, -1 line) Patch
M src/pkg/runtime/hashmap.c View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/runtime/map_test.go View 1 2 3 4 5 1 chunk +38 lines, -0 lines 0 comments Download

Messages

Total messages: 5
rsc
Hello golang-dev@googlegroups.com, khr (cc: bradfitz, dvyukov, golang-dev@googlegroups.com), I'd like you to review this change to ...
11 years, 11 months ago (2013-07-30 19:13:32 UTC) #1
khr1
LGTM. On Tue, Jul 30, 2013 at 12:13 PM, <rsc@golang.org> wrote: > Reviewers: golang-dev1, khr, ...
11 years, 11 months ago (2013-07-30 19:20:11 UTC) #2
dvyukov
LGTM
11 years, 11 months ago (2013-07-30 19:34:33 UTC) #3
bradfitz
Also include something like: ? diff -r f04c9f103e15 src/pkg/runtime/map_test.go --- a/src/pkg/runtime/map_test.go Tue Jul 30 19:47:16 ...
11 years, 11 months ago (2013-07-30 19:41:56 UTC) #4
rsc
11 years, 11 months ago (2013-07-31 02:48:07 UTC) #5
*** Submitted as https://code.google.com/p/go/source/detail?r=e21e678c5c66 ***

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 issue 5237.

R=golang-dev, khr, khr
CC=bradfitz, dvyukov, golang-dev
https://codereview.appspot.com/12034047
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b