1. 20 Mar, 2019 8 commits
  2. 19 Mar, 2019 23 commits
  3. 18 Mar, 2019 9 commits
    • Keith Randall's avatar
      cmd/compile: better write barrier removal when initializing new objects · ca36af21
      Keith Randall authored
      When initializing a new object, we're often writing
      1) to a location that doesn't have a pointer to a heap object
      2) a pointer that doesn't point to a heap object
      
      When both those conditions are true, we can avoid the write barrier.
      
      This CL detects case 1 by looking for writes to known-zeroed
      locations.  The results of runtime.newobject are zeroed, and we
      perform a simple tracking of which parts of that object are written so
      we can determine what part remains zero at each write.
      
      This CL detects case 2 by looking for addresses of globals (including
      the types and itabs which are used in interfaces) and for nil pointers.
      
      Makes cmd/go 0.3% smaller. Some particular cases, like the slice
      literal in #29573, can get much smaller.
      
      TODO: we can remove actual zero writes also with this mechanism.
      
      Update #29573
      
      Change-Id: Ie74a3533775ea88da0495ba02458391e5db26cb9
      Reviewed-on: https://go-review.googlesource.com/c/go/+/156363
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      ca36af21
    • Philipp Stephani's avatar
      cmd/cgo: use C exact-width integer types to represent Go types · 08751259
      Philipp Stephani authored
      The exact-width integer types are required to use two’s complement
      representation and may not have padding bits, cf. §7.20.1.1/1 in the C11
      standard or https://en.cppreference.com/w/c/types/integer.  This ensures that
      they have the same domain and representation as the corresponding Go types.
      
      Fixes #29878
      
      Change-Id: Ie8a51e91666dfd89731c7859abe47356c94ca1be
      GitHub-Last-Rev: 546a2cc3f1e22dc282757f73c01c91b00899d911
      GitHub-Pull-Request: golang/go#29907
      Reviewed-on: https://go-review.googlesource.com/c/go/+/159258
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      08751259
    • Keith Randall's avatar
      cmd/compile: rename init function from init.ializers back to init · 7b916243
      Keith Randall authored
      The name change init -> init.ializers was initially required for
      initialization code.
      
      With CL 161337 there's no wrapper code any more, there's a data
      structure instead (named .inittask). So we can go back to just
      plain init appearing in tracebacks.
      
      RELNOTE=yes
      
      Update #29919. Followon to CL 161337.
      
      Change-Id: I5a4a49d286df24b53b2baa193dfda482f3ea82a5
      Reviewed-on: https://go-review.googlesource.com/c/go/+/167780
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7b916243
    • bakape's avatar
      net/http: Detect MIME type of v5 RAR archives · 27e444d5
      bakape authored
      Change-Id: Id9dedc861523e2dafe0e67f70862973124fa07b3
      GitHub-Last-Rev: b662561f1980dff9861dd8a738c75a03baa72681
      GitHub-Pull-Request: golang/go#30909
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168039Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      27e444d5
    • Keith Randall's avatar
      runtime: fix registers for bounds check calling convention on arm · 689544c0
      Keith Randall authored
      Some of the registers in which indexes + length were supposed to
      be passed were wrong.
      
      Update #30116
      
      Change-Id: I1089366b7429c1e0ecad9219b847db069ce6b5d6
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168041
      Run-TryBot: Keith Randall <khr@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      689544c0
    • Keith Randall's avatar
      cmd/compile: reorganize init functions · d949d0b9
      Keith Randall authored
      Instead of writing an init function per package that does the same
      thing for every package, just write that implementation once in the
      runtime. Change the compiler to generate a data structure that encodes
      the required initialization operations.
      
      Reduces cmd/go binary size by 0.3%+.  Most of the init code is gone,
      including all the corresponding stack map info. The .inittask
      structures that replace them are quite a bit smaller.
      
      Most usefully to me, there is no longer an init function in every -S output.
      (There is an .inittask global there, but it's much less distracting.)
      
      After this CL we could change the name of the "init.ializers" function
      back to just "init".
      
      Update #6853
      
      R=go1.13
      
      Change-Id: Iec82b205cc52fe3ade4d36406933c97dbc9c01b1
      Reviewed-on: https://go-review.googlesource.com/c/go/+/161337
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      d949d0b9
    • Joel Sing's avatar
      cmd/dist: sort gohostos switch entries · 991c85a7
      Joel Sing authored
      Sort gohostos switch entries for readability/maintainability.
      
      Change-Id: I565b0aee33e8463502faa68eaceea6f7dccca66b
      Reviewed-on: https://go-review.googlesource.com/c/go/+/154379
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarTobias Klauser <tobias.klauser@gmail.com>
      991c85a7
    • Matthew Dempsky's avatar
      cmd/compile: fix importing rewritten f(g()) calls · 916e861f
      Matthew Dempsky authored
      golang.org/cl/166983 started serializing the Ninit field of OCALL
      nodes within function inline bodies (necessary to fix a regression in
      building crypto/ecdsa with -gcflags=-l=4), but this means the Ninit
      field needs to be typechecked when the imported function body is used.
      
      It's unclear why this wasn't necessary for the crypto/ecdsa
      regression.
      
      Fixes #30907.
      
      Change-Id: Id5f0bf3c4d17bbd6d5318913b859093c93a0a20c
      Reviewed-on: https://go-review.googlesource.com/c/go/+/168199
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      916e861f
    • Keith Randall's avatar
      cmd/compile,runtime: provide index information on bounds check failure · 2c423f06
      Keith Randall authored
      A few examples (for accessing a slice of length 3):
      
         s[-1]    runtime error: index out of range [-1]
         s[3]     runtime error: index out of range [3] with length 3
         s[-1:0]  runtime error: slice bounds out of range [-1:]
         s[3:0]   runtime error: slice bounds out of range [3:0]
         s[3:-1]  runtime error: slice bounds out of range [:-1]
         s[3:4]   runtime error: slice bounds out of range [:4] with capacity 3
         s[0:3:4] runtime error: slice bounds out of range [::4] with capacity 3
      
      Note that in cases where there are multiple things wrong with the
      indexes (e.g. s[3:-1]), we report one of those errors kind of
      arbitrarily, currently the rightmost one.
      
      An exhaustive set of examples is in issue30116[u].out in the CL.
      
      The message text has the same prefix as the old message text. That
      leads to slightly awkward phrasing but hopefully minimizes the chance
      that code depending on the error text will break.
      
      Increases the size of the go binary by 0.5% (amd64). The panic functions
      take arguments in registers in order to keep the size of the compiled code
      as small as possible.
      
      Fixes #30116
      
      Change-Id: Idb99a827b7888822ca34c240eca87b7e44a04fdd
      Reviewed-on: https://go-review.googlesource.com/c/go/+/161477
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      2c423f06