mirror of
https://github.com/golang/go
synced 2024-11-12 05:30:21 -07:00
cmd/compile: don't discard inlineable but empty functions with binary export format
Change-Id: I0f016fa000f949d27847d645b4cdebe68a8abf20 Reviewed-on: https://go-review.googlesource.com/22474 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
3a72d626a8
commit
17db07f9b5
@ -145,7 +145,16 @@ func Import(in *bufio.Reader) {
|
|||||||
if f := p.funcList[i]; f != nil {
|
if f := p.funcList[i]; f != nil {
|
||||||
// function not yet imported - read body and set it
|
// function not yet imported - read body and set it
|
||||||
funchdr(f)
|
funchdr(f)
|
||||||
f.Func.Inl.Set(p.stmtList())
|
body := p.stmtList()
|
||||||
|
if body == nil {
|
||||||
|
// Make sure empty body is not interpreted as
|
||||||
|
// no inlineable body (see also parser.fnbody)
|
||||||
|
// (not doing so can cause significant performance
|
||||||
|
// degradation due to unnecessary calls to empty
|
||||||
|
// functions).
|
||||||
|
body = []*Node{Nod(OEMPTY, nil, nil)}
|
||||||
|
}
|
||||||
|
f.Func.Inl.Set(body)
|
||||||
funcbody(f)
|
funcbody(f)
|
||||||
} else {
|
} else {
|
||||||
// function already imported - read body but discard declarations
|
// function already imported - read body but discard declarations
|
||||||
|
Loading…
Reference in New Issue
Block a user