1. 20 Sep, 2017 22 commits
    • Ilya Tocar's avatar
      runtime: make nextFreeFast inlinable · 101fbc2c
      Ilya Tocar authored
      https://golang.org/cl/22598 made nextFreeFast inlinable.
      But during https://golang.org/cl/63611 it was discovered, that it is no longer inlinable.
      Reduce number of statements below inlining threshold to make it inlinable again.
      Also update tests, to prevent regressions.
      Doesn't reduce readability.
      
      Change-Id: Ia672784dd48ed3b1ab46e390132f1094fe453de5
      Reviewed-on: https://go-review.googlesource.com/65030
      Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
      101fbc2c
    • Michael Munday's avatar
      cmd/compile: fix large global variables in -linkshared mode on s390x · 55ac5b50
      Michael Munday authored
      When rewriting loads and stores accessing global variables to use the
      GOT we were making use of REGTMP (R10). Unfortunately loads and stores
      with large offsets (larger than 20-bits) were also using REGTMP,
      causing it to be clobbered and subsequently a segmentation fault.
      
      This can be fixed by using REGTMP2 (R11) for the rewrite. This is fine
      because REGTMP2 only has a couple of uses in the assembler (division,
      high multiplication and storage-to-storage instructions). We didn't
      use REGTMP2 originally because it used to be used more frequently,
      in particular for stores of constants to memory. However we have now
      eliminated those uses.
      
      This was found while writing a test case for CL 63030. That test case
      is included in this CL.
      
      Change-Id: I13956f1f3ca258a7c8a7ff0a7570d2848adf7f68
      Reviewed-on: https://go-review.googlesource.com/65011Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      55ac5b50
    • Matthew Dempsky's avatar
      cmd/compile: change liveness-related functions into methods · 0d73f1e3
      Matthew Dempsky authored
      No functional change; just making the code slightly more idiomatic.
      
      Passes toolstash-check.
      
      Change-Id: I66d14a8410bbecf260d0ea5683564aa413ce5747
      Reviewed-on: https://go-review.googlesource.com/65070
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      0d73f1e3
    • Matthew Dempsky's avatar
      cmd/compile: refactor onebitwalktype1 · 39983cf4
      Matthew Dempsky authored
      The existing logic tried to advance the offset for each variable's
      width, but then tried to undo this logic with the array and struct
      handling code. It can all be much simpler by only worrying about
      computing offsets within the array and struct code.
      
      While here, include a short-circuit for zero-width arrays to fix a
      pedantic compiler failure case.
      
      Passes toolstash-check.
      
      Fixes #20739.
      
      Change-Id: I98af9bb512a33e3efe82b8bf1803199edb480640
      Reviewed-on: https://go-review.googlesource.com/64471
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      39983cf4
    • Matthew Dempsky's avatar
      cmd/compile/internal/syntax: fix source buffer refilling · e06a64a4
      Matthew Dempsky authored
      The previous code seems to have an off-by-1 in it somewhere, the
      consequence being that we didn't properly preserve all of the old
      buffer contents that we intended to.
      
      After spending a while looking at the existing window-shifting logic,
      I wasn't able to understand exactly how it was supposed to work or
      where the issue was, so I rewrote it to be (at least IMO) more
      obviously correct.
      
      Fixes #21938.
      
      Change-Id: I1ed7bbc1e1751a52ab5f7cf0411ae289586dc345
      Reviewed-on: https://go-review.googlesource.com/64830
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      e06a64a4
    • Matthew Dempsky's avatar
      cmd/compile/internal/types: simplify dclstack · a53e8539
      Matthew Dempsky authored
      We used to backup symbol declarations using complete Syms, but this
      was unnecessary: very few of Sym's fields were actually needed. Also,
      to restore a symbol, we had to re-Lookup the Sym in its Pkg.
      
      By introducing a new dedicated dsym type for this purpose, we can
      address both of these deficiencies.
      
      Passes toolstash-check.
      
      Change-Id: I39f3d672b301f84a3a62b9b34b4b2770cb25df79
      Reviewed-on: https://go-review.googlesource.com/64811
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      a53e8539
    • Kunpei Sakai's avatar
      net/http: net/http: doc that prefer "must" over "should" · 7e10a2f6
      Kunpei Sakai authored
      See https://go-review.googlesource.com/c/go/+/59850
      
      Change-Id: I9f0b6bc009eae86cbbdb56562ee4eb8d5eef653e
      Reviewed-on: https://go-review.googlesource.com/61230Reviewed-by: default avatarTom Bergan <tombergan@google.com>
      7e10a2f6
    • Michael Munday's avatar
      cmd/compile: stop rematerializable ops from clobbering flags · 2cb61aa3
      Michael Munday authored
      Rematerializable ops can be inserted after the flagalloc phase,
      they must therefore not clobber flags. This CL adds a check to
      ensure this doesn't happen and fixes the instances where it
      does currently.
      
      amd64: ADDQconst and ADDLconst were recently changed to be
      rematerializable in CL 54393 (only in tip, not 1.9). That change
      has been reverted.
      
      s390x: MOVDaddr could clobber flags when using dynamic linking due
      to a ADD with immediate instruction. Change the code generation to
      use LA/LAY instead.
      
      Fixes #21080.
      
      Change-Id: Ia85c882afa2a820a309e93775354b3169ec6d034
      Reviewed-on: https://go-review.googlesource.com/63030
      Run-TryBot: Michael Munday <mike.munday@ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Reviewed-by: default avatarIlya Tocar <ilya.tocar@intel.com>
      2cb61aa3
    • Matthew Dempsky's avatar
      cmd/compile: remove {Mark,Pop}dcl calls in bimport · 3628c2d5
      Matthew Dempsky authored
      These were previously only relevant for recording scoping level so
      that invalid 'fallthrough' statements could be rejected. However,
      that's handled differently since CL 61130 (in particular, there's no
      use of types.Block anymore), so these calls can be safely removed.
      
      Passes toolstash-check.
      
      Change-Id: I8631b156594df85b8d39f57acad3ebcf099d52f9
      Reviewed-on: https://go-review.googlesource.com/64810
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      3628c2d5
    • Albert Nigmatzianov's avatar
      io: Add benchmarks for CopyN · 36e1c7ab
      Albert Nigmatzianov authored
      Copied from CL 60630
      
      Current results:
      name          time/op
      CopyNSmall-4  2.20µs ±90%
      CopyNLarge-4   136µs ±56%
      
      name          alloc/op
      CopyNSmall-4  1.84kB ±21%
      CopyNLarge-4   128kB ±10%
      
      name          allocs/op
      CopyNSmall-4    1.00 ± 0%
      CopyNLarge-4    1.00 ± 0%
      
      Change-Id: If08c0132a773e936c9f61bff96e0aabf58006d31
      Reviewed-on: https://go-review.googlesource.com/64932
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      36e1c7ab
    • Albert Nigmatzianov's avatar
      io: Improve performance of CopyN · 098eb016
      Albert Nigmatzianov authored
      Benchmarks:
      name          old time/op    new time/op    delta
      CopyNSmall-4    5.09µs ± 1%    2.25µs ±86%  -55.91%  (p=0.000 n=11+14)
      CopyNLarge-4     114µs ±73%     121µs ±72%     ~     (p=0.701 n=14+14)
      
      name          old alloc/op   new alloc/op   delta
      CopyNSmall-4    34.6kB ± 0%     1.9kB ±19%  -94.60%  (p=0.000 n=12+14)
      CopyNLarge-4     129kB ± 8%     127kB ±18%   -2.00%  (p=0.007 n=14+14)
      
      name          old allocs/op  new allocs/op  delta
      CopyNSmall-4      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=14+14)
      CopyNLarge-4      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=14+14)
      
      Benchmark code:
      type Buffer struct {
      	bytes.Buffer
      	io.ReaderFrom
      }
      
      func BenchmarkCopyNSmall(b *testing.B) {
      	bs := bytes.Repeat([]byte{0}, 1024)
      	rd := bytes.NewReader(bs)
      	buf := new(Buffer)
      	b.ResetTimer()
      
      	for i := 0; i < b.N; i++ {
      		io.CopyN(buf, rd, 512)
      		rd.Reset(bs)
      	}
      }
      
      func BenchmarkCopyNLarge(b *testing.B) {
      	bs := bytes.Repeat([]byte{0}, 64*1024)
      	rd := bytes.NewReader(bs)
      	buf := new(Buffer)
      	b.ResetTimer()
      
      	for i := 0; i < b.N; i++ {
      		io.CopyN(buf, rd, (32*1024)+1)
      		rd.Reset(bs)
      	}
      }
      
      Change-Id: Id8d29e55758452c870cf372db640f07baec05849
      Reviewed-on: https://go-review.googlesource.com/60630
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      098eb016
    • Gabriel Aszalos's avatar
      bytes: improve test readability · 97757881
      Gabriel Aszalos authored
      This CL improves the readability of the tests in the bytes package by
      naming the `data` test variable `testString`, using the same convention
      as its counterpart, `testBytes`.
      
      It additionally removes some type casting which was unnecessary.
      
      Change-Id: If38b5606ce8bda0306bae24498f21cb8dbbb6377
      Reviewed-on: https://go-review.googlesource.com/64931
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      97757881
    • Marvin Stenger's avatar
      cmd/dist: rename variables + functions · 1b548dc5
      Marvin Stenger authored
      This belongs to a series of clean-up changes (see below) for cmd/dist.
      This is change (9).
      
      These changes include:
      (1)  apply minor fixes
      (2)  restore behavior of branchtag
      (3)  unleash bootstrap optimization for windows
      (4)  use standard generated code header
      (5)  remove trivial variables + functions
      (6)  move functions for the better
      (7)  simplify code segments
      (8)  use bytes.Buffer for code generation
      (9)  rename variables + functions
      
      Change-Id: I9247433d7d07a2c99d15b0a4d23164bcbc042768
      Reviewed-on: https://go-review.googlesource.com/61015
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      1b548dc5
    • Gabriel Aszalos's avatar
      bytes: correct message in test log · a696db1b
      Gabriel Aszalos authored
      Change-Id: Ib731874b9a37ff141e4305d8ccfdf7c165155da6
      Reviewed-on: https://go-review.googlesource.com/64930Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      a696db1b
    • Michael Munday's avatar
      cmd/compile: add s390x intrinsics for Ceil, Floor, Round and Trunc · 7582494e
      Michael Munday authored
      Ceil, Floor and Trunc are pre-existing intrinsics. Round is a new
      function and has been added as an intrinsic in this CL. All of the
      functions can be implemented as a single 'LOAD FP INTEGER'
      instruction, FIDBR, on s390x.
      
      name   old time/op  new time/op  delta
      Ceil   2.34ns ± 0%  0.85ns ± 0%  -63.74%  (p=0.000 n=5+4)
      Floor  2.33ns ± 0%  0.85ns ± 1%  -63.35%  (p=0.008 n=5+5)
      Round  4.23ns ± 0%  0.85ns ± 0%  -79.89%  (p=0.000 n=5+4)
      Trunc  2.35ns ± 0%  0.85ns ± 0%  -63.83%  (p=0.029 n=4+4)
      
      Change-Id: Idee7ba24a2899d12bf9afee4eedd6b4aaad3c510
      Reviewed-on: https://go-review.googlesource.com/63890
      Run-TryBot: Michael Munday <mike.munday@ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      7582494e
    • Rajath Agasthya's avatar
      fmt: Implement pp.WriteString method · 8802b188
      Rajath Agasthya authored
      This allows io.WriteString to make use of WriteString method
      implemented by pp when writing a string to fmt.State.
      
      Fixes #20786
      
      Change-Id: Ice7a92bf303127ad87f05562217fa076f5c589ad
      Reviewed-on: https://go-review.googlesource.com/61430Reviewed-by: default avatarRob Pike <r@golang.org>
      8802b188
    • Hiroshi Ioka's avatar
      all: correct location of go tool · fb54abe9
      Hiroshi Ioka authored
      In general, there are no guarantee that `go` command exist on $PATH.
      This CL tries to get `go` command from $GOROOT/bin instead.
      
      There are three kinds of code we should handle:
          For normal code, the CL implements goCmd() or goCmdName().
          For unit tests, the CL uses testenv.GoTool() or testenv.GoToolPath().
          For integration tests, the CL sets PATH=$GOROOT/bin:$PATH in cmd/dist.
      
      Note that make.bash sets PATH=$GOROOT/bin:$PATH in the build process.
      So this change is only useful when we use toolchain manually.
      
      Updates #21875
      
      Change-Id: I963b9f22ea732dd735363ececde4cf94a5db5ca2
      Reviewed-on: https://go-review.googlesource.com/64650
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      fb54abe9
    • Marvin Stenger's avatar
      cmd/dist: use bytes.Buffer for code generation · 88ced021
      Marvin Stenger authored
      This belongs to a series of clean-up changes (see below) for cmd/dist.
      This is change (8).
      
      These changes include:
      (1)  apply minor fixes
      (2)  restore behavior of branchtag
      (3)  unleash bootstrap optimization for windows
      (4)  use standard generated code header
      (5)  remove trivial variables + functions
      (6)  move functions for the better
      (7)  simplify code segments
      (8)  use bytes.Buffer for code generation
      (9)  rename variables + functions
      (10) remove doc.go
      
      Change-Id: I2d5a071eb8e14690325612271432fdc5f43b108b
      Reviewed-on: https://go-review.googlesource.com/61014
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      88ced021
    • Hiroshi Ioka's avatar
      cmd/nm: add test case for go archives · 822f832d
      Hiroshi Ioka authored
      Also, rename some test cases, check (*os.File).Close
      
      For #21706
      
      Change-Id: Ie60c4d345b2259736c823dc6001c08affcdd86e7
      Reviewed-on: https://go-review.googlesource.com/64510Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      822f832d
    • Samuel Tan's avatar
      html/template: prevent aliasing of parse Trees via AddParseTree · cd0a5f08
      Samuel Tan authored
      Check all associated templates in the set for an existing reference
      to the given Tree in AddParseTree before assigning that reference
      to a new or existing template. This prevents multiple html/template
      Templates from referencing and modifying the same underlying Tree.
      
      While there, fix a few existing unit tests so that they terminate
      upon encountering unrecoverable failures.
      
      Fixes #21844
      
      Change-Id: I6b4f6996cf5467113ef94f7b91a6933dbbc21839
      Reviewed-on: https://go-review.googlesource.com/64770
      Run-TryBot: Rob Pike <r@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      cd0a5f08
    • Marvin Stenger's avatar
      cmd/dist: simplify code segments · 3844e707
      Marvin Stenger authored
      This belongs to a series of clean-up changes (see below) for cmd/dist.
      This is change (7).
      
      These changes include:
      (1)  apply minor fixes
      (2)  restore behavior of branchtag
      (3)  unleash bootstrap optimization for windows
      (4)  use standard generated code header
      (5)  remove trivial variables + functions
      (6)  move functions for the better
      (7)  simplify code segments
      (8)  use bytes.Buffer for code generation
      (9)  rename variables + functions
      (10) remove doc.go
      
      Change-Id: Ia3c33ef060b4baaef354b729ba82ed0b28e52857
      Reviewed-on: https://go-review.googlesource.com/61013
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      3844e707
    • Sam Whited's avatar
      cmd/vet: don't warn on expected space in XML tag · c174e46a
      Sam Whited authored
      The change in https://golang.org/cl/43295 added warning about spaces in
      struct tags. However, in XML tags it is expected that there will be a
      space between the namespace and the local name.
      
      Change-Id: Ic31c3bdae30797f406f25c737b83bbe2de1ed1db
      Reviewed-on: https://go-review.googlesource.com/62570
      Run-TryBot: Rob Pike <r@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      c174e46a
  2. 19 Sep, 2017 14 commits
  3. 18 Sep, 2017 4 commits