From 1c24ffbf936b17387ee7f7a7c0adef4d27d1382d Mon Sep 17 00:00:00 2001 From: David Chase Date: Wed, 14 Mar 2018 16:54:33 -0400 Subject: [PATCH] cmd/compile: turn on DWARF locations lists for ssa vars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This changes the default setting for -dwarflocationlists from false to true, removes the flag from ssa/debug_test.go, and updates runtime/runtime-gdb_test.go to match a change in debugging output for composite variables. Current benchmarks (perflock, -count 10) benchstat -geomean before.log after.log name old time/op new time/op delta Template 175ms ± 0% 182ms ± 1% +3.68% (p=0.000 n=8+9) Unicode 82.0ms ± 2% 82.8ms ± 1% +0.96% (p=0.019 n=9+9) GoTypes 590ms ± 1% 611ms ± 1% +3.42% (p=0.000 n=9+10) Compiler 2.85s ± 0% 2.95s ± 1% +3.60% (p=0.000 n=9+10) SSA 6.42s ± 1% 6.70s ± 1% +4.31% (p=0.000 n=10+9) Flate 113ms ± 2% 117ms ± 1% +3.11% (p=0.000 n=10+9) GoParser 140ms ± 1% 145ms ± 1% +3.47% (p=0.000 n=10+9) Reflect 384ms ± 0% 398ms ± 1% +3.56% (p=0.000 n=8+9) Tar 165ms ± 1% 171ms ± 1% +3.33% (p=0.000 n=9+9) XML 207ms ± 2% 214ms ± 1% +3.41% (p=0.000 n=9+9) StdCmd 11.8s ± 2% 12.4s ± 2% +4.41% (p=0.000 n=10+9) [Geo mean] 489ms 506ms +3.38% name old user-ns/op new user-ns/op delta Template 247M ± 4% 254M ± 4% +2.76% (p=0.040 n=10+10) Unicode 118M ±16% 121M ±11% ~ (p=0.364 n=10+10) GoTypes 805M ± 2% 824M ± 2% +2.37% (p=0.003 n=9+8) Compiler 3.92G ± 2% 4.01G ± 2% +2.20% (p=0.001 n=9+9) SSA 9.63G ± 4% 10.00G ± 2% +3.81% (p=0.000 n=10+9) Flate 155M ±10% 154M ± 7% ~ (p=0.718 n=9+10) GoParser 184M ±11% 190M ± 7% ~ (p=0.220 n=10+9) Reflect 506M ± 4% 528M ± 2% +4.27% (p=0.000 n=10+10) Tar 224M ± 4% 227M ± 5% ~ (p=0.207 n=10+9) XML 272M ± 7% 286M ± 4% +5.23% (p=0.010 n=10+9) [Geo mean] 489M 502M +2.76% name old text-bytes new text-bytes delta HelloSize 672k ± 0% 672k ± 0% ~ (all equal) CmdGoSize 7.21M ± 0% 7.21M ± 0% ~ (all equal) [Geo mean] 2.20M 2.20M +0.00% name old data-bytes new data-bytes delta HelloSize 9.88k ± 0% 9.88k ± 0% ~ (all equal) CmdGoSize 248k ± 0% 248k ± 0% ~ (all equal) [Geo mean] 49.5k 49.5k +0.00% name old bss-bytes new bss-bytes delta HelloSize 125k ± 0% 125k ± 0% ~ (all equal) CmdGoSize 144k ± 0% 144k ± 0% ~ (all equal) [Geo mean] 135k 135k +0.00% name old exe-bytes new exe-bytes delta HelloSize 1.10M ± 0% 1.30M ± 0% +17.82% (p=0.000 n=10+10) CmdGoSize 11.6M ± 0% 13.5M ± 0% +16.90% (p=0.000 n=10+10) [Geo mean] 3.57M 4.19M +17.36% Change-Id: I250055813cadd25cebee8da1f9a7f995a6eae432 Reviewed-on: https://go-review.googlesource.com/100738 Reviewed-by: Heschi Kreinick --- src/cmd/compile/internal/gc/main.go | 2 +- src/cmd/compile/internal/ssa/debug_test.go | 4 ++-- src/runtime/runtime-gdb_test.go | 11 ++++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index 79017d2721a..2fa7ef84f5c 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -192,7 +192,7 @@ func Main(archInit func(*Arch)) { flag.BoolVar(&pure_go, "complete", false, "compiling complete package (no C or assembly)") flag.StringVar(&debugstr, "d", "", "print debug information about items in `list`; try -d help") flag.BoolVar(&flagDWARF, "dwarf", true, "generate DWARF symbols") - flag.BoolVar(&Ctxt.Flag_locationlists, "dwarflocationlists", false, "add location lists to DWARF in optimized mode") + flag.BoolVar(&Ctxt.Flag_locationlists, "dwarflocationlists", true, "add location lists to DWARF in optimized mode") flag.IntVar(&genDwarfInline, "gendwarfinl", 2, "generate DWARF inline info records") objabi.Flagcount("e", "no limit on number of errors reported", &Debug['e']) objabi.Flagcount("f", "debug stack frames", &Debug['f']) diff --git a/src/cmd/compile/internal/ssa/debug_test.go b/src/cmd/compile/internal/ssa/debug_test.go index 48dbaea27f6..b066816dc96 100644 --- a/src/cmd/compile/internal/ssa/debug_test.go +++ b/src/cmd/compile/internal/ssa/debug_test.go @@ -135,10 +135,10 @@ func TestNexting(t *testing.T) { t.Skip(skipReasons[:len(skipReasons)-2]) } - optFlags := "-dwarflocationlists" + optFlags := "" // Whatever flags are needed to test debugging of optimized code. if !*useDelve && !*inlines { // For gdb (default), disable inlining so that a compiler test does not depend on library code. - // TODO: This may not be necessary with 1.10 and later. + // TODO: Technically not necessary in 1.10, but it causes a largish regression that needs investigation. optFlags += " -l" } diff --git a/src/runtime/runtime-gdb_test.go b/src/runtime/runtime-gdb_test.go index c96bb952226..090e1c61d00 100644 --- a/src/runtime/runtime-gdb_test.go +++ b/src/runtime/runtime-gdb_test.go @@ -234,11 +234,16 @@ func testGdbPython(t *testing.T, cgo bool) { t.Fatalf("print strvar failed: %s", bl) } - // Issue 16338: ssa decompose phase can split a structure into - // a collection of scalar vars holding the fields. In such cases + // The exact format of composite values has changed over time. + // For issue 16338: ssa decompose phase split a slice into + // a collection of scalar vars holding its fields. In such cases // the DWARF variable location expression should be of the // form "var.field" and not just "field". - infoLocalsRe := regexp.MustCompile(`.*\sslicevar.cap = `) + // However, the newer dwarf location list code reconstituted + // aggregates from their fields and reverted their printing + // back to its original form. + + infoLocalsRe := regexp.MustCompile(`slicevar *= *\[\]string *= *{"def"}`) if bl := blocks["info locals"]; !infoLocalsRe.MatchString(bl) { t.Fatalf("info locals failed: %s", bl) }