]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: replace -l=2 with -d typecheckinl
authorMatthew Dempsky <mdempsky@google.com>
Fri, 20 Oct 2017 22:20:56 +0000 (15:20 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Sun, 22 Oct 2017 14:33:53 +0000 (14:33 +0000)
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>
src/cmd/compile/internal/gc/bexport.go
src/cmd/compile/internal/gc/inl.go
src/cmd/compile/internal/gc/main.go

index c8bbd79d262049b83f4e39fca567b3f234789e8a..9564a59f4ae5672da3b780e27ee4decec73ba0de 100644 (file)
@@ -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
index 5772ebe806fd1c5c55cf8182d1d610228a21967c..9a434601d5569076198dd904d8a75b2963d95114 100644 (file)
@@ -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)
        }
 
index 288c1d8420cdd426a69eeeacfa3081c71b71190f..ce91c6b48bfbee8da2850fed5f0164ada527e409 100644 (file)
@@ -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 {