1. 18 Oct, 2019 1 commit
  2. 17 Oct, 2019 20 commits
  3. 16 Oct, 2019 11 commits
    • Jay Conrod's avatar
      cmd/go/internal/module: fix inverted condition in MatchPathMajor · 3b003c3e
      Jay Conrod authored
      This was spotted in CL 200767. This change just ensures internal
      packages match their equivalents in x/mod.
      
      Also pulled in test added in CL 201517.
      
      Change-Id: I51d23d62697c256548f411930fcb6bccce51bf34
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201497
      Run-TryBot: Jay Conrod <jayconrod@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
      3b003c3e
    • Eugene Kalinin's avatar
      encoding/json: correct caller's name in encoding errors · 02196d36
      Eugene Kalinin authored
      1. Change mapencode.encode to use fmt.Error rather than MarshalerError.
      MarshalerError refer to MarshalJSON, but mapencode.encode does not use that.
      
      2. Add sourceFunc field to MarshalerError to record the name of the function
      that creates the error, so that the Error method can report it correctly.
      
      Fixes #29753
      
      Change-Id: I186c2fac8470ae2f9e300501de3730face642230
      Reviewed-on: https://go-review.googlesource.com/c/go/+/184119
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      02196d36
    • Michael Munday's avatar
      crypto/ecdsa: remove s390x assembly · 943df4f6
      Michael Munday authored
      This a revert of CL 174437 and follow up fix CL 201317.
      
      The s390x assembly in this package makes use of an instruction
      (specifically KDSA) which is not supported by the current build
      machine. Remove this assembly for now, we can revisit this
      functionality once we have a newer build machine and can ensure
      that this assembly is well tested.
      
      Updates #34927.
      
      Change-Id: I779286fa7d9530a254b53a515ee76b1218821f2f
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201360
      Run-TryBot: Michael Munday <mike.munday@ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      943df4f6
    • Bryan C. Mills's avatar
      Revert "cmd/compile, cmd/link, runtime: make defers low-cost through inline... · b76e6f88
      Bryan C. Mills authored
      Revert "cmd/compile, cmd/link, runtime: make defers low-cost through inline code and extra funcdata"
      
      This reverts CL 190098.
      
      Reason for revert: broke several builders.
      
      Change-Id: I69161352f9ded02537d8815f259c4d391edd9220
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201519
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      Reviewed-by: default avatarDan Scales <danscales@google.com>
      b76e6f88
    • Emmanuel T Odeke's avatar
      io/ioutil: support predictable prefix,suffix for TempDir with * · 2718789b
      Emmanuel T Odeke authored
      Allow TempDir to create directories with predictable
      prefixes and suffixes, separated by the last "*", for example:
          "prefix*suffix"
      will now expand to
          "prefix" + <RANDOM_VALUE> + "suffix"
      
      RELNOTE=yes
      
      Fixes #33805.
      
      Change-Id: I85fa73ae6a684ce820d1810c82a60765eb9c4a42
      Reviewed-on: https://go-review.googlesource.com/c/go/+/198488
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      2718789b
    • Dan Scales's avatar
      cmd/compile, cmd/link, runtime: make defers low-cost through inline code and extra funcdata · dad61637
      Dan Scales authored
      Generate inline code at defer time to save the args of defer calls to unique
      (autotmp) stack slots, and generate inline code at exit time to check which defer
      calls were made and make the associated function/method/interface calls. We
      remember that a particular defer statement was reached by storing in the deferBits
      variable (always stored on the stack). At exit time, we check the bits of the
      deferBits variable to determine which defer function calls to make (in reverse
      order). These low-cost defers are only used for functions where no defers
      appear in loops. In addition, we don't do these low-cost defers if there are too
      many defer statements or too many exits in a function (to limit code increase).
      
      When a function uses open-coded defers, we produce extra
      FUNCDATA_OpenCodedDeferInfo information that specifies the number of defers, and
      for each defer, the stack slots where the closure and associated args have been
      stored. The funcdata also includes the location of the deferBits variable.
      Therefore, for panics, we can use this funcdata to determine exactly which defers
      are active, and call the appropriate functions/methods/closures with the correct
      arguments for each active defer.
      
      In order to unwind the stack correctly after a recover(), we need to add an extra
      code segment to functions with open-coded defers that simply calls deferreturn()
      and returns. This segment is not reachable by the normal function, but is returned
      to by the runtime during recovery. We set the liveness information of this
      deferreturn() to be the same as the liveness at the first function call during the
      last defer exit code (so all return values and all stack slots needed by the defer
      calls will be live).
      
      I needed to increase the stackguard constant from 880 to 896, because of a small
      amount of new code in deferreturn().
      
      The -N flag disables open-coded defers. '-d defer' prints out the kind of defer
      being used at each defer statement (heap-allocated, stack-allocated, or
      open-coded).
      
      Cost of defer statement  [ go test -run NONE -bench BenchmarkDefer$ runtime ]
        With normal (stack-allocated) defers only:         35.4  ns/op
        With open-coded defers:                             5.6  ns/op
        Cost of function call alone (remove defer keyword): 4.4  ns/op
      
      Text size increase (including funcdata) for go cmd without/with open-coded defers:  0.09%
      
      The average size increase (including funcdata) for only the functions that use
      open-coded defers is 1.1%.
      
      The cost of a panic followed by a recover got noticeably slower, since panic
      processing now requires a scan of the stack for open-coded defer frames. This scan
      is required, even if no frames are using open-coded defers:
      
      Cost of panic and recover [ go test -run NONE -bench BenchmarkPanicRecover runtime ]
        Without open-coded defers:        62.0 ns/op
        With open-coded defers:           255  ns/op
      
      A CGO Go-to-C-to-Go benchmark got noticeably faster because of open-coded defers:
      
      CGO Go-to-C-to-Go benchmark [cd misc/cgo/test; go test -run NONE -bench BenchmarkCGoCallback ]
        Without open-coded defers:        443 ns/op
        With open-coded defers:           347 ns/op
      
      Updates #14939 (defer performance)
      Updates #34481 (design doc)
      
      Change-Id: I51a389860b9676cfa1b84722f5fb84d3c4ee9e28
      Reviewed-on: https://go-review.googlesource.com/c/go/+/190098Reviewed-by: default avatarAustin Clements <austin@google.com>
      dad61637
    • Fazlul Shahriar's avatar
      net: fix multicast and IPv6 related issues on Plan 9 · e94475ea
      Fazlul Shahriar authored
      Fix issues that make these tests pass:
      - TestDialerLocalAddr: return error if local address is not IPv4 for
      "tcp4" network.
      - TestInterfaceAddrs, TestInterfaceUnicastAddrs: don't assume each
      interface has only one address. It may have more than one or none.
      - TestConcurrentPreferGoResolversDial: should be skipped on Plan 9.
      - TestListenMulticastUDP: remove IP from `announce` command and don't
      mix IPv4 address with IPv6 address in `addmulti` command.
      
      Fixes #34931
      
      Change-Id: Ie0fdfe19ea282e5d6d6c938bf3c9139f8f5b0308
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201397
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      e94475ea
    • Ben Shi's avatar
      cmd/internal/obj/arm: remove NaCl related DATABUNDLE · f6c624a2
      Ben Shi authored
      Updates golang/go#30439
      
      Change-Id: Ieaf18b7cfd22a768eb1b7ac549ebc03637258876
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201377
      Run-TryBot: Ben Shi <powerman1st@163.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      f6c624a2
    • Agniva De Sarker's avatar
      cmd/internal/obj/wasm,cmd/link/internal/wasm: add fast path for writeUleb128 · 03bb3e9a
      Agniva De Sarker authored
      While building a simple hello world binary, there are total 858277 calls
      to writeUleb during the assembler phase out of which 836625 (97%) are less than 7 bits.
      
      Using a simple micro-benchmark like this:
      
      func BenchmarkUleb(b *testing.B) {
      	var buf bytes.Buffer
      	for i := 0; i < b.N; i++ {
      		writeUleb128(&buf, 42)
      		buf.Reset()
      	}
      }
      
      We get the following results with the fast path enabled.
      
      name    old time/op  new time/op  delta
      Uleb-4  8.45ns ± 2%  7.51ns ± 2%  -11.16%  (p=0.000 n=10+10)
      
      Applying the time taken to the number of calls, we get roughly 6% improvement
      in total time taken for writeUleb128.
      
      We also apply the change to the function in linker to make it consistent.
      
      Change-Id: I9fe8c41df1209f5f3aa7d8bd0181f1b0e536ceb5
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201177
      Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      03bb3e9a
    • bill_ofarrell's avatar
      crypto/ecdsa: fix buffer size on s390x for ecdsa · 86f40a2e
      bill_ofarrell authored
      I used too small a size for buffers, which can cause a panic in some testing.
      The new buffer size is generous and sufficient for all purposes.
      
      Fixes #34927
      Fixes #34928
      
      Change-Id: Icdbbfed5da87fe3757be40dfd23182b37ec62d58
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201317Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      86f40a2e
    • Cherry Zhang's avatar
      cmd/compile: on Wasm and AIX, let deferred nil function panic at invocation · c4817f5d
      Cherry Zhang authored
      The Go spec requires
      
      	If a deferred function value evaluates to nil, execution
      	panics when the function is invoked, not when the "defer"
      	statement is executed.
      
      On Wasm and AIX, currently we actually emit a nil check at the
      point of defer statement, which will make it panic too early.
      This CL fixes this.
      
      Also, on Wasm, now the nil function will be passed through
      deferreturn to jmpdefer, which does an explicit nil check and
      calls sigpanic if it is nil. This sigpanic, being called from
      assembly, is ABI0. So change the assembler backend to also
      handle sigpanic in ABI0.
      
      Fixes #34926.
      Updates #8047.
      
      Change-Id: I28489a571cee36d2aef041f917b8cfdc31d557d4
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201297Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      c4817f5d
  4. 15 Oct, 2019 8 commits