aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mfinal.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2016-10-11 22:58:21 -0400
committerAustin Clements <austin@google.com>2016-10-15 17:58:20 +0000
commit1bc6be6423e48318451a0faeaae840772137b001 (patch)
tree013de581e0dd5d1a65aac79b665b41afd5cb3586 /src/runtime/mfinal.go
parent991a85c88944e9cb92c4860c173f49d549a92845 (diff)
downloadgo-1bc6be6423e48318451a0faeaae840772137b001.tar.gz
go-1bc6be6423e48318451a0faeaae840772137b001.zip
runtime: mark several types go:notinheap
This covers basically all sysAlloc'd, persistentalloc'd, and fixalloc'd types. Change-Id: I0487c887c2a0ade5e33d4c4c12d837e97468e66b Reviewed-on: https://go-review.googlesource.com/30941 Reviewed-by: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src/runtime/mfinal.go')
-rw-r--r--src/runtime/mfinal.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/runtime/mfinal.go b/src/runtime/mfinal.go
index f9344882b1..0ee7a0599a 100644
--- a/src/runtime/mfinal.go
+++ b/src/runtime/mfinal.go
@@ -12,6 +12,10 @@ import (
"unsafe"
)
+// finblock is allocated from non-GC'd memory, so any heap pointers
+// must be specially handled.
+//
+//go:notinheap
type finblock struct {
alllink *finblock
next *finblock
@@ -31,11 +35,11 @@ var allfin *finblock // list of all blocks
// NOTE: Layout known to queuefinalizer.
type finalizer struct {
- fn *funcval // function to call
- arg unsafe.Pointer // ptr to object
+ fn *funcval // function to call (may be a heap pointer)
+ arg unsafe.Pointer // ptr to object (may be a heap pointer)
nret uintptr // bytes of return values from fn
fint *_type // type of first argument of fn
- ot *ptrtype // type of ptr to object
+ ot *ptrtype // type of ptr to object (may be a heap pointer)
}
var finalizer1 = [...]byte{
@@ -70,7 +74,6 @@ func queuefinalizer(p unsafe.Pointer, fn *funcval, nret uintptr, fint *_type, ot
lock(&finlock)
if finq == nil || finq.cnt == int32(len(finq.fin)) {
if finc == nil {
- // Note: write barrier here, assigning to finc, but should be okay.
finc = (*finblock)(persistentalloc(_FinBlockSize, 0, &memstats.gc_sys))
finc.alllink = allfin
allfin = finc