]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: hide testdclstack behind debug flag
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 11 Jan 2017 21:53:34 +0000 (13:53 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Wed, 11 Jan 2017 23:39:50 +0000 (23:39 +0000)
This reduces compilation time for the program
in #18602 from 7 hours to 30 min.

Updates #14781
Updates #18602

Change-Id: I3c4af878a08920e6373d3b3b0c4453ee002e32eb
Reviewed-on: https://go-review.googlesource.com/35113
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/alg.go
src/cmd/compile/internal/gc/bimport.go
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/noder.go
src/cmd/compile/internal/gc/subr.go

index 8113710e3983742d588f3da4ba2dbd52d5ba01ae..d4f3d9884ed989222d4ff92f4569ee5a3fac0c9c 100644 (file)
@@ -303,7 +303,9 @@ func genhash(sym *Sym, t *Type) {
        typecheckslice(fn.Nbody.Slice(), Etop)
        Curfn = nil
        popdcl()
-       testdclstack()
+       if debug_dclstack != 0 {
+               testdclstack()
+       }
 
        // Disable safemode while compiling this code: the code we
        // generate internally can refer to unsafe.Pointer.
@@ -493,7 +495,9 @@ func geneq(sym *Sym, t *Type) {
        typecheckslice(fn.Nbody.Slice(), Etop)
        Curfn = nil
        popdcl()
-       testdclstack()
+       if debug_dclstack != 0 {
+               testdclstack()
+       }
 
        // Disable safemode while compiling this code: the code we
        // generate internally can refer to unsafe.Pointer.
index 1d668412a181d05b6bc330865fc3e24535b1884e..94c1184138fc311349f504450e6487f909e2380a 100644 (file)
@@ -217,7 +217,9 @@ func Import(in *bufio.Reader) {
        typecheckok = tcok
        resumecheckwidth()
 
-       testdclstack() // debugging only
+       if debug_dclstack != 0 {
+               testdclstack()
+       }
 }
 
 func formatErrorf(format string, args ...interface{}) {
index 75f58a731c079f1bae8f7c19bfc4dd5467caa653..1690944b3df430c6cdf4f2d0d844f67dfed5ed87 100644 (file)
@@ -30,11 +30,12 @@ var (
 )
 
 var (
-       Debug_append  int
-       Debug_closure int
-       Debug_panic   int
-       Debug_slice   int
-       Debug_wb      int
+       Debug_append   int
+       Debug_closure  int
+       debug_dclstack int
+       Debug_panic    int
+       Debug_slice    int
+       Debug_wb       int
 )
 
 // Debug arguments.
@@ -48,6 +49,7 @@ var debugtab = []struct {
        {"append", &Debug_append},         // print information about append compilation
        {"closure", &Debug_closure},       // print information about closure compilation
        {"disablenil", &disable_checknil}, // disable nil checks
+       {"dclstack", &debug_dclstack},     // run internal dclstack checks
        {"gcprog", &Debug_gcprog},         // print dump of GC programs
        {"nil", &Debug_checknil},          // print information about nil checks
        {"panic", &Debug_panic},           // do not hide any compiler panic
@@ -325,7 +327,6 @@ func Main() {
        timings.Stop()
        timings.AddEvent(int64(lexlineno-lexlineno0), "lines")
 
-       testdclstack()
        mkpackage(localpkg.Name) // final import not used checks
        finishUniverse()
 
index ca99adea27caa1959e558b01c9a01c917a330037..ce18297ac3d31006ca50a85589a8bb8064aec832 100644 (file)
@@ -34,6 +34,7 @@ func parseFile(filename string) {
        }
 
        if nsyntaxerrors == 0 {
+               // Always run testdclstack here, even when debug_dclstack is not set, as a sanity measure.
                testdclstack()
        }
 }
index 9b9a3f121015d86fa746647b255ed19ab632e13d..7d008dfa65527f9d020995bfa67cd84ac7d76ec7 100644 (file)
@@ -1833,7 +1833,9 @@ func genwrapper(rcvr *Type, method *Field, newnam *Sym, iface int) {
        funcbody(fn)
        Curfn = fn
        popdcl()
-       testdclstack()
+       if debug_dclstack != 0 {
+               testdclstack()
+       }
 
        // wrappers where T is anonymous (struct or interface) can be duplicated.
        if rcvr.IsStruct() || rcvr.IsInterface() || rcvr.IsPtr() && rcvr.Elem().IsStruct() {