1. 20 Mar, 2016 9 commits
    • Ian Lance Taylor's avatar
      cmd/compile: don't penalize ODOT and friends when inlining · 060038bd
      Ian Lance Taylor authored
      Historically ODOT and friends have been considered to cost an extra
      budget point when deciding whether they should be inlined, because they
      had an ONAME node that represented the name to the right of the dot.
      This doesn't really make sense, as in general that symbol does not add
      any extra instructions; it just affects the offset of the load or store
      instruction.  And the ONAME node is gone now.  So, remove the extra
      cost.
      
      This does not pass toolstash -cmp, as it changes inlining decisions.
      For example, mspan.init in runtime/mheap.go is now considered to be an
      inlining candidate.
      
      Change-Id: I5ad27f08c66fd5daa4c8472dd0795df989183f5e
      Reviewed-on: https://go-review.googlesource.com/20891Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      060038bd
    • Shahar Kohanim's avatar
      cmd/link: use encbuf when writing integers · d6d33f67
      Shahar Kohanim authored
      name       old s/op   new s/op   delta
      LinkCmdGo  0.59 ± 6%  0.58 ± 5%  -1.61%  (p=0.000 n=99+99)
      
      GOGC=off:
      name       old s/op   new s/op   delta
      LinkCmdGo  0.50 ± 3%  0.49 ± 3%  -1.28%  (p=0.000 n=98+99)
      
      Change-Id: I737ae056214999441a210c69ec0cf4febc39a715
      Reviewed-on: https://go-review.googlesource.com/20914Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      d6d33f67
    • Shahar Kohanim's avatar
      cmd/compile, cmd/link: remove unused fields from relocations · 78fc59ef
      Shahar Kohanim authored
      Reduces size of archives in pkg/linux_amd64 by 3% from 41.5MB to 40.2MB
      
      Change-Id: Id64ca7995de8dd84c9e7ce1985730927cf4bfd66
      Reviewed-on: https://go-review.googlesource.com/20912Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      78fc59ef
    • Shahar Kohanim's avatar
      cmd/link: optimize int parsing · 35049450
      Shahar Kohanim authored
      Speeds up linking cmd/go by ~1.5%:
      
      name       old s/op   new s/op   delta
      LinkCmdGo  0.58 ± 6%  0.57 ± 5%  -1.21%  (p=0.000 n=98+99)
      
      Less noisy benchmark, with garbage collection off:
      
      name       old s/op   new s/op   delta
      LinkCmdGo  0.49 ± 2%  0.49 ± 2%  -1.79%  (p=0.000 n=98+99)
      
      Change-Id: I0123bcb66a87cbc4d703356e4c5a4035032012ec
      Reviewed-on: https://go-review.googlesource.com/20916Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      35049450
    • Martin Möhrmann's avatar
      fmt: unify integer formatting · 8d9ece9d
      Martin Möhrmann authored
      Deduplicate the verb switch for signed and unsigned integer formatting.
      
      Make names of integer related functions consistent
      with names of other fmt functions.
      
      Consolidate basic integer tests.
      
      Change-Id: I0c19c24f1c2c06a3b1a4d7d377dcdac3b36bb0f5
      Reviewed-on: https://go-review.googlesource.com/20831
      Run-TryBot: Rob Pike <r@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRob Pike <r@golang.org>
      8d9ece9d
    • Matthew Dempsky's avatar
      cmd/compile: ignore receiver name when checking duplicate methods · 3eaa3046
      Matthew Dempsky authored
      In golang.org/cl/20602, I changed the semantics of Eqtype to stop
      checking the receiver parameters for type equality, and pushed this
      responsibility to addmethod (the only Eqtype caller that cared).
      However, I accidentally made the check stricter by making it start
      requiring that receiver names were identical.
      
      In general, this is a non-problem because the receiver names in export
      data will always match the original source. But running
      GO_GCFLAGS=-newexport ./all.bash at one point tries to load both old
      and new format export data for package sync, which reveals the
      problem. (See golang.org/issue/14877 for details.)
      
      Easy fix: just check the receiver type for type equality in addmethod,
      instead of the entire receiver parameter list.
      
      Fixes #14877.
      
      Change-Id: If10b79f66ba58a1b7774622b4fbad1916aba32f1
      Reviewed-on: https://go-review.googlesource.com/20906
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      3eaa3046
    • Josh Bleecher Snyder's avatar
      cmd/compile: remove typechecklist · ec7c4945
      Josh Bleecher Snyder authored
      Convert remaining uses to typecheckslice.
      
      Passes toolstash -cmp.
      
      Change-Id: I6ed0877386fb6c0b036e8ee5a228433343855abd
      Reviewed-on: https://go-review.googlesource.com/20905
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: 's avatarDave Cheney <dave@cheney.net>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ec7c4945
    • Josh Bleecher Snyder's avatar
      cmd/compile: convert fmt.Sprintf to concatenation · ad4c55c0
      Josh Bleecher Snyder authored
      There are plenty more, but these cover most of
      the trivial cases, and all the cases that
      showed up in profiling.
      
      name       old time/op     new time/op     delta
      Template       331ms ± 3%      327ms ± 6%    ~           (p=0.143 n=10+10)
      Unicode        183ms ± 4%      180ms ± 2%    ~             (p=0.114 n=9+8)
      GoTypes        1.12s ± 4%      1.07s ± 1%  -4.34%         (p=0.000 n=10+9)
      Compiler       5.16s ± 2%      5.04s ± 2%  -2.24%         (p=0.001 n=10+9)
      MakeBash       41.7s ± 2%      42.3s ± 1%  +1.51%        (p=0.000 n=10+10)
      
      name       old alloc/op    new alloc/op    delta
      Template      63.4MB ± 0%     63.1MB ± 0%  -0.42%        (p=0.000 n=10+10)
      Unicode       43.2MB ± 0%     43.1MB ± 0%  -0.22%         (p=0.000 n=9+10)
      GoTypes        220MB ± 0%      219MB ± 0%  -0.57%         (p=0.000 n=8+10)
      Compiler       978MB ± 0%      975MB ± 0%  -0.30%        (p=0.000 n=10+10)
      
      name       old allocs/op   new allocs/op   delta
      Template        702k ± 0%       686k ± 0%  -2.35%        (p=0.000 n=10+10)
      Unicode         548k ± 0%       542k ± 0%  -1.09%        (p=0.000 n=10+10)
      GoTypes        2.17M ± 0%      2.09M ± 0%  -3.61%        (p=0.000 n=10+10)
      Compiler       9.33M ± 0%      9.15M ± 0%  -1.93%        (p=0.000 n=10+10)
      
      Change-Id: I3a3d7f2d56876427b04cfedc7302d7f496d5bb65
      Reviewed-on: https://go-review.googlesource.com/20904
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: 's avatarDave Cheney <dave@cheney.net>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ad4c55c0
    • Keith Randall's avatar
      cmd/compile: enforce 32-bit restrictions on ops · 8dc04cbe
      Keith Randall authored
      Most 64-bit x86 ops can only take a signed 32-bit constant.
      Clean up our rewrite rules to enforce this restriction.
      
      Modify the assembler to fail if the offset does not fit
      in the instruction.
      
      That last check triggers a few times on weird testing code.
      Suppress those errors if the compiler itself generated errors.
      
      Fixes #14862
      
      Change-Id: I76559af035b38483b1e59621a8029fc66b3a5d1e
      Reviewed-on: https://go-review.googlesource.com/20815Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
      8dc04cbe
  2. 19 Mar, 2016 3 commits
    • Martin Möhrmann's avatar
      fmt: integer formatting should not permanently change padding · d246eedc
      Martin Möhrmann authored
      Changes the integer function to restore the original f.zero value
      and therefore padding type before returning.
      
      Change-Id: I456449259a3d39bd6d62e110553120c31ec63f23
      Reviewed-on: https://go-review.googlesource.com/20512Reviewed-by: 's avatarRob Pike <r@golang.org>
      Run-TryBot: Rob Pike <r@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      d246eedc
    • Martin Möhrmann's avatar
      fmt: remove depth argument from handleMethods and printArg · 2f4d4206
      Martin Möhrmann authored
      handleMethods can format Error() and String() directly as its known
      these return strings that can be directly printed using fmtString.
      Remove the obsolete depth argument from handleMethods.
      
      Remove the depth argument from printArg since it is only ever
      called with depth set to 0. Recursion for formatting complex
      arguments is handled only by printValue which keeps track of depth.
      
      Change-Id: I4c4be588751de12ed999e7561a51bc168eb9eb2d
      Reviewed-on: https://go-review.googlesource.com/20911
      Run-TryBot: Rob Pike <r@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRob Pike <r@golang.org>
      2f4d4206
    • Ian Lance Taylor's avatar
      cmd/compile: change ODOT and friends to use Sym, not Right · 5f525ca6
      Ian Lance Taylor authored
      The Node type ODOT and its variants all represent a selector, with a
      simple name to the right of the dot.  Before this change this was
      represented by using an ONAME Node in the Right field.  This ONAME node
      served no useful purpose.  This CL changes these Node types to store the
      symbol in the Sym field instead, thus not requiring allocating a Node
      for each selector.
      
      When compiling x/tools/go/types this CL eliminates nearly 5000 calls to
      newname and reduces the total number of Nodes allocated by about 6.6%.
      It seems to cut compilation time by 1 to 2 percent.
      
      Getting this right was somewhat subtle, and I added two dubious changes
      to produce the exact same output as before.  One is to ishairy in
      inl.go: the ONAME node increased the cost of ODOT and friends by 1, and
      I retained that, although really ODOT is not more expensive than any
      other node.  The other is to varexpr in walk.go: because the ONAME in
      the Right field of an ODOT has no class, varexpr would always return
      false for an ODOT, although in fact for some ODOT's it seemingly ought
      to return true; I added an && false for now.  I will send separate CLs,
      that will break toolstash -cmp, to clean these up.
      
      This CL passes toolstash -cmp.
      
      Change-Id: I4af8a10cc59078c436130ce472f25abc3a9b2f80
      Reviewed-on: https://go-review.googlesource.com/20890
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      5f525ca6
  3. 18 Mar, 2016 25 commits
  4. 17 Mar, 2016 3 commits