1
0
mirror of https://github.com/golang/go synced 2024-11-13 20:20:30 -07:00
go/src/cmd
Matthew Dempsky f0b3626904 cmd/compile: discard duplicate inline method bodies
If we've already imported a named type, then there's no need to
process its associated methods except to validate that the signature
matches the existing known method.

However, the current import code still creates a new function node for
each method, saves its inline body (if any), and adds the node to the
global importlist. Because of this, the duplicate methods are never
garbage collected.

This CL changes the compiler to avoid amassing uncollectable garbage
or performing any unnecessary processing.

This is particularly noticeable for protobuf-heavy code. For the
motivating Go package, this CL reduced compile max-RSS from ~12GB to
~3GB and compile time from ~65s to ~50s.

Passes toolstash -cmp for std, cmd, and k8s.io/kubernetes/cmd/....

Change-Id: Ib53ba9f2ad3212995671cf6ba220ee8a56d8d009
Reviewed-on: https://go-review.googlesource.com/51331
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2017-08-09 21:57:50 +00:00
..
addr2line
api api: promote next to go1.9 2017-06-14 21:07:10 +00:00
asm cmd/internal/obj/arm: check illegal base registers in ARM instructions 2017-06-30 19:09:44 +00:00
cgo cmd/cgo: document that structs and arrays don't work with //export 2017-08-08 04:39:05 +00:00
compile cmd/compile: discard duplicate inline method bodies 2017-08-09 21:57:50 +00:00
cover cmd/cover: take default value of total only once. 2017-06-02 17:59:12 +00:00
dist cmd/go,cmd/link: support buildmode c-shared on ppc64le 2017-08-09 17:11:38 +00:00
doc cmd/doc: print Go syntax when printing struct.field docs 2017-07-06 21:57:52 +00:00
fix
go cmd/go,cmd/link: support buildmode c-shared on ppc64le 2017-08-09 17:11:38 +00:00
gofmt
internal cmd/compile: set/unset base register for better assembly print 2017-08-02 12:24:02 +00:00
link cmd/go,cmd/link: support buildmode c-shared on ppc64le 2017-08-09 17:11:38 +00:00
nm
objdump cmd/internal/objabi: fix the bug of shrinking SymType down to a uint8 2017-05-16 12:26:10 +00:00
pack
pprof cmd/pprof: restore printing descriptive errors from net/http/pprof endpoints 2017-06-15 02:14:24 +00:00
trace
vendor Revert "cmd/vendor/github.com/google/pprof: refresh from upstream" 2017-06-20 19:46:11 +00:00
vet cmd/vet: check that C receivers are cgo imports 2017-08-09 02:23:51 +00:00