summaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-10-07 11:06:51 -0400
committerRuss Cox <rsc@golang.org>2014-10-07 11:06:51 -0400
commit44ae5998770a185d1f8518b6917e1c094bc62a19 (patch)
tree272222847117acc2ce64d1a80d36777e72fb975b /src/reflect
parent049be2f16a585e45be4d8fe17660a537934488ee (diff)
downloadgo-44ae5998770a185d1f8518b6917e1c094bc62a19.tar.gz
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 issue 8864. LGTM=r R=golang-codereviews, dvyukov, r CC=golang-codereviews, iant, khr, rlh https://codereview.appspot.com/155820043
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/type.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/reflect/type.go b/src/reflect/type.go
index f099546d2..a36c0ba60 100644
--- a/src/reflect/type.go
+++ b/src/reflect/type.go
@@ -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))