]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: make KeepAlive work on stack object
authorCherry Zhang <cherryyz@google.com>
Thu, 28 Feb 2019 01:43:29 +0000 (20:43 -0500)
committerCherry Zhang <cherryyz@google.com>
Fri, 1 Mar 2019 15:36:52 +0000 (15:36 +0000)
commit40df9cc6062492cd323f2251dd1583d200d1207e
tree713d48a5c54bc62e8fb2bbb71dd89232ef6632a2
parent1f3d38fdaaff88d7ce711612fbe9b7fc7182efd7
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.

Fixes #30476.

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>
src/cmd/compile/internal/ssa/regalloc.go
test/fixedbugs/issue30476.go [new file with mode: 0644]