Commit f65abf6d authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: hide testdclstack behind debug flag

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: 's avatarRobert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 641ef2a7
......@@ -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.
......
......@@ -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{}) {
......
......@@ -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()
......
......@@ -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()
}
}
......
......@@ -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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment