mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: call fninit earlier
This allows the global initializers function to go through normal mid-end optimizations (e.g., inlining, escape analysis) like any other function. Updates #33485. Change-Id: I9bcfe98b8628d1aca09b4c238d8d3b74c69010a5 Reviewed-on: https://go-review.googlesource.com/c/go/+/254839 Reviewed-by: Keith Randall <khr@golang.org> Trust: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
237410547b
commit
f4936d09fd
3 changed files with 6 additions and 10 deletions
|
|
@ -642,6 +642,8 @@ func Main(archInit func(*Arch)) {
|
|||
errorexit()
|
||||
}
|
||||
|
||||
fninit(xtop)
|
||||
|
||||
// Phase 4: Decide how to capture closed variables.
|
||||
// This needs to run before escape analysis,
|
||||
// because variables captured by value do not escape.
|
||||
|
|
@ -751,10 +753,6 @@ func Main(archInit func(*Arch)) {
|
|||
}
|
||||
timings.AddEvent(fcount, "funcs")
|
||||
|
||||
if nsavederrors+nerrors == 0 {
|
||||
fninit(xtop)
|
||||
}
|
||||
|
||||
compileFunctions()
|
||||
|
||||
if nowritebarrierrecCheck != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue