1
0
mirror of https://github.com/golang/go synced 2024-11-26 08:38:01 -07:00

runtime: replace union in MHeap with a struct

Unions break precise GC.
Update #5193.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8368044
This commit is contained in:
Dmitriy Vyukov 2013-04-06 20:02:03 -07:00
parent 54340bf56f
commit cfe336770b
2 changed files with 4 additions and 2 deletions

View File

@ -416,10 +416,10 @@ struct MHeap
byte *arena_end; byte *arena_end;
// central free lists for small size classes. // central free lists for small size classes.
// the union makes sure that the MCentrals are // the padding makes sure that the MCentrals are
// spaced CacheLineSize bytes apart, so that each MCentral.Lock // spaced CacheLineSize bytes apart, so that each MCentral.Lock
// gets its own cache line. // gets its own cache line.
union { struct {
MCentral; MCentral;
byte pad[CacheLineSize]; byte pad[CacheLineSize];
} central[NumSizeClasses]; } central[NumSizeClasses];

View File

@ -61,6 +61,8 @@ struct Bucket
Bucket *next; // next in hash list Bucket *next; // next in hash list
Bucket *allnext; // next in list of all mbuckets/bbuckets Bucket *allnext; // next in list of all mbuckets/bbuckets
int32 typ; int32 typ;
// Generally unions can break precise GC,
// this one is fine because it does not contain pointers.
union union
{ {
struct // typ == MProf struct // typ == MProf