1. 26 Oct, 2016 18 commits
    • Austin Clements's avatar
      runtime: scan mark worker stacks like normal · d6625caf
      Austin Clements authored
      Currently, markroot delays scanning mark worker stacks until mark
      termination by putting the mark worker G directly on the rescan list
      when it encounters one during the mark phase. Without this, since mark
      workers are non-preemptible, two mark workers that attempt to scan
      each other's stacks can deadlock.
      
      However, this is annoyingly asymmetric and causes some real problems.
      First, markroot does not own the G at that point, so it's not
      technically safe to add it to the rescan list. I haven't been able to
      find a specific problem this could cause, but I suspect it's the root
      cause of issue #17099. Second, this will interfere with the hybrid
      barrier, since there is no stack rescanning during mark termination
      with the hybrid barrier.
      
      This commit switches to a different approach. We move the mark
      worker's call to gcDrain to the system stack and set the mark worker's
      status to _Gwaiting for the duration of the drain to indicate that
      it's preemptible. This lets another mark worker scan its G stack while
      the drain is running on the system stack. We don't return to the G
      stack until we can switch back to _Grunning, which ensures we don't
      race with a stack scan. This lets us eliminate the special case for
      mark worker stack scans and scan them just like any other goroutine.
      The only subtlety to this approach is that we have to disable stack
      shrinking for mark workers; they could be referring to captured
      variables from the G stack, so it's not safe to move their stacks.
      
      Updates #17099 and #17503.
      
      Change-Id: Ia5213949ec470af63e24dfce01df357c12adbbea
      Reviewed-on: https://go-review.googlesource.com/31820
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      d6625caf
    • David du Colombier's avatar
      net/rpc: enable TestGobError on Plan 9 · 8e4e103a
      David du Colombier authored
      This issue has been fixed in CL 31271.
      
      Fixes #8908.
      
      Change-Id: I8015490e2d992e09c664560e42188315e0e0669e
      Reviewed-on: https://go-review.googlesource.com/32150
      Run-TryBot: David du Colombier <0intro@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      8e4e103a
    • Austin Clements's avatar
      cmd/compile: remove unused writebarrierptr, typedmemmove Nodes · f46324cf
      Austin Clements authored
      Now that SSA's write barrier pass is generating calls to these,
      compile doesn't need to look them up.
      
      Change-Id: Ib50e5f2c67b247ca280d467c399e23877988bc12
      Reviewed-on: https://go-review.googlesource.com/32170
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      f46324cf
    • David du Colombier's avatar
      os: consider only files from #M as regular on Plan 9 · a0cf021b
      David du Colombier authored
      TestRemoveDevNull was added in CL 31657. However, this test
      was failing on Plan 9, because /dev/null was considered as
      a regular file.
      
      On Plan 9, there is no special mode to distinguish between
      device files and regular files.
      
      However, files are served by different servers. For example,
      /dev/null is served by #c (devcons), while /bin/cat is served
      by #M (devmnt).
      
      We chose to consider only the files served by #M as regular
      files. All files served by different servers will be considered
      as device files.
      
      Fixes #17598.
      
      Change-Id: Ibb1c3357d742cf2a7de15fc78c9e436dc31982bb
      Reviewed-on: https://go-review.googlesource.com/32152Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      Run-TryBot: David du Colombier <0intro@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      a0cf021b
    • Russ Cox's avatar
      flag: arrange for FlagSet.Usage to be non-nil by default · 49543695
      Russ Cox authored
      This allows callers to invoke f.Usage() themselves and get the default
      usage handler instead of a panic (from calling a nil function).
      
      Fixes #16955.
      
      Change-Id: Ie337fd9e1f85daf78c5eae7b5c41d5ad8c1f89bf
      Reviewed-on: https://go-review.googlesource.com/31576
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      49543695
    • Rob Pike's avatar
      all: freeze net/rpc and reword the 'frozen' message in other frozen packages · f9027d61
      Rob Pike authored
      Make the messages grammatically korrect and consistent.
      
      Fixes #16844
      
      Change-Id: I7c137b4dc25c0c875ed07b0c64c67ae984c39cbc
      Reviewed-on: https://go-review.googlesource.com/32112Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      f9027d61
    • Rob Pike's avatar
      doc/effectivego: reword confusing sentence · cec84f73
      Rob Pike authored
      For some reason git won't let me write
      
      	doc/effective_go.html: reword confusing sentence
      
      or even
      
      	doc/effective_go: reword confusing sentence
      
      as the subject line for this CL, but that's not important. The
      actual CL just rewrites one sentence and adds an option to grep in
      the associated example.
      
      Fixes #15875
      
      Change-Id: Iee159ea751caf4b73eacf3dfc86e29032646373f
      Reviewed-on: https://go-review.googlesource.com/32110Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      cec84f73
    • Austin Clements's avatar
      runtime: fix bad pointer with 0 stack barriers · 3193c71c
      Austin Clements authored
      Currently, if the number of stack barriers for a stack is 0, we'll
      create a zero-length slice that points just past the end of the stack
      allocation. This bad pointer causes GC panics.
      
      Fix this by creating a nil slice if the stack barrier count is 0.
      
      In practice, the only way this can happen is if
      GODEBUG=gcstackbarrieroff=1 is set because even the minimum size stack
      reserves space for two stack barriers.
      
      Change-Id: I3527c9a504c445b64b81170ee285a28594e7983d
      Reviewed-on: https://go-review.googlesource.com/31762Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      3193c71c
    • Austin Clements's avatar
      runtime: debug code to panic when marking a free object · d1cc8347
      Austin Clements authored
      This adds debug code enabled in gccheckmark mode that panics if we
      attempt to mark an unallocated object. This is a common issue with the
      hybrid barrier when we're manipulating uninitialized memory that
      contains stale pointers. This also tends to catch bugs that will lead
      to "sweep increased allocation count" crashes closer to the source of
      the bug.
      
      Change-Id: I443ead3eac6f316a46f50b106078b524cac317f4
      Reviewed-on: https://go-review.googlesource.com/31761Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      d1cc8347
    • Austin Clements's avatar
      runtime: simplify reflectcall write barriers · 79561a84
      Austin Clements authored
      Currently reflectcall has a subtle dance with write barriers where the
      assembly code copies the result values from the stack to the in-heap
      argument frame without write barriers and then calls into the runtime
      after the fact to invoke the necessary write barriers.
      
      For the hybrid barrier (and for ROC), we need to switch to a
      *pre*-write write barrier, which is very difficult to do with the
      current setup. We could tie ourselves in knots of subtle reasoning
      about why it's okay in this particular case to have a post-write write
      barrier, but this commit instead takes a different approach. Rather
      than making things more complex, this simplifies reflection calls so
      that the argument copy is done in Go using normal bulk write barriers.
      
      The one difficulty with this approach is that calling into Go requires
      putting arguments on the stack, but the call* functions "donate" their
      entire stack frame to the called function. We can get away with this
      now because the copy avoids using the stack and has copied the results
      out before we clobber the stack frame to call into the write barrier.
      The solution in this CL is to call another function, passing arguments
      in registers instead of on the stack, and let that other function
      reserve more stack space and setup the arguments for the runtime.
      
      This approach seemed to work out the best. I also tried making the
      call* functions reserve 32 extra bytes of frame for the write barrier
      arguments and adjust SP up by 32 bytes around the call. However, even
      with the necessary changes to the assembler to correct the spdelta
      table, the runtime was still having trouble with the frame layout (and
      the changes to the assembler caused many other things that do strange
      things with the SP to fail to assemble). The approach I took doesn't
      require any funny business with the SP.
      
      Updates #17503.
      
      Change-Id: Ie2bb0084b24d6cff38b5afb218b9e0534ad2119e
      Reviewed-on: https://go-review.googlesource.com/31655
      Run-TryBot: Austin Clements <austin@google.com>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      79561a84
    • Russ Cox's avatar
      cmd/go: report missing vendor visibility error · 1c3ab3d4
      Russ Cox authored
      The logic for saving the list of packages was not always
      preferring to keep error messages around correctly.
      The missed error led to an internal consistency failure later.
      
      Fixes #17119.
      
      Change-Id: I9723b5d2518c25e2cac5249e6a7b907be95b521c
      Reviewed-on: https://go-review.googlesource.com/31812
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarQuentin Smith <quentin@golang.org>
      1c3ab3d4
    • Filippo Valsorda's avatar
      crypto/tls: expand ClientHelloInfo · 51c959b6
      Filippo Valsorda authored
      Fixes #17430
      
      Change-Id: Ia1c25363d64e3091455ce00644438715aff30a0d
      Reviewed-on: https://go-review.googlesource.com/31391
      Run-TryBot: Adam Langley <agl@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarFilippo Valsorda <hi@filippo.io>
      51c959b6
    • Russ Cox's avatar
      fmt: document that unexported struct fields don't get the String/Error treatment · 4b9490ee
      Russ Cox authored
      Fixes #17409.
      
      Change-Id: Ib49ff4a467431b5c1e6637e5144979cf0bfba489
      Reviewed-on: https://go-review.googlesource.com/31817Reviewed-by: default avatarMartin Möhrmann <martisch@uos.de>
      Reviewed-by: default avatarQuentin Smith <quentin@golang.org>
      4b9490ee
    • Russ Cox's avatar
      cmd/go: diagnose non-canonical import paths before compilation · 59b0e147
      Russ Cox authored
      If we leave it for compilation sometimes the error appears first
      in derived vendor paths, without any indication where they came from.
      This is better.
      
      $ go1.7 build canonical/d
      cmd/go/testdata/src/canonical/a/a.go:3: non-canonical import path "canonical/a//vendor/c" (should be "canonical/a/vendor/c")
      cmd/go/testdata/src/canonical/a/a.go:3: can't find import: "canonical/a//vendor/c"
      
      $ go build canonical/d
      package canonical/d
      	imports canonical/b
      	imports canonical/a/: non-canonical import path: "canonical/a/" should be "canonical/a"
      $
      
      Fixes #16954.
      
      Change-Id: I315ccec92a00d98a08c139b3dc4e17dbc640edd0
      Reviewed-on: https://go-review.googlesource.com/31668Reviewed-by: default avatarQuentin Smith <quentin@golang.org>
      59b0e147
    • Russ Cox's avatar
      cmd/vet: diagnose non-space-separated struct tag like `json:"x",xml:"y"` · e3324a4b
      Russ Cox authored
      This is not strictly illegal but it probably should be (too late)
      and doesn't mean what it looks like it means:
      the second key-value pair has the key ",xml".
      
      Fixes #14466.
      
      Change-Id: I174bccc23fd28affeb87f57f77c6591634ade641
      Reviewed-on: https://go-review.googlesource.com/32031
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      Reviewed-by: default avatarQuentin Smith <quentin@golang.org>
      e3324a4b
    • Michael Munday's avatar
      cmd/compile: improve s390x SSA rules for logical ops · 3202aa78
      Michael Munday authored
      This CL introduces some minor changes to match rules more closely
      to the instructions they are targeting. s390x logical operation
      with immediate instructions typically leave some bits in the
      target register unchanged. This means for example that an XOR
      with -1 requires 2 instructions. It is better in cases such as
      this to create a constant and leave it visible to the compiler
      so that it can be reused rather than hiding it in the assembler.
      
      This CL also tweaks the rules a bit to ensure that constants are
      folded when possible.
      
      Change-Id: I1c6dee31ece00fc3c5fdf6a24f1abbc91dd2db2a
      Reviewed-on: https://go-review.googlesource.com/31754Reviewed-by: default avatarKeith Randall <khr@golang.org>
      3202aa78
    • Alexander Morozov's avatar
      runtime: fix comments in time.go · 2481481f
      Alexander Morozov authored
      Change-Id: I5c501f598f41241e6d7b21d98a126827a3c3ad9a
      Reviewed-on: https://go-review.googlesource.com/32018Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      2481481f
    • Francesc Campoy's avatar
      cmd/dist: ignore stderr when listing packages to test · 6e02750d
      Francesc Campoy authored
      Currently any warning will make dist fail because the
      text will be considered as part of the package list.
      
      Change-Id: I09a14089cd0448c3779e2f767e9356fe3325d8d9
      Reviewed-on: https://go-review.googlesource.com/32111
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Run-TryBot: Andrew Gerrand <adg@golang.org>
      Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      6e02750d
  2. 25 Oct, 2016 22 commits