Commit cfe33677 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

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
parent 54340bf5
......@@ -416,10 +416,10 @@ struct MHeap
byte *arena_end;
// 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
// gets its own cache line.
union {
struct {
MCentral;
byte pad[CacheLineSize];
} central[NumSizeClasses];
......
......@@ -61,6 +61,8 @@ struct Bucket
Bucket *next; // next in hash list
Bucket *allnext; // next in list of all mbuckets/bbuckets
int32 typ;
// Generally unions can break precise GC,
// this one is fine because it does not contain pointers.
union
{
struct // typ == MProf
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment