diff options
author | Keith Randall <khr@golang.org> | 2020-08-21 20:20:12 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2020-08-25 01:46:05 +0000 |
commit | d9a6bdf7ef4d0dd15608427b0f7ba3c45c221a3c (patch) | |
tree | b2d75e4e50e5204d89380233ca4b20a4c8ef6c8a /src/runtime/runtime2.go | |
parent | 95df156e6ac53f98efd6c57e4586c1dfb43066dd (diff) | |
download | go-d9a6bdf7ef4d0dd15608427b0f7ba3c45c221a3c.tar.gz go-d9a6bdf7ef4d0dd15608427b0f7ba3c45c221a3c.zip |
cmd/compile: don't allow go:notinheap on the heap or stack
Right now we just prevent such types from being on the heap. This CL
makes it so they cannot appear on the stack either. The distinction
between heap and stack is pretty vague at the language level (e.g. it
is affected by -N), and we don't need the flexibility anyway.
Once go:notinheap types cannot be in either place, we don't need to
consider pointers to such types to be pointers, at least according to
the garbage collector and stack copying. (This is the big win of this
CL, in my opinion.)
The distinction between HasPointers and HasHeapPointer no longer
exists. There is only HasPointers.
This CL is cleanup before possible use of go:notinheap to fix #40954.
Update #13386
Change-Id: Ibd895aadf001c0385078a6d4809c3f374991231a
Reviewed-on: https://go-review.googlesource.com/c/go/+/249917
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/runtime/runtime2.go')
-rw-r--r-- | src/runtime/runtime2.go | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index b7d0739e54..64c6cc7198 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -909,15 +909,12 @@ type _defer struct { // A _panic holds information about an active panic. // -// This is marked go:notinheap because _panic values must only ever -// live on the stack. +// A _panic value must only ever live on the stack. // // The argp and link fields are stack pointers, but don't need special // handling during stack growth: because they are pointer-typed and // _panic values only live on the stack, regular stack pointer // adjustment takes care of them. -// -//go:notinheap type _panic struct { argp unsafe.Pointer // pointer to arguments of deferred call run during panic; cannot move - known to liblink arg interface{} // argument to panic |