1
0
mirror of https://github.com/golang/go synced 2024-11-23 11:30:06 -07:00

cmd/compile: compile all functions concurrently

CL 40693 added concurrent backend compilation support,
and used it for user-provided functions.
Autogenerated functions were still compiled serially.
This CL brings them into the fold.
As of this CL, when requested,
no functions are compiled serially.

There generally aren't many autogenerated functions.
When there are, this CL can help a lot,
because autogenerated functions are usually short.
Many short functions is the best case scenario
for concurrent compilation; see CL 41192.

One example of such a package comes from Dave Cheney's benchjuju:
github.com/juju/govmomi/vim25/types.
It has thousands of autogenerated functions.
This CL improves performance on the entire benchmark
by around a second on my machine at c=8, or about ~5%.

Updates #15756

Change-Id: Ia21e302b2469a9ed743df02244ec7ebde55b32f3
Reviewed-on: https://go-review.googlesource.com/41503
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2017-04-23 05:06:22 -07:00
parent befd5c44cc
commit fa3e9d27f3
2 changed files with 11 additions and 7 deletions

View File

@ -626,13 +626,6 @@ func Main(archInit func(*Arch)) {
compileFunctions()
// We autogenerate and compile some small functions
// such as method wrappers and equality/hash routines
// while exporting code.
// Disable concurrent compilation from here on,
// at least until this convoluted structure has been unwound.
nBackendWorkers = 1
if nowritebarrierrecCheck != nil {
// Write barriers are now known. Check the
// call graph.

View File

@ -140,6 +140,17 @@ func dumpLinkerObj(bout *bio.Writer) {
dumpimportstrings()
dumpbasictypes()
// The first call to dumpsignats can generate functions,
// like method wrappers and hash and equality routines.
compileFunctions()
// Process any new signats added during compilation.
// No need to loop here; signats from compiling the generated
// functions should not themselves generate new functions.
// If they do, we'll know about it; the sanity check of
// len(compilequeue) in gc.Main will fail.
dumpsignats()
// Dump extra globals.
tmp := externdcl