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

Issue 8368044: code review 8368044: runtime: replace union in MHeap with a struct (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 1 month ago by dvyukov
Modified:
12 years, 1 month ago
Reviewers:
bradfitz
CC:
golang-dev, iant
Visibility:
Public.

Description

runtime: replace union in MHeap with a struct Unions break precise GC. Update issue 5193.

Patch Set 1 #

Patch Set 2 : diff -r 7767d71dcc7b https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 3 : diff -r 7767d71dcc7b https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 4 : diff -r 8580ea3506e4 https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 5 : diff -r 8580ea3506e4 https://dvyukov%40google.com@code.google.com/p/go/ #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -2 lines) Patch
M src/pkg/runtime/malloc.h View 1 1 chunk +2 lines, -2 lines 2 comments Download
M src/pkg/runtime/mprof.goc View 1 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 5
dvyukov
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://dvyukov%40google.com@code.google.com/p/go/
12 years, 1 month ago (2013-04-07 01:34:22 UTC) #1
iant
LGTM
12 years, 1 month ago (2013-04-07 03:00:21 UTC) #2
dvyukov
*** Submitted as https://code.google.com/p/go/source/detail?r=b127aaab80eb *** runtime: replace union in MHeap with a struct Unions break ...
12 years, 1 month ago (2013-04-07 03:02:07 UTC) #3
bradfitz
https://codereview.appspot.com/8368044/diff/12001/src/pkg/runtime/malloc.h File src/pkg/runtime/malloc.h (right): https://codereview.appspot.com/8368044/diff/12001/src/pkg/runtime/malloc.h#newcode424 src/pkg/runtime/malloc.h:424: byte pad[CacheLineSize]; why don't you adjust for sizeof(MCentral) like ...
12 years, 1 month ago (2013-04-07 03:31:23 UTC) #4
dvyukov
12 years, 1 month ago (2013-04-07 03:37:17 UTC) #5
Message was sent while issue was closed.
https://codereview.appspot.com/8368044/diff/12001/src/pkg/runtime/malloc.h
File src/pkg/runtime/malloc.h (right):

https://codereview.appspot.com/8368044/diff/12001/src/pkg/runtime/malloc.h#ne...
src/pkg/runtime/malloc.h:424: byte pad[CacheLineSize];
On 2013/04/07 03:31:23, bradfitz wrote:
> why don't you adjust for sizeof(MCentral) like you did elsewhere, now that
it's
> a struct instead of a union?

Actually this version is correct and all others are not (but they were incorrect
before, so it's fine :)). If you use pad[CacheLineSize-sizeof(X)], then it only
works if the array starts at cache line boundary. If it is not, then end one
element is collocated in the same cache line with beginning of the next.
If the array is not aligned to cache line boundary then you need to use
pad[CacheLineSize] to separate them for sure.
Sign in to reply to this message.

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