aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/symtab.go
diff options
context:
space:
mode:
authorKeith Randall <keithr@alum.mit.edu>2018-09-01 20:16:39 -0700
committerKeith Randall <khr@golang.org>2018-10-03 19:52:49 +0000
commitcbafcc55e80d5b444e659a892b739c04a27980d3 (patch)
tree686bb3629f659f6ed6d7c8ea6d7cb51a61f00ca9 /src/runtime/symtab.go
parent433496615ff0ec5c2235279dddbe01adf1701fa2 (diff)
downloadgo-cbafcc55e80d5b444e659a892b739c04a27980d3.tar.gz
go-cbafcc55e80d5b444e659a892b739c04a27980d3.zip
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 'src/runtime/symtab.go')
-rw-r--r--src/runtime/symtab.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index d90ab86ffa..452e9d06ae 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -348,6 +348,7 @@ const (
_FUNCDATA_LocalsPointerMaps = 1
_FUNCDATA_InlTree = 2
_FUNCDATA_RegPointerMaps = 3
+ _FUNCDATA_StackObjects = 4
_ArgsSizeUnknown = -0x80000000
)