mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: remove type-punning for Type.gc[0], gc[1]
Depending on flags&KindGCProg, gc[0] and gc[1] are either pointers or inlined bitmap bits. That's not compatible with a precise garbage collector: it needs to be always pointers or never pointers. Change the inlined bitmap case to store a pointer to an out-of-line bitmap in gc[0]. The out-of-line bitmaps are dedup'ed, so that for example all pointer types share the same out-of-line bitmap. Fixes #8864. LGTM=r R=golang-codereviews, dvyukov, r CC=golang-codereviews, iant, khr, rlh https://golang.org/cl/155820043
This commit is contained in:
parent
f739b77508
commit
18172c42ff
5 changed files with 30 additions and 8 deletions
|
|
@ -1523,8 +1523,8 @@ func (gc *gcProg) appendProg(t *rtype) {
|
|||
// The program is stored in t.gc[0], skip unroll flag.
|
||||
prog = (*[1 << 30]byte)(unsafe.Pointer(t.gc[0]))[1:]
|
||||
} else {
|
||||
// The mask is embed directly in t.gc.
|
||||
prog = (*[1 << 30]byte)(unsafe.Pointer(&t.gc[0]))[:]
|
||||
// The mask is linked directly in t.gc.
|
||||
prog = (*[2 * ptrSize]byte)(unsafe.Pointer(t.gc[0]))[:]
|
||||
}
|
||||
for i := uintptr(0); i < nptr; i++ {
|
||||
gc.appendWord(extractGCWord(prog, i))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue