An error occurred fetching the project authors.
  1. 14 Mar, 2017 1 commit
    • philhofer's avatar
      cmd/compile: de-virtualize interface calls · 295307ae
      philhofer authored
      With this change, code like
      
          h := sha1.New()
          h.Write(buf)
          sum := h.Sum()
      
      gets compiled into static calls rather than
      interface calls, because the compiler is able
      to prove that 'h' is really a *sha1.digest.
      
      The InterCall re-write rule hits a few dozen times
      during make.bash, and hundreds of times during all.bash.
      
      The most common pattern identified by the compiler
      is a constructor like
      
          func New() Interface { return &impl{...} }
      
      where the constructor gets inlined into the caller,
      and the result is used immediately. Examples include
      {sha1,md5,crc32,crc64,...}.New, base64.NewEncoder,
      base64.NewDecoder, errors.New, net.Pipe, and so on.
      
      Some existing benchmarks that change on darwin/amd64:
      
      Crc64/ISO4KB-8        2.67µs ± 1%    2.66µs ± 0%  -0.36%  (p=0.015 n=10+10)
      Crc64/ISO1KB-8         694ns ± 0%     690ns ± 1%  -0.59%  (p=0.001 n=10+10)
      Adler32KB-8            473ns ± 1%     471ns ± 0%  -0.39%  (p=0.010 n=10+9)
      
      On architectures like amd64, the reduction in code size
      appears to contribute more to benchmark improvements than just
      removing the indirect call, since that branch gets predicted
      accurately when called in a loop.
      
      Updates #19361
      
      Change-Id: I57d4dc21ef40a05ec0fbd55a9bb0eb74cdc67a3d
      Reviewed-on: https://go-review.googlesource.com/38139
      Run-TryBot: Philip Hofer <phofer@umich.edu>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      295307ae
  2. 13 Mar, 2017 2 commits
    • David Chase's avatar
      Revert "cmd/compile: de-virtualize interface calls" · b59a4056
      David Chase authored
      This reverts commit 4e0c7c3f.
      
      Reason for revert: The presence-of-optimization test program is fragile, breaks under noopt, and might break if the Go libraries are tweaked.  It needs to be (re)written without reference to other packages.
      
      Change-Id: I3aaf1ab006a1a255f961a978e9c984341740e3c7
      Reviewed-on: https://go-review.googlesource.com/38097Reviewed-by: default avatarKeith Randall <khr@golang.org>
      b59a4056
    • Philip Hofer's avatar
      cmd/compile: de-virtualize interface calls · 4e0c7c3f
      Philip Hofer authored
      With this change, code like
      
          h := sha1.New()
          h.Write(buf)
          sum := h.Sum()
      
      gets compiled into static calls rather than
      interface calls, because the compiler is able
      to prove that 'h' is really a *sha1.digest.
      
      The InterCall re-write rule hits a few dozen times
      during make.bash, and hundreds of times during all.bash.
      
      The most common pattern identified by the compiler
      is a constructor like
      
          func New() Interface { return &impl{...} }
      
      where the constructor gets inlined into the caller,
      and the result is used immediately. Examples include
      {sha1,md5,crc32,crc64,...}.New, base64.NewEncoder,
      base64.NewDecoder, errors.New, net.Pipe, and so on.
      
      Some existing benchmarks that change on darwin/amd64:
      
      Crc64/ISO4KB-8        2.67µs ± 1%    2.66µs ± 0%  -0.36%  (p=0.015 n=10+10)
      Crc64/ISO1KB-8         694ns ± 0%     690ns ± 1%  -0.59%  (p=0.001 n=10+10)
      Adler32KB-8            473ns ± 1%     471ns ± 0%  -0.39%  (p=0.010 n=10+9)
      
      On architectures like amd64, the reduction in code size
      appears to contribute more to benchmark improvements than just
      removing the indirect call, since that branch gets predicted
      accurately when called in a loop.
      
      Updates #19361
      
      Change-Id: Ia9d30afdd5f6b4d38d38b14b88f308acae8ce7ed
      Reviewed-on: https://go-review.googlesource.com/37751
      Run-TryBot: Philip Hofer <phofer@umich.edu>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      4e0c7c3f
  3. 09 Mar, 2017 1 commit
    • Robert Griesemer's avatar
      cmd/compile: print columns (not just lines) in error messages · 2a5cf48f
      Robert Griesemer authored
      Compiler errors now show the exact line and line byte offset (sometimes
      called "column") of where an error occured. For `go tool compile x.go`:
      
      	package p
      	const c int = false
      	//line foo.go:123
      	type t intg
      
      reports
      
      	x.go:2:7: cannot convert false to type int
      	foo.go:123[x.go:4:8]: undefined: intg
      
      (Some errors use the "wrong" position for the error message; arguably
      the byte offset for the first error should be 15, the position of 'false',
      rathen than 7, the position of 'c'. But that is an indepedent issue.)
      
      The byte offset (column) values are measured in bytes; they start at 1,
      matching the convention used by editors and IDEs.
      
      Positions modified by //line directives show the line offset only for the
      actual source location (in square brackets), not for the "virtual" file and
      line number because that code is likely generated and the //line directive
      only provides line information.
      
      Because the new format might break existing tools or scripts, printing
      of line offsets can be disabled with the new compiler flag -C. We plan
      to remove this flag eventually.
      
      Fixes #10324.
      
      Change-Id: I493f5ee6e78457cf7b00025aba6b6e28e50bb740
      Reviewed-on: https://go-review.googlesource.com/37970Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      2a5cf48f
  4. 07 Mar, 2017 1 commit
  5. 03 Mar, 2017 3 commits
    • David Lazar's avatar
      cmd/compile: add flag for debugging PC-value tables · 0824ae6d
      David Lazar authored
      For example, `-d pctab=pctoinline` prints the PC-inline table and
      inlining tree for every function.
      
      Change-Id: Ia6b9ce4d83eed0b494318d40ffe06481ec5d58ab
      Reviewed-on: https://go-review.googlesource.com/37235
      Run-TryBot: David Lazar <lazard@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      0824ae6d
    • Aliaksandr Valialkin's avatar
      cmd/compile: pack bool fields in Node, Name, Func and Type structs to bitsets · ed70f37e
      Aliaksandr Valialkin authored
      This reduces compiler memory usage by up to 4% - see compilebench
      results below.
      
      name       old time/op     new time/op     delta
      Template       245ms ± 4%      241ms ± 2%  -1.88%  (p=0.029 n=10+10)
      Unicode        126ms ± 3%      124ms ± 3%    ~     (p=0.105 n=10+10)
      GoTypes        805ms ± 2%      813ms ± 3%    ~     (p=0.515 n=8+10)
      Compiler       3.95s ± 2%      3.83s ± 1%  -2.96%  (p=0.000 n=9+10)
      MakeBash       47.4s ± 4%      46.6s ± 1%  -1.59%  (p=0.028 n=9+10)
      
      name       old user-ns/op  new user-ns/op  delta
      Template        324M ± 5%       326M ± 3%    ~     (p=0.935 n=10+10)
      Unicode         186M ± 5%       178M ±10%    ~     (p=0.067 n=9+10)
      GoTypes        1.08G ± 7%      1.09G ± 4%    ~     (p=0.956 n=10+10)
      Compiler       5.34G ± 4%      5.31G ± 1%    ~     (p=0.501 n=10+8)
      
      name       old alloc/op    new alloc/op    delta
      Template      41.0MB ± 0%     39.8MB ± 0%  -3.03%  (p=0.000 n=10+10)
      Unicode       32.3MB ± 0%     31.0MB ± 0%  -4.13%  (p=0.000 n=10+10)
      GoTypes        119MB ± 0%      116MB ± 0%  -2.39%  (p=0.000 n=10+10)
      Compiler       499MB ± 0%      487MB ± 0%  -2.48%  (p=0.000 n=10+10)
      
      name       old allocs/op   new allocs/op   delta
      Template        380k ± 1%       379k ± 1%    ~     (p=0.436 n=10+10)
      Unicode         324k ± 1%       324k ± 0%    ~     (p=0.853 n=10+10)
      GoTypes        1.15M ± 0%      1.15M ± 0%    ~     (p=0.481 n=10+10)
      Compiler       4.41M ± 0%      4.41M ± 0%  -0.12%  (p=0.007 n=10+10)
      
      name       old text-bytes  new text-bytes  delta
      HelloSize       623k ± 0%       623k ± 0%    ~     (all equal)
      CmdGoSize      6.64M ± 0%      6.64M ± 0%    ~     (all equal)
      
      name       old data-bytes  new data-bytes  delta
      HelloSize      5.81k ± 0%      5.81k ± 0%    ~     (all equal)
      CmdGoSize       238k ± 0%       238k ± 0%    ~     (all equal)
      
      name       old bss-bytes   new bss-bytes   delta
      HelloSize       134k ± 0%       134k ± 0%    ~     (all equal)
      CmdGoSize       152k ± 0%       152k ± 0%    ~     (all equal)
      
      name       old exe-bytes   new exe-bytes   delta
      HelloSize       967k ± 0%       967k ± 0%    ~     (all equal)
      CmdGoSize      10.2M ± 0%      10.2M ± 0%    ~     (all equal)
      
      Change-Id: I1f40af738254892bd6c8ba2eb43390b175753d52
      Reviewed-on: https://go-review.googlesource.com/37445Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ed70f37e
    • Austin Clements's avatar
      cmd/compile: accept string debug flags · 8eb14e9d
      Austin Clements authored
      The compiler's -d flag accepts string-valued flags, but currently only
      for SSA debug flags. Extend it to support string values for other
      flags. This also makes the syntax somewhat more sane so flag=value and
      flag:value now both accept integers and strings.
      
      Change-Id: Idd144d8479a430970cc1688f824bffe0a56ed2df
      Reviewed-on: https://go-review.googlesource.com/37345
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      8eb14e9d
  6. 01 Mar, 2017 1 commit
    • Matthew Dempsky's avatar
      cmd/compile/internal/gc: separate builtin and real runtime packages · b6c600fc
      Matthew Dempsky authored
      The builtin runtime package definitions intentionally diverge from the
      actual runtime package's, but this only works as long as they never
      overlap.
      
      To make it easier to expand the builtin runtime package, this CL now
      loads their definitions into a logically separate "go.runtime"
      package.  By resetting the package's Prefix field to "runtime", any
      references to builtin definitions will still resolve against the real
      package runtime.
      
      Fixes #14482.
      
      Passes toolstash -cmp.
      
      Change-Id: I539c0994deaed4506a331f38c5b4d6bc8c95433f
      Reviewed-on: https://go-review.googlesource.com/37538
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      b6c600fc
  7. 23 Feb, 2017 1 commit
    • Josh Bleecher Snyder's avatar
      cmd/compile: add -dolinkobj flag · 005c77dd
      Josh Bleecher Snyder authored
      When set to false, the -dolinkobj flag instructs the compiler
      not to generate or emit linker information.
      
      This is handy when you need the compiler's export data,
      e.g. for use with go/importer,
      but you want to avoid the cost of full compilation.
      
      This must be used with care, since the resulting
      files are unusable for linking.
      
      This CL interacts with #18369,
      where adding gcflags and ldflags to buildid has been mooted.
      On the one hand, adding gcflags would make safe use of this
      flag easier, since if the full object files were needed,
      a simple 'go install' would fix it.
      On the other hand, this would mean that
      'go install -gcflags=-dolinkobj=false' would rebuild the object files,
      although any existing object files would probably suffice.
      
      Change-Id: I8dc75ab5a40095c785c1a4d2260aeb63c4d10f73
      Reviewed-on: https://go-review.googlesource.com/37384
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      005c77dd
  8. 01 Feb, 2017 1 commit
  9. 26 Jan, 2017 1 commit
  10. 13 Jan, 2017 2 commits
  11. 12 Jan, 2017 1 commit
  12. 11 Jan, 2017 1 commit
  13. 10 Jan, 2017 1 commit
  14. 09 Jan, 2017 3 commits
    • Robert Griesemer's avatar
      [dev.inline] cmd/internal/obj: remove vestiges of LineHist - not used anymore · 33c03686
      Robert Griesemer authored
      Change-Id: I9d3fcdd5b002953fa9d2f001bf7a834073443794
      Reviewed-on: https://go-review.googlesource.com/34722
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Run-TryBot: Robert Griesemer <gri@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      33c03686
    • Robert Griesemer's avatar
      [dev.inline] cmd/internal/src: introduce compact source position representation · 472c792e
      Robert Griesemer authored
      XPos is a compact (8 instead of 16 bytes on a 64bit machine) source
      position representation. There is a 1:1 correspondence between each
      XPos and each regular Pos, translated via a global table.
      
      In some sense this brings back the LineHist, though positions can
      track line and column information; there is a O(1) translation
      between the representations (no binary search), and the translation
      is factored out.
      
      The size increase with the prior change is brought down again and
      the compiler speed is in line with the master repo (measured on
      the same "quiet" machine as for prior change):
      
      name       old time/op     new time/op     delta
      Template       256ms ± 1%      262ms ± 2%    ~             (p=0.063 n=5+4)
      Unicode        132ms ± 1%      135ms ± 2%    ~             (p=0.063 n=5+4)
      GoTypes        891ms ± 1%      871ms ± 1%  -2.28%          (p=0.016 n=5+4)
      Compiler       3.84s ± 2%      3.89s ± 2%    ~             (p=0.413 n=5+4)
      MakeBash       47.1s ± 1%      46.2s ± 2%    ~             (p=0.095 n=5+5)
      
      name       old user-ns/op  new user-ns/op  delta
      Template        309M ± 1%       314M ± 2%    ~             (p=0.111 n=5+4)
      Unicode         165M ± 1%       172M ± 9%    ~             (p=0.151 n=5+5)
      GoTypes        1.14G ± 2%      1.12G ± 1%    ~             (p=0.063 n=5+4)
      Compiler       5.00G ± 1%      4.96G ± 1%    ~             (p=0.286 n=5+4)
      
      Change-Id: Icc570cc60ab014d8d9af6976f1f961ab8828cc47
      Reviewed-on: https://go-review.googlesource.com/34506
      Run-TryBot: Robert Griesemer <gri@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      472c792e
    • Robert Griesemer's avatar
      [dev.inline] cmd/internal/src: replace src.Pos with syntax.Pos · 4808fc44
      Robert Griesemer authored
      This replaces the src.Pos LineHist-based position tracking with
      the syntax.Pos implementation and updates all uses.
      
      The LineHist table is not used anymore - the respective code is still
      there but should be removed eventually. CL forthcoming.
      
      Passes toolstash -cmp when comparing to the master repo (with the
      exception of a couple of swapped assembly instructions, likely due
      to different instruction scheduling because the line-based sorting
      has changed; though this is won't affect correctness).
      
      The sizes of various important compiler data structures have increased
      significantly (see the various sizes_test.go files); this is probably
      the reason for an increase of compilation times (to be addressed). Here
      are the results of compilebench -count 5, run on a "quiet" machine (no
      apps running besides a terminal):
      
      name       old time/op     new time/op     delta
      Template       256ms ± 1%      280ms ±15%  +9.54%          (p=0.008 n=5+5)
      Unicode        132ms ± 1%      132ms ± 1%    ~             (p=0.690 n=5+5)
      GoTypes        891ms ± 1%      917ms ± 2%  +2.88%          (p=0.008 n=5+5)
      Compiler       3.84s ± 2%      3.99s ± 2%  +3.95%          (p=0.016 n=5+5)
      MakeBash       47.1s ± 1%      47.2s ± 2%    ~             (p=0.841 n=5+5)
      
      name       old user-ns/op  new user-ns/op  delta
      Template        309M ± 1%       326M ± 2%  +5.18%          (p=0.008 n=5+5)
      Unicode         165M ± 1%       168M ± 4%    ~             (p=0.421 n=5+5)
      GoTypes        1.14G ± 2%      1.18G ± 1%  +3.47%          (p=0.008 n=5+5)
      Compiler       5.00G ± 1%      5.16G ± 1%  +3.12%          (p=0.008 n=5+5)
      
      Change-Id: I241c4246cdff627d7ecb95cac23060b38f9775ec
      Reviewed-on: https://go-review.googlesource.com/34273
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      4808fc44
  15. 08 Dec, 2016 3 commits
  16. 30 Nov, 2016 1 commit
  17. 31 Oct, 2016 1 commit
    • Matthew Dempsky's avatar
      cmd/compile: remove legacy debug flags · 49b2dd58
      Matthew Dempsky authored
      -M, -P, and -R were for debugging backend passes that no longer
      exists.
      
      -g is used for debugging instructions generated with Gins, but the SSA
      backend mostly generates instructions directly. The handful of
      instructions still generated with Gins are pretty useless for
      debugging.
      
      -x was used to debug the old lexer, but now it only causes us to print
      file names as they're parsed, and only if we manually hack the
      compiler to enable tracing.
      
      Change-Id: Ia58d4bc9c1312693466171a3fcefc1221e9a2381
      Reviewed-on: https://go-review.googlesource.com/32428
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      49b2dd58
  18. 27 Oct, 2016 1 commit
  19. 25 Oct, 2016 3 commits
  20. 20 Oct, 2016 1 commit
    • David Chase's avatar
      cmd/compile: enable flag-specified dump of specific phase+function · a190f3c8
      David Chase authored
      For very large input files, use of GOSSAFUNC to obtain a dump
      after compilation steps can lead to both unwieldy large output
      files and unwieldy larger processes (because the output is
      buffered in a string).  This flag
      
        -d=ssa/<phase>/dump:<function name>
      
      provides finer control of what is dumped, into a smaller
      file, and with less memory overhead in the running compiler.
      The special phase name "build" is added to allow printing
      of the just-built ssa before any transformations are applied.
      
      This was helpful in making sense of the gogo/protobuf
      problems.
      
      The output format was tweaked to remove gratuitous spaces,
      and a crude -d=ssa/help help text was added.
      
      Change-Id: If7516e22203420eb6ed3614f7cee44cb9260f43e
      Reviewed-on: https://go-review.googlesource.com/23044
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      a190f3c8
  21. 19 Oct, 2016 2 commits
  22. 18 Oct, 2016 1 commit
  23. 12 Oct, 2016 1 commit
  24. 16 Sep, 2016 1 commit
  25. 15 Sep, 2016 2 commits
  26. 14 Sep, 2016 1 commit
  27. 13 Sep, 2016 2 commits