mirror of
https://github.com/golang/go
synced 2024-11-12 03:00:22 -07:00
cmd/compile: replace -l=2 with -d typecheckinl
Currently, benchmarking compile performance under -l=4 is confounded by -l=2 enabling eager typechecking of unused inline function bodies for debugging. This isn't logically an "inlining aggressiveness" level, so instead move this logic under the -d umbrella flag. Change-Id: I713f68952efbe25b6941d3ebc2f3707ccbbd6240 Reviewed-on: https://go-review.googlesource.com/72253 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
e769c9d6cf
commit
7092a312e5
@ -594,7 +594,7 @@ func isInlineable(n *Node) bool {
|
||||
if exportInlined && n != nil && n.Func != nil && n.Func.Inl.Len() != 0 {
|
||||
// when lazily typechecking inlined bodies, some re-exported ones may not have been typechecked yet.
|
||||
// currently that can leave unresolved ONONAMEs in import-dot-ed packages in the wrong package
|
||||
if Debug['l'] < 2 {
|
||||
if Debug_typecheckinl == 0 {
|
||||
typecheckinl(n)
|
||||
}
|
||||
return true
|
||||
|
@ -8,18 +8,21 @@
|
||||
// expand calls to inlinable functions.
|
||||
//
|
||||
// The debug['l'] flag controls the aggressiveness. Note that main() swaps level 0 and 1,
|
||||
// making 1 the default and -l disable. -ll and more is useful to flush out bugs.
|
||||
// These additional levels (beyond -l) may be buggy and are not supported.
|
||||
// making 1 the default and -l disable. Additional levels (beyond -l) may be buggy and
|
||||
// are not supported.
|
||||
// 0: disabled
|
||||
// 1: 80-nodes leaf functions, oneliners, lazy typechecking (default)
|
||||
// 2: early typechecking of all imported bodies
|
||||
// 2: (unassigned)
|
||||
// 3: allow variadic functions
|
||||
// 4: allow non-leaf functions , (breaks runtime.Caller)
|
||||
// 4: allow non-leaf functions
|
||||
//
|
||||
// At some point this may get another default and become switch-offable with -N.
|
||||
// At some point this may get another default and become switch-offable with -N.
|
||||
//
|
||||
// The debug['m'] flag enables diagnostic output. a single -m is useful for verifying
|
||||
// which calls get inlined or not, more is for debugging, and may go away at any point.
|
||||
// The -d typcheckinl flag enables early typechecking of all imported bodies,
|
||||
// which is useful to flush out bugs.
|
||||
//
|
||||
// The debug['m'] flag enables diagnostic output. a single -m is useful for verifying
|
||||
// which calls get inlined or not, more is for debugging, and may go away at any point.
|
||||
//
|
||||
// TODO:
|
||||
// - inline functions with ... args
|
||||
@ -727,7 +730,7 @@ func mkinlcall1(n, fn *Node, isddd bool) *Node {
|
||||
return n
|
||||
}
|
||||
|
||||
if Debug['l'] < 2 {
|
||||
if Debug_typecheckinl == 0 {
|
||||
typecheckinl(fn)
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,7 @@ var (
|
||||
Debug_wb int
|
||||
Debug_pctab string
|
||||
Debug_locationlist int
|
||||
Debug_typecheckinl int
|
||||
)
|
||||
|
||||
// Debug arguments.
|
||||
@ -72,6 +73,7 @@ var debugtab = []struct {
|
||||
{"export", "print export data", &Debug_export},
|
||||
{"pctab", "print named pc-value table", &Debug_pctab},
|
||||
{"locationlists", "print information about DWARF location list creation", &Debug_locationlist},
|
||||
{"typecheckinl", "eager typechecking of inline function bodies", &Debug_typecheckinl},
|
||||
}
|
||||
|
||||
const debugHelpHeader = `usage: -d arg[,arg]* and arg is <key>[=<value>]
|
||||
@ -523,7 +525,7 @@ func Main(archInit func(*Arch)) {
|
||||
|
||||
// Phase 5: Inlining
|
||||
timings.Start("fe", "inlining")
|
||||
if Debug['l'] > 1 {
|
||||
if Debug_typecheckinl != 0 {
|
||||
// Typecheck imported function bodies if debug['l'] > 1,
|
||||
// otherwise lazily when used or re-exported.
|
||||
for _, n := range importlist {
|
||||
|
Loading…
Reference in New Issue
Block a user