1. 01 Nov, 2019 3 commits
    • Than McIntosh's avatar
      [dev.link] cmd/link/internal/loader: do more bulk allocation · 5aea5979
      Than McIntosh authored
      Change the loader to do more bulk allocation when making slices of
      small objects (sym.Reloc, etc) as part of creating and populating
      sym.Symbols in loader.LoadFull(). This replaces a large number of
      small allocations with a smaller number of large allocations,
      improving performace. Compilebench numbers (linker portion) for this
      change:
      
      name                      old time/op       new time/op       delta
      LinkCompiler                    1.71s ±11%        1.57s ± 9%   -8.35%  (p=0.000 n=19+20)
      LinkWithoutDebugCompiler        1.19s ±14%        1.10s ±13%   -7.93%  (p=0.000 n=20+19)
      
      name                      old user-time/op  new user-time/op  delta
      LinkCompiler                    1.86s ±15%        1.34s ±10%  -28.02%  (p=0.000 n=20+20)
      LinkWithoutDebugCompiler        1.05s ±14%        0.95s ± 9%   -9.17%  (p=0.000 n=19+20)
      
      Hyperkube from kubernetes doesn't show any significant benefit (which
      seems a little surprising).
      
      Change-Id: Ide97f78532fb60b08bb6e4cfa097e9058f7ea8ab
      Reviewed-on: https://go-review.googlesource.com/c/go/+/203457
      
      
      Run-TryBot: Than McIntosh <thanm@google.com>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Reviewed-by: default avatarJeremy Faller <jeremy@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      5aea5979
    • Than McIntosh's avatar
      [dev.link] cmd/link: add support to new deadcode for field tracking · 219922e9
      Than McIntosh authored
      Fix up the new dead code pass to include support for populating the
      ctxt "Reachparent" map, which is needed to support field tracking.
      Since we don't have sym.Symbols created at the point where new dead
      code runs, keep track of reachability using global symbol indices, and
      then once loader.LoadFull is complete we can translate the index
      mappings into symbol mappings.
      
      The fieldtracking output is unfortunately different relative to
      master, due to differences in the order in which symbols are
      encountered in deadcode, but I have eyeballed the results to make sure
      they look reasonable.
      
      Change-Id: I48c7a4597f05c00f15af3bfd37fc15ab4d0017c2
      Reviewed-on: https://go-review.googlesource.com/c/go/+/204342
      
      
      Run-TryBot: Than McIntosh <thanm@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      219922e9
    • Cherry Zhang's avatar
      [dev.link] cmd/link: resolve ABI aliases for external symbols · 63815923
      Cherry Zhang authored
      ABI alias references in Go symbols are resolved during
      loadObjFull. But for external symbols they are not resolved. If
      there is a reference from an external symbol to a Go ABIInternal
      symbol, this reference will be invalid as it is not resolved.
      
      The old code resolve ABI aliases in the deadcode pass. But the
      new deadcode pass doesn't do it, as it works with indices instead
      of Symbols. We do this in LoadFull.
      
      This makes all internal cgo linking tests pass on Mach-O.
      
      Change-Id: Iac6c084c03f5ddbcc9455527800ce7ed7313f9a7
      Reviewed-on: https://go-review.googlesource.com/c/go/+/204698
      
      
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarThan McIntosh <thanm@google.com>
      63815923
  2. 31 Oct, 2019 5 commits
  3. 25 Oct, 2019 1 commit
    • Than McIntosh's avatar
      [dev.link] cmd/link/internal/loader: add PkgNone resolver cache · 2e2ef666
      Than McIntosh authored
      Add a cache for the loader.Loader.resolve() method to use when
      looking mapping local PkgNone symbols to global symbol indices.
      This helps avoid repeated map lookups during deadcode and other
      early phases of the linker when we haven't fully read in all
      of object file symbols. Benchstat numbers:
      
      name                      old time/op       new time/op       delta
      LinkCompiler                    1.97s ±13%        1.67s ± 8%  -15.34%  (p=0.000 n=20+20)
      LinkWithoutDebugCompiler        1.48s ±12%        1.21s ±11%  -18.14%  (p=0.000 n=20+20)
      
      name                      old user-time/op  new user-time/op  delta
      LinkCompiler                    2.19s ± 9%        2.04s ±17%   -6.98%  (p=0.002 n=19+20)
      LinkWithoutDebugCompiler        1.29s ±13%        1.20s ±13%   -7.70%  (p=0.000 n=20+20)
      
      Change-Id: I4b0b05c8208ee44ee9405b24774b84443e486831
      Reviewed-on: https://go-review.googlesource.com/c/go/+/203197
      
      
      Run-TryBot: Than McIntosh <thanm@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      2e2ef666
  4. 24 Oct, 2019 3 commits
  5. 21 Oct, 2019 1 commit
    • Cherry Zhang's avatar
      [dev.link] cmd/link: do not put static symbols into name lookup table · c480d32f
      Cherry Zhang authored
      Since the previous CL, we will not reference static symbols by
      name. Therefore no need to put them into the name lookup table.
      
      On Linux/ARM, in runtime/internal/atomic/sys_linux_arm.s, the
      kernelcas function has a definition and a reference written in
      two different forms, one with package prefix, one without. This
      way, the assembler cannot know they are the same symbol, only the
      linker knows. This is quite unusual, unify the names to so the
      assembler can resolve it to index.
      
      Change-Id: Ie7223097be6a3b65f3fa43ed4575da9972ef5b69
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201998
      
      
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarThan McIntosh <thanm@google.com>
      c480d32f
  6. 19 Oct, 2019 1 commit
  7. 17 Oct, 2019 4 commits
  8. 16 Oct, 2019 2 commits
  9. 15 Oct, 2019 6 commits
  10. 14 Oct, 2019 4 commits
  11. 11 Oct, 2019 2 commits
  12. 10 Oct, 2019 3 commits
  13. 09 Oct, 2019 3 commits
    • Cherry Zhang's avatar
      [dev.link] cmd/link, cmd/internal/goobj2: adopt new DWARF compilation unit... · 65a649c5
      Cherry Zhang authored
      [dev.link] cmd/link, cmd/internal/goobj2: adopt new DWARF compilation unit logic with new object file
      
      The dev.link branch was not sync'd with the new DWARF compilation
      unit logic change on the master branch, and the new object file
      format didn't support this.
      
      This CL adds the new DWARF CU and file table support to the new
      object file format. In the old object file, the DWARF file table
      is a separate section. For now, we do the same with the new
      object file, keeping it as a separate block.
      
      While here, also refactor the loader code so it is easier for the
      loader to carry per-object informations.
      
      Change-Id: I4c317941fc0a5831acbc11ce8c2a8b7421471372
      Reviewed-on: https://go-review.googlesource.com/c/go/+/198198
      
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      65a649c5
    • Cherry Zhang's avatar
      [dev.link] cmd/link, cmd/internal/goobj2: mmap object file in -newobj mode · 0d7404c8
      Cherry Zhang authored
      With the old object file format, we use mmap (if supported) to
      read object files and back symbol data with mapped read-only
      memory.
      
      Do the same with the new object file format. This also
      significantly reduces number of syscalls made to read object
      files.
      
      Currently we still do mmap in object file level, not archive
      level. This is probably ok, as there shouldn't be many archives
      that contain more than one object. If this is a problem we can
      change that later.
      
      Change-Id: Icae3ef14d8ed6adbee1b5b48d420e2af22fd9604
      Reviewed-on: https://go-review.googlesource.com/c/go/+/197797
      
      
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarThan McIntosh <thanm@google.com>
      0d7404c8
    • Cherry Zhang's avatar
      [dev.link] cmd/link: load full symbol contents after deadcode pass · 24950952
      Cherry Zhang authored
      If the new object file format is used, now we load full symbol
      contents after the deadcode pass, for reachable symbols only.
      We still load some informations early, like relocations and the
      contents of type symbols, which are used in the deadcode pass.
      If we rewrite deadcode to use index directly, we could delay more
      of the loading (to sym.Symbol), and perhaps delay the creation of
      sym.Symbol.
      
      TODO: internal linking with host objects doesn't work yet.
      
      Change-Id: I7d4880e8f150e8709ffac277e62191623440e4cf
      Reviewed-on: https://go-review.googlesource.com/c/go/+/197258
      
      
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarThan McIntosh <thanm@google.com>
      24950952
  14. 08 Oct, 2019 1 commit
  15. 04 Oct, 2019 1 commit
    • Cherry Zhang's avatar
      [dev.link] cmd/link: support new object file format · 6051fd0a
      Cherry Zhang authored
      Parse new object file format in the linker. At least we can link
      a hello-world program.
      
      Add a basic "loader", which handles symbol references in the
      object file.
      - mapping between local and global indices
      - resolve by-name references
        (TODO: the overwrite logic isn't implemented yet)
      
      Currently we still create sym.Symbol rather early, and, after all
      the object files are loaded and indexed references are resolved,
      add all symbols to sym.Symbols.
      
      The code here is probably not going in the final version. This
      is basically only for debugging purposes -- to make sure the
      writer and the reader work as expected.
      
      Change-Id: I895aeea68326fabdb7e5aa1371b8cac7211a09dd
      Reviewed-on: https://go-review.googlesource.com/c/go/+/196032
      
      
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarThan McIntosh <thanm@google.com>
      6051fd0a