]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.15] 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)
committerDmitri Shuralyov <dmitshur@golang.org>
Fri, 9 Oct 2020 17:24:33 +0000 (17:24 +0000)
commit439ce71eb6a472c5f758021a92f06d8489ca0689
treea304a40860196fed1dda3e3f7fd5c20d73c704bb
parenta460a2beee167fc5e7ada6d4effbbf2a52969bfb
[release-branch.go1.15] 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/+/255320
Trust: Keith Randall <khr@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.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