1. 17 Oct, 2017 9 commits
    • Ben Shi's avatar
      cmd/internal/obj/arm: better solution of .S/.P/.U/.W suffix check · 47193dcc
      Ben Shi authored
      Current suffix check is based on instruction, which is not very
      accurate. For example, "MOVW.S R1, R2" is valid, but
      "MOVW.S $0xaaaaaaaa, R1" and "MOVW.P CPSR, R9" are not.
      
      This patch fixes the above kinds of issues by checking suffix
      based on []optab. And also more test cases are added.
      
      fixes #20509
      
      Change-Id: Ibad91be72c78eefa719412a83b4d44370d2202a8
      Reviewed-on: https://go-review.googlesource.com/70910
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      47193dcc
    • David du Colombier's avatar
      runtime: don't terminate locked OS threads on Plan 9 · f4faca60
      David du Colombier authored
      CL 46037 and CL 46038 implemented termination of
      locked OS threads when the goroutine exits.
      
      However, this behavior leads to crashes of Go programs
      using runtime.LockOSThread on Plan 9. This is notably
      the case of the os/exec and net packages.
      
      This change disables termination of locked OS threads
      on Plan 9.
      
      Updates #22227.
      
      Change-Id: If9fa241bff1c0b68e7e9e321e06e5203b3923212
      Reviewed-on: https://go-review.googlesource.com/71230Reviewed-by: 's avatarAustin Clements <austin@google.com>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      f4faca60
    • David du Colombier's avatar
      runtime: disable use of template thread on Plan 9 · d155b32f
      David du Colombier authored
      CL 46033 added a "template thread" mechanism to
      allow creation of thread with a known-good state
      from a thread of unknown state.
      
      However, we are experiencing issues on Plan 9
      with programs using the os/exec and net package.
      These package are relying on runtime.LockOSThread.
      
      Updates #22227.
      
      Change-Id: I85b71580a41df9fe8b24bd8623c064b6773288b0
      Reviewed-on: https://go-review.googlesource.com/70231
      Run-TryBot: David du Colombier <0intro@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      d155b32f
    • Wei Xiao's avatar
      reflect: optimize CALLFN wrapper for arm64 · 18508740
      Wei Xiao authored
      Optimize arm64 CALLFN wrapper with LDP/STP instructions.
      This provides a significant speedup for big argument copy.
      Benchmark results for reflect:
      
      name                      old time/op    new time/op     delta
      Call-8                      79.0ns ± 4%     73.6ns ± 4%    -6.78%  (p=0.000 n=10+10)
      CallArgCopy/size=128-8      80.5ns ± 0%     60.3ns ± 0%   -25.06%  (p=0.000 n=10+9)
      CallArgCopy/size=256-8       119ns ± 2%       67ns ± 1%   -43.59%  (p=0.000 n=8+10)
      CallArgCopy/size=1024-8      524ns ± 1%       99ns ± 1%   -81.03%  (p=0.000 n=10+10)
      CallArgCopy/size=4096-8      837ns ± 0%      231ns ± 1%   -72.42%  (p=0.000 n=9+9)
      CallArgCopy/size=65536-8    13.6µs ± 6%      3.1µs ± 1%   -77.38%  (p=0.000 n=10+10)
      PtrTo-8                     12.9ns ± 0%     13.1ns ± 3%    +1.86%  (p=0.000 n=10+10)
      FieldByName1-8              28.7ns ± 2%     28.6ns ± 2%      ~     (p=0.408 n=9+10)
      FieldByName2-8               928ns ± 4%      946ns ± 8%      ~     (p=0.326 n=9+10)
      FieldByName3-8              5.35µs ± 5%     5.32µs ± 5%      ~     (p=0.755 n=10+10)
      InterfaceBig-8              2.57ns ± 0%     2.57ns ± 0%      ~     (all equal)
      InterfaceSmall-8            2.57ns ± 0%     2.57ns ± 0%      ~     (all equal)
      New-8                       9.09ns ± 1%     8.83ns ± 1%    -2.81%  (p=0.000 n=10+9)
      
      name                      old alloc/op   new alloc/op    delta
      Call-8                       0.00B           0.00B           ~     (all equal)
      
      name                      old allocs/op  new allocs/op   delta
      Call-8                        0.00            0.00           ~     (all equal)
      
      name                      old speed      new speed       delta
      CallArgCopy/size=128-8    1.59GB/s ± 0%   2.12GB/s ± 1%   +33.46%  (p=0.000 n=10+9)
      CallArgCopy/size=256-8    2.14GB/s ± 2%   3.81GB/s ± 1%   +78.02%  (p=0.000 n=8+10)
      CallArgCopy/size=1024-8   1.95GB/s ± 1%  10.30GB/s ± 0%  +427.99%  (p=0.000 n=10+9)
      CallArgCopy/size=4096-8   4.89GB/s ± 0%  17.69GB/s ± 1%  +261.87%  (p=0.000 n=9+9)
      CallArgCopy/size=65536-8  4.84GB/s ± 6%  21.36GB/s ± 1%  +341.67%  (p=0.000 n=10+10)
      
      Change-Id: I775d88b30c43cb2eda1d0612ac15e6d283e70beb
      Reviewed-on: https://go-review.googlesource.com/70570Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      18508740
    • Ian Lance Taylor's avatar
      runtime: unify 386 entry point code · 378de1ae
      Ian Lance Taylor authored
      Unify the 386 entry point code as much as possible.
      
      The main function could not be unified because on Windows 386 it is
      called _main. Putting main in asm_386.s caused multiple definition
      errors when using the external linker.
      
      Add the _lib entry point to various operating systems.  A future CL
      will enable c-archive/c-shared mode for those targets.
      
      Fix _rt0_386_windows_lib_go--it was passing arguments as though it
      were amd64.
      
      Change-Id: Ic73f1c95cdbcbea87f633f4a29bbc218a5db4f58
      Reviewed-on: https://go-review.googlesource.com/70530
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      378de1ae
    • Ian Lance Taylor's avatar
      debug/dwarf: support 64-bit DWARF in byte order check · 151c66b5
      Ian Lance Taylor authored
      Also fix 64-bit DWARF to read a 64-bit abbrev offset in the
      compilation unit.
      
      Change-Id: Idc22e59ffb354d58e9973b62fdbd342acf695859
      Reviewed-on: https://go-review.googlesource.com/71171Reviewed-by: 's avatarAustin Clements <austin@google.com>
      151c66b5
    • griesemer's avatar
      cmd/compile/internal/parser: removed TODO (cleanup) · 4fe43f81
      griesemer authored
      - checking for the correct closing token leads to slightly better
        behavior for some randomly bogus programs
      - removed `switch` in favor of an `if` statement
      
      Follow-up on https://go-review.googlesource.com/c/go/+/71250.
      
      Change-Id: I47f6c47b43baf790907f55ed97a947661687a9db
      Reviewed-on: https://go-review.googlesource.com/71252Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      4fe43f81
    • Tim Cooper's avatar
      text/template: add break, continue actions in ranges · 3be5d551
      Tim Cooper authored
      Adds the two range control actions "break" and "continue". They act the
      same as the Go keywords break and continue, but are simplified in that
      only the innermost range statement can be broken out of or continued.
      
      Fixes #20531
      
      Change-Id: I4412b3bbfd4dadb0ab74ae718e308c1ac7a0a1e9
      Reviewed-on: https://go-review.googlesource.com/66410Reviewed-by: 's avatarRob Pike <r@golang.org>
      3be5d551
    • griesemer's avatar
      cmd/compile/internal/syntax: better recovery after missing closing parentheses · 0b2cb891
      griesemer authored
      Fine-tune skipping of tokens after missing closing parentheses in lists.
      
      Fixes #22164.
      
      Change-Id: I575d86e21048cd40340a2c08399e8b0deec337cf
      Reviewed-on: https://go-review.googlesource.com/71250
      Run-TryBot: Robert Griesemer <gri@golang.org>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      0b2cb891
  2. 16 Oct, 2017 18 commits
  3. 15 Oct, 2017 3 commits
  4. 14 Oct, 2017 3 commits
    • Jed Denlea's avatar
      image/gif: write fewer, bigger blocks · 8b220d8e
      Jed Denlea authored
      The indexed bitmap of a frame is encoded into a GIF by first LZW
      compression, and then packaged by a simple block mechanism.  Each block
      of up-to-256 bytes starts with one byte, which indicates the size of the
      block (0x01-0xff). The sequence of blocks is terminated by a 0x00.
      
      While the format supports it, there is no good reason why any particular
      image should be anything but a sequence of 255-byte blocks with one last
      block less than 255-bytes.
      
      The old blockWriter implementation would not buffer between Write()s,
      meaning if the lzw Writer needs to flush more than one chunk of data via
      a Write, multiple short blocks might exist in the middle of a stream.
      
      Separate but related, the old implementation also forces lzw.NewWriter
      to allocate a bufio.Writer because the blockWriter is not an
      io.ByteWriter itself.  But, even though it doesn't effectively buffer
      data between Writes, it does make extra copies of sub-blocks during the
      course of writing them to the GIF's writer.
      
      Now, the blockWriter shall continue to use the encoder's [256]byte buf,
      but use it to effectively buffer a series of WriteByte calls from the
      lzw Writer.  Once a WriteByte fills the buffer, the staged block is
      Write()n to the underlying GIF writer.  After the lzw Writer is Closed,
      the blockWriter should also be closed, which will flush any remaining
      block along with the block terminator.
      
      BenchmarkEncode indicates slight improvements:
      
      name      old time/op    new time/op    delta
      Encode-8    7.71ms ± 0%    7.38ms ± 0%   -4.27%  (p=0.008 n=5+5)
      
      name      old speed      new speed      delta
      Encode-8   159MB/s ± 0%   167MB/s ± 0%   +4.46%  (p=0.008 n=5+5)
      
      name      old alloc/op   new alloc/op   delta
      Encode-8    84.1kB ± 0%    80.0kB ± 0%   -4.94%  (p=0.008 n=5+5)
      
      name      old allocs/op  new allocs/op  delta
      Encode-8      9.00 ± 0%      7.00 ± 0%  -22.22%  (p=0.008 n=5+5)
      
      Change-Id: I9eb9367d41d7c3d4d7f0adc9b720fc24fb50006a
      Reviewed-on: https://go-review.googlesource.com/68351Reviewed-by: 's avatarNigel Tao <nigeltao@golang.org>
      8b220d8e
    • Matthew Dempsky's avatar
      cmd/compile: omit ICE diagnostics after normal error messages · f3d4ff7d
      Matthew Dempsky authored
      After we detect errors, the AST is in a precarious state and more
      likely to trip useless ICE failures. Instead let the user fix any
      existing errors and see if the ICE persists.  This makes Fatalf more
      consistent with how panics are handled by hidePanic.
      
      While here, also fix detection for release versions: release version
      strings begin with "go" ("go1.8", "go1.9.1", etc), not "release".
      
      Fixes #22252.
      
      Change-Id: I1c400af62fb49dd979b96e1bf0fb295a81c8b336
      Reviewed-on: https://go-review.googlesource.com/70850
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      f3d4ff7d
    • Cherry Zhang's avatar
      cmd/compile: mark LoweredGetCallerPC rematerializeable · e01eac37
      Cherry Zhang authored
      The caller's PC is always available in the frame. We can just
      load it when needed, no need to spill.
      
      Change-Id: I9c0a525903e574bb4eec9fe53cbeb8c64321166a
      Reviewed-on: https://go-review.googlesource.com/70710
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDavid Chase <drchase@google.com>
      e01eac37
  5. 13 Oct, 2017 7 commits
    • Peter Wu's avatar
      crypto/tls: replace signatureAndHash by SignatureScheme. · d1bbdbe7
      Peter Wu authored
      Consolidate the signature and hash fields (SignatureAndHashAlgorithm in
      TLS 1.2) into a single uint16 (SignatureScheme in TLS 1.3 draft 21).
      This makes it easier to add RSASSA-PSS for TLS 1.2 in the future.
      
      Fields were named like "signatureAlgorithm" rather than
      "signatureScheme" since that name is also used throughout the 1.3 draft.
      
      The only new public symbol is ECDSAWithSHA1, other than that this is an
      internal change with no new functionality.
      
      Change-Id: Iba63d262ab1af895420583ac9e302d9705a7e0f0
      Reviewed-on: https://go-review.googlesource.com/62210Reviewed-by: 's avatarAdam Langley <agl@golang.org>
      d1bbdbe7
    • David Crawshaw's avatar
      cmd/link: use the correct module data on ppc64le · c996d07f
      David Crawshaw authored
      Fixes #22250
      
      Change-Id: I0e39d10ff6f0785cd22b0105de2d839e569db4b7
      Reviewed-on: https://go-review.googlesource.com/70810
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c996d07f
    • Austin Clements's avatar
      runtime: schedule fractional workers on all Ps · e09dbaa1
      Austin Clements authored
      Currently only a single P can run a fractional mark worker at a time.
      This doesn't let us spread out the load, so it gets concentrated on
      whatever unlucky P picks up the token to run a fractional worker. This
      can significantly delay goroutines on that P.
      
      This commit changes this scheduling rule so each P separately
      schedules fractional workers. This can significantly reduce the load
      on any individual P and allows workers to self-preempt earlier. It
      does have the downside that it's possible for all Ps to be in
      fractional workers simultaneously (an effect STW).
      
      Updates #21698.
      
      Change-Id: Ia1e300c422043fa62bb4e3dd23c6232d81e4419c
      Reviewed-on: https://go-review.googlesource.com/68574
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      e09dbaa1
    • Austin Clements's avatar
      runtime: preempt fractional worker after reaching utilization goal · 28e1a8e4
      Austin Clements authored
      Currently fractional workers run until preempted by the scheduler,
      which means they typically run for 20ms. During this time, all other
      goroutines on that P are blocked, which can introduce significant
      latency variance.
      
      This modifies fractional workers to self-preempt shortly after
      achieving the fractional utilization goal. In practice this means they
      preempt much sooner, and the scale of their preemption is on the order
      of how often the user goroutine block (so, if the application is
      compute-bound, the fractional workers will also run for long times,
      but if the application blocks frequently, the fractional workers will
      also preempt quickly).
      
      Fixes #21698.
      Updates #18534.
      
      Change-Id: I03a5ab195dae93154a46c32083c4bb52415d2017
      Reviewed-on: https://go-review.googlesource.com/68573
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      28e1a8e4
    • Austin Clements's avatar
      runtime: simplify fractional mark worker scheduler · b783930e
      Austin Clements authored
      We haven't used non-zero gcForcePreemptNS for ages. Remove it and
      declutter the code.
      
      Change-Id: Id5cc62f526d21ca394d2b6ca17d34a72959535da
      Reviewed-on: https://go-review.googlesource.com/68572
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      b783930e
    • Austin Clements's avatar
      runtime: use only dedicated mark workers at reasonable GOMAXPROCS · 315c28b7
      Austin Clements authored
      When GOMAXPROCS is not small, fractional workers don't add much to
      throughput, but they do add to the latency of individual goroutines.
      In this case, it makes sense to just use dedicated workers, even if we
      can't exactly hit the 25% CPU goal with dedicated workers.
      
      This implements this logic by computing the number of dedicated mark
      workers that will us closest to the 25% target. We only fall back to
      fractional workers if that would be more than 30% off of the target
      (less than 17.5% or more than 32.5%, which in practice happens for
      GOMAXPROCS <= 3 and GOMAXPROCS == 6).
      
      Updates #21698.
      
      Change-Id: I484063adeeaa1190200e4ef210193a20e635d552
      Reviewed-on: https://go-review.googlesource.com/68571Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      315c28b7
    • Austin Clements's avatar
      runtime: separate GC background utilization from goal utilization · 27923482
      Austin Clements authored
      Currently these are the same constant, but are separate concepts.
      Split them into two constants for easier experimentation and better
      documentation.
      
      Change-Id: I121854d4fd1a4a827f727c8e5153160c24aacda7
      Reviewed-on: https://go-review.googlesource.com/68570
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      27923482