1. 22 Mar, 2016 10 commits
    • Josh Bleecher Snyder's avatar
      cmd/compile: reduce use of **Node parameters · 34699bc7
      Josh Bleecher Snyder authored
      Escape analysis has a hard time with tree-like
      structures (see #13493 and #14858).
      This is unlikely to change.
      As a result, when invoking a function that accepts
      a **Node parameter, we usually allocate a *Node
      on the heap. This happens a whole lot.
      
      This CL changes functions from taking a **Node
      to acting more like append: It both modifies
      the input and returns a replacement for it.
      
      Because of the cascading nature of escape analysis,
      in order to get the benefits, I had to modify
      almost all such functions. The remaining functions
      are in racewalk and the backend. I would be happy
      to update them as well in a separate CL.
      
      This CL was created by manually updating the
      function signatures and the directly impacted
      bits of code. The callsites were then automatically
      updated using a bespoke script:
      https://gist.github.com/josharian/046b1be7aceae244de39
      
      For ease of reviewing and future understanding,
      this CL is also broken down into four CLs,
      mailed separately, which show the manual
      and the automated changes separately.
      They are CLs 20990, 20991, 20992, and 20993.
      
      Passes toolstash -cmp.
      
      name       old time/op     new time/op     delta
      Template       335ms ± 5%      324ms ± 5%   -3.35%        (p=0.000 n=23+24)
      Unicode        176ms ± 9%      165ms ± 6%   -6.12%        (p=0.000 n=23+24)
      GoTypes        1.10s ± 4%      1.07s ± 2%   -2.77%        (p=0.000 n=24+24)
      Compiler       5.31s ± 3%      5.15s ± 3%   -2.95%        (p=0.000 n=24+24)
      MakeBash       41.6s ± 1%      41.7s ± 2%     ~           (p=0.586 n=23+23)
      
      name       old alloc/op    new alloc/op    delta
      Template      63.3MB ± 0%     62.4MB ± 0%   -1.36%        (p=0.000 n=25+23)
      Unicode       42.4MB ± 0%     41.6MB ± 0%   -1.99%        (p=0.000 n=24+25)
      GoTypes        220MB ± 0%      217MB ± 0%   -1.11%        (p=0.000 n=25+25)
      Compiler       994MB ± 0%      973MB ± 0%   -2.08%        (p=0.000 n=24+25)
      
      name       old allocs/op   new allocs/op   delta
      Template        681k ± 0%       574k ± 0%  -15.71%        (p=0.000 n=24+25)
      Unicode         518k ± 0%       413k ± 0%  -20.34%        (p=0.000 n=25+24)
      GoTypes        2.08M ± 0%      1.78M ± 0%  -14.62%        (p=0.000 n=25+25)
      Compiler       9.26M ± 0%      7.64M ± 0%  -17.48%        (p=0.000 n=25+25)
      
      name       old text-bytes  new text-bytes  delta
      HelloSize       578k ± 0%       578k ± 0%     ~     (all samples are equal)
      CmdGoSize      6.46M ± 0%      6.46M ± 0%     ~     (all samples are equal)
      
      name       old data-bytes  new data-bytes  delta
      HelloSize       128k ± 0%       128k ± 0%     ~     (all samples are equal)
      CmdGoSize       281k ± 0%       281k ± 0%     ~     (all samples are equal)
      
      name       old exe-bytes   new exe-bytes   delta
      HelloSize       921k ± 0%       921k ± 0%     ~     (all samples are equal)
      CmdGoSize      9.86M ± 0%      9.86M ± 0%     ~     (all samples are equal)
      
      Change-Id: I277d95bd56d51c166ef7f560647aeaa092f3f475
      Reviewed-on: https://go-review.googlesource.com/20959Reviewed-by: default avatarDave Cheney <dave@cheney.net>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      34699bc7
    • Ian Lance Taylor's avatar
      debug/dwarf: add Reader.SeekPC and Data.Ranges · d1b8871f
      Ian Lance Taylor authored
      These new methods help find the compilation unit to pass to the
      LineReader method in order to find the line information for a PC.
      The Ranges method also helps identify the specific function for a PC,
      needed to determine the function name.
      
      This uses the .debug.ranges section if necessary, and changes the object
      file format packages to pass in the section contents if available.
      
      Change-Id: I5ebc3d27faaf1a126ffb17a1e6027efdf64af836
      Reviewed-on: https://go-review.googlesource.com/20769Reviewed-by: default avatarAustin Clements <austin@google.com>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      d1b8871f
    • Dominik Honnef's avatar
      encoding/json, internal/testenv: use Fatalf · 77f4b773
      Dominik Honnef authored
      Change-Id: I64dd09e76d811000a914776fdad47808e3895690
      Reviewed-on: https://go-review.googlesource.com/20989Reviewed-by: default avatarDave Cheney <dave@cheney.net>
      77f4b773
    • Michael Munday's avatar
      misc/cgo/test: add RewindAndSetgid implementation for s390x · c16a6151
      Michael Munday authored
      Required to pass the issue9400 test.
      
      Change-Id: I595223c403b12faade54e2e46510f8537150af39
      Reviewed-on: https://go-review.googlesource.com/20940Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c16a6151
    • Michael Munday's avatar
      internal/syscall/unix: add randomTrap const for s390x · 5f0935b7
      Michael Munday authored
      Change-Id: I81376f524e76db25fd52cc5bec2c80fbf618a0c5
      Reviewed-on: https://go-review.googlesource.com/20877Reviewed-by: default avatarMinux Ma <minux@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      5f0935b7
    • Michael Munday's avatar
      cmd/internal/obj: add support for s390x · 2a7e85f1
      Michael Munday authored
      Adds a new R_PCRELDBL relocation for 2-byte aligned relative
      relocations on s390x. Should be removed once #14218 is
      implemented.
      
      Change-Id: I79dd2d8e746ba8cbc26c570faccfdd691e8161e8
      Reviewed-on: https://go-review.googlesource.com/20941Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      2a7e85f1
    • Keith Randall's avatar
      cmd/compile: change the way SSA does slice zero-cap detection · 69a7c152
      Keith Randall authored
      There is a special case for slicing s[i:j] when the resulting
      slice has zero capacity, to prevent pointing to the next object
      in memory.
      
      Change this special case code from:
        rptr := rcap == 0 ? ptr : ptr+i*elemsize
      to
        rptr := ptr + (rcap == 0 ? 0 : i) * elemsize
      
      This change leads to slightly smaller generated code, replacing
      a load with a register zero.
      
      old:
      	0x002e 00046 (slice.go:8)	CMPQ	BX, $0
      	0x0032 00050 (slice.go:8)	JEQ	$0, 78
      	0x0034 00052 (slice.go:8)	MOVQ	"".a+8(FP), BP
      	0x0039 00057 (slice.go:8)	LEAQ	(BP)(CX*8), AX
      	0x003e 00062 ... rest of function ...
      
      	0x004e 00078 (slice.go:7)	MOVQ	"".a+8(FP), AX
      	0x0053 00083 (slice.go:8)	JMP	62
      
      new:
      	0x002e 00046 (slice.go:8)	CMPQ	BX, $0
      	0x0032 00050 (slice.go:8)	JEQ	$0, 78
      	0x0034 00052 (slice.go:8)	MOVQ	"".a+8(FP), BP
      	0x0039 00057 (slice.go:8)	LEAQ	(BP)(CX*8), AX
      	0x003e 00062 ... rest of function...
      
      	0x004e 00078 (slice.go:8)	MOVQ	$0, CX
      	0x0050 00080 (slice.go:8)	JMP	52
      
      Change-Id: I2a396616b0d7b090c226a47c92a7ba14b128401f
      Reviewed-on: https://go-review.googlesource.com/20994Reviewed-by: default avatarDavid Chase <drchase@google.com>
      69a7c152
    • David Crawshaw's avatar
      net/http, internal/testenv: find go binary in PATH · d37d3bdc
      David Crawshaw authored
      Fixes #14901
      
      Change-Id: Ia32e09767374a341c9a36c5d977d47d7d1a82315
      Reviewed-on: https://go-review.googlesource.com/20967Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      d37d3bdc
    • Michael Munday's avatar
      cmd/dist: allow gohostarch to be s390x · 596949c1
      Michael Munday authored
      Should let the s390x builder progress a little further.
      
      Change-Id: I5eab5f384b0b039f8e246ba69ecfb24de08625d2
      Reviewed-on: https://go-review.googlesource.com/20965Reviewed-by: default avatarMinux Ma <minux@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      596949c1
    • Keith Randall's avatar
      cmd/compile: allow naming of subexpressions · 259b7edf
      Keith Randall authored
      Allow names to be used for subexpressions of match rules.
      For example:
      
      (OpA x:(OpB y)) -> ..use x here to refer to the OpB value..
      
      This gets rid of the .Args[0].Args[0]... way of naming we
      used to use.
      
      While we're here, give all subexpression matches names instead
      of recomputing them with .Args[i] sequences each time they
      are referenced.  Makes the generated rule code a bit smaller.
      
      Change-Id: Ie42139f6f208933b75bd2ae8bd34e95419bc0e4e
      Reviewed-on: https://go-review.googlesource.com/20997
      Run-TryBot: Todd Neal <todd@tneal.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarTodd Neal <todd@tneal.org>
      259b7edf
  2. 21 Mar, 2016 30 commits