1. 18 May, 2017 7 commits
    • Josh Bleecher Snyder's avatar
      cmd/compile: don't break up contiguous blocks in looprotate · 638ebb04
      Josh Bleecher Snyder authored
      looprotate finds loop headers and arranges for them to be placed
      after the body of the loop. This eliminates a jump from the body.
      
      However, if the loop header is a series of contiguously laid out blocks,
      the rotation introduces a new jump in that series.
      This CL expands the "loop header" to move to be the entire
      run of contiguously laid out blocks in the same loop.
      
      This shrinks object files a little, and actually speeds up
      the compiler noticeably. Numbers below.
      
      Fannkuch performance seems to vary a lot by machine. On my laptop:
      
      name          old time/op  new time/op  delta
      Fannkuch11-8   2.89s ± 2%   2.85s ± 3%  -1.22%  (p=0.000 n=50+50)
      
      This has a significant affect on the append benchmarks in #14758:
      
      name   old time/op    new time/op    delta
      Foo-8     312ns ± 3%     276ns ± 2%  -11.37%  (p=0.000 n=30+29)
      Bar-8     565ns ± 2%     456ns ± 2%  -19.27%  (p=0.000 n=27+28)
      
      Updates #18977
      Fixes #20355
      
      name        old time/op       new time/op       delta
      Template          205ms ± 5%        204ms ± 8%    ~     (p=0.903 n=92+99)
      Unicode          85.3ms ± 4%       85.1ms ± 3%    ~     (p=0.191 n=92+94)
      GoTypes           512ms ± 4%        507ms ± 4%  -0.93%  (p=0.000 n=95+97)
      Compiler          2.38s ± 3%        2.35s ± 3%  -1.27%  (p=0.000 n=98+95)
      SSA               4.67s ± 3%        4.64s ± 3%  -0.62%  (p=0.000 n=95+96)
      Flate             117ms ± 3%        117ms ± 3%    ~     (p=0.099 n=84+86)
      GoParser          139ms ± 4%        137ms ± 4%  -0.90%  (p=0.000 n=97+98)
      Reflect           329ms ± 5%        326ms ± 6%  -0.97%  (p=0.002 n=99+98)
      Tar               102ms ± 6%        101ms ± 5%  -0.97%  (p=0.006 n=97+97)
      XML               198ms ±10%        196ms ±13%    ~     (p=0.087 n=100+100)
      [Geo mean]        318ms             316ms       -0.72%
      
      name        old user-time/op  new user-time/op  delta
      Template          250ms ± 7%        250ms ± 7%    ~     (p=0.850 n=94+92)
      Unicode           107ms ± 8%        106ms ± 5%  -0.76%  (p=0.005 n=98+91)
      GoTypes           665ms ± 5%        659ms ± 5%  -0.85%  (p=0.003 n=93+98)
      Compiler          3.15s ± 3%        3.10s ± 3%  -1.60%  (p=0.000 n=99+98)
      SSA               6.82s ± 3%        6.72s ± 4%  -1.55%  (p=0.000 n=94+98)
      Flate             138ms ± 8%        138ms ± 6%    ~     (p=0.369 n=94+92)
      GoParser          170ms ± 5%        168ms ± 6%  -1.13%  (p=0.002 n=96+98)
      Reflect           412ms ± 8%        416ms ± 8%    ~     (p=0.169 n=100+100)
      Tar               123ms ±18%        123ms ±14%    ~     (p=0.896 n=100+100)
      XML               236ms ± 9%        234ms ±11%    ~     (p=0.124 n=100+100)
      [Geo mean]        401ms             398ms       -0.63%
      
      name        old alloc/op      new alloc/op      delta
      Template         38.8MB ± 0%       38.8MB ± 0%    ~     (p=0.222 n=5+5)
      Unicode          28.7MB ± 0%       28.7MB ± 0%    ~     (p=0.421 n=5+5)
      GoTypes           109MB ± 0%        109MB ± 0%    ~     (p=0.056 n=5+5)
      Compiler          457MB ± 0%        457MB ± 0%  +0.07%  (p=0.008 n=5+5)
      SSA              1.10GB ± 0%       1.10GB ± 0%  +0.05%  (p=0.008 n=5+5)
      Flate            24.5MB ± 0%       24.5MB ± 0%    ~     (p=0.222 n=5+5)
      GoParser         30.9MB ± 0%       31.0MB ± 0%  +0.21%  (p=0.016 n=5+5)
      Reflect          73.4MB ± 0%       73.4MB ± 0%    ~     (p=0.421 n=5+5)
      Tar              25.5MB ± 0%       25.5MB ± 0%    ~     (p=0.548 n=5+5)
      XML              40.9MB ± 0%       40.9MB ± 0%    ~     (p=0.151 n=5+5)
      [Geo mean]       71.6MB            71.6MB       +0.07%
      
      name        old allocs/op     new allocs/op     delta
      Template           394k ± 0%         394k ± 0%    ~     (p=1.000 n=5+5)
      Unicode            344k ± 0%         343k ± 0%    ~     (p=0.310 n=5+5)
      GoTypes           1.16M ± 0%        1.16M ± 0%    ~     (p=1.000 n=5+5)
      Compiler          4.42M ± 0%        4.42M ± 0%    ~     (p=1.000 n=5+5)
      SSA               9.80M ± 0%        9.80M ± 0%    ~     (p=0.095 n=5+5)
      Flate              237k ± 1%         238k ± 1%    ~     (p=0.310 n=5+5)
      GoParser           320k ± 0%         322k ± 1%  +0.50%  (p=0.032 n=5+5)
      Reflect            958k ± 0%         957k ± 0%    ~     (p=0.548 n=5+5)
      Tar                252k ± 1%         252k ± 0%    ~     (p=1.000 n=5+5)
      XML                400k ± 0%         400k ± 0%    ~     (p=0.841 n=5+5)
      [Geo mean]         741k              742k       +0.06%
      
      name        old object-bytes  new object-bytes  delta
      Template           386k ± 0%         386k ± 0%  -0.05%  (p=0.008 n=5+5)
      Unicode            202k ± 0%         202k ± 0%  -0.01%  (p=0.008 n=5+5)
      GoTypes           1.16M ± 0%        1.16M ± 0%  -0.06%  (p=0.008 n=5+5)
      Compiler          3.91M ± 0%        3.91M ± 0%  -0.06%  (p=0.008 n=5+5)
      SSA               7.91M ± 0%        7.92M ± 0%  +0.01%  (p=0.008 n=5+5)
      Flate              228k ± 0%         227k ± 0%  -0.04%  (p=0.008 n=5+5)
      GoParser           283k ± 0%         283k ± 0%  -0.06%  (p=0.008 n=5+5)
      Reflect            952k ± 0%         951k ± 0%  -0.02%  (p=0.008 n=5+5)
      Tar                187k ± 0%         187k ± 0%  -0.04%  (p=0.008 n=5+5)
      XML                406k ± 0%         406k ± 0%  -0.05%  (p=0.008 n=5+5)
      [Geo mean]         648k              648k       -0.04%
      
      Change-Id: I8630c4291a0eb2f7e7927bc04d7cc0efef181094
      Reviewed-on: https://go-review.googlesource.com/43491Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      638ebb04
    • Alberto Donizetti's avatar
      os: document that NewFile can return nil · 9a432552
      Alberto Donizetti authored
      Fixes #20023
      
      Change-Id: I1bec3e69031ffcfd7ad71716be9597ec322528ff
      Reviewed-on: https://go-review.googlesource.com/41211Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      9a432552
    • Alberto Donizetti's avatar
      cmd/compile: don't panic in complex division · 2d1829b5
      Alberto Donizetti authored
      Updates #20227
      
      Change-Id: Idadc3137490181a5d380367660cee21e8313cf3b
      Reviewed-on: https://go-review.googlesource.com/42650
      Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      2d1829b5
    • Ben Shi's avatar
      cmd/internal/obj/arm: remove illegal form of the SWI instruction · c7cae34b
      Ben Shi authored
      SWI only support "SWI $imm", but currently "SWI (Reg)" is also
      accepted. This patch fixes it.
      
      And more instruction tests are added to cmd/asm/internal/asm/testdata/arm.s
      
      fixes #20375
      
      Change-Id: Id437d853924a403e41da9b6cbddd20d994b624ff
      Reviewed-on: https://go-review.googlesource.com/43552
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      c7cae34b
    • Alex Brainman's avatar
      net: adjust TestInterfaceHardwareAddrWithGetmac · 0927b472
      Alex Brainman authored
      Ignore adapters with "Transport Name:   N/A" line in getmac
      command output. This allows us to skip duplicate MAC addresses.
      
      Fixes #19537.
      
      Change-Id: I6b7be9d31322f963e02023c8f1037f6e9042b479
      Reviewed-on: https://go-review.googlesource.com/39071Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarAvelino <t@avelino.xxx>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      0927b472
    • Alex Brainman's avatar
      cmd/link: make sure that runtime.epclntab lives in .text section · b5e964cc
      Alex Brainman authored
      Second attempt to fix #14710.
      
      CL 35272 already tried to fix this issue. But CL 35272 assumed
      that runtime.epclntab type is STEXT, while it is actually SRODATA.
      
      This CL uses Symbol.Sect.Seg to determine if symbol is part
      of Segtext or Segdata.
      
      Fixes #14710
      
      Change-Id: Ic6b6f657555c87a64d2bc36cc4c07ab0591d00c4
      Reviewed-on: https://go-review.googlesource.com/42390
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      b5e964cc
    • Ian Lance Taylor's avatar
      test: add missing copyright header to checkbce.go · f700f89b
      Ian Lance Taylor authored
      Change-Id: Iafeb8e033c876f482caa17cca414fe13b0fadb12
      Reviewed-on: https://go-review.googlesource.com/43613
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDave Cheney <dave@cheney.net>
      f700f89b
  2. 17 May, 2017 8 commits
    • Austin Clements's avatar
      runtime/pprof: don't produce 0 location in count profiles · c34add78
      Austin Clements authored
      profileBuilder.locForPC returns 0 to mean "no location" because 0 is
      an invalid location index. However, the code to build count profiles
      doesn't check the result of locForPC, so this 0 location index ends up
      in the profile's location list. This, in turn, causes problems later
      when we decode the profile because it puts a nil *Location in the
      sample's location slice, which can later lead to a nil pointer panic.
      
      Fix this by making printCountProfile correctly discard the result of
      locForPC if it returns 0. This makes this call match the other two
      calls of locForPC.
      
      Updates #15156.
      
      Change-Id: I4492b3652b513448bc56f4cfece4e37da5e42f94
      Reviewed-on: https://go-review.googlesource.com/43630Reviewed-by: default avatarMichael Matloob <matloob@golang.org>
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c34add78
    • Carl Henrik Lunde's avatar
      runtime/pprof: deflake TestGoroutineCounts · 2dc27839
      Carl Henrik Lunde authored
      TestGoroutineCounts was flaky when running on a system under load.
      This happened on three builds the last couple of days.
      
      Fix this by running this test with a single operating system thread, so
      we do not depend on the operating system scheduler.  50 000 tests ran
      without failure with the new version, the old version failed 0.5% of the
      time.
      
      Fixes #15156.
      
      Change-Id: I1e5a18d0fef4f72cc9a56e376822b2849cdb0f8b
      Reviewed-on: https://go-review.googlesource.com/43590Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      2dc27839
    • Josh Bleecher Snyder's avatar
      cmd/compile: fuse from end to beginning · b3e577b9
      Josh Bleecher Snyder authored
      fuseBlockPlain was accidentally quadratic.
      If you had plain blocks b1 -> b2 -> b3 -> b4,
      each containing single values v1, v2, v3, and v4 respectively,
      fuseBlockPlain would move v1 from b1 to b2 to b3 to b4,
      then v2 from b2 to b3 to b4, etc.
      
      There are two obvious fixes.
      
      * Look for runs of blocks in fuseBlockPlain
        and handle them in a single go.
      * Fuse from end to beginning; any given value in a run
        of blocks to fuse then moves only once.
      
      The latter is much simpler, so that's what this CL does.
      
      Somewhat surprisingly, this change does not pass toolstash-check.
      
      The resulting set of blocks is the same,
      and the values in them are the same,
      but the order of values in them differ,
      and that order of values (while arbitrary)
      is enough to change the compiler's output.
      This may be due to #20178; deadstore is the next pass after fuse.
      
      Adding basic sorting to the beginning of deadstore
      is enough to make this CL pass toolstash-check:
      
      	for _, b := range f.Blocks {
      		obj.SortSlice(b.Values, func(i, j int) bool { return b.Values[i].ID < b.Values[j].ID })
      	}
      
      Happily, this CL appears to result in better code on average,
      if only by accident. It cuts 4k off of cmd/go; go1 benchmarks
      are noisy as always but don't regress (numbers below).
      
      No impact on the standard compilebench benchmarks.
      For the code in #13554, this speeds up compilation dramatically:
      
      name  old time/op       new time/op       delta
      Pkg         53.1s ± 2%        12.8s ± 3%  -75.92%  (p=0.008 n=5+5)
      
      name  old user-time/op  new user-time/op  delta
      Pkg         55.0s ± 2%        14.9s ± 3%  -73.00%  (p=0.008 n=5+5)
      
      name  old alloc/op      new alloc/op      delta
      Pkg        2.04GB ± 0%       2.04GB ± 0%   +0.18%  (p=0.008 n=5+5)
      
      name  old allocs/op     new allocs/op     delta
      Pkg         6.21M ± 0%        6.21M ± 0%     ~     (p=0.222 n=5+5)
      
      name  old object-bytes  new object-bytes  delta
      Pkg         28.4M ± 0%        28.4M ± 0%   +0.00%  (p=0.008 n=5+5)
      
      name  old export-bytes  new export-bytes  delta
      Pkg           208 ± 0%          208 ± 0%     ~     (all equal)
      
      
      Updates #13554
      
      
      go1 benchmarks:
      
      name                     old time/op    new time/op    delta
      BinaryTree17-8              2.29s ± 2%     2.26s ± 2%  -1.43%  (p=0.000 n=48+50)
      Fannkuch11-8                2.74s ± 2%     2.79s ± 2%  +1.63%  (p=0.000 n=50+49)
      FmtFprintfEmpty-8          36.6ns ± 3%    34.6ns ± 4%  -5.29%  (p=0.000 n=49+50)
      FmtFprintfString-8         58.3ns ± 3%    59.1ns ± 3%  +1.35%  (p=0.000 n=50+49)
      FmtFprintfInt-8            62.4ns ± 2%    63.2ns ± 3%  +1.19%  (p=0.000 n=49+49)
      FmtFprintfIntInt-8         95.1ns ± 2%    96.7ns ± 3%  +1.61%  (p=0.000 n=49+50)
      FmtFprintfPrefixedInt-8     118ns ± 3%     113ns ± 2%  -4.00%  (p=0.000 n=50+49)
      FmtFprintfFloat-8           191ns ± 2%     192ns ± 2%  +0.40%  (p=0.034 n=50+50)
      FmtManyArgs-8               419ns ± 2%     420ns ± 2%    ~     (p=0.228 n=49+49)
      GobDecode-8                5.26ms ± 3%    5.19ms ± 2%  -1.33%  (p=0.000 n=50+49)
      GobEncode-8                4.12ms ± 2%    4.15ms ± 3%  +0.68%  (p=0.007 n=49+50)
      Gzip-8                      198ms ± 2%     197ms ± 2%  -0.50%  (p=0.018 n=48+48)
      Gunzip-8                   31.9ms ± 3%    31.8ms ± 3%  -0.47%  (p=0.024 n=50+50)
      HTTPClientServer-8         64.4µs ± 0%    64.0µs ± 0%  -0.55%  (p=0.000 n=43+46)
      JSONEncode-8               10.6ms ± 2%    10.6ms ± 3%    ~     (p=0.543 n=49+49)
      JSONDecode-8               43.3ms ± 3%    43.1ms ± 2%    ~     (p=0.079 n=50+50)
      Mandelbrot200-8            3.70ms ± 2%    3.70ms ± 2%    ~     (p=0.553 n=47+50)
      GoParse-8                  2.70ms ± 2%    2.71ms ± 3%    ~     (p=0.843 n=49+50)
      RegexpMatchEasy0_32-8      70.5ns ± 4%    70.4ns ± 4%    ~     (p=0.867 n=48+50)
      RegexpMatchEasy0_1K-8       162ns ± 3%     162ns ± 2%    ~     (p=0.739 n=48+48)
      RegexpMatchEasy1_32-8      66.1ns ± 5%    66.2ns ± 4%    ~     (p=0.970 n=50+50)
      RegexpMatchEasy1_1K-8       297ns ± 7%     296ns ± 7%    ~     (p=0.406 n=50+50)
      RegexpMatchMedium_32-8      105ns ± 5%     105ns ± 5%    ~     (p=0.702 n=50+50)
      RegexpMatchMedium_1K-8     32.3µs ± 4%    32.2µs ± 3%    ~     (p=0.614 n=49+49)
      RegexpMatchHard_32-8       1.75µs ±18%    1.74µs ±12%    ~     (p=0.738 n=50+48)
      RegexpMatchHard_1K-8       52.2µs ±14%    51.3µs ±13%    ~     (p=0.230 n=50+50)
      Revcomp-8                   366ms ± 3%     367ms ± 3%    ~     (p=0.745 n=49+49)
      Template-8                 48.5ms ± 4%    48.5ms ± 4%    ~     (p=0.824 n=50+48)
      TimeParse-8                 263ns ± 2%     256ns ± 2%  -2.98%  (p=0.000 n=48+49)
      TimeFormat-8                265ns ± 3%     262ns ± 3%  -1.35%  (p=0.000 n=48+49)
      [Geo mean]                 41.1µs         40.9µs       -0.48%
      
      
      Change-Id: Ib35fa15b54282abb39c077d150beee27f610891a
      Reviewed-on: https://go-review.googlesource.com/43570
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      b3e577b9
    • Josh Bleecher Snyder's avatar
      cmd/compile: seed rand with time when race enabled · ff262913
      Josh Bleecher Snyder authored
      When the race detector is enabled,
      the compiler randomizes the order in which functions are compiled,
      in an attempt to shake out bugs.
      But we never re-seed the rand source, so every execution is identical.
      Fix that to get more coverage.
      
      Change-Id: If5cdde03ef4f1bab5f45e07f03fb6614945481d7
      Reviewed-on: https://go-review.googlesource.com/43572
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      ff262913
    • Hiroshi Ioka's avatar
      cmd/cgo: support large unsigned macros · 7555a45d
      Hiroshi Ioka authored
      Currently, cgo converts integer macros into int64 if it's possible.
      As a result, some macros which satisfy
      
      math.MaxInt64 < x <= math.MaxUint64
      
      will lose their original values.
      
      This CL introduces the new probe to check signs,
      so we can handle signed ints and unsigned ints separately.
      
      Fixes #20369
      
      Change-Id: I002ba452a82514b3a87440960473676f842cc9ee
      Reviewed-on: https://go-review.googlesource.com/43476Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7555a45d
    • Ian Lance Taylor's avatar
      cmd/go: don't fail on missing runtime/internal/sys/zversion.go · c20e5453
      Ian Lance Taylor authored
      The generated file runtime/internal/sys/zversion.go is deleted by
      `go tool cmd dist clean` as part of running clean.bash. Don't treat
      a missing file as a reason to stop running the go tool; just treat
      is as meaning that runtime/internal/sys is stale.
      
      No test because I don't particularly want to clobber $GOROOT.
      
      Fixes #20385.
      
      Change-Id: I5251a99542cc93c33f627f133d7118df56e18af1
      Reviewed-on: https://go-review.googlesource.com/43559
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      c20e5453
    • Ian Lance Taylor's avatar
      cmd/go: fix TestExecutableGOROOT if GOROOT is a symlink · acc56909
      Ian Lance Taylor authored
      Fixes #20365.
      
      Change-Id: If1a4866193cff3bc836d8bbf18b6a1f5deb9808d
      Reviewed-on: https://go-review.googlesource.com/43550
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarAlessandro Arzilli <alessandro.arzilli@gmail.com>
      acc56909
    • Ian Lance Taylor's avatar
      os: fix handling of ErrShortWrite in (*File).Write · 0fd7de49
      Ian Lance Taylor authored
      Restore the handling of io.ErrShortWrite in (*File).Write:
      if we write less than the requested amount, and there is no error from
      the syscall, then return io.ErrShortWrite.
      
      I can't figure out how to write a test for this. It would require a
      non-pollable file (not a pipe) on a device that is almost but not
      quite entirely full. The original code (https://golang.org/cl/36800043,
      committed as part of https://golang.org/cl/36930044) does not have a test.
      
      Fixes #20386.
      
      Change-Id: Ied7b411e621e1eaf49f864f8db90069f276256f5
      Reviewed-on: https://go-review.googlesource.com/43558
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      0fd7de49
  3. 16 May, 2017 8 commits
    • Sean Chittenden's avatar
      runtime: mmap(2) on Solaris & Illumos can return EAGAIN. · 13cdd814
      Sean Chittenden authored
      In low memory situations mmap(2) on Illumos[2] can return EAGAIN when it
      is unable to reserve the necessary space for the requested mapping.  Go
      was not previously handling this correctly for Illumos and would fail to
      recognize it was in a low-memory situation, the result being the program
      would terminate with a panic instead of running the GC.
      
      Fixes: #14930
      
      [1]: https://www.illumos.org/man/2/mmap
      
      Change-Id: I889cc0547e23f9d6c56e4fdd7bcbd0e15403873a
      Reviewed-on: https://go-review.googlesource.com/43461Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      13cdd814
    • Cherry Zhang's avatar
      runtime, syscall: in Plan 9 ARM asm, replace "SWI 0" with "SWI $0" · 3b263e43
      Cherry Zhang authored
      On other systems we use "SWI $n". Change Plan 9 files to be
      consistent. Generated binary is unchanged.
      
      Fixes #20378.
      
      Change-Id: Ia2a722061da2450c7b30cb707ed4f172fafecf74
      Reviewed-on: https://go-review.googlesource.com/43533Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      3b263e43
    • Adam Langley's avatar
      crypto/tls: pass argument to serverInit rather than using a field in Config. · 46f4bfb2
      Adam Langley authored
      Updates #20164.
      
      Change-Id: Ib900095e7885f25cd779750674a712c770603ca8
      Reviewed-on: https://go-review.googlesource.com/42137Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      46f4bfb2
    • Cherry Zhang's avatar
      cmd/internal/obj/mips: add support of LLV, SCV, NOOP instructions · b53acd89
      Cherry Zhang authored
      LLV and SCV are 64-bit load-linked and store-conditional. They
      were used in runtime as #define WORD. Change them to normal
      instruction form.
      
      NOOP is hardware no-op. It was written as WORD $0. Make a name
      for it for better disassembly output.
      
      Fixes #12561.
      Fixes #18238.
      
      Change-Id: I82c667ce756fa83ef37b034b641e8c4366335e83
      Reviewed-on: https://go-review.googlesource.com/40297Reviewed-by: default avatarMinux Ma <minux@golang.org>
      Run-TryBot: Minux Ma <minux@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      b53acd89
    • Mark Harrison's avatar
      path: add examples · 84a51432
      Mark Harrison authored
      This change adds several examples, with emphasis on special or edge
      cases such as a directory parameter consisting of an empty string.
      
      Change-Id: Ib4ac3d0f6d503493eeed0c4fda7c12acf782e9e2
      Reviewed-on: https://go-review.googlesource.com/43010Reviewed-by: default avatarSteve Francia <spf@golang.org>
      Run-TryBot: Jaana Burcu Dogan <jbd@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      84a51432
    • Josh Bleecher Snyder's avatar
      cmd/compile: eliminate some bounds checks from generated rewrite rules · 5548f7d5
      Josh Bleecher Snyder authored
      Noticed while looking at #20356.
      
      Cuts 160k (1%) off of the cmd/compile binary.
      
      Change-Id: If2397bc6971d6be9be6975048adecb0b5efa6d66
      Reviewed-on: https://go-review.googlesource.com/43501
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      5548f7d5
    • Josh Bleecher Snyder's avatar
      cmd/compile: lay out exit blocks last · 4b0d74f8
      Josh Bleecher Snyder authored
      In Go 1.8.x, panics are generally scheduled at the very end of functions.
      That property was lost in Go 1.9; this CL restores it.
      
      This helps with the Fannkuch benchmark:
      
      name          old time/op  new time/op  delta
      Fannkuch11-8   2.74s ± 2%   2.55s ± 2%  -7.03%  (p=0.000 n=20+20)
      
      This increases the fannkuch function size from 801 bytes to 831 bytes,
      but that is still smaller than Go 1.8.1 at 844 bytes.
      
      It generally increases binary size a tiny amount.
      Negligible compiler performance impact.
      
      For the code in #14758:
      
      name   old time/op    new time/op    delta
      Foo-8     326ns ± 3%     312ns ± 3%  -4.32%  (p=0.000 n=28+30)
      Bar-8     560ns ± 2%     565ns ± 2%  +0.96%  (p=0.002 n=30+27)
      
      Updates #18977
      
      name        old alloc/op      new alloc/op      delta
      Template         38.8MB ± 0%       38.8MB ± 0%    ~     (p=0.690 n=5+5)
      Unicode          28.7MB ± 0%       28.7MB ± 0%    ~     (p=0.841 n=5+5)
      GoTypes           109MB ± 0%        109MB ± 0%    ~     (p=0.690 n=5+5)
      Compiler          457MB ± 0%        457MB ± 0%    ~     (p=0.841 n=5+5)
      SSA              1.10GB ± 0%       1.10GB ± 0%  +0.03%  (p=0.032 n=5+5)
      Flate            24.4MB ± 0%       24.5MB ± 0%    ~     (p=0.690 n=5+5)
      GoParser         30.9MB ± 0%       30.9MB ± 0%    ~     (p=0.421 n=5+5)
      Reflect          73.3MB ± 0%       73.3MB ± 0%    ~     (p=1.000 n=5+5)
      Tar              25.5MB ± 0%       25.5MB ± 0%    ~     (p=0.095 n=5+5)
      XML              40.8MB ± 0%       40.9MB ± 0%    ~     (p=0.056 n=5+5)
      [Geo mean]       71.6MB            71.6MB       +0.01%
      
      name        old allocs/op     new allocs/op     delta
      Template           395k ± 0%         394k ± 1%    ~     (p=1.000 n=5+5)
      Unicode            344k ± 0%         344k ± 0%    ~     (p=0.690 n=5+5)
      GoTypes           1.16M ± 0%        1.16M ± 0%    ~     (p=0.421 n=5+5)
      Compiler          4.41M ± 0%        4.41M ± 0%    ~     (p=0.841 n=5+5)
      SSA               9.79M ± 0%        9.79M ± 0%    ~     (p=0.310 n=5+5)
      Flate              237k ± 0%         237k ± 0%    ~     (p=0.841 n=5+5)
      GoParser           321k ± 0%         321k ± 1%    ~     (p=0.421 n=5+5)
      Reflect            956k ± 0%         956k ± 0%    ~     (p=1.000 n=5+5)
      Tar                251k ± 1%         252k ± 0%    ~     (p=0.095 n=5+5)
      XML                399k ± 0%         400k ± 0%    ~     (p=0.222 n=5+5)
      [Geo mean]         741k              741k       +0.03%
      
      name        old object-bytes  new object-bytes  delta
      Template           386k ± 0%         386k ± 0%  +0.05%  (p=0.008 n=5+5)
      Unicode            202k ± 0%         202k ± 0%  +0.02%  (p=0.008 n=5+5)
      GoTypes           1.16M ± 0%        1.16M ± 0%  +0.07%  (p=0.008 n=5+5)
      Compiler          3.91M ± 0%        3.91M ± 0%  +0.05%  (p=0.008 n=5+5)
      SSA               7.86M ± 0%        7.87M ± 0%  +0.07%  (p=0.008 n=5+5)
      Flate              227k ± 0%         227k ± 0%  +0.10%  (p=0.008 n=5+5)
      GoParser           283k ± 0%         283k ± 0%  +0.04%  (p=0.008 n=5+5)
      Reflect            950k ± 0%         951k ± 0%  +0.04%  (p=0.008 n=5+5)
      Tar                187k ± 0%         187k ± 0%  -0.03%  (p=0.008 n=5+5)
      XML                406k ± 0%         406k ± 0%  +0.04%  (p=0.008 n=5+5)
      [Geo mean]         647k              647k       +0.04%
      
      Change-Id: I2015aa26338b90cf41e47f89564e336dc02608df
      Reviewed-on: https://go-review.googlesource.com/43293Reviewed-by: default avatarKeith Randall <khr@golang.org>
      4b0d74f8
    • Wei Xiao's avatar
      cmd/internal/objabi: fix the bug of shrinking SymType down to a uint8 · b2363ee9
      Wei Xiao authored
      Previous CL (cmd/internal/objabi: shrink SymType down to a uint8) shrinks
      SymType down to a uint8 but forgot making according change in goobj.
      
      Fixes #20296
      Also add a test to catch such Goobj format inconsistency bug
      
      Change-Id: Ib43dd7122cfcacf611a643814e95f8c5a924941f
      Reviewed-on: https://go-review.googlesource.com/42971
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMichael Hudson-Doyle <michael.hudson@canonical.com>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      b2363ee9
  4. 15 May, 2017 8 commits
  5. 14 May, 2017 3 commits
    • Robert Griesemer's avatar
      text/scanner: clarify documentation on Pos and Position · fca6ad45
      Robert Griesemer authored
      For #20292. (See discussion in that issue.)
      
      Change-Id: I44cd69394fc47a01776905ec34305ba524c89883
      Reviewed-on: https://go-review.googlesource.com/43452Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      fca6ad45
    • Josh Bleecher Snyder's avatar
      cmd/compile: tweak ssa.html colors · cfae61b6
      Josh Bleecher Snyder authored
      Make yellow the last highlight color rather than the first.
      Yellow is also the color that Chrome uses to highlight
      search results, which can be confusing.
      Also, when Night Shift is on on macOS,
      yellow highlighting is completely invisible.
      I suppose should be sleeping instead.
      
      Also, remove a completed TODO.
      
      Change-Id: I0eb4439272fad9ccb5fe8e2cf409fdd5dc15b26e
      Reviewed-on: https://go-review.googlesource.com/43463
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      cfae61b6
    • Josh Bleecher Snyder's avatar
      cmd/compile: don't update outer variables after capturevars is complete · 61336b78
      Josh Bleecher Snyder authored
      When compiling concurrently, we walk all functions before compiling
      any of them. Walking functions can cause variables to switch from
      being non-addrtaken to addrtaken, e.g. to prepare for a runtime call.
      Typechecking propagates addrtaken-ness of closure variables to
      their outer variables, so that capturevars can decide whether to
      pass the variable's value or a pointer to it.
      
      When all functions are compiled immediately, as long as the containing
      function is compiled prior to the closure, this propagation has no effect.
      When compilation is deferred, though, in rare cases, this results in 
      a change in the addrtaken-ness of a variable in the outer function,
      which in turn changes the compiler's output.
      (This is rare because in a great many cases, a temporary has been
      introduced, insulating the outer variable from modification.)
      But concurrent compilation must generate identical results.
      
      To fix this, track whether capturevars has run.
      If it has, there is no need to update outer variables
      when closure variables change.
      Capturevars always runs before any functions are walked or compiled.
      
      The remainder of the changes in this CL are to support the test.
      In particular, -d=compilelater forces the compiler to walk all
      functions before compiling any of them, despite being non-concurrent.
      This is useful because -live is fundamentally incompatible with
      concurrent compilation, but we want -c=1 to have no behavior changes.
      
      Fixes #20250
      
      Change-Id: I89bcb54268a41e8588af1ac8cc37fbef856a90c2
      Reviewed-on: https://go-review.googlesource.com/42853
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      61336b78
  6. 13 May, 2017 3 commits
  7. 12 May, 2017 3 commits
    • Robert Griesemer's avatar
      text/scanner: use correct token position in example · 8f06e217
      Robert Griesemer authored
      While at it, unindent source text so column values are easier
      to read, remove unnecessary text in output, and simplify the
      loop.
      
      Fixes #20346.
      
      Change-Id: I0fde02b9e4242383da427f4cf4c6c13dd0ab3b47
      Reviewed-on: https://go-review.googlesource.com/43450
      Run-TryBot: Robert Griesemer <gri@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      8f06e217
    • Matt Harden's avatar
      net: allow Resolver to use a custom dialer · 380aa884
      Matt Harden authored
      In some cases it is desirable to customize the way the DNS server is
      contacted, for instance to use a specific LocalAddr. While most
      operating-system level resolvers do not allow this, we have the
      opportunity to do so with the Go resolver. Most of the code was
      already in place to allow tests to override the dialer. This exposes
      that functionality, and as a side effect eliminates the need for a
      testing hook.
      
      Fixes #17404
      
      Change-Id: I1c5e570f8edbcf630090f8ec6feb52e379e3e5c0
      Reviewed-on: https://go-review.googlesource.com/37260
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      380aa884
    • Austin Clements's avatar
      runtime: doubly fix "double wakeup" panic · 3b5637ff
      Austin Clements authored
      runtime.gchelper depends on the non-atomic load of work.ndone
      happening strictly before the atomic add of work.nwait. Until very
      recently (commit 978af9c2, fixing #20334), the compiler reordered
      these operations. This created a race since work.ndone can change as
      soon as work.nwait is equal to work.ndone. If that happened, more than
      one gchelper could attempt to wake up the work.alldone note, causing a
      "double wakeup" panic.
      
      This was fixed in the compiler, but to make this code less subtle,
      make the load of work.ndone atomic. This clearly forces the order of
      these operations, ensuring the race doesn't happen.
      
      Fixes #19305 (though really 978af9c2 fixed it).
      
      Change-Id: Ieb1a84e1e5044c33ac612c8a5ab6297e7db4c57d
      Reviewed-on: https://go-review.googlesource.com/43311
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      3b5637ff