1. 20 Oct, 2019 2 commits
    • Alex Brainman's avatar
      cmd/link: use libmsvcrt.a during internal link · e4c39259
      Alex Brainman authored
      When using recent versions of gcc with cgo, internal link fails with
      
      c:\>go test debug/pe
      --- FAIL: TestInternalLinkerDWARF (0.94s)
          file_test.go:394: building test executable for linktype 2 failed: exit status 2 # command-line-arguments
              runtime/cgo(.text): relocation target __acrt_iob_func not defined for ABI0 (but is defined for ABI0)
              runtime/cgo(.text): relocation target __acrt_iob_func not defined for ABI0 (but is defined for ABI0)
              runtime/cgo(.text): relocation target __acrt_iob_func not defined for ABI0 (but is defined for ABI0)
      FAIL
      FAIL    debug/pe        4.572s
      FAIL
      
      It appears that __acrt_iob_func is defined in libmsvcrt.a. And this
      change adds libmsvcrt.a to the list of libraries always used byi
      internal linker.
      
      libmsvcrt.a also implements __imp___acrt_iob_func. So this change
      also prevents rewriting __imp___acrt_iob_func name into
      __acrt_iob_func, otherwise we end up with duplicate __acrt_iob_func
      symbol error.
      
      Fixes #23649
      
      Change-Id: Ie9864cd17e907501e9a8a3672bbc33e02ca20e5c
      Reviewed-on: https://go-review.googlesource.com/c/go/+/197977
      Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      e4c39259
    • Luke Young's avatar
      net/http: make Transport.roundTrip close body on invalid method · 39cfb760
      Luke Young authored
      Updates #35015
      
      Change-Id: Ibfe8f72ed3887ca88ce9c1d8a29dacda72f3fe17
      GitHub-Last-Rev: 4bfc56e71660ad9624ac5eb594b3afd0d221c99d
      GitHub-Pull-Request: golang/go#35014
      Reviewed-on: https://go-review.googlesource.com/c/go/+/202237Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      39cfb760
  2. 19 Oct, 2019 2 commits
  3. 18 Oct, 2019 10 commits
  4. 17 Oct, 2019 20 commits
  5. 16 Oct, 2019 6 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