1. 14 Feb, 2017 14 commits
    • Kirill Smelkov's avatar
      cmd/compile/internal/ssa: generate bswap/store for indexed bigendian byte stores too on AMD64 · bd91e356
      Kirill Smelkov authored
      Commit 10f75748 (CL 32222) added rewrite rules to combine byte loads/stores +
      shifts into larger loads/stores + bswap. For loads both MOVBload and
      MOVBloadidx1 were handled but for store only MOVBstore was there without
      MOVBstoreidx added to rewrite pattern. Fix it.
      
      Here is how generated code changes for the following 2 functions
      (ommitting staying the same prologue/epilogue):
      
          func put32(b []byte, i int, v uint32) {
                  binary.BigEndian.PutUint32(b[i:], v)
          }
      
          func put64(b []byte, i int, v uint64) {
                  binary.BigEndian.PutUint64(b[i:], v)
          }
      
      "".put32 t=1 size=100 args=0x28 locals=0x0
      
      	// before
      	0x0032 00050 (x.go:5)	MOVL	CX, DX
      	0x0034 00052 (x.go:5)	SHRL	$24, CX
      	0x0037 00055 (x.go:5)	MOVQ	"".b+8(FP), BX
      	0x003c 00060 (x.go:5)	MOVB	CL, (BX)(AX*1)
      	0x003f 00063 (x.go:5)	MOVL	DX, CX
      	0x0041 00065 (x.go:5)	SHRL	$16, DX
      	0x0044 00068 (x.go:5)	MOVB	DL, 1(BX)(AX*1)
      	0x0048 00072 (x.go:5)	MOVL	CX, DX
      	0x004a 00074 (x.go:5)	SHRL	$8, CX
      	0x004d 00077 (x.go:5)	MOVB	CL, 2(BX)(AX*1)
      	0x0051 00081 (x.go:5)	MOVB	DL, 3(BX)(AX*1)
      
      	// after
      	0x0032 00050 (x.go:5)	BSWAPL	CX
      	0x0034 00052 (x.go:5)	MOVQ	"".b+8(FP), DX
      	0x0039 00057 (x.go:5)	MOVL	CX, (DX)(AX*1)
      
      "".put64 t=1 size=155 args=0x28 locals=0x0
      
      	// before
      	0x0037 00055 (x.go:9)	MOVQ	CX, DX
      	0x003a 00058 (x.go:9)	SHRQ	$56, CX
      	0x003e 00062 (x.go:9)	MOVQ	"".b+8(FP), BX
      	0x0043 00067 (x.go:9)	MOVB	CL, (BX)(AX*1)
      	0x0046 00070 (x.go:9)	MOVQ	DX, CX
      	0x0049 00073 (x.go:9)	SHRQ	$48, DX
      	0x004d 00077 (x.go:9)	MOVB	DL, 1(BX)(AX*1)
      	0x0051 00081 (x.go:9)	MOVQ	CX, DX
      	0x0054 00084 (x.go:9)	SHRQ	$40, CX
      	0x0058 00088 (x.go:9)	MOVB	CL, 2(BX)(AX*1)
      	0x005c 00092 (x.go:9)	MOVQ	DX, CX
      	0x005f 00095 (x.go:9)	SHRQ	$32, DX
      	0x0063 00099 (x.go:9)	MOVB	DL, 3(BX)(AX*1)
      	0x0067 00103 (x.go:9)	MOVQ	CX, DX
      	0x006a 00106 (x.go:9)	SHRQ	$24, CX
      	0x006e 00110 (x.go:9)	MOVB	CL, 4(BX)(AX*1)
      	0x0072 00114 (x.go:9)	MOVQ	DX, CX
      	0x0075 00117 (x.go:9)	SHRQ	$16, DX
      	0x0079 00121 (x.go:9)	MOVB	DL, 5(BX)(AX*1)
      	0x007d 00125 (x.go:9)	MOVQ	CX, DX
      	0x0080 00128 (x.go:9)	SHRQ	$8, CX
      	0x0084 00132 (x.go:9)	MOVB	CL, 6(BX)(AX*1)
      	0x0088 00136 (x.go:9)	MOVB	DL, 7(BX)(AX*1)
      
      	// after
      	0x0033 00051 (x.go:9)	BSWAPQ	CX
      	0x0036 00054 (x.go:9)	MOVQ	"".b+8(FP), DX
      	0x003b 00059 (x.go:9)	MOVQ	CX, (DX)(AX*1)
      
      Updates #17151
      
      Change-Id: I3f4a7f28f210e62e153e60da5abd1d39508cc6c4
      Reviewed-on: https://go-review.googlesource.com/34635
      Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIlya Tocar <ilya.tocar@intel.com>
      bd91e356
    • Kale Blankenship's avatar
      net/http: document ErrServerClosed · a0645fca
      Kale Blankenship authored
      Fixes #19085
      
      Change-Id: Ib11b9a22ea8092aca9e1c9c36b1fb015dd555c4b
      Reviewed-on: https://go-review.googlesource.com/36943Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      a0645fca
    • Austin Clements's avatar
      runtime: remove g.stackAlloc · 0993b2fd
      Austin Clements authored
      Since we're no longer stealing space for the stack barrier array from
      the stack allocation, the stack allocation is simply
      g.stack.hi-g.stack.lo.
      
      Updates #17503.
      
      Change-Id: Id9b450ae12c3df9ec59cfc4365481a0a16b7c601
      Reviewed-on: https://go-review.googlesource.com/36621
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      0993b2fd
    • Austin Clements's avatar
      runtime: remove stack barriers · d089a6c7
      Austin Clements authored
      Now that we don't rescan stacks, stack barriers are unnecessary. This
      removes all of the code and structures supporting them as well as
      tests that were specifically for stack barriers.
      
      Updates #17503.
      
      Change-Id: Ia29221730e0f2bbe7beab4fa757f31a032d9690c
      Reviewed-on: https://go-review.googlesource.com/36620
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      d089a6c7
    • Austin Clements's avatar
      runtime: remove rescan list · c5ebcd2c
      Austin Clements authored
      With the hybrid barrier, rescanning stacks is no longer necessary so
      the rescan list is no longer necessary. Remove it.
      
      This leaves the gcrescanstacks GODEBUG variable, since it's useful for
      debugging, but changes it to simply walk all of the Gs to rescan
      stacks rather than using the rescan list.
      
      We could also remove g.gcscanvalid, which is effectively a distributed
      rescan list. However, it's still useful for gcrescanstacks mode and it
      adds little complexity, so we'll leave it in.
      
      Fixes #17099.
      Updates #17503.
      
      Change-Id: I776d43f0729567335ef1bfd145b75c74de2cc7a9
      Reviewed-on: https://go-review.googlesource.com/36619
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      c5ebcd2c
    • Austin Clements's avatar
      runtime: remove unused debug.wbshadow · 7aeb915d
      Austin Clements authored
      The wbshadow implementation was removed a year and a half ago in
      1635ab7d, but the GODEBUG setting remained. Remove the GODEBUG
      setting since it doesn't do anything.
      
      Change-Id: I19cde324a79472aff60acb5cc9f7d4aa86c0c0ed
      Reviewed-on: https://go-review.googlesource.com/36618
      Run-TryBot: Austin Clements <austin@google.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      7aeb915d
    • Nathan Caza's avatar
      net/http: handle absolute paths in mapDirOpenError · a610957f
      Nathan Caza authored
      The current implementation does not account for Dir being
      initialized with an absolute path on systems that start
      paths with filepath.Separator. In this scenario, the
      original error is returned, and not checked for file
      segments.
      
      This change adds a test for this case, and corrects the
      behavior by ignoring blank path segments in the loop.
      
      Refs #18984
      
      Change-Id: I9b79fd0a73a46976c8e2feda0283ef0bb2b62ea1
      Reviewed-on: https://go-review.googlesource.com/36804Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      a610957f
    • Josh Bleecher Snyder's avatar
      runtime: fix some assembly offset names · ef30a1c8
      Josh Bleecher Snyder authored
      For vet. There are more. This is a start.
      
      Change-Id: Ibbbb2b20b5db60ee3fac4a1b5913d18fab01f6b9
      Reviewed-on: https://go-review.googlesource.com/36939
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      ef30a1c8
    • Josh Bleecher Snyder's avatar
      all: fix some printf format strings · 785cb7e0
      Josh Bleecher Snyder authored
      Appease vet.
      
      Change-Id: Ie88de08b91041990c0eaf2e15628cdb98d40c660
      Reviewed-on: https://go-review.googlesource.com/36938
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      785cb7e0
    • Josh Bleecher Snyder's avatar
      all: use keyed composite literals · cc2a52ad
      Josh Bleecher Snyder authored
      Makes vet happy.
      
      Change-Id: I7250f283c96e82b9796c5672a0a143ba7568fa63
      Reviewed-on: https://go-review.googlesource.com/36937
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      cc2a52ad
    • Dave Cheney's avatar
      internal/poll: only build str.go on plan9 · c0165a38
      Dave Cheney authored
      Alternatively the contents of str.go could be moved into fd_io_plan9.go
      
      Change-Id: I9d7ec85bbb376f4244eeca732f25c0b77cadc6a6
      Reviewed-on: https://go-review.googlesource.com/36971
      Run-TryBot: Dave Cheney <dave@cheney.net>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c0165a38
    • Dave Cheney's avatar
      internal/poll: remove named return values and naked returns · 84cf1f05
      Dave Cheney authored
      Change-Id: I283f4453e5cf8b22995b3abffccae182cfbb6945
      Reviewed-on: https://go-review.googlesource.com/36970Reviewed-by: default avatarDave Cheney <dave@cheney.net>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Dave Cheney <dave@cheney.net>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      84cf1f05
    • Caleb Spare's avatar
      time: add Duration.Truncate and Duration.Round · 45356c1a
      Caleb Spare authored
      Fixes #18996
      
      Change-Id: I0b0f7270960b368ce97ad4456f60bcc1fc2a8313
      Reviewed-on: https://go-review.googlesource.com/36615
      Run-TryBot: Caleb Spare <cespare@gmail.com>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      45356c1a
    • Josh Bleecher Snyder's avatar
      runtime: speed up fastrand() % n · 46a75870
      Josh Bleecher Snyder authored
      This occurs a fair amount in the runtime for non-power-of-two n.
      Use an alternative, faster formulation.
      
      name           old time/op  new time/op  delta
      Fastrandn/2-8  4.45ns ± 2%  2.09ns ± 3%  -53.12%  (p=0.000 n=14+14)
      Fastrandn/3-8  4.78ns ±11%  2.06ns ± 2%  -56.94%  (p=0.000 n=15+15)
      Fastrandn/4-8  4.76ns ± 9%  1.99ns ± 3%  -58.28%  (p=0.000 n=15+13)
      Fastrandn/5-8  4.96ns ±13%  2.03ns ± 6%  -59.14%  (p=0.000 n=15+15)
      
      name                    old time/op  new time/op  delta
      SelectUncontended-8     33.7ns ± 2%  33.9ns ± 2%  +0.70%  (p=0.000 n=49+50)
      SelectSyncContended-8   1.68µs ± 4%  1.65µs ± 4%  -1.54%  (p=0.000 n=50+45)
      SelectAsyncContended-8   282ns ± 1%   277ns ± 1%  -1.50%  (p=0.000 n=48+43)
      SelectNonblock-8        5.31ns ± 1%  5.32ns ± 1%    ~     (p=0.275 n=45+44)
      SelectProdCons-8         585ns ± 3%   577ns ± 2%  -1.35%  (p=0.000 n=50+50)
      GoroutineSelect-8       1.59ms ± 2%  1.59ms ± 1%    ~     (p=0.084 n=49+48)
      
      Updates #16213
      
      Change-Id: Ib555a4d7da2042a25c3976f76a436b536487d5b7
      Reviewed-on: https://go-review.googlesource.com/36932
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      46a75870
  2. 13 Feb, 2017 24 commits
  3. 12 Feb, 2017 2 commits
    • Alex Brainman's avatar
      path/filepath: add test for directory junction walk · 61bf0d1c
      Alex Brainman authored
      For #10424.
      
      Change-Id: Ie4e87503b0ed04f65d2444652bd1db647d3529f4
      Reviewed-on: https://go-review.googlesource.com/36851Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      61bf0d1c
    • Russ Cox's avatar
      runtime: use two-level list for semaphore address search in semaRoot · 45c6f59e
      Russ Cox authored
      If there are many goroutines contending for two different locks
      and both locks hash to the same semaRoot, the scans to find the
      goroutines for a particular lock can end up being O(n), making
      n lock acquisitions quadratic.
      
      As long as only one actively-used lock hashes to each semaRoot
      there's no problem, since the list operations in that case are O(1).
      But when the second actively-used lock hits the same semaRoot,
      then scans for entries with for a given lock have to scan over the
      entries for the other lock.
      
      Fix this problem by changing the semaRoot to hold only one sudog
      per unique address. In the running example, this drops the length of
      that list from O(n) to 2. Then attach other goroutines waiting on the
      same address to a separate list headed by the sudog in the semaRoot list.
      Those "same address list" operations are still O(1), so now the
      example from above works much better.
      
      There is still an assumption here that in real programs you don't have
      many many goroutines queueing up on many many distinct addresses.
      If we end up with that problem, we can replace the top-level list with
      a treap.
      
      Fixes #17953.
      
      Change-Id: I78c5b1a5053845275ab31686038aa4f6db5720b2
      Reviewed-on: https://go-review.googlesource.com/36792
      Run-TryBot: Russ Cox <rsc@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      45c6f59e