diff options
author | Keith Randall <keithr@alum.mit.edu> | 2018-09-01 20:16:39 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2018-10-03 19:52:49 +0000 |
commit | cbafcc55e80d5b444e659a892b739c04a27980d3 (patch) | |
tree | 686bb3629f659f6ed6d7c8ea6d7cb51a61f00ca9 /test | |
parent | 433496615ff0ec5c2235279dddbe01adf1701fa2 (diff) | |
download | go-git-cbafcc55e80d5b444e659a892b739c04a27980d3.tar.gz |
cmd/compile,runtime: implement stack objects
Rework how the compiler+runtime handles stack-allocated variables
whose address is taken.
Direct references to such variables work as before. References through
pointers, however, use a new mechanism. The new mechanism is more
precise than the old "ambiguously live" mechanism. It computes liveness
at runtime based on the actual references among objects on the stack.
Each function records all of its address-taken objects in a FUNCDATA.
These are called "stack objects". The runtime then uses that
information while scanning a stack to find all of the stack objects on
a stack. It then does a mark phase on the stack objects, using all the
pointers found on the stack (and ancillary structures, like defer
records) as the root set. Only stack objects which are found to be
live during this mark phase will be scanned and thus retain any heap
objects they point to.
A subsequent CL will remove all the "ambiguously live" logic from
the compiler, so that the stack object tracing will be required.
For this CL, the stack tracing is all redundant with the current
ambiguously live logic.
Update #22350
Change-Id: Ide19f1f71a5b6ec8c4d54f8f66f0e9a98344772f
Reviewed-on: https://go-review.googlesource.com/c/134155
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions