]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.12] cmd/compile: make KeepAlive work on stack object
authorCherry Zhang <cherryyz@google.com>
Thu, 28 Feb 2019 01:43:29 +0000 (20:43 -0500)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 13 Mar 2019 20:59:47 +0000 (20:59 +0000)
commit6fc1242ea8f8bbacd88cb834ef61dbe9e84a8514
treef6ed0157aa1bb98470f8297579777d5ddb980115
parentf9d0594a471841f6ddd97a38f822da4f3461232f
[release-branch.go1.12] cmd/compile: make KeepAlive work on stack object

Currently, runtime.KeepAlive applied on a stack object doesn't
actually keeps the stack object alive, and the heap object
referenced from it could be collected. This is because the
address of the stack object is rematerializeable, and we just
ignored KeepAlive on rematerializeable values. This CL fixes it.

Updates #30476.
Fixes #30478.

Change-Id: Ic1f75ee54ed94ea79bd46a8ddcd9e81d01556d1d
Reviewed-on: https://go-review.googlesource.com/c/164537
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit 40df9cc6062492cd323f2251dd1583d200d1207e)
Reviewed-on: https://go-review.googlesource.com/c/go/+/164627
src/cmd/compile/internal/ssa/regalloc.go
test/fixedbugs/issue30476.go [new file with mode: 0644]