• Cherry Zhang's avatar
    cmd/compile: make KeepAlive work on stack object · 40df9cc6
    Cherry Zhang authored
    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: default avatarKeith Randall <khr@golang.org>
    40df9cc6
issue30476.go 525 Bytes