]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.regabi] cmd/compile: compile functions before closures
authorMatthew Dempsky <mdempsky@google.com>
Tue, 12 Jan 2021 20:00:58 +0000 (12:00 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 12 Jan 2021 23:22:41 +0000 (23:22 +0000)
commitd6ad88b4db454813e1bdf09635cd853fe3b7ef13
tree69790b43a39e0ef77e64c6e601169ecc1c1e7915
parent432f9ffb11231b00b67c8fa8047f21a8282fa914
[dev.regabi] cmd/compile: compile functions before closures

This CL reorders function compilation to ensure that functions are
always compiled before any enclosed function literals. The primary
goal of this is to reduce the risk of race conditions that arise due
to compilation of function literals needing to inspect data from their
closure variables. However, a pleasant side effect is that it allows
skipping the redundant, separate compilation of function literals that
were inlined into their enclosing function.

Change-Id: I03ee96212988cb578c2452162b7e99cc5e92918f
Reviewed-on: https://go-review.googlesource.com/c/go/+/282892
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/compile.go
src/cmd/compile/internal/ir/func.go
src/cmd/compile/internal/ir/sizeof_test.go
src/cmd/compile/internal/walk/closure.go
src/cmd/compile/internal/walk/expr.go