]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: don't allow go:notinheap on the heap or stack
authorKeith Randall <khr@golang.org>
Sat, 22 Aug 2020 03:20:12 +0000 (20:20 -0700)
committerKeith Randall <khr@golang.org>
Tue, 25 Aug 2020 01:46:05 +0000 (01:46 +0000)
commitd9a6bdf7ef4d0dd15608427b0f7ba3c45c221a3c
treeb2d75e4e50e5204d89380233ca4b20a4c8ef6c8a
parent95df156e6ac53f98efd6c57e4586c1dfb43066dd
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>
16 files changed:
src/cmd/compile/internal/gc/escape.go
src/cmd/compile/internal/gc/pgen_test.go
src/cmd/compile/internal/gc/plive.go
src/cmd/compile/internal/gc/range.go
src/cmd/compile/internal/gc/walk.go
src/cmd/compile/internal/ssa/decompose.go
src/cmd/compile/internal/ssa/gen/dec.rules
src/cmd/compile/internal/ssa/nilcheck.go
src/cmd/compile/internal/ssa/rewritedec.go
src/cmd/compile/internal/ssa/writebarrier.go
src/cmd/compile/internal/types/type.go
src/runtime/export_test.go
src/runtime/mgcmark.go
src/runtime/mgcstack.go
src/runtime/runtime2.go
test/notinheap2.go