]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: Drop references to Prog structs after each function
authorKeith Randall <khr@golang.org>
Wed, 24 Feb 2016 17:12:51 +0000 (09:12 -0800)
committerKeith Randall <khr@golang.org>
Wed, 24 Feb 2016 18:47:57 +0000 (18:47 +0000)
commit45c2e38b37e40c3b6bdc508065edce0643f79110
treeb5c8e22f3b0b6893875c90e2abe807b43ee84663
parentfdd0179bb1fdd70d405929b78c7d2fb6b61369b0
cmd/compile: Drop references to Prog structs after each function

Don't accumulate a massive list of Prog structs during
compilation and write them all out at the end of compilation.
Instead, convert them to code+relocs (or data+relocs) after each
function is compiled.

Track down a few other places that were keeping Progs alive
and nil them out so the Progs get GCd promptly.

Saves ~20% in peak memory usage for the compiler.  Surprisingly not much
help speed-wise (only because we end up doing more GCs.  With a
compensating GOGC=120, it does help a bit), but this provides a base for
more changes (e.g. reusing a cache of Progs).

Change-Id: I838e01017c228995a687a8110d0cd67bf8596407
Reviewed-on: https://go-review.googlesource.com/19867
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/gc/dcl.go
src/cmd/compile/internal/gc/gsubr.go
src/cmd/internal/obj/objfile.go