diff options
| author | Russ Cox <rsc@golang.org> | 2014-08-25 14:38:19 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-08-25 14:38:19 -0400 |
| commit | 613383c7651d490aae045eb70cd515b151735766 (patch) | |
| tree | c77f23bff111b953d23cb7a3bf288116dcca137f /src/pkg/runtime/malloc.h | |
| parent | c6f7c176a3a46ff87d72c4b744bbadf02df1890e (diff) | |
| download | go-613383c7651d490aae045eb70cd515b151735766.tar.xz | |
cmd/gc, runtime: treat slices and strings like pointers in garbage collection
Before, a slice with cap=0 or a string with len=0 might have its
base pointer pointing beyond the actual slice/string data into
the next block. The collector had to ignore slices and strings with
cap=0 in order to avoid misinterpreting the base pointer.
Now, a slice with cap=0 or a string with len=0 still has a base
pointer pointing into the actual slice/string data, no matter what.
The collector can now always scan the pointer, which means
strings and slices are no longer special.
Fixes #8404.
LGTM=khr, josharian
R=josharian, khr, dvyukov
CC=golang-codereviews
https://golang.org/cl/112570044
Diffstat (limited to 'src/pkg/runtime/malloc.h')
| -rw-r--r-- | src/pkg/runtime/malloc.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/pkg/runtime/malloc.h b/src/pkg/runtime/malloc.h index f5a2b2a42d..eafabb364a 100644 --- a/src/pkg/runtime/malloc.h +++ b/src/pkg/runtime/malloc.h @@ -303,7 +303,6 @@ extern int8 runtime·size_to_class8[1024/8 + 1]; extern int8 runtime·size_to_class128[(MaxSmallSize-1024)/128 + 1]; extern void runtime·InitSizes(void); - typedef struct MCacheList MCacheList; struct MCacheList { @@ -581,6 +580,9 @@ struct StackMap // (the index is encoded in PCDATA_StackMapIndex). BitVector runtime·stackmapdata(StackMap *stackmap, int32 n); +extern BitVector runtime·gcdatamask; +extern BitVector runtime·gcbssmask; + // defined in mgc0.go void runtime·gc_m_ptr(Eface*); void runtime·gc_g_ptr(Eface*); |
