1. 23 Sep, 2016 3 commits
  2. 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: 's 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: 's 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: 's 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: 's 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: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: 's 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: 's 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: 's avatarKeith Randall <khr@golang.org>
      Reviewed-by: 's 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: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      dcbbd319
    • Nigel Tao's avatar
  3. 21 Sep, 2016 16 commits
  4. 20 Sep, 2016 12 commits