This CL skips reading of imported function bodies except from the
local package or for inlining. Previously, we wasted a bunch of CPU
and memory by reading in normal function bodies for all imported
functions and methods.
Change-Id: I0b3df3f4a3e2819117dac11a1f9e4526288c14d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/347030
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
pri := pkgReaderIndex{r.p, r.reloc(relocBody), r.dict}
bodyReader[fn] = pri
+ if fn.Nname.Defn == nil {
+ // Don't read in function body for imported functions.
+ // See comment in funcExt.
+ return
+ }
+
if r.curfn == nil {
todoBodies = append(todoBodies, fn)
return