1. 24 Sep, 2016 4 commits
  2. 23 Sep, 2016 7 commits
  3. 22 Sep, 2016 9 commits
    • Ian Lance Taylor's avatar
      cmd/compile: don't instrument copy and append in runtime · 9d8522fd
      Ian Lance Taylor authored
      Instrumenting copy and append for the race detector changes them to call
      different functions. In the runtime package the alternate functions are
      not marked as nosplit. This caused a crash in the SIGPROF handler when
      invoked on a non-Go thread in a program built with the race detector. In
      some cases the handler can call copy, the race detector changed that to
      a call to a non-nosplit function, the function tried to check the stack
      guard, and crashed because it was running on a non-Go thread. The
      SIGPROF handler is written carefully to avoid such problems, but hidden
      function calls are difficult to avoid.
      
      Fix this by changing the compiler to not instrument copy and append when
      compiling the runtime package. Change the runtime package to add
      explicit race checks for the only code I could find where copy is used
      to write to user data (append is never used).
      
      Change-Id: I11078a66c0aaa459a7d2b827b49f4147922050af
      Reviewed-on: https://go-review.googlesource.com/29472
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      9d8522fd
    • Keith Randall's avatar
      cmd/compile: fix type of static closure pointer · 88d2f911
      Keith Randall authored
        var x *X = ...
        defer x.foo()
      
      As part of the defer, we need to calculate &(*X).foo·f.  This expression
      is the address of the static closure that will call (*X).foo when a
      pointer to that closure is used in a call/defer/go.  This pointer is not
      currently properly typed in SSA.  It is a pointer type, but the base
      type is nil, not a proper type.
      
      This turns out not to be a problem currently because we never use the
      type of these SSA values.  But I'm trying to change that (to be able to
      spill them) in CL 28391.  To fix, use uint8 as the fake type of the
      closure.
      
      Change-Id: Ieee388089c9af398ed772ee8c815122c347cb633
      Reviewed-on: https://go-review.googlesource.com/29444
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      88d2f911
    • Cherry Zhang's avatar
      test: errorcheck auto-generated functions · d586aae1
      Cherry Zhang authored
      Add an "errorcheckwithauto" action which performs error check
      including lines with auto-generated functions (excluded by
      default). Comment "// ERRORAUTO" matches these lines.
      
      Add testcase for CL 29570 (as an example).
      
      Updates #16016, #17186.
      
      Change-Id: Iaba3727336cd602f3dda6b9e5f97dafe0848e632
      Reviewed-on: https://go-review.googlesource.com/29652
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      d586aae1
    • Cherry Zhang's avatar
      cmd/compile: ensure args are live in tail calls for LR machines · 3dfb92f2
      Cherry Zhang authored
      On link-register machines we uses RET (sym), instead of JMP (sym),
      for tail call (so the assembler knows and may rewrite it to
      restore link register if necessary). Add RET to the analysis.
      
      Fixes #17186.
      Fixes #16016 on link-register machines.
      
      Change-Id: I8690ac57dd9d49beeea76a5f291988e9a1d3afe5
      Reviewed-on: https://go-review.googlesource.com/29570
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      3dfb92f2
    • Adam Langley's avatar
      crypto/tls: fix deadlock when racing to complete handshake. · 254169d7
      Adam Langley authored
      After renegotiation support was added (af125a51) it's possible for a
      Write to block on a Read when racing to complete the handshake:
         1. The Write determines that a handshake is needed and tries to
            take the neccesary locks in the correct order.
         2. The Read also determines that a handshake is needed and wins
            the race to take the locks.
         3. The Read goroutine completes the handshake and wins a race
            to unlock and relock c.in, which it'll hold when waiting for
            more network data.
      
      If the application-level protocol requires the Write to complete before
      data can be read then the system as a whole will deadlock.
      
      Unfortunately it doesn't appear possible to reverse the locking order of
      c.in and handshakeMutex because we might read a renegotiation request at
      any point and need to be able to do a handshake without unlocking.
      
      So this change adds a sync.Cond that indicates that a goroutine has
      committed to doing a handshake. Other interested goroutines can wait on
      that Cond when needed.
      
      The test for this isn't great. I was able to reproduce the deadlock with
      it only when building with -race. (Because -race happened to alter the
      timing just enough.)
      
      Fixes #17101.
      
      Change-Id: I4e8757f7b82a84e46c9963a977d089f0fb675495
      Reviewed-on: https://go-review.googlesource.com/29164Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      254169d7
    • Kale Blankenship's avatar
      net/url: prefix relative paths containing ":" in the first segment with "./" · ad5d91c1
      Kale Blankenship authored
      This change modifies URL.String to prepend "./" to a relative URL which
      contains a colon in the first path segment.
      
      Per RFC 3986 §4.2:
      
      > A path segment that contains a colon character (e.g., "this:that")
      > cannot be used as the first segment of a relative-path reference, as
      > it would be mistaken for a scheme name.  Such a segment must be
      > preceded by a dot-segment (e.g., "./this:that") to make a relative-
      > path reference.
      
      https://go-review.googlesource.com/27440 corrects the behavior for http.FileServer,
      but URL.String will still return an invalid URL. This CL reverts the changes to
      http.FileServer as they are unnecessary with this fix.
      
      Fixes #17184
      
      Change-Id: I9211ae20f82c91b785d1b079b2cd766487d94225
      Reviewed-on: https://go-review.googlesource.com/29610Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ad5d91c1
    • David Chase's avatar
      cmd/compile: use ISEL, cleanup use of zero & extensions · cddddbc6
      David Chase authored
      Abandoned earlier efforts to expose zero register,
      but left it in numbering to decrease squirrelyness of
      register allocator.
      
      ISELrelOp used in code generation of bool := x relOp y.
      Some patterns added to better elide zero case and
      some sign extension.
      
      Updates: #17109
      
      Change-Id: Ida7839f0023ca8f0ffddc0545f0ac269e65b05d9
      Reviewed-on: https://go-review.googlesource.com/29380
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      cddddbc6
    • Emmanuel Odeke's avatar
      compress/gzip: add examples · dcbbd319
      Emmanuel Odeke authored
      Updates #16360.
      
      Adds examples uing:
      + Writer, Reader
      + Reader.Multistream to concatenate and then
      individually retrieve multiple gzipped files
      + Reset
      
      Change-Id: I9ad9b92729a5cd58f7368eaf2db05f1cdf21063d
      Reviewed-on: https://go-review.googlesource.com/29218Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarJoe Tsai <thebrokentoaster@gmail.com>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      dcbbd319
    • Nigel Tao's avatar
  4. 21 Sep, 2016 16 commits
  5. 20 Sep, 2016 4 commits
    • Brad Fitzpatrick's avatar
      doc: add some missing HTML tags in the FAQ · e7191479
      Brad Fitzpatrick authored
      Fixes #17170
      
      Change-Id: I939f087df133710495fdf6f09040051cb9b176d7
      Reviewed-on: https://go-review.googlesource.com/29442Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      e7191479
    • Keith Randall's avatar
      cmd/compile: improve tighten pass · dd24b109
      Keith Randall authored
      Move a value to the block which is the lowest common ancestor in the
      dominator tree of all of its uses.  Make sure not to move a value into a
      loop.
      
      Makes the tighten pass on average (across go1 benchmarks) 40% slower.
      Still not a big contributor to overall compile time.
      
      Binary size is just a tad smaller.
      
      name                      old time/op    new time/op    delta
      BinaryTree17-12              2.77s ± 9%     2.76s ± 9%     ~     (p=0.878 n=8+8)
      Fannkuch11-12                2.75s ± 1%     2.74s ± 1%     ~     (p=0.232 n=8+7)
      FmtFprintfEmpty-12          48.9ns ± 9%    47.7ns ± 0%     ~     (p=0.431 n=8+8)
      FmtFprintfString-12          143ns ± 8%     142ns ± 1%     ~     (p=0.257 n=8+7)
      FmtFprintfInt-12             123ns ± 1%     122ns ± 1%   -1.04%  (p=0.026 n=7+8)
      FmtFprintfIntInt-12          195ns ± 7%     185ns ± 0%   -5.32%  (p=0.000 n=8+8)
      FmtFprintfPrefixedInt-12     194ns ± 4%     195ns ± 0%   +0.81%  (p=0.015 n=7+7)
      FmtFprintfFloat-12           267ns ± 0%     268ns ± 0%   +0.37%  (p=0.001 n=7+6)
      FmtManyArgs-12               800ns ± 0%     762ns ± 1%   -4.78%  (p=0.000 n=8+8)
      GobDecode-12                7.67ms ± 2%    7.60ms ± 2%     ~     (p=0.234 n=8+8)
      GobEncode-12                6.55ms ± 0%    6.57ms ± 1%     ~     (p=0.336 n=7+8)
      Gzip-12                      237ms ± 0%     238ms ± 0%   +0.40%  (p=0.017 n=7+7)
      Gunzip-12                   40.8ms ± 0%    40.2ms ± 0%   -1.52%  (p=0.000 n=7+8)
      HTTPClientServer-12          208µs ± 3%     209µs ± 3%     ~     (p=0.955 n=8+7)
      JSONEncode-12               16.2ms ± 1%    17.2ms ±11%   +5.80%  (p=0.001 n=7+8)
      JSONDecode-12               57.3ms ±12%    55.5ms ± 3%     ~     (p=0.867 n=8+7)
      Mandelbrot200-12            4.68ms ± 6%    4.46ms ± 1%     ~     (p=0.442 n=8+8)
      GoParse-12                  4.27ms ±44%    3.42ms ± 1%  -19.95%  (p=0.005 n=8+8)
      RegexpMatchEasy0_32-12      75.1ns ± 0%    75.8ns ± 1%   +0.99%  (p=0.002 n=7+7)
      RegexpMatchEasy0_1K-12       963ns ± 0%    1021ns ± 6%   +5.98%  (p=0.001 n=7+7)
      RegexpMatchEasy1_32-12      72.4ns ±11%    70.8ns ± 1%     ~     (p=0.368 n=8+8)
      RegexpMatchEasy1_1K-12       394ns ± 1%     399ns ± 0%   +1.23%  (p=0.000 n=8+7)
      RegexpMatchMedium_32-12      114ns ± 0%     115ns ± 1%   +0.63%  (p=0.021 n=7+7)
      RegexpMatchMedium_1K-12     35.9µs ± 0%    37.6µs ± 1%   +4.72%  (p=0.000 n=7+8)
      RegexpMatchHard_32-12       1.93µs ± 2%    1.91µs ± 0%   -0.91%  (p=0.001 n=7+7)
      RegexpMatchHard_1K-12       60.2µs ± 3%    61.2µs ±10%     ~     (p=0.442 n=8+8)
      Revcomp-12                   404ms ± 1%     406ms ± 1%     ~     (p=0.054 n=8+7)
      Template-12                 64.6ms ± 1%    63.5ms ± 1%   -1.66%  (p=0.000 n=8+8)
      TimeParse-12                 347ns ± 8%     309ns ± 0%  -11.13%  (p=0.000 n=8+7)
      TimeFormat-12                343ns ± 4%     331ns ± 0%   -3.34%  (p=0.000 n=8+7)
      
      Change-Id: Id6da1239ddd4d0cb074ff29cffb06302d1c6d08f
      Reviewed-on: https://go-review.googlesource.com/28712
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      dd24b109
    • Keith Randall's avatar
      cmd/compile: simple cleanups · b7426089
      Keith Randall authored
      Change-Id: If2cf3c5a29afc6cf74c3b08b9745e950231ead37
      Reviewed-on: https://go-review.googlesource.com/29441Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      b7426089
    • Damien Neil's avatar
      syscall: validate ParseDirent inputs · f5f7d6e3
      Damien Neil authored
      Don't panic, crash, or return references to uninitialized memory when
      ParseDirent is passed invalid input.
      
      Move common dirent parsing to syscall.go with minimal platform-specific
      functions in syscall_$GOOS.go.
      
      Fixes #15653
      
      Change-Id: I5602475e02321fe381064488401c14b33bec6886
      Reviewed-on: https://go-review.googlesource.com/23780
      Run-TryBot: Damien Neil <dneil@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      f5f7d6e3