Skip to content

Commit fa3e9d2

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Robert Griesemer <[email protected]>
1 parent befd5c4 commit fa3e9d2

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/cmd/compile/internal/gc/main.go

-7
Original file line numberDiff line numberDiff line change
@@ -626,13 +626,6 @@ func Main(archInit func(*Arch)) {
626626

627627
compileFunctions()
628628

629-
// We autogenerate and compile some small functions
630-
// such as method wrappers and equality/hash routines
631-
// while exporting code.
632-
// Disable concurrent compilation from here on,
633-
// at least until this convoluted structure has been unwound.
634-
nBackendWorkers = 1
635-
636629
if nowritebarrierrecCheck != nil {
637630
// Write barriers are now known. Check the
638631
// call graph.

src/cmd/compile/internal/gc/obj.go

+11
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,17 @@ func dumpLinkerObj(bout *bio.Writer) {
140140
dumpimportstrings()
141141
dumpbasictypes()
142142

143+
// The first call to dumpsignats can generate functions,
144+
// like method wrappers and hash and equality routines.
145+
compileFunctions()
146+
147+
// Process any new signats added during compilation.
148+
// No need to loop here; signats from compiling the generated
149+
// functions should not themselves generate new functions.
150+
// If they do, we'll know about it; the sanity check of
151+
// len(compilequeue) in gc.Main will fail.
152+
dumpsignats()
153+
143154
// Dump extra globals.
144155
tmp := externdcl
145156

0 commit comments

Comments
 (0)