1. 23 Apr, 2019 13 commits
  2. 22 Apr, 2019 12 commits
  3. 20 Apr, 2019 3 commits
  4. 19 Apr, 2019 12 commits
    • Bryan C. Mills's avatar
      cmd/go: only add a 'go' directive on 'go mod tidy' or when a conversion occurs · a1c481d8
      Bryan C. Mills authored
      If the go.mod file exists and is empty, we initialize it from any of
      various formats supported by legacy dependency-management tools.
      
      We also initialize the 'go' directive at that point: we know that the
      go.mod file is incomplete, because it does not reflect the information
      in the legacy configuration file, and since we know that the go.mod
      file is incomplete, we should complete it with as much information as
      we have — including the version of the language currently in use.
      
      However, if there is no legacy configuration file present, then we
      cannot infer that the go.mod file is incomplete: it may correctly
      specify a module without external dependencies. In that case, we
      should not initialize the 'go' directive either: the user will not be
      expecting unnecessary edits to the go.mod file, and we generally do
      not make unnecessary-but-helpful edits unless 'go mod tidy' is invoked
      explicitly.
      
      Fixes #30790
      Fixes #31100
      
      Change-Id: I05a7872bce54a917c10d910cd9a616cab52e2730
      Reviewed-on: https://go-review.googlesource.com/c/go/+/169877
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      a1c481d8
    • Matthew Dempsky's avatar
      cmd/compile: fix ICE from go/defer call to variadic function · 9f9e17a8
      Matthew Dempsky authored
      The special case logic for go/defer arguments in Escape.call was
      scattered around a bit and was somewhat inconsistently handled across
      different types of function calls and parameters. This CL pulls the
      logic out into a separate callStmt method that's used uniformly for
      all kinds of function calls and arguments.
      
      Fixes #31573.
      
      Change-Id: Icdcdf611754dc3fcf1af7cb52879fb4b73a7a31f
      Reviewed-on: https://go-review.googlesource.com/c/go/+/173019
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      9f9e17a8
    • David Chase's avatar
      cmd/compile: shortcut intrinsic inlining AFTER getcallerXX check · 376ce8c8
      David Chase authored
      A check in inl.go to prevent inlining of functions calling
      either getcallerpc or getcallersp does not work when these
      functions are intrinsics. Swap checks to fix.
      
      Includes test.
      
      No bug, this was discovered in the course of a ridiculous
      experiment with inlining.
      
      Change-Id: Ie1392523bb89882d586678f2674e1a4eadc5e431
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172217
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      376ce8c8
    • Than McIntosh's avatar
      go/internal/gccgoimporter: improve alias handling for anonymous fields · dc193dee
      Than McIntosh authored
      The code in the parser that deals with anonymous structure fields
      records the fact that a field is anonymous, then tries to install a proxy
      name for the field based on the name of the type used to declare
      the field. If that type was an alias, the current recipe for determining
      the proxy name was not working properly; enhance the code to recover
      and report the alias name used.
      
      Fixes #31540.
      
      Change-Id: I9b7369ed558a288b56d85170c6f1144daf5228eb
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172603Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      dc193dee
    • Than McIntosh's avatar
      cmd/link: adjust whitelist for -strictdups checking for plan9 · 4590abe0
      Than McIntosh authored
      Add a couple of additional entries to the white list used to screen
      out errors for builtin functions; these correspond to cases
      that appear to come up only on the plan9 builder.
      
      Updates #31503.
      
      Change-Id: I48ab942ab2894240efe651ec7b7eace7aa5cb45e
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172986Reviewed-by: default avatarDavid du Colombier <0intro@gmail.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Than McIntosh <thanm@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4590abe0
    • Yuval Pavel Zholkover's avatar
      os: disable the use of netpoll on directories as well on *BSDs · 059f2d4a
      Yuval Pavel Zholkover authored
      Follow up CL 156379.
      
      Updates #19093
      
      Change-Id: I5ea3177fc5911d3af71cbb32584249e419e9d4a3
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172937
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      059f2d4a
    • Bryan C. Mills's avatar
      cmd/go/internal/modload: fix boundary conditions in matchPackages · 14b5b4a2
      Bryan C. Mills authored
      This makes the boundary logic of matchPackages consistent with
      modload.dirInModule.
      
      Previously, matchPackages always stopped at go.mod file, even within
      the vendor tree. However, we do not guarantee that the vendor tree is
      free of such files in general.
      
      matchPackages also issued needless stat operations for modules in the
      module cach, which we already know to be free of nested modules. On
      systems with slow filesystems (such as macOS), those extra calls could
      potentially slow package matching considerably.
      
      Change-Id: I71979ab752e1d3971b370b37085d30502690413b
      Reviewed-on: https://go-review.googlesource.com/c/go/+/172985
      Run-TryBot: Bryan C. Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarJay Conrod <jayconrod@google.com>
      14b5b4a2
    • Cherry Zhang's avatar
      cmd/link: mmap object data · dbe32284
      Cherry Zhang authored
      This resurrects CL 121198, except that this time we map read-only.
      
      In case that we need to apply relocations to the symbol's
      content that is backed by read-only memory, we do our own copy-
      on-write. This can happen if we failed to mmap the output file,
      or we build for Wasm.
      
      Memory profile for building k8s.io/kubernetes/cmd/kube-apiserver
      on Linux/AMD64:
      
      Old (before this sequence of CLs):
      inuse_space 1598.75MB total
      669.87MB 41.90% 41.90%   669.87MB 41.90%  cmd/link/internal/objfile.(*objReader).readSlices
      
      New:
      inuse_space 1280.45MB total
      441.18MB 34.46% 34.46%   441.18MB 34.46%  cmd/link/internal/objfile.(*objReader).readSlices
      
      Change-Id: I6b4d29d6eee9828089ea3120eb38c212db21330b
      Reviewed-on: https://go-review.googlesource.com/c/go/+/170741
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      dbe32284
    • Cherry Zhang's avatar
      cmd/link: apply relocations later · f957a7e3
      Cherry Zhang authored
      Move the phase of applying relocations later, after the sections
      and segments are written to the mmap'd output region. Then apply
      relocations directly in the output region, instead of the input.
      So the input slices we read in don't need to be modified.
      
      This is in preparation for mmap'ing input files read-only.
      
      Change-Id: If9c80657b4469da36aec5a9ab6acf664f5af8fa0
      Reviewed-on: https://go-review.googlesource.com/c/go/+/170739
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      f957a7e3
    • Cherry Zhang's avatar
      cmd/link: apply DWARF relocations while doing compression · 248444d5
      Cherry Zhang authored
      We are preparing for applying relocations to the output buffer.
      However, for DWARF compression, relocations need to be applied
      before compression, but we don't have an output buffer at that
      time. We also cannot delay DWARF compression to when we mmap the
      output file, because we need the size of the DWARF sections to
      compute the file size.
      
      Instead of applying all the relocations together, we apply
      relocations in DWARF sections one symbol at a time, right before
      it is writing out for compression. As the symbol content may be
      in read-only memory (in the future), we use a temporary buffer
      for applying the relocations, and immediately write it out.
      
      If compression is not used, relocations are still applied all
      together.
      
      This is in preparation for mmap'ing input files read-only.
      
      Change-Id: Iae6d2dd71313897d5054bcc458d3bb78075b30c3
      Reviewed-on: https://go-review.googlesource.com/c/go/+/171397
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      248444d5
    • Cherry Zhang's avatar
      cmd/link: apply R_DWARFFILEREF later · 15a31bd9
      Cherry Zhang authored
      Apply R_DWARFFILEREF relocations later, along with other
      relocations, so that we don't modify symbols' contents before
      they are written to the output buffer.
      
      This is in preparation for mmap'ing input files read-only.
      
      Change-Id: I8e9ffb2f05acf8f198589b8770f277beb3847541
      Reviewed-on: https://go-review.googlesource.com/c/go/+/170740
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      15a31bd9
    • Cherry Zhang's avatar
      cmd/link: mmap output file · b2f94d3e
      Cherry Zhang authored
      Use mmap for writing most of the output file content,
      specifically, the sections and segments. After layout, we
      already know the sizes and file offsets for the sections and
      segments. So we can just write the bytes by copying to a mmap'd
      backing store.
      
      The writing of the output file is split into two parts. The first
      part writes the sections and segments to the mmap'd region. The
      second part writes some extra content, for which we don't know
      the size, so we use direct file IO.
      
      This is in preparation for mmap'ing input files read-only.
      
      Change-Id: I9f3b4616a9f96bfd5c940d74c50aacd6d330f7d2
      Reviewed-on: https://go-review.googlesource.com/c/go/+/170738
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      b2f94d3e