aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/deadcode/deadcode.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-01-01 02:39:00 -0800
committerMatthew Dempsky <mdempsky@google.com>2021-01-01 11:30:21 +0000
commitfad9a8b52864da738037163565e8eacc958baaa8 (patch)
treef6c90c6a4257ef17bd47eaf27a2442e434be24ec /src/cmd/compile/internal/deadcode/deadcode.go
parent7d55669847389b8d2e490400226f272023da8605 (diff)
downloadgo-fad9a8b52864da738037163565e8eacc958baaa8.tar.xz
[dev.regabi] cmd/compile: simplify inlining of closures
Closures have their own ONAMEs for captured variables, which their function bodies refer to. So during inlining, we need to account for this and ensure the references still work. The previous inlining handled this by actually declaring the variables and then either copying the original value or creating a pointer to them, as appropriate for variables captured by value or by reference. But this is needlessly complicated. When inlining the function body, we need to rewrite all variable references anyway. We can just detect closure variables and change them to directly point to the enclosing function's version of this variable. No need for copying or further indirection. Does not pass toolstash -cmp. Presumably because we're able to generate better code in some circumstances. Change-Id: I8f0ccf7b098f39b8cd33f3bcefb875c8132d2c62 Reviewed-on: https://go-review.googlesource.com/c/go/+/280996 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/deadcode/deadcode.go')
0 files changed, 0 insertions, 0 deletions