1. 11 Oct, 2016 1 commit
    • John Dethridge's avatar
      cmd/link: more efficient encoding of DWARF line number information · 8f65379f
      John Dethridge authored
      The (pc, line) deltas in the line number information are currently encoded
      either with a special opcode, or with a triplet of DW_LNS_advance_pc,
      DW_LNS_advance_line, and DW_LNS_copy instructions.  Instead of DW_LNS_copy,
      this change always uses a special opcode, which can make DW_LNS_advance_pc or
      DW_LNS_advance_line unnecessary, or make their operands take fewer bytes.  It
      chooses the special opcode so that the encoding of the remaining deltas is as
      small as possible.
      
      Use DW_LNS_const_add_pc or DW_LNS_fixed_advance_pc instead of DW_LNS_advance_pc
      for deltas where they save a byte.
      
      Update LINE_BASE and LINE_RANGE constants to optimal values for this strategy.
      
      This reduces line number information by about 35% and total size by about 2%
      for a typical binary.
      
      Change-Id: Ia61d6bf19c95c1d34ba63c67ed32b376beda225f
      Reviewed-on: https://go-review.googlesource.com/30577Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      8f65379f
  2. 10 Oct, 2016 5 commits
  3. 09 Oct, 2016 7 commits
  4. 08 Oct, 2016 2 commits
  5. 07 Oct, 2016 11 commits
    • Michael Munday's avatar
      cmd/{asm,compile}: replace TESTB op with CMPWconst on s390x · 45b26a93
      Michael Munday authored
      TESTB was implemented as AND $0xff, Rx, REGTMP. Unfortunately there
      is no 3-operand AND-with-immediate instruction and so it was emulated
      by the assembler using two instructions.
      
      This CL uses CMPW instead of AND and also optimizes CMPW to use
      the chi instruction where possible.
      
      Overall this CL reduces the size of the .text section of the
      bin/go binary by ~2%.
      
      Change-Id: Ic335c29fc1129378fcbb1265bfb10f5b744a0f3f
      Reviewed-on: https://go-review.googlesource.com/30690
      Run-TryBot: Michael Munday <munday@ca.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      45b26a93
    • Keith Randall's avatar
      cmd/compile: use standard dom tree in nilcheckelim · f4e37c8e
      Keith Randall authored
      No need to build a bespoke dom tree here when we might
      have one cached already.  The allocations for the dom tree
      were also more expensive than they needed to be.
      
      Fixes #12021
      
      Change-Id: I6a967880aee03660ad6fc293f8fc783779cae11d
      Reviewed-on: https://go-review.googlesource.com/30671
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      f4e37c8e
    • Andrew Pogrebnoy's avatar
      cmd/compile: fix choice of phi building algorithm · 433be563
      Andrew Pogrebnoy authored
      The algorithm for placing a phi nodes in small functions now
      unreachable. This patch fix that.
      
      Change-Id: I253d745b414fa12ee0719459c28e78a69c6861ae
      Reviewed-on: https://go-review.googlesource.com/30106
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      433be563
    • Austin Clements's avatar
      cmd/trace: label mark termination spans as such · 94589054
      Austin Clements authored
      Currently these are labeled "MARK", which was accurate in the STW
      collector, but these really indicate mark termination now, since
      marking happens for the full duration of the concurrent GC. Re-label
      them as "MARK TERMINATION" to clarify this.
      
      Change-Id: Ie98bd961195acde49598b4fa3f9e7d90d757c0a6
      Reviewed-on: https://go-review.googlesource.com/30018Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      94589054
    • Austin Clements's avatar
      cmd/trace: move process-wide GC events to their own row · eed309f5
      Austin Clements authored
      Currently, the process-wide GC state is attributed to the P that
      happened to perform the allocation that exceeded the GC trigger. This
      is pretty arbitrary and makes it hard to see when GC is running since
      the GC spans are intermingled with a lot of other trace noise.
      
      The current display is particularly confusing because it creates three
      sub-rows in the P row that can overlap each other. Usually a P has
      just two sub-rows: one showing the current G and another showing that
      G's activity. However, because GC is attributed to a proc, it winds up
      as a third row that neither subsumes nor is subsumed by any other row.
      This in turn screws up the trace's layout and results in overlapping
      events.
      
      Fix these problems by creating a new dedicated row like the existing
      "Network" and "Timer" rows and displaying process-wide GC events in
      this row. Mark termination and sweep events still appear in their
      respective P rows because these are meaningfully attributed.
      
      Change-Id: Ie1a1c6cf8c446e4b043f10f3968f91ff1b546d15
      Reviewed-on: https://go-review.googlesource.com/30017Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      eed309f5
    • Austin Clements's avatar
      runtime: make next_gc ^0 when GC is disabled · fa9b57bb
      Austin Clements authored
      When GC is disabled, we set gcpercent to -1. However, we still use
      gcpercent to compute several values, such as next_gc and gc_trigger.
      These calculations are meaningless when gcpercent is -1 and result in
      meaningless values. This is okay in a sense because we also never use
      these values if gcpercent is -1, but they're confusing when exposed to
      the user, for example via MemStats or the execution trace. It's
      particularly unfortunate in the execution trace because it attempts to
      plot the underflowed value of next_gc, which scales all useful
      information in the heap row into oblivion.
      
      Fix this by making next_gc ^0 when gcpercent < 0. This has the
      advantage of being true in a way: next_gc is effectively infinite when
      gcpercent < 0. We can also detect this special value when updating the
      execution trace and report next_gc as 0 so it doesn't blow up the
      display of the heap line.
      
      Change-Id: I4f366e4451f8892a4908da7b2b6086bdc67ca9a9
      Reviewed-on: https://go-review.googlesource.com/30016Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      fa9b57bb
    • Keith Randall's avatar
      test: re-enable live2 test on amd64 · f8a0c15e
      Keith Randall authored
      Not sure why it was ever disabled (early SSA work?) but it passes now.
      
      Change-Id: I76439cacdbd286ce077f7e08c4d0663396a0cd8f
      Reviewed-on: https://go-review.googlesource.com/30672Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      f8a0c15e
    • Keith Randall's avatar
      cmd/compile: do regalloc check only when checkEnabled · 93d5f43a
      Keith Randall authored
      No point doing this check all the time.
      
      Fixes #15621
      
      Change-Id: I1966c061986fe98fe9ebe146d6b9738c13cef724
      Reviewed-on: https://go-review.googlesource.com/30670Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      93d5f43a
    • Russ Cox's avatar
      fmt: document and adjust Scanf space handling to eliminate a few paradoxes · 0db9518a
      Russ Cox authored
      This CL makes minor adjustment to the handling of spaces and newlines
      and then documents the result.
      
      The semantic adjustment mainly concerns the handling of a run of
      spaces following a newline in the format, like in "\n ".
      Previously, that run of spaces was ignored entirely, leading to paradoxes
      like the format "1 \n 2" not matching itself as input.
      Now, spaces following a newline in the format match zero or more
      spaces following the corresponding newline in the input.
      
      The changes to the test suite show how minor the semantic adjustments are
      and how they make the behavior more regular than previously.
      
      This CL also updates the documentation to explain the handling of
      spaces more precisely, incorporating the draft from CL 17723 but
      describing the newly introduced behavior.
      
      Fixes #13565.
      
      Change-Id: I129666e9ba42de3c28b67f75cb47488e9a4c1867
      Reviewed-on: https://go-review.googlesource.com/30611Reviewed-by: default avatarRob Pike <r@golang.org>
      0db9518a
    • Russ Cox's avatar
      fmt: add tests showing current Scanf space handling · 23606c6f
      Russ Cox authored
      There are no semantic changes here, just tests to establish
      the status quo. A followup CL will make some semantic changes,
      the (limited) scope of which should be clear from the number of
      tests that change.
      
      For #13565.
      
      Change-Id: I960749cf59d4dfe39c324875bcc575096654f883
      Reviewed-on: https://go-review.googlesource.com/30610
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      23606c6f
    • Matthew Dempsky's avatar
      cmd/compile: cache pointer and slice types · 78a267e3
      Matthew Dempsky authored
      Anonymous pointer and slice types are very common and identical
      anyway, so just reuse them rather than allocating new ones everywhere
      they appear.
      
      Turns out to be a small code/stack size win because SSA relies on
      gc.Type identity for reusing temporary stack slots:
      
         text	   data	    bss	    dec	    hex	filename
      6453005	 231643	 146328	6830976	 683b80	go.old
      6446660	 231643	 146328	6824631	 6822b7	go.new
      
      Saves on memory usage during compile time too, and maybe a small CPU
      time win, but the benchmarks are pretty noisy:
      
      name       old time/op     new time/op     delta
      Template       342ms ± 8%      339ms ± 9%    ~           (p=0.332 n=99+99)
      Unicode        183ms ± 9%      181ms ±11%    ~           (p=0.274 n=95+98)
      GoTypes        1.05s ± 4%      1.04s ± 3%  -1.22%        (p=0.000 n=97+95)
      Compiler       4.49s ± 7%      4.46s ± 6%    ~           (p=0.058 n=96+91)
      
      name       old user-ns/op  new user-ns/op  delta
      Template        520M ±17%       522M ±20%    ~          (p=0.544 n=98+100)
      Unicode         331M ±27%       327M ±30%    ~           (p=0.615 n=98+98)
      GoTypes        1.54G ±10%      1.53G ±12%    ~          (p=0.173 n=99+100)
      Compiler       6.33G ±10%      6.33G ±10%    ~           (p=0.682 n=98+98)
      
      name       old alloc/op    new alloc/op    delta
      Template      44.5MB ± 0%     44.1MB ± 0%  -0.80%        (p=0.000 n=97+99)
      Unicode       37.5MB ± 0%     37.3MB ± 0%  -0.44%       (p=0.000 n=98+100)
      GoTypes        126MB ± 0%      124MB ± 0%  -1.41%        (p=0.000 n=98+99)
      Compiler       518MB ± 0%      508MB ± 0%  -1.90%       (p=0.000 n=98+100)
      
      name       old allocs/op   new allocs/op   delta
      Template        441k ± 0%       434k ± 0%  -1.76%       (p=0.000 n=100+97)
      Unicode         368k ± 0%       365k ± 0%  -0.69%        (p=0.000 n=99+99)
      GoTypes        1.26M ± 0%      1.23M ± 0%  -2.27%       (p=0.000 n=100+99)
      Compiler       4.60M ± 0%      4.46M ± 0%  -2.96%       (p=0.000 n=100+99)
      
      Change-Id: I94abce5c57aed0f9c48f567b3ac24c627d4c7c91
      Reviewed-on: https://go-review.googlesource.com/30632
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      78a267e3
  6. 06 Oct, 2016 14 commits