1. 02 May, 2017 8 commits
    • Filip Gruszczynski's avatar
      runtime: don't panic for bad size hint in hashmap · f9531448
      Filip Gruszczynski authored
      Because the hint parameter is supposed to be treated
      purely as a hint, if it doesn't meet the requirements
      we disregard it and continue as if there was no hint
      at all.
      
      Fixes #19926
      
      Change-Id: I86e7f99472fad6b99ba4e2fd33e4a9e55d55115e
      Reviewed-on: https://go-review.googlesource.com/40854
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      f9531448
    • Alberto Donizetti's avatar
      doc/contribute: directly link to the Agreements page · 9f6fde3a
      Alberto Donizetti authored
      There's no Settings->Agreement path for PolyGerrit users, but if we
      link directly to the page in the instructions, Gerrit will inform them
      that they can access the page by switching to the old UI.
      
      Fixes #20207
      
      Change-Id: I0887ee854e4ac5975b5f305adb6259b81b41618f
      Reviewed-on: https://go-review.googlesource.com/42412Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      9f6fde3a
    • Brad Fitzpatrick's avatar
      api: update next.txt · b2c60b2b
      Brad Fitzpatrick authored
      Change-Id: Ifbfd71a9c0d447e22c369c9d1209063b2a5c657b
      Reviewed-on: https://go-review.googlesource.com/42490
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      b2c60b2b
    • Michael Munday's avatar
      cmd/{asm,compile}: avoid zeroAuto clobbering flags on s390x · 35cf3843
      Michael Munday authored
      This CL modifies how MOV[DWHB] instructions that store a constant to
      memory are assembled to avoid them clobbering the condition code
      (flags). It also modifies zeroAuto to use MOVD instructions instead of
      CLEAR (which is assembled as XC).
      
      MOV[DWHB]storeconst ops also no longer clobbers flags.
      
      Note: this CL modifies the assembler so that it can no longer handle
      immediates outside the range of an int16 or offsets from SB, which
      reflects what the machine instructions support. The compiler doesn't
      need this capability any more and I don't think this affects any existing
      assembly, but it is easy to workaround if it does.
      
      Fixes #20187.
      
      Change-Id: Ie54947ff38367bd6a19962bf1a6d0296a4accffb
      Reviewed-on: https://go-review.googlesource.com/42179Reviewed-by: default avatarDavid Chase <drchase@google.com>
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      35cf3843
    • Bryan C. Mills's avatar
      expvar: reduce sync.Map overhead for (*Map).Set · e9702c0c
      Bryan C. Mills authored
      Use Load instead of LoadOrStore in the fast path to save 1 alloc/op
      for existing keys.
      
      name                          old time/op    new time/op    delta
      IntAdd                          6.39ns ± 7%    6.97ns ±19%     ~     (p=0.105 n=8+8)
      IntAdd-6                        12.3ns ± 1%    12.2ns ± 1%     ~     (p=0.396 n=7+7)
      IntSet                          6.41ns ± 6%    6.94ns ±21%     ~     (p=0.168 n=8+8)
      IntSet-6                        12.1ns ± 3%    11.7ns ± 9%     ~     (p=0.496 n=7+8)
      FloatAdd                        14.3ns ± 9%    14.7ns ± 4%     ~     (p=0.088 n=8+8)
      FloatAdd-6                      36.5ns ± 1%    36.6ns ± 0%     ~     (p=0.709 n=7+6)
      FloatSet                        6.59ns ± 7%    6.47ns ± 7%     ~     (p=0.397 n=8+7)
      FloatSet-6                      12.2ns ± 1%    12.2ns ± 2%     ~     (p=0.748 n=7+7)
      StringSet                       67.8ns ± 6%    68.7ns ± 6%     ~     (p=0.342 n=8+8)
      StringSet-6                     41.8ns ± 5%    41.7ns ± 5%     ~     (p=0.979 n=8+8)
      MapSet                           294ns ± 6%     234ns ± 4%  -20.35%  (p=0.000 n=8+8)
      MapSet-6                        95.8ns ± 2%    89.4ns ± 3%   -6.73%  (p=0.000 n=8+8)
      MapSetDifferent                 1.31µs ± 5%    1.07µs ± 4%  -18.21%  (p=0.000 n=8+8)
      MapSetDifferent-6                260ns ± 8%     210ns ± 9%  -19.44%  (p=0.000 n=8+8)
      MapSetString                     294ns ± 6%     236ns ± 4%  -19.92%  (p=0.000 n=8+8)
      MapSetString-6                  95.6ns ± 2%    89.9ns ± 2%   -5.97%  (p=0.000 n=7+8)
      MapAddSame                      1.46µs ± 3%    1.46µs ± 5%     ~     (p=0.721 n=8+8)
      MapAddSame-6                     328ns ± 6%     330ns ± 4%     ~     (p=0.776 n=8+8)
      MapAddDifferent                 4.89µs ± 7%    4.98µs ± 6%     ~     (p=0.505 n=8+8)
      MapAddDifferent-6               1.02µs ± 3%    1.01µs ± 4%     ~     (p=0.352 n=7+8)
      MapAddSameSteadyState           62.1ns ± 7%    60.8ns ± 4%     ~     (p=0.521 n=8+8)
      MapAddSameSteadyState-6         38.1ns ± 3%    37.7ns ± 0%     ~     (p=0.185 n=7+6)
      MapAddDifferentSteadyState       290ns ± 5%     293ns ± 4%     ~     (p=0.515 n=8+8)
      MapAddDifferentSteadyState-6    63.0ns ± 7%    63.7ns ±11%     ~     (p=0.482 n=7+8)
      RealworldExpvarUsage            7.39µs ± 5%    7.51µs ± 5%     ~     (p=0.382 n=8+8)
      RealworldExpvarUsage-6          3.07µs ±28%    3.04µs ±43%     ~     (p=0.798 n=8+8)
      
      name                          old alloc/op   new alloc/op   delta
      IntAdd                           0.00B          0.00B          ~     (all equal)
      IntAdd-6                         0.00B          0.00B          ~     (all equal)
      IntSet                           0.00B          0.00B          ~     (all equal)
      IntSet-6                         0.00B          0.00B          ~     (all equal)
      FloatAdd                         0.00B          0.00B          ~     (all equal)
      FloatAdd-6                       0.00B          0.00B          ~     (all equal)
      FloatSet                         0.00B          0.00B          ~     (all equal)
      FloatSet-6                       0.00B          0.00B          ~     (all equal)
      StringSet                        16.0B ± 0%     16.0B ± 0%     ~     (all equal)
      StringSet-6                      16.0B ± 0%     16.0B ± 0%     ~     (all equal)
      MapSet                           48.0B ± 0%     32.0B ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSet-6                         48.0B ± 0%     32.0B ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetDifferent                   192B ± 0%      128B ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetDifferent-6                 192B ± 0%      128B ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetString                     48.0B ± 0%     32.0B ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetString-6                   48.0B ± 0%     32.0B ± 0%  -33.33%  (p=0.000 n=8+8)
      MapAddSame                        480B ± 0%      480B ± 0%     ~     (all equal)
      MapAddSame-6                      480B ± 0%      480B ± 0%     ~     (all equal)
      MapAddDifferent                 1.09kB ± 0%    1.09kB ± 0%     ~     (all equal)
      MapAddDifferent-6               1.09kB ± 0%    1.09kB ± 0%     ~     (all equal)
      MapAddSameSteadyState            0.00B          0.00B          ~     (all equal)
      MapAddSameSteadyState-6          0.00B          0.00B          ~     (all equal)
      MapAddDifferentSteadyState       0.00B          0.00B          ~     (all equal)
      MapAddDifferentSteadyState-6     0.00B          0.00B          ~     (all equal)
      RealworldExpvarUsage             0.00B          0.00B          ~     (all equal)
      RealworldExpvarUsage-6           0.00B          0.00B          ~     (all equal)
      
      name                          old allocs/op  new allocs/op  delta
      IntAdd                            0.00           0.00          ~     (all equal)
      IntAdd-6                          0.00           0.00          ~     (all equal)
      IntSet                            0.00           0.00          ~     (all equal)
      IntSet-6                          0.00           0.00          ~     (all equal)
      FloatAdd                          0.00           0.00          ~     (all equal)
      FloatAdd-6                        0.00           0.00          ~     (all equal)
      FloatSet                          0.00           0.00          ~     (all equal)
      FloatSet-6                        0.00           0.00          ~     (all equal)
      StringSet                         1.00 ± 0%      1.00 ± 0%     ~     (all equal)
      StringSet-6                       1.00 ± 0%      1.00 ± 0%     ~     (all equal)
      MapSet                            3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSet-6                          3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetDifferent                   12.0 ± 0%       8.0 ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetDifferent-6                 12.0 ± 0%       8.0 ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetString                      3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=8+8)
      MapSetString-6                    3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=8+8)
      MapAddSame                        11.0 ± 0%      11.0 ± 0%     ~     (all equal)
      MapAddSame-6                      11.0 ± 0%      11.0 ± 0%     ~     (all equal)
      MapAddDifferent                   31.0 ± 0%      31.0 ± 0%     ~     (all equal)
      MapAddDifferent-6                 31.0 ± 0%      31.0 ± 0%     ~     (all equal)
      MapAddSameSteadyState             0.00           0.00          ~     (all equal)
      MapAddSameSteadyState-6           0.00           0.00          ~     (all equal)
      MapAddDifferentSteadyState        0.00           0.00          ~     (all equal)
      MapAddDifferentSteadyState-6      0.00           0.00          ~     (all equal)
      RealworldExpvarUsage              0.00           0.00          ~     (all equal)
      RealworldExpvarUsage-6            0.00           0.00          ~     (all equal)
      
      https://perf.golang.org/search?q=upload:20170501.1
      
      Change-Id: I28fc3906473f2b7307f6d1ae05a8d9b01ef8a6f8
      Reviewed-on: https://go-review.googlesource.com/42211
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      e9702c0c
    • Chris Manghane's avatar
      net/http: bgErr is unused; remove it · 48def43f
      Chris Manghane authored
      Fixes #20196.
      
      Change-Id: Ib87f6e9e27a38f21f860b7150c818d77be653dd3
      Reviewed-on: https://go-review.googlesource.com/42370Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      48def43f
    • Josh Bleecher Snyder's avatar
      cmd/dist: spin up fewer test dir runners · a93e9f0f
      Josh Bleecher Snyder authored
      5 shards, each of which spins up NumCPU processes,
      each of which is running at GOMAXPROCS=NumCPU,
      is too much for one machine. It makes my laptop unusable.
      
      It might also be in part responsible for test flakes
      that require a moderately responsive system,
      like #18589 (backedge scheduling) and #19276 (locklinear).
      
      It's possible that Go should be a better neighbor in general;
      that's #17969. In the meantime, fix this corner of the world.
      
      Builders snapshot the world and run shards on different
      machines, so keeping sharding high for them is good.
      
      This is a partial reversion of CL 18199.
      
      Fixes #20141.
      
      Change-Id: I123cf9436f4f4da3550372896265c38117b78071
      Reviewed-on: https://go-review.googlesource.com/42431Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      a93e9f0f
    • Josh Bleecher Snyder's avatar
      cmd/internal/obj: fix LSym.Type during compilation, not linking · 18fb670e
      Josh Bleecher Snyder authored
      Prior to this CL, the compiler and assembler
      were sloppy about the LSym.Type for LSyms
      containing static data.
      
      The linker then fixed this up, converting
      Sxxx and SBSS to SDATA, and SNOPTRBSS to SNOPTRDATA
      if it noticed that the symbol had associated data.
      
      It is preferable to just get this right in cmd/compile
      and cmd/asm, because it removes an unnecessary traversal
      of the symbol table from the linker (see #14624).
      Do this by touching up the LSym.Type fixes in
      LSym.prepwrite and Link.Globl.
      
      I have confirmed by instrumenting the linker
      that the now-eliminated code paths were unreached.
      And an additional check in the object file writing code
      will help preserve that invariant.
      
      There was a case in the Windows linker,
      with internal linking and cgo,
      where we were generating SNOPTRBSS symbols with data.
      For now, convert those at the site at which they occur
      into SNOPTRDATA, just like they were.
      
      Does not pass toolstash-check,
      but does generate identical linked binaries.
      
      No compiler performance changes.
      
      Change-Id: I77b071ab103685ff8e042cee9abb864385488872
      Reviewed-on: https://go-review.googlesource.com/40864
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      Reviewed-by: default avatarMichael Hudson-Doyle <michael.hudson@canonical.com>
      18fb670e
  2. 01 May, 2017 11 commits
    • Elias Naur's avatar
      misc/android: don't let the Android exec wrapper hang indefinitely · 00f82778
      Elias Naur authored
      On Android, the exec wrapper passes on output from adb to its parent
      process by passing on os.Stderr and os.Stdout to adb. If the adb
      process somehow hangs, it will keep stderr and stdout will open, in turn
      blocking go test from ever returning from its cmd.Wait() even though
      it has killed the exec wrapper process.
      
      Break the short circuit by introducing a wrapper between adb and the
      exec wrapper, preventing os/exec.Run from passing along the raw
      file descriptors for os.Stdout and os.Stderr.
      
      (Hopefully) fixes occasional indefinite hangs on the Android builder.
      
      Change-Id: I1188211fbde79b4a66bf93ff8e9d0091abf34560
      Reviewed-on: https://go-review.googlesource.com/42271
      Run-TryBot: Elias Naur <elias.naur@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      00f82778
    • Martin Möhrmann's avatar
      cmd/compile: use MOVL instead of MOVQ for small constants on amd64 · f9bec9eb
      Martin Möhrmann authored
      The encoding of MOVL to a register is 2 bytes shorter than for MOVQ.
      The upper 32bit are automatically zeroed when MOVL to a register is used.
      
      Replaces 1657 MOVQ by MOVL in the go binary.
      Reduces go binary size by 4 kilobyte.
      
      name                   old time/op    new time/op    delta
      BinaryTree17              1.93s ± 0%     1.93s ± 0%  -0.32%  (p=0.000 n=9+9)
      Fannkuch11                2.66s ± 0%     2.48s ± 0%  -6.60%  (p=0.000 n=9+9)
      FmtFprintfEmpty          31.8ns ± 0%    31.6ns ± 0%  -0.63%  (p=0.000 n=10+10)
      FmtFprintfString         52.0ns ± 0%    51.9ns ± 0%  -0.19%  (p=0.000 n=10+10)
      FmtFprintfInt            55.6ns ± 0%    54.6ns ± 0%  -1.80%  (p=0.002 n=8+10)
      FmtFprintfIntInt         87.7ns ± 0%    84.8ns ± 0%  -3.31%  (p=0.000 n=9+9)
      FmtFprintfPrefixedInt    98.9ns ± 0%   102.0ns ± 0%  +3.10%  (p=0.000 n=10+10)
      FmtFprintfFloat           165ns ± 0%     164ns ± 0%  -0.61%  (p=0.000 n=10+10)
      FmtManyArgs               368ns ± 0%     361ns ± 0%  -1.98%  (p=0.000 n=8+10)
      GobDecode                4.53ms ± 0%    4.58ms ± 0%  +1.08%  (p=0.000 n=9+10)
      GobEncode                3.74ms ± 0%    3.73ms ± 0%  -0.27%  (p=0.000 n=10+10)
      Gzip                      164ms ± 0%     163ms ± 0%  -0.48%  (p=0.000 n=10+10)
      Gunzip                   26.7ms ± 0%    26.6ms ± 0%  -0.13%  (p=0.000 n=9+10)
      HTTPClientServer         30.4µs ± 1%    30.3µs ± 1%  -0.41%  (p=0.016 n=10+10)
      JSONEncode               10.9ms ± 0%    11.0ms ± 0%  +0.70%  (p=0.000 n=10+10)
      JSONDecode               36.8ms ± 0%    37.0ms ± 0%  +0.59%  (p=0.000 n=9+10)
      Mandelbrot200            3.20ms ± 0%    3.21ms ± 0%  +0.44%  (p=0.000 n=9+10)
      GoParse                  2.35ms ± 0%    2.35ms ± 0%  +0.26%  (p=0.000 n=10+9)
      RegexpMatchEasy0_32      58.3ns ± 0%    58.4ns ± 0%  +0.17%  (p=0.000 n=10+10)
      RegexpMatchEasy0_1K       138ns ± 0%     142ns ± 0%  +2.68%  (p=0.000 n=10+10)
      RegexpMatchEasy1_32      55.1ns ± 0%    55.6ns ± 1%    ~     (p=0.104 n=10+10)
      RegexpMatchEasy1_1K       242ns ± 0%     243ns ± 0%  +0.41%  (p=0.000 n=10+10)
      RegexpMatchMedium_32     87.4ns ± 0%    89.9ns ± 0%  +2.86%  (p=0.000 n=10+10)
      RegexpMatchMedium_1K     27.4µs ± 0%    27.4µs ± 0%  +0.15%  (p=0.000 n=10+10)
      RegexpMatchHard_32       1.30µs ± 0%    1.32µs ± 1%  +1.91%  (p=0.000 n=10+10)
      RegexpMatchHard_1K       39.0µs ± 0%    39.5µs ± 0%  +1.38%  (p=0.000 n=10+10)
      Revcomp                   316ms ± 0%     319ms ± 0%  +1.13%  (p=0.000 n=9+8)
      Template                 40.6ms ± 0%    40.6ms ± 0%    ~     (p=0.123 n=10+10)
      TimeParse                 224ns ± 0%     224ns ± 0%    ~     (all equal)
      TimeFormat                230ns ± 0%     225ns ± 0%  -2.17%  (p=0.000 n=10+10)
      
      Change-Id: I32a099b65f9e6d4ad7288ed48546655c534757d8
      Reviewed-on: https://go-review.googlesource.com/38630
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      f9bec9eb
    • Martin Möhrmann's avatar
      runtime: refactor cpu feature detection for 386 & amd64 · 5a6c5809
      Martin Möhrmann authored
      Changes all cpu features to be detected and stored in bools in rt0_go.
      
      Updates: #15403
      
      Change-Id: I5a9961cdec789b331d09c44d86beb53833d5dc3e
      Reviewed-on: https://go-review.googlesource.com/41950
      Run-TryBot: Martin Möhrmann <moehrmann@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIlya Tocar <ilya.tocar@intel.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      5a6c5809
    • Michael Hudson-Doyle's avatar
      cmd/internal/obj/x86: use LEAx rather than ADDx when calling DUFFxxxx via GOT · 1f85d3ad
      Michael Hudson-Doyle authored
      DUFFZERO on 386 is not marked as clobbering flags, but rewriteToUseGot rewrote
      "ADUFFZERO $offset" to "MOVL runtime.duffxxx@GOT, CX; ADDL $offset, CX; CALL CX"
      which does. Luckily the fix is easier than figuring out what the problem was:
      replace the ADDL $offset, CX with LEAL $offset(CX), CX.
      
      On amd64 DUFFZERO clobbers flags, on arm, arm64 and ppc64 ADD does not clobber
      flags and s390x does not use the duff functions, so I'm fairly confident this
      is the only fix required.
      
      I don't know how to write a test though.
      
      Change-Id: I69b0958f5f45771d61db5f5ecb4ded94e8960d4d
      Reviewed-on: https://go-review.googlesource.com/41821
      Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      1f85d3ad
    • Damien Lespiau's avatar
      cmd/internal/obj/x86: fix ANDPS encoding · a2da2108
      Damien Lespiau authored
      ANDPS, like all others PS (Packed Single precision floats) instructions,
      need Ym: they don't use the 0x66 prefix.
      
      From the manual:
      
          NP 0F 54 /r        ANDPS xmm1, xmm2/m128
      
      NP meaning, quoting the manual:
      
        NP - Indicates the use of 66/F2/F3 prefixes (beyond those already part
        of the instructions opcode) are not allowed with the instruction.
      
      And indeed, the same instruction prefixed by 0x66 is ANDPD.
      
      Updates #14069
      
      Change-Id: If312a6f1e77113ab8c0febe66bdb1b4171e41e0a
      Reviewed-on: https://go-review.googlesource.com/42090Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      a2da2108
    • Josh Bleecher Snyder's avatar
      cmd/compile: avoid giant init functions due to many user inits · d1b544c7
      Josh Bleecher Snyder authored
      We generate code that calls each user init function one at a time.
      When there are lots of user init functions,
      usually due to generated code, like test/rotate* or
      github.com/juju/govmomi/vim25/types,
      we can end up with a giant function,
      which can be slow to compile.
      
      This CL puts in an escape valve.
      When there are more than 500 functions, instead of doing:
      
      init.0()
      init.1()
      // ...
      
      we construct a static array of functions:
      
      var fns = [...]func(){init.0, init.1, ... }
      
      and call them in a loop.
      
      This generates marginally bigger, marginally worse code,
      so we restrict it to cases in which it might start to matter.
      
      500 was selected as a mostly arbitrary threshold for "lots".
      Each call uses two Progs, one for PCDATA and one for the call,
      so at 500 calls we use ~1000 Progs.
      At concurrency==8, we get a Prog cache of about
      1000 Progs per worker.
      So a threshold of 500 should more or less avoid
      exhausting the Prog cache in most cases.
      
      Change-Id: I276b887173ddbf65b2164ec9f9b5eb04d8c753c2
      Reviewed-on: https://go-review.googlesource.com/41500Reviewed-by: default avatarKeith Randall <khr@golang.org>
      d1b544c7
    • Josh Bleecher Snyder's avatar
      runtime: use 64 bit calculation in overLoadFactor · b666f286
      Josh Bleecher Snyder authored
      overLoadFactor used a uintptr for its calculations.
      When the number of potential buckets was large,
      perhaps due to a coding error or corrupt/malicious user input
      leading to a very large map size hint,
      this led to overflow on 32 bit systems.
      This overflow resulted in an infinite loop.
      
      Prevent it by always using a 64 bit calculation.
      
      Updates #20195
      
      Change-Id: Iaabc710773cd5da6754f43b913478cc5562d89a2
      Reviewed-on: https://go-review.googlesource.com/42185
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      b666f286
    • Josh Bleecher Snyder's avatar
      cmd/compile: add minor bit twiddling optimizations · 00db0cbf
      Josh Bleecher Snyder authored
      Noticed while adding to the bitset implementation
      in cmd/compile/internal/gc.
      
      The (Com (Const)) optimizations were already present
      in the AMD64 lowered optimizations.
      They trigger 118, 44, 262, and 108 times
      respectively for int sizes 8, 16, 32, and 64
      in a run of make.bash.
      
      The (Or (And)) optimization is new.
      It triggers 3 times for int size 8
      and once for int size 64 during make.bash,
      in packages internal/poll, reflect,
      encoding/asn1, and go/types,
      so there is a bit of natural test coverage.
      
      Change-Id: I44072864ff88831d5ec7dce37c516d29df056e98
      Reviewed-on: https://go-review.googlesource.com/41758
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      00db0cbf
    • Josh Bleecher Snyder's avatar
      cmd/compile: add comments to trackAllTypes · c095e92c
      Josh Bleecher Snyder authored
      Per gri's suggestion on CL 41623,
      add a comment to trackAllTypes
      about the trade-offs of enabling it.
      
      Change-Id: Iec42b0da7933543200729003d1b2c6e0d9dcc5f0
      Reviewed-on: https://go-review.googlesource.com/42186Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      c095e92c
    • Damien Lespiau's avatar
      cmd/asm: enable CMPPS, CMPPD, CMPSS and CMPSD encoding tests · 51995aa4
      Damien Lespiau authored
      The generated test cases had their arguments reversed, putting them back
      in order makes those tests pass.
      
        CMPPS SRC, DEST, CC
      
      Change-Id: Ie15021edc533d5681a6a78d10d88b665e3de9017
      Reviewed-on: https://go-review.googlesource.com/42097Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      51995aa4
    • Michael Hudson-Doyle's avatar
      Revert "cmd/link: replace SHIDDEN bit in SymKind with a bit of Attribute" · 164f99e5
      Michael Hudson-Doyle authored
      This reverts commit a69222d9.
      
      Reason for revert: broke ppc64le
      
      Change-Id: I57d275177e90f036caf7dbade9669b8121dfa437
      Reviewed-on: https://go-review.googlesource.com/42194Reviewed-by: default avatarMichael Hudson-Doyle <michael.hudson@canonical.com>
      164f99e5
  3. 30 Apr, 2017 8 commits
  4. 29 Apr, 2017 7 commits
    • Emmanuel Odeke's avatar
      cmd/compile: add test for blank field in composite literal · 320aabba
      Emmanuel Odeke authored
      Updates #18089.
      
      Test for that issue; it was inadvertently fixed
      by CL 34988. Ensure that we don't regress on the fix.
      
      Change-Id: Icb85fc20dbb0a47f028f088281319b552b16759d
      Reviewed-on: https://go-review.googlesource.com/42173Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      320aabba
    • Bryan C. Mills's avatar
      archive/zip: replace RWMutex with sync.Map · 34fd5db1
      Bryan C. Mills authored
      This change replaces the compressors and decompressors maps with
      instances of sync.Map, eliminating the need for Mutex locking in
      NewReader and NewWriter.
      
      The impact for encoding large payloads is miniscule, but as the
      payload size decreases, the reduction in setup costs becomes
      measurable.
      
      updates #17973
      updates #18177
      
      name                        old time/op    new time/op    delta
      CompressedZipGarbage          13.6ms ± 3%    13.8ms ± 4%    ~     (p=0.275 n=14+16)
      CompressedZipGarbage-6        2.81ms ±10%    2.80ms ± 9%    ~     (p=0.616 n=16+16)
      CompressedZipGarbage-48        606µs ± 4%     600µs ± 3%    ~     (p=0.110 n=16+15)
      Zip64Test                     88.7ms ± 5%    87.5ms ± 5%    ~     (p=0.150 n=14+14)
      Zip64Test-6                   88.6ms ± 8%    94.5ms ±13%    ~     (p=0.070 n=14+16)
      Zip64Test-48                   102ms ±19%     101ms ±19%    ~     (p=0.599 n=16+15)
      Zip64TestSizes/4096           21.7µs ±10%    23.0µs ± 2%    ~     (p=0.076 n=14+12)
      Zip64TestSizes/4096-6         7.58µs ±13%    7.49µs ±18%    ~     (p=0.752 n=16+16)
      Zip64TestSizes/4096-48        19.5µs ± 8%    18.0µs ± 4%  -7.74%  (p=0.000 n=16+15)
      Zip64TestSizes/1048576        1.36ms ± 9%    1.40ms ± 8%  +2.79%  (p=0.029 n=24+25)
      Zip64TestSizes/1048576-6       262µs ±11%     260µs ±10%    ~     (p=0.506 n=24+24)
      Zip64TestSizes/1048576-48      120µs ± 7%     116µs ± 7%  -3.05%  (p=0.006 n=24+25)
      Zip64TestSizes/67108864       86.8ms ± 6%    85.1ms ± 5%    ~     (p=0.149 n=14+17)
      Zip64TestSizes/67108864-6     15.9ms ± 2%    16.1ms ± 6%    ~     (p=0.279 n=14+17)
      Zip64TestSizes/67108864-48    4.51ms ± 5%    4.53ms ± 4%    ~     (p=0.766 n=15+17)
      
      name                        old alloc/op   new alloc/op   delta
      CompressedZipGarbage          5.63kB ± 0%    5.63kB ± 0%    ~     (all equal)
      CompressedZipGarbage-6        15.4kB ± 0%    15.4kB ± 0%    ~     (all equal)
      CompressedZipGarbage-48       25.5kB ± 3%    25.6kB ± 2%    ~     (p=0.450 n=16+16)
      Zip64Test                     20.0kB ± 0%    20.0kB ± 0%    ~     (p=0.060 n=16+13)
      Zip64Test-6                   20.0kB ± 0%    20.0kB ± 0%    ~     (p=0.136 n=16+14)
      Zip64Test-48                  20.0kB ± 0%    20.0kB ± 0%    ~     (p=1.000 n=16+16)
      Zip64TestSizes/4096           20.0kB ± 0%    20.0kB ± 0%    ~     (all equal)
      Zip64TestSizes/4096-6         20.0kB ± 0%    20.0kB ± 0%    ~     (all equal)
      Zip64TestSizes/4096-48        20.0kB ± 0%    20.0kB ± 0%  -0.00%  (p=0.002 n=16+13)
      Zip64TestSizes/1048576        20.0kB ± 0%    20.0kB ± 0%    ~     (all equal)
      Zip64TestSizes/1048576-6      20.0kB ± 0%    20.0kB ± 0%    ~     (all equal)
      Zip64TestSizes/1048576-48     20.1kB ± 0%    20.1kB ± 0%    ~     (p=0.775 n=24+25)
      Zip64TestSizes/67108864       20.0kB ± 0%    20.0kB ± 0%    ~     (all equal)
      Zip64TestSizes/67108864-6     20.0kB ± 0%    20.0kB ± 0%    ~     (p=0.272 n=16+17)
      Zip64TestSizes/67108864-48    20.1kB ± 0%    20.1kB ± 0%    ~     (p=0.098 n=14+15)
      
      name                        old allocs/op  new allocs/op  delta
      CompressedZipGarbage            44.0 ± 0%      44.0 ± 0%    ~     (all equal)
      CompressedZipGarbage-6          44.0 ± 0%      44.0 ± 0%    ~     (all equal)
      CompressedZipGarbage-48         44.0 ± 0%      44.0 ± 0%    ~     (all equal)
      Zip64Test                       53.0 ± 0%      53.0 ± 0%    ~     (all equal)
      Zip64Test-6                     53.0 ± 0%      53.0 ± 0%    ~     (all equal)
      Zip64Test-48                    53.0 ± 0%      53.0 ± 0%    ~     (all equal)
      Zip64TestSizes/4096             53.0 ± 0%      53.0 ± 0%    ~     (all equal)
      Zip64TestSizes/4096-6           53.0 ± 0%      53.0 ± 0%    ~     (all equal)
      Zip64TestSizes/4096-48          53.0 ± 0%      53.0 ± 0%    ~     (all equal)
      Zip64TestSizes/1048576          53.0 ± 0%      53.0 ± 0%    ~     (all equal)
      Zip64TestSizes/1048576-6        53.0 ± 0%      53.0 ± 0%    ~     (all equal)
      Zip64TestSizes/1048576-48       53.0 ± 0%      53.0 ± 0%    ~     (all equal)
      Zip64TestSizes/67108864         53.0 ± 0%      53.0 ± 0%    ~     (all equal)
      Zip64TestSizes/67108864-6       53.0 ± 0%      53.0 ± 0%    ~     (all equal)
      Zip64TestSizes/67108864-48      53.0 ± 0%      53.0 ± 0%    ~     (all equal)
      
      https://perf.golang.org/search?q=upload:20170428.4
      
      Change-Id: Idb7bec091a210aba833066f8d083d66e27788286
      Reviewed-on: https://go-review.googlesource.com/42113
      Run-TryBot: Bryan Mills <bcmills@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      34fd5db1
    • Josh Bleecher Snyder's avatar
      cmd/compile: move writebarrier pass after dse · e5c9358f
      Josh Bleecher Snyder authored
      This avoids generating writeBarrier.enabled
      blocks for dead stores.
      
      Change-Id: Ib11d8e2ba952f3f1f01d16776e40a7200a7683cf
      Reviewed-on: https://go-review.googlesource.com/42012
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      e5c9358f
    • Emmanuel Odeke's avatar
      net/http: enable TestRequestDoesntBodyCloseDoesntBlock · cf1b323f
      Emmanuel Odeke authored
      Fixes #7121.
      
      CL 31173 inadvertently fixed this issue in the Go1.8 cycle.
      This CL enables the test for that issue.
      
      Change-Id: I8e73b41f646fa89c75bff833c1b07e1cdb2b1e62
      Reviewed-on: https://go-review.googlesource.com/42149Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      cf1b323f
    • Austin Clements's avatar
      runtime: reduce Windows timer resolution when idle · 11eaf428
      Austin Clements authored
      Currently Go sets the system-wide timer resolution to 1ms the whole
      time it's running. This has negative affects on system performance and
      power consumption. Unfortunately, simply reducing the timer resolution
      to the default 15ms interferes with several sleeps in the runtime
      itself, including sysmon's ability to interrupt goroutines.
      
      This commit takes a hybrid approach: it only reduces the timer
      resolution when the Go process is entirely idle. When the process is
      idle, nothing needs a high resolution timer. When the process is
      non-idle, it's already consuming CPU so it doesn't really matter if
      the OS also takes timer interrupts more frequently.
      
      Updates #8687.
      
      Change-Id: I0652564b4a36d61a80e045040094a39c19da3b06
      Reviewed-on: https://go-review.googlesource.com/38403
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      11eaf428
    • Hiroshi Ioka's avatar
      mime: re-accept empty encoded-text · b225396f
      Hiroshi Ioka authored
      https://go-review.googlesource.com/37812 prohibits empty encoded-text.
      This CL accepts it again for backward compatibility.
      
      Change-Id: I0e0840b501927f147160b999bb59d2d029ea314c
      Reviewed-on: https://go-review.googlesource.com/40051
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      b225396f
    • Ben Shi's avatar
      cmd/compile/internal/ssa: more constant folding rules for ARM · 38fbada5
      Ben Shi authored
      (ADDconst [c] x) && !isARMImmRot(uint32(c)) && isARMImmRot(uint32(-c)) -> (SUBconst [int64(int32(-c))] x)
      (SUBconst [c] x) && !isARMImmRot(uint32(c)) && isARMImmRot(uint32(-c)) -> (ADDconst [int64(int32(-c))] x)
      Currently
      a = a + 0xfffffff1 is compiled to (variable a is in R0)
      MVN $14, R11
      ADD R11, R0, R0
      After applying the above 2 rules, it becomes
      SUB $15, R0, R0
      
      (BICconst [c] (BICconst [d] x)) -> (BICconst [int64(int32(c|d))] x)
      This rule also optimizes the generated ARM code.
      
      The other rules are added to avoid to generate less optimized ARM code
      when substitutions ADD->SUB happen.
      
      Change-Id: I3ead9aae2b446b674e2ab42d37259d38ceb93a4d
      Reviewed-on: https://go-review.googlesource.com/41679Reviewed-by: default avatarKeith Randall <khr@golang.org>
      38fbada5
  5. 28 Apr, 2017 6 commits
    • Josh Bleecher Snyder's avatar
      cmd/compile: checkwidthj all expressions in walk · c4335f81
      Josh Bleecher Snyder authored
      Instead of playing whack-a-mole finding all
      the non-dowidth'd expressions that can sneak
      out of the frontend and then deciding on
      just the right place to handle them,
      use a big hammer.
      
      Fixes #20152
      
      Change-Id: Id452d9e8c4e9585216bd8bf0e0004c85aba4f9f7
      Reviewed-on: https://go-review.googlesource.com/42021
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c4335f81
    • Austin Clements's avatar
      runtime/pprof: use symbol information already in profile in tests · c1ac70ff
      Austin Clements authored
      Currently the pprof tests re-symbolize PCs in profiles, and do so in a
      way that can't handle inlining. Proto profiles already contain full
      symbol information, so this modifies the tests to use the symbol
      information already present in the profile.
      
      Change-Id: I63cd491de7197080fd158b1e4f782630f1bbbb56
      Reviewed-on: https://go-review.googlesource.com/41255
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMichael Matloob <matloob@golang.org>
      c1ac70ff
    • Daniel Theophanes's avatar
      database/sql: ensure releaseConn is defined before a possible close · 2133d63f
      Daniel Theophanes authored
      When running a Query on Stmt a dependency is added to the stmt and
      rows. To do that it needs a reference to Rows, so the releaseConn
      function is defined after the definition. However the
      rows.initContextClose was set to run before the releaseConn was
      set on rows, setting up a situation where the connection could
      be canceled before the releaseConn was set and resulting in
      a segfault.
      
      Fixes #20160
      
      Change-Id: I5592e7db2cf653dfc48d42cbc2b03ca20501b1a0
      Reviewed-on: https://go-review.googlesource.com/42139
      Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      2133d63f
    • Austin Clements's avatar
      runtime: make _TinySizeClass an int8 to prevent use as spanClass · 295d160e
      Austin Clements authored
      Currently _TinySizeClass is untyped, which means it can accidentally
      be used as a spanClass (not that I would know this from experience or
      anything). Make it an int8 to avoid this mix up.
      
      This is a cherry-pick of dev.garbage commit 81b74bf9c5.
      
      Change-Id: I1e69eccee436ea5aa45e9a9828a013e369e03f1a
      Reviewed-on: https://go-review.googlesource.com/41254
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      295d160e
    • Austin Clements's avatar
      runtime: eliminate heapBitsSetTypeNoScan · 8e25d4cc
      Austin Clements authored
      It's no longer necessary to maintain the bitmap of noscan objects
      since we now use the span metadata to determine that they're noscan
      instead of the bitmap.
      
      The combined effect of segregating noscan spans and the follow-on
      optimizations is roughly a 1% improvement in performance across the
      go1 benchmarks and the x/benchmarks, with no increase in heap size.
      
      Benchmark details: https://perf.golang.org/search?q=upload:20170420.1
      
      name                       old time/op    new time/op    delta
      Garbage/benchmem-MB=64-12    2.27ms ± 0%    2.25ms ± 1%  -0.96% (p=0.000 n=15+18)
      
      name                      old time/op    new time/op    delta
      BinaryTree17-12              2.53s ± 2%     2.55s ± 1%  +0.68%        (p=0.001 n=17+16)
      Fannkuch11-12                3.02s ± 0%     3.01s ± 0%  -0.15%        (p=0.000 n=16+16)
      FmtFprintfEmpty-12          47.1ns ± 7%    47.0ns ± 5%    ~           (p=0.886 n=20+17)
      FmtFprintfString-12         73.6ns ± 3%    73.8ns ± 1%  +0.30%        (p=0.026 n=19+17)
      FmtFprintfInt-12            80.3ns ± 2%    80.2ns ± 1%    ~           (p=0.994 n=20+18)
      FmtFprintfIntInt-12          124ns ± 0%     124ns ± 0%    ~     (all samples are equal)
      FmtFprintfPrefixedInt-12     172ns ± 1%     171ns ± 1%  -0.72%        (p=0.003 n=20+18)
      FmtFprintfFloat-12           217ns ± 1%     216ns ± 1%  -0.27%        (p=0.019 n=18+19)
      FmtManyArgs-12               490ns ± 1%     488ns ± 0%  -0.36%        (p=0.014 n=18+18)
      GobDecode-12                6.71ms ± 1%    6.73ms ± 1%  +0.42%        (p=0.000 n=20+20)
      GobEncode-12                5.25ms ± 0%    5.24ms ± 0%  -0.20%        (p=0.001 n=18+20)
      Gzip-12                      227ms ± 0%     226ms ± 1%    ~           (p=0.107 n=20+19)
      Gunzip-12                   38.8ms ± 0%    38.8ms ± 0%    ~           (p=0.221 n=19+18)
      HTTPClientServer-12         75.4µs ± 1%    76.3µs ± 1%  +1.26%        (p=0.000 n=20+19)
      JSONEncode-12               14.7ms ± 0%    14.7ms ± 1%  -0.14%        (p=0.002 n=18+17)
      JSONDecode-12               57.6ms ± 0%    55.2ms ± 0%  -4.13%        (p=0.000 n=19+19)
      Mandelbrot200-12            3.73ms ± 0%    3.73ms ± 0%  -0.09%        (p=0.000 n=19+17)
      GoParse-12                  3.18ms ± 1%    3.15ms ± 1%  -0.90%        (p=0.000 n=18+20)
      RegexpMatchEasy0_32-12      73.3ns ± 2%    73.2ns ± 1%    ~           (p=0.994 n=20+18)
      RegexpMatchEasy0_1K-12       236ns ± 2%     234ns ± 1%  -0.70%        (p=0.002 n=19+17)
      RegexpMatchEasy1_32-12      69.7ns ± 2%    69.9ns ± 2%    ~           (p=0.416 n=20+20)
      RegexpMatchEasy1_1K-12       366ns ± 1%     365ns ± 1%    ~           (p=0.376 n=19+17)
      RegexpMatchMedium_32-12      109ns ± 1%     108ns ± 1%    ~           (p=0.461 n=17+18)
      RegexpMatchMedium_1K-12     35.2µs ± 1%    35.2µs ± 3%    ~           (p=0.238 n=19+20)
      RegexpMatchHard_32-12       1.77µs ± 1%    1.77µs ± 1%  +0.33%        (p=0.007 n=17+16)
      RegexpMatchHard_1K-12       53.2µs ± 0%    53.3µs ± 0%  +0.26%        (p=0.001 n=17+17)
      Revcomp-12                  1.13s ±117%    0.87s ±184%    ~           (p=0.813 n=20+19)
      Template-12                 63.9ms ± 1%    64.6ms ± 1%  +1.18%        (p=0.000 n=19+20)
      TimeParse-12                 313ns ± 5%     312ns ± 0%    ~           (p=0.114 n=20+19)
      TimeFormat-12                336ns ± 0%     333ns ± 0%  -0.97%        (p=0.000 n=18+16)
      [Geo mean]                  50.6µs         50.1µs       -1.04%
      
      This is a cherry-pick of dev.garbage commit edb54c300f, with updated
      benchmark results.
      
      Change-Id: Ic77faaa15cdac3bfbbb0032dde5c204e05a0fd8e
      Reviewed-on: https://go-review.googlesource.com/41253
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      8e25d4cc
    • Austin Clements's avatar
      runtime: eliminate heapBits.hasPointers · c44d031b
      Austin Clements authored
      This is no longer necessary now that we can more efficiently consult
      the span's noscan bit.
      
      This is a cherry-pick of dev.garbage commit 312aa09996.
      
      Change-Id: Id0b00b278533660973f45eb6efa5b00f373d58af
      Reviewed-on: https://go-review.googlesource.com/41252
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      c44d031b