From: Dmitriy Vyukov Date: Sun, 7 Apr 2013 03:02:03 +0000 (-0700) Subject: runtime: replace union in MHeap with a struct X-Git-Tag: go1.1rc2~161 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=cfe336770b684ba1a4806772d23e9d178f9b4003;p=gostls13.git 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 --- diff --git a/src/pkg/runtime/malloc.h b/src/pkg/runtime/malloc.h index 38122bf8a5..4635e53e09 100644 --- a/src/pkg/runtime/malloc.h +++ b/src/pkg/runtime/malloc.h @@ -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]; diff --git a/src/pkg/runtime/mprof.goc b/src/pkg/runtime/mprof.goc index 707e505ba7..63334e704e 100644 --- a/src/pkg/runtime/mprof.goc +++ b/src/pkg/runtime/mprof.goc @@ -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