1. 10 Jan, 2018 14 commits
  2. 09 Jan, 2018 13 commits
  3. 08 Jan, 2018 1 commit
  4. 06 Jan, 2018 5 commits
  5. 05 Jan, 2018 7 commits
    • Ian Lance Taylor's avatar
      cmd/go: add support for build IDs with gccgo · fc408b62
      Ian Lance Taylor authored
      This just adds support on ELF systems, which is OK for now since that
      is all that gccgo works on.
      
      For the archive file generated by the compiler we add a new file
      _buildid.o that has a section .go.buildid containing the build ID.
      Using a new file lets us set the SHF_EXCLUDE bit in the section header,
      so the linker will discard the section. It would be nicer to use
      `objcopy --add-section`, but objcopy doesn't support setting the
      SHF_EXCLUDE bit.
      
      For an executable we just use an ordinary GNU build ID. Doing this
      required modifying cmd/internal/buildid to look for a GNU build ID,
      and use it if there is no other Go-specific note.
      
      This CL fixes a minor bug in gccgoTOolchain.link: it was using .Target
      instead of .built, so it failed for a cached file.
      
      This CL fixes a bug reading note segments: the notes are aligned as
      reported by the PT_NOTE's alignment field.
      
      Updates #22472
      
      Change-Id: I4d9e9978ef060bafc5b9574d9af16d97c13f3102
      Reviewed-on: https://go-review.googlesource.com/85555
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      fc408b62
    • Russ Cox's avatar
      cmd/test2json: fix processing of --- BENCH: output · 65fa5318
      Russ Cox authored
      If a benchmark calls b.Log without failing (without b.Error/b.Fatal/b.FailNow)
      then that turns into output very much like a test passing,
      except it says BENCH instead of PASS.
      Benchmarks failing say FAIL just like tests failing.
      
      Fixes #23346.
      
      Change-Id: Ib188e695952da78057ab4a13f90d49937aa3c232
      Reviewed-on: https://go-review.googlesource.com/86396
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      65fa5318
    • Hana Kim's avatar
      doc/debugging_with_gdb: mention delve as an alternative. · acc1ec9b
      Hana Kim authored
      Fixes #23108
      
      Change-Id: I9b3d0f0c399c0b4cb488adaf3c002bc55d5d21d9
      Reviewed-on: https://go-review.googlesource.com/84795Reviewed-by: 's avatarHeschi Kreinick <heschi@google.com>
      acc1ec9b
    • Russ Cox's avatar
      go/constant: make string addition compute actual string lazily · 010d8948
      Russ Cox authored
      It is natural for tools to take a large string concatenation like
      
      	"1" + "1" + "1" + ... + "1"
      
      and translate that into a sequence of go/constant calls:
      
      	x := constant.MakeString("1")
      	x = constant.BinaryOp(x, token.ADD, constant.MakeString("1"))
      	x = constant.BinaryOp(x, token.ADD, constant.MakeString("1"))
      	x = constant.BinaryOp(x, token.ADD, constant.MakeString("1"))
      	x = constant.BinaryOp(x, token.ADD, constant.MakeString("1"))
      	...
      
      If the underlying representation of a string constant is a Go string,
      then this leads to O(N²) memory for the concatenation of N strings,
      allocating memory for "1", "11", "111", "1111", and so on.
      This makes go/types and in particular cmd/vet run out of memory
      (or at least use far too much) on machine-generated string concatenations,
      such as those generated by go-bindata.
      
      This CL allows code like the above to operate efficiently, by delaying
      the evaluation of the actual string constant value until it is needed.
      Now the representation of a string constant is either a string or an
      explicit addition expression. The addition expression is turned into
      a string the first time it is requested and then cached for future use.
      This slows down the use of single strings, but analyses are likely not
      dominated by that use anyway. It speeds up string concatenations,
      especially large ones, significantly.
      
      On my Mac running 32-bit code:
      
      name               old time/op    new time/op    delta
      StringAdd/1-8         160ns ± 2%     183ns ± 1%  +13.98%  (p=0.000 n=10+10)
      StringAdd/4-8         650ns ± 1%     927ns ± 4%  +42.73%  (p=0.000 n=10+10)
      StringAdd/16-8       3.93µs ± 1%    2.78µs ± 2%  -29.12%  (p=0.000 n=8+9)
      StringAdd/64-8       37.3µs ± 9%    10.1µs ± 5%  -73.06%  (p=0.000 n=10+10)
      StringAdd/256-8       513µs ± 5%      38µs ± 1%  -92.63%  (p=0.000 n=10+10)
      StringAdd/1024-8     5.67ms ± 4%    0.14ms ± 2%  -97.45%  (p=0.000 n=8+10)
      StringAdd/4096-8     77.1ms ± 9%     0.7ms ± 2%  -99.10%  (p=0.000 n=10+9)
      StringAdd/16384-8     1.33s ± 7%     0.00s ±10%  -99.64%  (p=0.000 n=10+10)
      StringAdd/65536-8     21.5s ± 4%      0.0s ± 8%  -99.89%  (p=0.000 n=10+10)
      
      name               old alloc/op   new alloc/op   delta
      StringAdd/1-8          232B ± 0%      256B ± 0%  +10.34%  (p=0.000 n=10+10)
      StringAdd/4-8        1.20kB ± 0%    1.24kB ± 0%   +3.33%  (p=0.000 n=10+10)
      StringAdd/16-8       14.7kB ± 0%     4.6kB ± 0%  -68.87%  (p=0.000 n=10+10)
      StringAdd/64-8        223kB ± 0%      16kB ± 0%  -92.66%  (p=0.000 n=10+10)
      StringAdd/256-8      3.48MB ± 0%    0.07MB ± 0%  -98.07%  (p=0.000 n=10+10)
      StringAdd/1024-8     55.7MB ± 0%     0.3MB ± 0%  -99.53%  (p=0.000 n=10+10)
      StringAdd/4096-8      855MB ± 0%       1MB ± 0%  -99.88%  (p=0.000 n=10+10)
      StringAdd/16384-8    13.5GB ± 0%     0.0GB ± 0%  -99.97%  (p=0.000 n=9+10)
      StringAdd/65536-8     215GB ± 0%       0GB ± 0%  -99.99%  (p=0.000 n=10+10)
      
      name               old allocs/op  new allocs/op  delta
      StringAdd/1-8          3.00 ± 0%      3.00 ± 0%     ~     (all equal)
      StringAdd/4-8          9.00 ± 0%     11.00 ± 0%  +22.22%  (p=0.000 n=10+10)
      StringAdd/16-8         33.0 ± 0%      25.0 ± 0%  -24.24%  (p=0.000 n=10+10)
      StringAdd/64-8          129 ± 0%        75 ± 0%  -41.86%  (p=0.000 n=10+10)
      StringAdd/256-8         513 ± 0%       269 ± 0%  -47.56%  (p=0.000 n=10+10)
      StringAdd/1024-8      2.05k ± 0%     1.04k ± 0%  -49.29%  (p=0.000 n=10+10)
      StringAdd/4096-8      8.19k ± 0%     4.12k ± 0%  -49.77%  (p=0.000 n=10+10)
      StringAdd/16384-8     32.8k ± 0%     16.4k ± 0%  -49.97%  (p=0.000 n=9+10)
      StringAdd/65536-8      131k ± 0%       66k ± 0%  -50.11%  (p=0.000 n=10+10)
      
      https://perf.golang.org/search?q=upload:20180105.2
      
      Fixes #23348 (originally reported as cmd/vet failures in comments on #23222).
      
      This makes constant.Values of Kind String no longer meaningful for ==, which
      required fixes in go/types. While there, also fix go/types handling of constant.Values
      of Kind Int (for uint64), Float, and Complex.
      
      Change-Id: I80867bc9c4232c5c9b213443ff16645434a68b36
      Reviewed-on: https://go-review.googlesource.com/86395
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      010d8948
    • Russ Cox's avatar
      cmd/go: skip long tests in -short mode · 26222ddc
      Russ Cox authored
      I marked every test that takes more than 0.5 seconds on my machine
      as something to run only when not in -short mode, or in -short mode
      on the beefy linux/amd64, windows/amd64, and darwin/amd64 builders.
      
      I also shortened a few needlessly-expensive tests where possible.
      
      Cuts the time for go test -short cmd/go from 45s to 15s on my machine.
      Should help even more on some of our builders and slower user machines.
      
      Fixes #23287.
      
      Change-Id: I0e36003ef947b0ebe4224a1373731f9fa9216843
      Reviewed-on: https://go-review.googlesource.com/86252
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      26222ddc
    • Brad Fitzpatrick's avatar
      net/http: document internal error errServerClosedIdle more · fcdcb194
      Brad Fitzpatrick authored
      Updates #19943
      
      Change-Id: Iea249be51a7af3264bee9ee2b28dbd91043275fc
      Reviewed-on: https://go-review.googlesource.com/86375Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      fcdcb194
    • Brad Fitzpatrick's avatar
      net/http: don't validate WriteHeader code if header's already been sent · 596e3d9c
      Brad Fitzpatrick authored
      Also vendors x/net/http git rev 42fe2e1c for:
      
          http2: don't check WriteHeader status if we've already sent the header
          https://golang.org/cl/86255
      
      Fixes #23010
      
      Change-Id: I4f3dd63acb52d5a34a0350aaf847a7a376d6968f
      Reviewed-on: https://go-review.googlesource.com/86275Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      596e3d9c