1. 08 Mar, 2016 18 commits
    • Brad Fitzpatrick's avatar
      cmd/compile: gofmt · 1264f6e2
      Brad Fitzpatrick authored
      Change-Id: I754861147838d0f6c184d8deb8a028062a1d3214
      Reviewed-on: https://go-review.googlesource.com/20400Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      1264f6e2
    • Russ Cox's avatar
      cmd/compile, cmd/link: eliminate string merging pass · 21af2d39
      Russ Cox authored
      Deleting the string merging pass makes the linker 30-35% faster
      but makes jujud (using the github.com/davecheney/benchjuju snapshot) 2.5% larger.
      Two optimizations bring the space overhead down to 0.6%.
      
      First, change the default alignment for string data to 1 byte.
      (It was previously defaulting to larger amounts, usually pointer width.)
      
      Second, write out the type string for T (usually a bigger expression) as "*T"[1:],
      so that the type strings for T and *T share storage.
      
      Combined, these obtain the bulk of the benefit of string merging
      at essentially no cost. The remaining benefit from string merging
      is not worth the excessive cost, so delete it.
      
      As penance for making the jujud binary 0.6% larger,
      the next CL in this sequence trims the reflect functype
      information enough to make the jujud binary overall 0.75% smaller
      (that is, that CL has a net -1.35% effect).
      
      For #6853.
      Fixes #14648.
      
      Change-Id: I3fdd74c85410930c36bb66160ca4174ed540fc6e
      Reviewed-on: https://go-review.googlesource.com/20334Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Russ Cox <rsc@golang.org>
      21af2d39
    • Russ Cox's avatar
      cmd/newlink: delete · fb880b8a
      Russ Cox authored
      cmd/link is clearly the way forward.
      The original rationale for cmd/newlink was that it would be a clean Go reimplementation.
      But when push came to shove, cmd/link got converted from C instead,
      and all the work on build modes and the like is in cmd/link now.
      Cleaning up cmd/link is likely a much better plan.
      
      This directory is something to delete from releases and the
      testdata is something that breaks every time the .6 format changes.
      Fix both problems by just deleting it outright.
      
      Change-Id: Ib00fecda258ba685f1752725971182af9d4459eb
      Reviewed-on: https://go-review.googlesource.com/20380
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      fb880b8a
    • Ian Lance Taylor's avatar
      cmd/compile: remove nodesOrNodeList outside of syntax.go · c4012b6b
      Ian Lance Taylor authored
      Passes toolstash -cmp.
      
      Update #14473.
      
      Change-Id: I717ebd948dfc8faf8b9ef5aa02c67484af618d18
      Reviewed-on: https://go-review.googlesource.com/20359Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      c4012b6b
    • Josh Bleecher Snyder's avatar
      cmd/compile: preallocate storage for three Value args · f3a29f1f
      Josh Bleecher Snyder authored
      benchstat master2 arg3b
      name      old time/op    new time/op    delta
      Template     441ms ± 4%     444ms ± 6%    ~     (p=0.335 n=22+25)
      GoTypes      1.51s ± 2%     1.51s ± 2%    ~     (p=0.129 n=25+21)
      Compiler     5.59s ± 1%     5.56s ± 2%  -0.65%  (p=0.001 n=24+21)
      
      name      old alloc/op   new alloc/op   delta
      Template    85.6MB ± 0%    85.3MB ± 0%  -0.40%  (p=0.000 n=25+24)
      GoTypes      307MB ± 0%     305MB ± 0%  -0.38%  (p=0.000 n=25+25)
      Compiler    1.06GB ± 0%    1.05GB ± 0%  -0.43%  (p=0.000 n=25+25)
      
      name      old allocs/op  new allocs/op  delta
      Template     1.10M ± 0%     1.09M ± 0%  -1.04%  (p=0.000 n=25+25)
      GoTypes      3.36M ± 0%     3.32M ± 0%  -1.13%  (p=0.000 n=25+24)
      Compiler     13.0M ± 0%     12.9M ± 0%  -1.12%  (p=0.000 n=25+25)
      
      Change-Id: I1280b846e895c00b95bb6664958a7765bd819610
      Reviewed-on: https://go-review.googlesource.com/20296Reviewed-by: default avatarKeith Randall <khr@golang.org>
      f3a29f1f
    • Brad Fitzpatrick's avatar
      os/user: skip Current test on android · b2018719
      Brad Fitzpatrick authored
      Also, add more failure output to debug why linux/mips64le and
      linux/ppc64 are failing. They should be working. I suspect their
      builder test envs are missing something.
      
      Change-Id: I97273fe72c4e3009db400394636d0da1ef147485
      Reviewed-on: https://go-review.googlesource.com/20358
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarHyang-Ah Hana Kim <hyangah@gmail.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      b2018719
    • Klaus Post's avatar
      hash/crc32: use slicing by 8 for Castagnoli and smaller sizes · b212c68b
      Klaus Post authored
      This adds "slicing by 8" optimization to Castagnoli tables which will
      speed up CRC32 calculation on systems without asssembler,
      which are all but AMD64.
      
      In my tests, it is faster to use "slicing by 8" for sizes all down to
      16 bytes, so the switchover point has been adjusted.
      
      There are no benchmarks for small sizes, so I have added one for 40 bytes,
      as well as one for bigger sizes (32KB).
      
      Castagnoli, No assembler, 40 Byte payload: (before, after)
      BenchmarkCastagnoli40B-4   10000000     161 ns/op         246.94 MB/s
      BenchmarkCastagnoli40B-4   20000000     100 ns/op         398.01 MB/s
      
      Castagnoli, No assembler, 32KB payload: (before, after)
      BenchmarkCastagnoli32KB-4     10000     115426 ns/op      283.89 MB/s
      BenchmarkCastagnoli32KB-4     30000     45171 ns/op       725.41 MB/s
      
      IEEE, No assembler, 1KB payload: (before, after)
      BenchmarkCrc1KB-4       500000     3604 ns/op         284.10 MB/s
      BenchmarkCrc1KB-4      1000000     1463 ns/op         699.79 MB/s
      
      Compared:
      benchmark                     old ns/op     new ns/op     delta
      BenchmarkCastagnoli40B-4      161           100           -37.89%
      BenchmarkCastagnoli32KB-4     115426        45171         -60.87%
      BenchmarkCrc1KB-4             3604          1463          -59.41%
      
      benchmark                     old MB/s     new MB/s     speedup
      BenchmarkCastagnoli40B-4      246.94       398.01       1.61x
      BenchmarkCastagnoli32KB-4     283.89       725.41       2.56x
      BenchmarkCrc1KB-4             284.10       699.79       2.46x
      
      Change-Id: I303e4ec84e8d4dafd057d64c0e43deb2b498e968
      Reviewed-on: https://go-review.googlesource.com/19335
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      b212c68b
    • Josh Bleecher Snyder's avatar
      cmd/compile: cache const nil, iface, slice, and "" · 39214275
      Josh Bleecher Snyder authored
      name      old time/op    new time/op    delta
      Template     441ms ± 4%     446ms ± 4%  +1.23%  (p=0.048 n=22+25)
      GoTypes      1.51s ± 2%     1.51s ± 2%    ~     (p=0.224 n=25+25)
      Compiler     5.59s ± 1%     5.57s ± 2%  -0.38%  (p=0.019 n=24+24)
      
      name      old alloc/op   new alloc/op   delta
      Template    85.6MB ± 0%    85.6MB ± 0%  -0.11%  (p=0.000 n=25+24)
      GoTypes      307MB ± 0%     305MB ± 0%  -0.45%  (p=0.000 n=25+25)
      Compiler    1.06GB ± 0%    1.06GB ± 0%  -0.34%  (p=0.000 n=25+25)
      
      name      old allocs/op  new allocs/op  delta
      Template     1.10M ± 0%     1.10M ± 0%  -0.03%  (p=0.001 n=25+24)
      GoTypes      3.36M ± 0%     3.35M ± 0%  -0.13%  (p=0.000 n=25+25)
      Compiler     13.0M ± 0%     13.0M ± 0%  -0.12%  (p=0.000 n=25+24)
      
      Change-Id: I7fc18acbc3b1588aececef9692e24a0bd3dba974
      Reviewed-on: https://go-review.googlesource.com/20295
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      39214275
    • Brad Fitzpatrick's avatar
      cmd/compile: fix comment accuracy after recent change · 7529701d
      Brad Fitzpatrick authored
      Change-Id: Ifa09bccb8482a6141d0aa862cef674fade30e2eb
      Reviewed-on: https://go-review.googlesource.com/20355Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      7529701d
    • Matthew Dempsky's avatar
      cmd/compile: simplify eq and hash function generation · 199cc194
      Matthew Dempsky authored
      Passes toolstash -cmp.
      
      Change-Id: Ie4675e6f713c3bbb90556f5347cbd7268a9c1a5d
      Reviewed-on: https://go-review.googlesource.com/20357
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      199cc194
    • Ian Lance Taylor's avatar
      cmd/compile: remove nodesOrNodeListPtr outside of syntax.go · e28a890d
      Ian Lance Taylor authored
      Passes toolstash -cmp.
      
      Update #14473.
      
      Change-Id: I2620374b79c61b1e48467b98afe2d7d3beef878b
      Reviewed-on: https://go-review.googlesource.com/20354Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      e28a890d
    • Matthew Dempsky's avatar
      cmd/compile: fix lineno restoration after SSA compilation · beabd872
      Matthew Dempsky authored
      Without SSA:
      
      $ go build -a -gcflags='-S -ssa=0' runtime 2>&1 | grep 'TEXT.*""\.init(SB)'
              0x0000 00000 ($GOROOT/src/runtime/write_err.go:14)        TEXT    "".init(SB), $88-0
      
      With SSA, before this CL:
      
      $ go build -a -gcflags='-S -ssa=1' runtime 2>&1 | grep 'TEXT.*""\.init(SB)'
              0x0000 00000 ($GOROOT/src/runtime/traceback.go:608)       TEXT    "".init(SB), $152-0
      
      With SSA, after this CL:
      
      $ go build -a -gcflags='-S -ssa=1' runtime 2>&1 | grep 'TEXT.*""\.init(SB)'
              0x0000 00000 ($GOROOT/src/runtime/write_err.go:14)        TEXT    "".init(SB), $152-0
      
      Change-Id: Ida3541e03a1af6ffc753ee5c3abeb653459edbf6
      Reviewed-on: https://go-review.googlesource.com/20321
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      beabd872
    • Aaron Zinman's avatar
      darwin/amd64: fix text-relocation issues for c-archive libraries
 · aea4222f
      Aaron Zinman authored
      The existing implementation deals with absolute relocations in __TEXT
      for darwin/amd64 in build-mode c-shared, but it ignores c-archive.
      This results in issues when trying to use a c-archive in an iOS
      app on the 64-bit simulator. This patch adds c-archive to the
      handling of this issue.
      
      Fixes #14217
      
      Change-Id: I2e4d5193caa531171ad22fd0cd420a8bfb4646a6
      Reviewed-on: https://go-review.googlesource.com/19206Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      aea4222f
    • Matthew Dempsky's avatar
      cmd/internal/obj: add As type for assembly opcodes · 0d9258a8
      Matthew Dempsky authored
      Passes toolstash/buildall.
      
      Fixes #14692.
      
      Change-Id: I4352678d8251309f2b8b7793674c550fac948006
      Reviewed-on: https://go-review.googlesource.com/20350Reviewed-by: default avatarDave Cheney <dave@cheney.net>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      0d9258a8
    • David Chase's avatar
      cmd/compile: Tinkering with schedule for debug and regalloc · b1785a50
      David Chase authored
      This adds a heap-based proper priority queue to the
      scheduler which made a relatively easy to test quite a few
      heuristics that "ought to work well".  For go tools
      themselves (which may not be representative) the heuristic
      that works best is (1) in line-number-order, then (2) from
      more to fewer args, then (3) in variable ID order.  Trying
      to improve this with information about use at end of
      blocks turned out to be fruitless -- all of my naive
      attempts at using that information turned out worse than
      ignoring it.  I can confirm that the stores-early heuristic
      tends to help; removing it makes the results slightly worse.
      
      My metric is code size reduction, which I take to mean fewer
      spills from register allocation.  It's not uniform.
      Here's the endpoints for "vet" from one set of pretty-good
      heuristics (this is representative at least).
      
      -2208 time.parse 13472 15680 -14.081633%
      -1514 runtime.pclntab 1002058 1003572 -0.150861%
      -352 time.Time.AppendFormat 9952 10304 -3.416149%
      -112 runtime.runGCProg 1984 2096 -5.343511%
      -64 regexp/syntax.(*parser).factor 7264 7328 -0.873362%
      -44 go.string.alldata 238630 238674 -0.018435%
      
      48 math/big.(*Float).round 1376 1328 3.614458%
      48 text/tabwriter.(*Writer).writeLines 1232 1184 4.054054%
      48 math/big.shr 832 784 6.122449%
      88 go.func.* 75174 75086 0.117199%
      96 time.Date 1968 1872 5.128205%
      
      Overall there appears to be an 0.1% decrease in text size.
      No timings yet, and given the distribution of size reductions
      it might make sense to wait on those.
      
      addr2line  text (code) = -4392 bytes (-0.156273%)
      api  text (code) = -5502 bytes (-0.147644%)
      asm  text (code) = -5254 bytes (-0.187810%)
      cgo  text (code) = -4886 bytes (-0.148846%)
      compile  text (code) = -1577 bytes (-0.019346%) * changed
      cover  text (code) = -5236 bytes (-0.137992%)
      dist  text (code) = -5015 bytes (-0.167829%)
      doc  text (code) = -5180 bytes (-0.182121%)
      fix  text (code) = -5000 bytes (-0.215148%)
      link  text (code) = -5092 bytes (-0.152712%)
      newlink  text (code) = -5204 bytes (-0.196986%)
      nm  text (code) = -4398 bytes (-0.156018%)
      objdump  text (code) = -4582 bytes (-0.155046%)
      pack  text (code) = -4503 bytes (-0.294287%)
      pprof  text (code) = -6314 bytes (-0.085177%)
      trace  text (code) = -5856 bytes (-0.097818%)
      vet  text (code) = -5696 bytes (-0.117334%)
      yacc  text (code) = -4971 bytes (-0.213817%)
      
      This leaves me sorely tempted to look into a "real" scheduler
      to try to do a better job, but I think it might make more
      sense to look into getting loop information into the
      register allocator instead.
      
      Fixes #14577.
      
      Change-Id: I5238b83284ce76dea1eb94084a8cd47277db6827
      Reviewed-on: https://go-review.googlesource.com/20240
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      b1785a50
    • Todd Neal's avatar
      cmd/compile: fix load combining from a non-zero pointer offset · 481fe590
      Todd Neal authored
      When the pointer offset is non-zero in the small loads, we need to add the offset
      when converting to the larger load.
      
      Fixes #14694
      
      Change-Id: I5ba8bcb3b9ce26c7fae0c4951500b9ef0fed54cd
      Reviewed-on: https://go-review.googlesource.com/20333Reviewed-by: default avatarKeith Randall <khr@golang.org>
      481fe590
    • Burcu Dogan's avatar
      runtime: listen 127.0.0.1 instead of localhost on android · 6df80387
      Burcu Dogan authored
      Fixes #14486.
      Related to #14485.
      
      Change-Id: I2dd77b0337aebfe885ae828483deeaacb500b12a
      Reviewed-on: https://go-review.googlesource.com/20340Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      6df80387
    • Matthew Dempsky's avatar
      cmd/internal/obj: stop using as+ALAST as an opcode · e8531316
      Matthew Dempsky authored
      Currently, package obj reserves a range of 1<<12 opcodes for each
      target architecture.  E.g., mips64 has [6<<12, 7<<12).
      
      However, because mips.ABEQ and mips.ALAST are both within that range,
      the expression mips.ABEQ+mips.ALAST in turn falls (far) outside that
      range around 12<<12, meaning it could theoretically collide with
      another arch's opcodes.
      
      More practically, it's a problem because 12<<12 overflows an int16,
      which hampers fixing #14692.  (We could also just switch to uint16 to
      avoid the overflow, but that still leaves the first problem.)
      
      As a workaround, use Michael Hudson-Doyle's solution from
      https://golang.org/cl/20182 and use negative values for these variant
      instructions.
      
      Passes toolstash -cmp for GOARCH=arm and GOARCH=mips64.
      
      Updates #14692.
      
      Change-Id: Iad797d10652360109fa4db19d4d1edb6529fc2c0
      Reviewed-on: https://go-review.googlesource.com/20345
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e8531316
  2. 07 Mar, 2016 22 commits