Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: struct field alive too long #24263
In program 1, the allocation at
The allocation in program 2 should be GCd, it is no longer referenced.
First reported here: https://groups.google.com/forum/#!topic/golang-nuts/4qmn5gw7OBQ
Maybe we can change convT2E64 to take a uint64 value instead of pointer? I'm not sure about its impact and concerns, though.
That’s a good idea. Should be safe, because it is guaranteed to be scalar—pointer-shaped values don’t go through a convT2x call. Same probably holds for other specialized functions in runtime/iface.go, although for the multi-word ones (slice, string), it might be better to stick with an address to keep the call site small.
This would make a decent starter change for someone who wants to work on the runtime+compiler. Not trivial, but straightforward enough. Or you could just do it. :)
That would solve this particular instance, but it doesn't solve the general problem of:
But maybe that's ok and I'm just being too critical of a live variable analysis that is necessarily going to be conservative in some situations.
The thing that I think originally tripped me up is that