1
0
mirror of https://github.com/golang/go synced 2024-09-25 09:10:14 -06:00
Commit Graph

26427 Commits

Author SHA1 Message Date
Todd Neal
93a0b0f315 [dev.ssa] cmd/compile: rewrites for constant shifts
Add rewrite rules to optimize constant shifts.

Fixes #10637

Change-Id: I74b724d3e81aeb7098c696d02c050f7fdfd5b523
Reviewed-on: https://go-review.googlesource.com/19106
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-02-04 16:41:07 +00:00
Alexandru Moșoi
606a11f464 [dev.ssa] src/cmd/compile/internal/ssa/gen: detect type earlier when generating rules.
Removes approx. one assignment per rule.

Change-Id: Ie9f0a7082ae12c4447ff6b4d40678cd92bdbb6f2
Reviewed-on: https://go-review.googlesource.com/19194
Reviewed-by: Keith Randall <khr@golang.org>
2016-02-04 16:01:53 +00:00
Alexandru Moșoi
d4a95e78fa [dev.ssa] cmd/compile/internal/ssa: simplify comparisons with constants
* Simplify comparisons of form a + const1 == const2 or a + const1 != const2.
* Canonicalize Eq, Neq, Add, Sub to have a constant as first argument.
Needed for the above new rules and helps constant folding.

Change-Id: I8078702a5daa706da57106073a3e9f640a67f486
Reviewed-on: https://go-review.googlesource.com/19192
Reviewed-by: Keith Randall <khr@golang.org>
2016-02-04 16:00:19 +00:00
Todd Neal
c58c20f30f [dev.ssa] cmd/compile: use sparsetree in checkFunc
Modify the simple domCheck to use the sparse tree code.  This
speeds up compilation of one of the generated test cases from
1m48s to 17s.

Change-Id: If577410ee77b54918147a66917a8e3721297ee0a
Reviewed-on: https://go-review.googlesource.com/19187
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-02-04 12:03:33 +00:00
Todd Neal
955749c45f [dev.ssa] cmd/compile: remove dead code
Change-Id: I1738e3af7de0972c54d74325d80781059d0796d8
Reviewed-on: https://go-review.googlesource.com/19186
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-02-04 00:53:55 +00:00
Todd Neal
3297a4f5f3 [dev.ssa] cmd/compile: cache sparse sets in Config
Move the cached sparse sets to the Config.  I tested make.bash with
pre-allocating sets of size 150 and not caching very small sets, but the
difference between this implementation (no min size, no preallocation)
and a min size with preallocation was fairly negligible:

Number of sparse sets allocated:
Cached in Config w/none preallocated no min size    3684 *this CL*
Cached in Config w/three preallocated no min size   3370
Cached in Config w/three preallocated min size=150  3370
Cached in Config w/none preallocated min size=150  15947
Cached in Func,  w/no min                          96996 *previous code*

Change-Id: I7f9de8a7cae192648a7413bfb18a6690fad34375
Reviewed-on: https://go-review.googlesource.com/19152
Reviewed-by: Keith Randall <khr@golang.org>
2016-02-02 18:08:46 +00:00
Keith Randall
16b1fce921 [dev.ssa] cmd/compile: add aux typing, flags to ops
Add the aux type to opcodes.
Add rematerializeable as a flag.

Change-Id: I906e19281498f3ee51bb136299bf26e13a54b2ec
Reviewed-on: https://go-review.googlesource.com/19088
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
2016-02-02 02:55:13 +00:00
David Chase
c87a62f32b [dev.ssa] cmd/compile: reducing alloc footprint of dominator calc
Converted working slices of pointer into slices of pointer
index.  Half the size (on 64-bit machine) and no pointers
to trace if GC occurs while they're live.

TODO - could expose slice mapping ID->*Block; some dom
clients also construct these.

Minor optimization in regalloc that cuts allocation count.

Minor optimization in compile.go that cuts calls to Sprintf.

Change-Id: I28f0bfed422b7344af333dc52ea272441e28e463
Reviewed-on: https://go-review.googlesource.com/19104
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
2016-02-02 02:20:25 +00:00
Todd Neal
25abe96214 [dev.ssa] cmd/compile: regenerate code
These changes were left out of the 1cc5789df9 commit.

Change-Id: Id7f49973da281a567b69228dbaea31846b82b4af
Reviewed-on: https://go-review.googlesource.com/19105
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-02-01 03:40:00 +00:00
Keith Randall
1cc5789df9 [dev.ssa] cmd/compile: lots of small rewrite optimizations
Small optimizations I noticed while looking at Giovanni's test cases.

More shifts by constants.
Indexed stores for smaller types.
Fold LEA into loads/stores.
More extending loads.
CMP $0 of AND -> TEST

Fix order of TEST ops.

Giovanni's test cases at https://gist.github.com/rasky/62fba94e3a20d1b05b2a

Change-Id: I7077bc0b5319bf05767eeb39f401f4bb4b39f635
Reviewed-on: https://go-review.googlesource.com/19086
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
Reviewed-by: David Chase <drchase@google.com>
2016-01-31 05:30:13 +00:00
Todd Neal
f962f33035 [dev.ssa] cmd/compile: reuse sparse sets across compiler passes
Cache sparse sets in the function so they can be reused by subsequent
compiler passes.

benchmark                        old ns/op     new ns/op     delta
BenchmarkDSEPass-8               206945        180022        -13.01%
BenchmarkDSEPassBlock-8          5286103       2614054       -50.55%
BenchmarkCSEPass-8               1790277       1790655       +0.02%
BenchmarkCSEPassBlock-8          18083588      18112771      +0.16%
BenchmarkDeadcodePass-8          59837         41375         -30.85%
BenchmarkDeadcodePassBlock-8     1651575       511169        -69.05%
BenchmarkMultiPass-8             531529        427506        -19.57%
BenchmarkMultiPassBlock-8        7033496       4487814       -36.19%

benchmark                        old allocs     new allocs     delta
BenchmarkDSEPass-8               11             4              -63.64%
BenchmarkDSEPassBlock-8          599            120            -79.97%
BenchmarkCSEPass-8               18             18             +0.00%
BenchmarkCSEPassBlock-8          2700           2700           +0.00%
BenchmarkDeadcodePass-8          4              3              -25.00%
BenchmarkDeadcodePassBlock-8     30             9              -70.00%
BenchmarkMultiPass-8             24             20             -16.67%
BenchmarkMultiPassBlock-8        1800           1000           -44.44%

benchmark                        old bytes     new bytes     delta
BenchmarkDSEPass-8               221367        142           -99.94%
BenchmarkDSEPassBlock-8          3695207       3846          -99.90%
BenchmarkCSEPass-8               303328        303328        +0.00%
BenchmarkCSEPassBlock-8          5006400       5006400       +0.00%
BenchmarkDeadcodePass-8          84232         10506         -87.53%
BenchmarkDeadcodePassBlock-8     1274940       163680        -87.16%
BenchmarkMultiPass-8             608674        313834        -48.44%
BenchmarkMultiPassBlock-8        9906001       5003450       -49.49%

Change-Id: Ib1fa58c7f494b374d1a4bb9cffbc2c48377b59d3
Reviewed-on: https://go-review.googlesource.com/19100
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2016-01-30 13:57:39 +00:00
David Chase
88b230eaa6 [dev.ssa] cmd/compile: exposed do-log boolean to reduce allocations
From memory profiling, about 3% reduction in allocation count.

Change-Id: I4b662d55b8a94fe724759a2b22f05a08d0bf40f8
Reviewed-on: https://go-review.googlesource.com/19103
Reviewed-by: Keith Randall <khr@golang.org>
2016-01-29 21:30:29 +00:00
Keith Randall
f3575a9561 [dev.ssa] cmd/compile: tweak init function prologue
We used to compare the init state with == to 0 and 2, which
requires 2 comparisons.  Instead, compare with 1 and use
<, ==.  That requires only one comparison.

This isn't a big deal performance-wise, as it is just init
code.  But there is a fair amount of init code, so this
should help a bit with code size.

Change-Id: I4a2765f1005776f0edce28ac143f4b7596d95a68
Reviewed-on: https://go-review.googlesource.com/18948
Reviewed-by: David Chase <drchase@google.com>
2016-01-29 20:22:35 +00:00
Keith Randall
f94e0745b3 [dev.ssa] cmd/compile: prepare for some load+op combining
Rename StoreConst to ValAndOff so we can use it for other ops.
Make ValAndOff print nicely.

Add some notes & checks related to my aborted attempt to
implement combined CMP+load ops.

Change-Id: I2f901d12d42bc5a82879af0334806aa184a97e27
Reviewed-on: https://go-review.googlesource.com/18947
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
2016-01-29 20:22:09 +00:00
Keith Randall
5ba31940dc [dev.ssa] cmd/compile: fix write barriers for SSA
The old write barriers used _nostore versions, which
don't work for Ian's cgo checker.  Instead, we adopt the
same write barrier pattern as the default compiler.

It's a bit trickier to code up but should be more efficient.

Change-Id: I6696c3656cf179e28f800b0e096b7259bd5f3bb7
Reviewed-on: https://go-review.googlesource.com/18941
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-01-29 17:49:59 +00:00
Keith Randall
d8a65672f8 [dev.ssa] cmd/compile: optimization for && and || expressions
Compiling && and || expressions often leads to control
flow of the following form:

p:
  If a goto b else c
b: <- p ...
  x = phi(a, ...)
  If x goto t else u

Note that if we take the edge p->b, then we are guaranteed
to take the edge b->t also.  So in this situation, we might
as well go directly from p to t.

Change-Id: I6974f1e6367119a2ddf2014f9741fdb490edcc12
Reviewed-on: https://go-review.googlesource.com/18910
Reviewed-by: David Chase <drchase@google.com>
2016-01-29 17:49:45 +00:00
Keith Randall
9d6e605cf7 [dev.ssa] cmd/compile: simple forward-looking register allocation tweak
For each value that needs to be in a fixed register at the end of the
block, and try to pick that fixed register when the instruction
generating that value is scheduled (or restored from a spill).

Just used for end-of-block register requirements for now.
Fixed-register instruction requirements (e.g. shift in ecx) can be
added later.  Also two-instruction constraints (input reg == output
reg) might be recorded in a similar manner.

Change-Id: I59916e2e7f73657bb4fc3e3b65389749d7a23fa8
Reviewed-on: https://go-review.googlesource.com/18774
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-01-29 17:32:38 +00:00
Keith Randall
8a961aee28 [dev.ssa] cmd/compile: fix -N build
The OpSB hack didn't quite work.  We need to really
CSE these ops to make regalloc happy.

Change-Id: I9f4d7bfb0929407c84ee60c9e25ff0c0fbea84af
Reviewed-on: https://go-review.googlesource.com/19083
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-01-29 17:27:12 +00:00
Keith Randall
056c09bb88 [dev.ssa] cmd/compile: add backing store buffers for block.{Preds,Succs,Values}
Speeds up compilation by 6%.

Change-Id: Ibaad95710323ddbe13c1b0351843fe43a48d776e
Reviewed-on: https://go-review.googlesource.com/19080
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-29 01:01:39 +00:00
Keith Randall
4c5459da2b [dev.ssa] cmd/compile: fix build
Some tests make multiple Funcs per Config at once.
With value & block caching, we can't do that any more.

Change-Id: Ibdb60aa2fcf478f1726b3be0fcaa06b04433eb67
Reviewed-on: https://go-review.googlesource.com/19081
Reviewed-by: Keith Randall <khr@golang.org>
2016-01-29 00:30:13 +00:00
Keith Randall
2f57d0fe02 [dev.ssa] cmd/compile: preallocate small-numbered values and blocks
Speeds up the compiler ~5%.

Change-Id: Ia5cf0bcd58701fd14018ec77d01f03d5c7d6385b
Reviewed-on: https://go-review.googlesource.com/19060
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-28 22:52:42 +00:00
Keith Randall
6a96a2fe5a [dev.ssa] cmd/compile: make cse faster
It is one of the slowest compiler phases right now, and we
run two of them.

Instead of using a map to make the initial partition, use a sort.
It is much less memory intensive.

Do a few optimizations to avoid work for size-1 equivalence classes.

Implement -N.

Change-Id: I1d2d85d3771abc918db4dd7cc30b0b2d854b15e1
Reviewed-on: https://go-review.googlesource.com/19024
Reviewed-by: David Chase <drchase@google.com>
2016-01-28 20:59:20 +00:00
Keith Randall
7b773946c0 [dev.ssa] cmd/compile: disable xor clearing when flags must be preserved
The x86 backend automatically rewrites MOV $0, AX to
XOR AX, AX.  That rewrite isn't ok when the flags register
is live across the MOV.  Keep track of which moves care
about preserving flags, then disable this rewrite for them.

On x86, Prog.Mark was being used to hold the length of the
instruction.  We already store that in Prog.Isize, so no
need to store it in Prog.Mark also.  This frees up Prog.Mark
to hold a bitmask on x86 just like all the other architectures.

Update #12405

Change-Id: Ibad8a8f41fc6222bec1e4904221887d3cc3ca029
Reviewed-on: https://go-review.googlesource.com/18861
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-26 17:40:22 +00:00
Keith Randall
733bf6ef67 [dev.ssa] cmd/compile: get rid of +0.0 hack
The conversion from -0.0 to +0.0 happens inside mpgetflt now.
The SSA code doesn't need this fix any more.

Change-Id: I6cd4f4a4e75b13cf284ebbb95b08af050ed9891c
Reviewed-on: https://go-review.googlesource.com/18942
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
2016-01-26 16:18:48 +00:00
Keith Randall
3c26c0db39 [dev.ssa] cmd/compile: short-circuit empty blocks
Empty blocks are introduced to remove critical edges.
After regalloc, we can remove any of the added blocks
that are still empty.

Change-Id: I0b40e95ac3a6cc1e632a479443479532b6c5ccd9
Reviewed-on: https://go-review.googlesource.com/18833
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-01-22 22:12:12 +00:00
Keith Randall
7730880f7c [dev.ssa] cmd/compile: update SSA TODOs
Change-Id: I78743987dcb45d821212caf95a00ae15b7a6cfd8
Reviewed-on: https://go-review.googlesource.com/18773
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-21 03:20:29 +00:00
Keith Randall
a734bbc953 [dev.ssa] cmd/compile: Allow structs to be SSAd
Break small structs up into their components so they
can be registerized.

Change StructSelect to use field indexes instead of
field offsets, as field offsets aren't unique in the
presence of zero-sized fields.

Change-Id: I2f1dc89f7fa58e1cf58aa1a32b238959d53f62e4
Reviewed-on: https://go-review.googlesource.com/18570
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-01-20 22:37:11 +00:00
Keith Randall
b5c5efd5de [dev.ssa] cmd/compile: optimize phi ops
Redo how we keep track of forward references when building SSA.
When the forward reference is resolved, update the Value node
in place.

Improve the phi elimination pass so it can simplify phis of phis.

Give SSA package access to decoded line numbers.  Fix line numbers
for constant booleans.

Change-Id: I3dc9896148d260be2f3dd14cbe5db639ec9fa6b7
Reviewed-on: https://go-review.googlesource.com/18674
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
2016-01-20 21:45:37 +00:00
Keith Randall
23d5810c8f [dev.ssa] Merge remote-tracking branch 'origin/master' into mergebranch
Semi-regular merge from tip to dev.ssa.

Conflicts:
	src/runtime/sys_windows_amd64.s

Change-Id: I5f733130049c810e6ceacd46dad85faebca52b29
2016-01-19 14:13:16 -08:00
Keith Randall
90065eaba4 [dev.ssa] cmd/compile: use wider move instruction for floats
Distinguish move/load/store ops.  Unify some of this code a bit.

Reduces Mandelbrot slowdown with SSA from 58% to 12%.

Change-Id: I3276eaebcbcdd9de3f8299c79b5f25c0429194c4
Reviewed-on: https://go-review.googlesource.com/18677
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-01-19 15:44:03 +00:00
Keith Randall
da8af47710 [dev.ssa] cmd/compile: report better line numbers for Unimplemented/Fatal
If a failure occurs in SSA processing, we always report the
last line of the function we're compiling.  Modify the callbacks
from SSA to the GC compiler so we can pass a line number back
and use it in Fatalf.

Change-Id: Ifbfad50d5e167e997e0a96f0775bcc369f5c397e
Reviewed-on: https://go-review.googlesource.com/18599
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-01-19 15:43:32 +00:00
Michael Munday
c7754c8f54 net: add timeout to DNS requests sent by TestSpecialDomainName
The timeout means that TestSpecialDomainName will not hang if
the DNS server does not respond to the request.

Fixes #13939

Change-Id: I46e30bbd3c11b6c560656134e704331cf6f8af3f
Reviewed-on: https://go-review.googlesource.com/18661
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-19 06:20:36 +00:00
Brad Fitzpatrick
c40a73d80c net/http: make hidden http2 Transport respect remaining Transport fields
Updates x/net/http2 to git rev 72aa00c6 for https://golang.org/cl/18721
(but actually at https://golang.org/cl/18722 now)

Fixes #14008

Change-Id: If05d5ad51ec0ba5ba7e4fe16605c0a83f0484bc8
Reviewed-on: https://go-review.googlesource.com/18723
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-19 05:31:38 +00:00
Shenghou Ma
3208d92b78 build: test linux/mips64 and linux/mips64le with buildall.bash
Both mips64 architectures share the same runtime/rt0 file, so
we have to hardcode them in buildall.bash.

Ideally we should have cmd/dist report all supported platforms,
see #12270.

Change-Id: I08ce35cfe0a831af5e1e8255b305efd38386fa52
Reviewed-on: https://go-review.googlesource.com/18687
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-19 04:43:44 +00:00
Shenghou Ma
14aacc2fd8 runtime: print address as hex in messages
Change-Id: I7ccf1b5001d77c4390479f53c0137ab02f98595b
Reviewed-on: https://go-review.googlesource.com/18685
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-18 23:48:06 +00:00
Brad Fitzpatrick
3092a63a64 net/http: clarify docs on Request.Proto field
No need to say "by default" because there is no alternative and no way
to override. Always HTTP/2.0 is officially spelled HTTP/2 these days.

Fixes #13985 harder

Change-Id: Ib1ec03cec171ca865342b8e7452cd4c707d7b770
Reviewed-on: https://go-review.googlesource.com/18720
Reviewed-by: Rob Pike <r@golang.org>
2016-01-18 23:42:56 +00:00
Brad Fitzpatrick
5b588e6682 net/http: make http2 Transport send Content Length
Updates x/net/http2 to git rev 5c0dae8 for https://golang.org/cl/18709

Fixes #14003

Change-Id: I8bc205d6d089107b017e3458bbc7e05f6d0cae60
Reviewed-on: https://go-review.googlesource.com/18730
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-18 23:35:54 +00:00
Brad Fitzpatrick
49234ee2db net/http: panic on bogus use of CloseNotifier or Hijacker
Fixes #14001

Change-Id: I6f9bc3028345081758d8f537c3aaddb2e254e69e
Reviewed-on: https://go-review.googlesource.com/18708
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-18 22:11:00 +00:00
Mikio Hara
5c94f1ae8f net: disable TestInterfaceAddrsWithNetsh on windows
Updates #13981.

Change-Id: Id8f3cd56a81a7a993cea5c757e619407da491fed
Reviewed-on: https://go-review.googlesource.com/18710
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-18 22:02:21 +00:00
Ian Lance Taylor
9270973a5b runtime: don't run TestEnsureDropM on windows or plan9
This is testing code in asm_GOARCH.s, so it's not necessary to run the
test on systems where it doesn't build.

Fixes #13991.

Change-Id: Ia7a2d3a34b32e6987dc67428c1e09e63baf0518a
Reviewed-on: https://go-review.googlesource.com/18707
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-18 18:40:45 +00:00
Brad Fitzpatrick
01b86400d9 net/http: update bundled http2, pass through Transport.CloseIdleConnections
Wire up Transport.CloseIdleConnections to http2.Transport.CloseIdleConnections.

Updates x/net/http2 to git rev c92cdcb0 for https://golang.org/cl/18678

Fixes #13975

Change-Id: I1183a31256104ff95ae7621e5788cfeee741b1aa
Reviewed-on: https://go-review.googlesource.com/18679
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-16 03:35:23 +00:00
Austin Clements
b05f18e3f7 runtime: fix sleep/wakeup race for GC assists
GC assists check gcBlackenEnabled under the assist queue lock to avoid
going to sleep after gcWakeAllAssists has already woken all assists.
However, currently we clear gcBlackenEnabled shortly *after* waking
all assists, which opens a window where this exact race can happen.

Fix this by clearing gcBlackenEnabled before waking blocked assists.
However, it's unlikely this actually matters because the world is
stopped between waking assists and clearing gcBlackenEnabled and there
aren't any obvious allocations during this window, so I don't think an
assist could actually slip in to this race window.

Updates #13645.

Change-Id: I7571f059530481dc781d8fd96a1a40aadebecb0d
Reviewed-on: https://go-review.googlesource.com/18682
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2016-01-16 02:40:00 +00:00
Mikio Hara
aea4de80f9 runtime: readjust signal code for dragonfly-2.6 and above
Also adds missing nosplit to unminit.

Fixes #13964.

Change-Id: I07d93a8c872a255a89f91f808b66c889f0a6a69c
Reviewed-on: https://go-review.googlesource.com/18658
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-16 00:47:55 +00:00
Brad Fitzpatrick
91b910b7e2 net/http: update bundled http2
If a user starts two HTTP requests when no http2 connection is
available, both end up creating new TCP connections, since the
server's protocol (h1 or h2) isn't yet known. Once it turns out that
the server supports h2, one of the connections is useless. Previously
we kept upgrading both TLS connections to h2 (SETTINGS frame exchange,
etc).  Now the unnecessary connections are closed instead, before the
h2 preface/SETTINGS.

Updates x/net/http2 to git rev a8e212f3d for https://golang.org/cl/18675

This CL contains the tests for https://golang.org/cl/18675

Semi-related change noticed while writing the tests: now that we have
TLSNextProto in Go 1.6, which consults the TLS
ConnectionState.NegotiatedProtocol, we have to gurantee that the TLS
handshake has been done before we look at the ConnectionState. So add
that check after the DialTLS hook. (we never documented that users
have to call Handshake, so do it for them, now that it matters)

Updates #13957

Change-Id: I9a70e9d1282fe937ea654d9b1269c984c4e366c0
Reviewed-on: https://go-review.googlesource.com/18676
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-15 18:06:34 +00:00
Keith Randall
594c3aa063 [dev.ssa] runtime: fix windows build
Pull the relevant part of https://go-review.googlesource.com/#/c/18304/
into the SSA branch.  This fixes the windows SSA build.

Change-Id: Iee3834d8e7019cd90307e32029f3d1032ceb46c1
Reviewed-on: https://go-review.googlesource.com/18673
Reviewed-by: Austin Clements <austin@google.com>
2016-01-15 05:13:50 +00:00
Austin Clements
1556c317f1 runtime: use at least "system" traceback level for runtime tests
While the default behavior of eliding runtime frames from tracebacks
usually makes sense, this is not the case when you're trying to test
the runtime itself. Fix this by forcing the traceback level to at
least "system" in the runtime tests.

This will specifically help with debugging issue #13645, which has
proven remarkably resistant to reproduction outside of the build
dashboard itself.

Change-Id: I2a8356ba6c3c5badba8bb3330fc527357ec0d296
Reviewed-on: https://go-review.googlesource.com/18648
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-01-15 02:22:46 +00:00
Matthew Dempsky
c5a2f364d3 runtime: fix darwin/arm64 build
Fixes #13916.

Change-Id: If2cad5473a749460909519ac20aca19dea8a2e7a
Reviewed-on: https://go-review.googlesource.com/18671
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-14 20:57:21 +00:00
Russ Cox
383d817e02 cmd/go: fix vendor directory check on Windows
Fixes build.

Change-Id: Idd7d87f0bf3fe553b3ab00dd32eee4925a4fe3ff
Reviewed-on: https://go-review.googlesource.com/18647
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2016-01-14 20:41:14 +00:00
Ian Lance Taylor
28f9d96c75 runtime: remove erroneous go:noescape declaration
Change-Id: I6b1dc789e54a385c958961e7ba16bfd9d0f3b313
Reviewed-on: https://go-review.googlesource.com/18629
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-14 17:11:48 +00:00
Brad Fitzpatrick
38ca0466d3 net/http: fix flaky TestServerValidatesHostHeader
Passes with go test -race -count=1000 -name=TestServerValidatesHostHeader now
without hanging.

Fixes #13950

Change-Id: I41c3a555c642595c95c8c52f19a05a4c68e67630
Reviewed-on: https://go-review.googlesource.com/18660
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-14 15:23:41 +00:00