Skip to content

Commit a760283

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 golang#15756 Change-Id: Ia21e302b2469a9ed743df02244ec7ebde55b32f3
1 parent 71e63fa commit a760283

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
@@ -579,13 +579,6 @@ func Main(archInit func(*Arch)) {
579579

580580
compileFunctions()
581581

582-
// We autogenerate and compile some small functions
583-
// such as method wrappers and equality/hash routines
584-
// while exporting code.
585-
// Disable concurrent compilation from here on,
586-
// at least until this convoluted structure has been unwound.
587-
nBackendWorkers = 1
588-
589582
if compiling_runtime {
590583
checknowritebarrierrec()
591584
}

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

+11
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,17 @@ func dumpobj1(outfile string, mode int) {
143143
dumpimportstrings()
144144
dumpbasictypes()
145145

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

0 commit comments

Comments
 (0)