1. 13 Mar, 2017 8 commits
    • Josh Bleecher Snyder's avatar
      cmd/compile: eliminate more nil checks of phis · c694f6f3
      Josh Bleecher Snyder authored
      The existing implementation started by eliminating
      nil checks for OpAddr, OpAddPtr, and OpPhis with
      all non-nil args.
      
      However, some OpPhis had all non-nil args,
      but their args had not been processed yet.
      
      Pull the OpPhi checks into their own loop,
      and repeat until stabilization.
      
      Eliminates a dozen additional nilchecks during make.bash.
      
      Negligible compiler performance impact.
      
      Change-Id: If7b803c3ad7582af7d9867d05ca13e03e109d864
      Reviewed-on: https://go-review.googlesource.com/37999
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      c694f6f3
    • Philip Hofer's avatar
      cmd/compile: de-virtualize interface calls · 4e0c7c3f
      Philip Hofer authored
      With this change, code like
      
          h := sha1.New()
          h.Write(buf)
          sum := h.Sum()
      
      gets compiled into static calls rather than
      interface calls, because the compiler is able
      to prove that 'h' is really a *sha1.digest.
      
      The InterCall re-write rule hits a few dozen times
      during make.bash, and hundreds of times during all.bash.
      
      The most common pattern identified by the compiler
      is a constructor like
      
          func New() Interface { return &impl{...} }
      
      where the constructor gets inlined into the caller,
      and the result is used immediately. Examples include
      {sha1,md5,crc32,crc64,...}.New, base64.NewEncoder,
      base64.NewDecoder, errors.New, net.Pipe, and so on.
      
      Some existing benchmarks that change on darwin/amd64:
      
      Crc64/ISO4KB-8        2.67µs ± 1%    2.66µs ± 0%  -0.36%  (p=0.015 n=10+10)
      Crc64/ISO1KB-8         694ns ± 0%     690ns ± 1%  -0.59%  (p=0.001 n=10+10)
      Adler32KB-8            473ns ± 1%     471ns ± 0%  -0.39%  (p=0.010 n=10+9)
      
      On architectures like amd64, the reduction in code size
      appears to contribute more to benchmark improvements than just
      removing the indirect call, since that branch gets predicted
      accurately when called in a loop.
      
      Updates #19361
      
      Change-Id: Ia9d30afdd5f6b4d38d38b14b88f308acae8ce7ed
      Reviewed-on: https://go-review.googlesource.com/37751
      Run-TryBot: Philip Hofer <phofer@umich.edu>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      4e0c7c3f
    • Robert Griesemer's avatar
      spec: remove superfluous terms "delimiter" and "special tokens" · 26e726c3
      Robert Griesemer authored
      The (original) section on "Operators and Delimiters" introduced
      superfluous terminology ("delimiter", "special token") which
      didn't matter and was used inconsistently.
      
      Removed any mention of "delimiter" or "special token" and now
      simply group the special character tokens into "operators"
      (clearly defined via links), and "punctuation" (everything else).
      
      Fixes #19450.
      
      Change-Id: Ife31b24b95167ace096f93ed180b7eae41c66808
      Reviewed-on: https://go-review.googlesource.com/38073Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      26e726c3
    • Chew Choon Keat's avatar
      net/http: unset proxy environment after test · eb715fbb
      Chew Choon Keat authored
      Fix last proxy in TestProxyFromEnvironment bleeds into other tests
      Change ResetProxyEnv to use the newer os.Unsetenv, instead of hard
      coding as ""
      
      Change-Id: I67cf833dbcf4bec2e10ea73c354334160cf05f84
      Reviewed-on: https://go-review.googlesource.com/38115
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      eb715fbb
    • Dave Cheney's avatar
      cmd/compile/internal/gc: remove unused exportsize variable · dd0e1acf
      Dave Cheney authored
      In Go 1.7 and earlier, gc.exportsize tracked the number of bytes
      written through exportf. With the removal of the old exporter in Go 1.8
      exportf is only used for printing the build id, and the header and
      trailer of the binary export format. The size of the export data is
      now returned directly from the exporter and exportsize is never
      referenced. Remove it.
      
      Change-Id: Id301144b3c26c9004c722d0c55c45b0e0801a88c
      Reviewed-on: https://go-review.googlesource.com/38116
      Run-TryBot: Dave Cheney <dave@cheney.net>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      dd0e1acf
    • Dave Cheney's avatar
      cmd/go/internal/get: remove unused tag selection code · d5a9fbd5
      Dave Cheney authored
      selectTag has been hard coded to only understand the tag `go1` since
      CL 6112060 which landed in 2012. The commit message asserted;
      
        Right now (before go1.0.1) there is only one possible tag,
        "go1", and I'd like to keep it that way.
      
      Remove goTag and the unused matching code in selectTag.
      
      Change-Id: I85f7c10f95704e22f8e8681266afd72bbcbe8fbd
      Reviewed-on: https://go-review.googlesource.com/38112Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      d5a9fbd5
    • Dave Cheney's avatar
      runtime: remove sizeToClass · 7ee43faf
      Dave Cheney authored
      CL 32219 added precomputed sizeclass tables.
      
      Remove the unused sizeToClass method which was previously only
      called from initSizes.
      
      Change-Id: I907bf9ed78430ecfaabbec7fca77ef2375010081
      Reviewed-on: https://go-review.googlesource.com/38113
      Run-TryBot: Dave Cheney <dave@cheney.net>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      7ee43faf
    • Marcel Edmund Franke's avatar
      net/http: fix body close statement is missing · e831bd1f
      Marcel Edmund Franke authored
      Call body close after ioutil.ReadAll is done
      
      Change-Id: Ieceb1965a6a8f2dbc024e983acdfe22df17d07d1
      Reviewed-on: https://go-review.googlesource.com/38059Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e831bd1f
  2. 12 Mar, 2017 2 commits
    • Martin Möhrmann's avatar
      strconv: fix performance regression in integer formatting on 32bit platforms · b71ed4ed
      Martin Möhrmann authored
      Some of the changes in CL golang.org/cl/38071/ assumed that / and %
      could always be combined to use only one DIV instruction. However,
      this is not the case for 64bit operands on a 32bit platform which use
      seperate runtime functions to calculate division and modulo.
      
      This CL restores the original optimizations that help on 32bit platforms
      with negligible impact on 64bit platforms.
      
      386:
      name          old time/op  new time/op  delta
      FormatInt-2   6.06µs ± 0%  6.02µs ± 0%  -0.70%  (p=0.000 n=20+20)
      AppendInt-2   4.98µs ± 0%  4.98µs ± 0%    ~     (p=0.747 n=18+18)
      FormatUint-2  1.93µs ± 0%  1.85µs ± 0%  -4.19%  (p=0.000 n=20+20)
      AppendUint-2  1.71µs ± 0%  1.64µs ± 0%  -3.68%  (p=0.000 n=20+20)
      
      amd64:
      name          old time/op  new time/op  delta
      FormatInt-2   2.41µs ± 0%  2.41µs ± 0%  -0.09%  (p=0.010 n=18+18)
      AppendInt-2   1.77µs ± 0%  1.77µs ± 0%  +0.08%  (p=0.000 n=18+18)
      FormatUint-2   653ns ± 1%   653ns ± 0%    ~     (p=0.178 n=20+20)
      AppendUint-2   514ns ± 0%   513ns ± 0%  -0.13%  (p=0.000 n=20+17)
      
      Change-Id: I574a18e54fb41b25fbe51ce696e7a8765abc79a6
      Reviewed-on: https://go-review.googlesource.com/38051
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      b71ed4ed
    • Matthew Dempsky's avatar
      cmd/link: eliminate markextra · d3434782
      Matthew Dempsky authored
      This appears to be leftover from when instruction selection happened
      in the linker. Many of the morestackX functions listed don't even
      exist anymore.
      
      Now that we select instructions within the compiler and assembler,
      normal deadcode elimination mechanisms should suffice for these
      symbols.
      
      Change-Id: I2cb1e435101392e7c983957c4acfbbcc87a5ca7d
      Reviewed-on: https://go-review.googlesource.com/38077
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      d3434782
  3. 11 Mar, 2017 4 commits
  4. 10 Mar, 2017 9 commits
  5. 09 Mar, 2017 14 commits
  6. 08 Mar, 2017 3 commits
    • Elias Naur's avatar
      go/internal/srcimporter: skip tests on iOS · 3a1271da
      Elias Naur authored
      The iOS test harness only includes the current test directory in its
      app bundles, but the tests need access to all source code.
      
      Change-Id: I8a902b183bc2745b4fbfffef867002d573abb1f5
      Reviewed-on: https://go-review.googlesource.com/37961
      Run-TryBot: Elias Naur <elias.naur@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      3a1271da
    • Josh Bleecher Snyder's avatar
      runtime: optimize slicebytestostring · 23be7289
      Josh Bleecher Snyder authored
      Inline rawstringtmp and simplify.
      Use memmove instead of copy.
      
      name                     old time/op  new time/op  delta
      SliceByteToString/1-8    19.4ns ± 2%  14.1ns ± 1%  -27.04%  (p=0.000 n=20+17)
      SliceByteToString/2-8    20.8ns ± 2%  15.5ns ± 2%  -25.46%  (p=0.000 n=20+20)
      SliceByteToString/4-8    20.7ns ± 1%  14.9ns ± 1%  -28.30%  (p=0.000 n=20+20)
      SliceByteToString/8-8    23.2ns ± 1%  17.1ns ± 1%  -26.22%  (p=0.000 n=19+19)
      SliceByteToString/16-8   29.4ns ± 1%  23.6ns ± 1%  -19.76%  (p=0.000 n=17+20)
      SliceByteToString/32-8   31.4ns ± 1%  26.0ns ± 1%  -17.11%  (p=0.000 n=16+19)
      SliceByteToString/64-8   36.1ns ± 0%  30.0ns ± 0%  -16.96%  (p=0.000 n=16+16)
      SliceByteToString/128-8  46.9ns ± 0%  38.9ns ± 0%  -17.15%  (p=0.000 n=17+19)
      
      Change-Id: I422e688830e4a9bd21897d1f74964625b735f436
      Reviewed-on: https://go-review.googlesource.com/37791
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMarvin Stenger <marvin.stenger94@gmail.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      23be7289
    • Elias Naur's avatar
      os/user: fake Current on Android · 228438e0
      Elias Naur authored
      On Android devices where the stub fallback for Current fails to
      extract a User from the environment, return a dummy fallback instead
      of failing.
      
      While we're here, use / instead of /home/nacl for the NaCL fallback.
      
      Hopefully fixes the Android builder.
      
      Change-Id: Ia29304fbc224ee5f9c0f4e706d1756f765a7eae5
      Reviewed-on: https://go-review.googlesource.com/37960
      Run-TryBot: Elias Naur <elias.naur@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      228438e0