1
0
mirror of https://github.com/golang/go synced 2024-10-01 01:28:32 -06:00
Commit Graph

34856 Commits

Author SHA1 Message Date
David Chase
6adaf17eaa cmd/compile: preserve statements in late nilcheckelim optimization
When a subsequent load/store of a ptr makes the nil check of that pointer
unnecessary, if their lines differ, change the line of the load/store
to that of the nilcheck, and attempt to rehome the load/store position
instead.

This fix makes profiling less accurate in order to make panics more
informative.

Fixes #33724

Change-Id: Ib9afaac12fe0d0320aea1bf493617facc34034b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/200197
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-15 16:43:44 +00:00
Keith Randall
c2c2ba280c cmd/compile: fix fmt test
CL 196781 added map[int64]uint32 to the set of things printed with %v.

Fixes #34907

Change-Id: If4a13e86cfb4b691988f5fb70449ae23760f5789
Reviewed-on: https://go-review.googlesource.com/c/go/+/201079
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-15 01:10:46 +00:00
Joel Sing
a04aa1f6d1 cmd/internal/obj/riscv: implement MOV pseudo-instructions
Add support for rewriting MOV pseudo-instructions into appropriate
RISC-V instructions.

Based on the riscv-go port.

Updates #27532

Change-Id: I22da6f5f12c841d56fb676ab2a37f6d0a686b033
Reviewed-on: https://go-review.googlesource.com/c/go/+/198677
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-15 00:53:01 +00:00
Daniel Martí
1ed932d22b cmd/go: refuse -w with an invalid GO111MODULE
It was possible to get 'go env' to break itself:

	$ go env -w GO111MODULE=bad
	$ go env
	go: unknown environment setting GO111MODULE=bad

We already check if the variable name is known. In some cases like
GO111MODULE, we also know what the variable's valid values are. Enforce
it when writing the variable, not just when fetching it.

Fixes #34880.

Change-Id: I10d682087c69f3445f314fd4473644f694e255f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/200867
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-14 22:39:28 +00:00
Giovanni Bajo
90888ed97b cmd/compile: in poset, change the way inequality is recorded
Before this CL, inequality was recorded in a bit matrix using
SSA IDs. This allowed to record inequality for SSA values that
we didn't know any relation in the partial order of. Unfortunately,
this also means that inequality is harder to use within the poset
itself as there is not fast way to map from internal poset indices
and SSA values.

Since we will need to check for inequality in following CLs within
code that lost track of SSA values, switch to use a bit matrix
of poset indices instead. This requires always allocate a poset
node (as a new root) for values that are first seen in a SetNonEqual
call, but it doesn't sound like a big problem. The other solution
(creating and maintaining a reverse map from poset indices to SSA
values) seem more complicated and memory hungry.

Change-Id: Ic917485abbe70aef7ad6fa98408e5430328b6cd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/196782
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2019-10-14 21:29:11 +00:00
Giovanni Bajo
233f45499b cmd/compile: in poset, improve panic strings and comments
No functional changes.

Change-Id: I6f5e811e141dd09dc5c47ff2d37fae4c640315e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/200862
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-14 21:27:21 +00:00
Giovanni Bajo
c3a871fde1 cmd/compile: in poset, make constant handling more flexible
Currently, constants in posets, in addition to being stored in
a DAG, are also stored as SSA values in a slice. This allows to
quickly go through all stored constants, but it's not easy to search
for a specific constant.

Following CLs will benefit from being able to quickly find
a constants by value in the poset, so change the constants
structure to a map. Since we're at it, don't store it as
*ssa.Value: poset always uses dense uint32 indices when
referring a node, so just switch to it.

Using a map also forces us to have a single node per
constant value: this is a good thing in the first place,
so this CL also make sure we never create two nodes for
the same constant value.

Change-Id: I099814578af35f935ebf14bc4767d607021f5f8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/196781
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2019-10-14 21:27:08 +00:00
Meng Zhuo
50f1157760 cmd/compile: add math/bits.Mul64 intrinsic on mips64x
Benchmark:
name   old time/op  new time/op  delta
Mul    36.0ns ± 1%   2.8ns ± 0%  -92.31%  (p=0.000 n=10+10)
Mul32  4.37ns ± 0%  4.37ns ± 0%     ~     (p=0.429 n=6+10)
Mul64  36.4ns ± 0%   2.8ns ± 0%  -92.37%  (p=0.000 n=10+9)

Change-Id: Ic4f4e5958adbf24999abcee721d0180b5413fca7
Reviewed-on: https://go-review.googlesource.com/c/go/+/200582
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-14 21:23:34 +00:00
Anmol Sethi
9f95a30977 net/http: clean up checkIfModifiedSince and checkIfUnmodifiedSince
The comment in both functions referred to the wrong header and I made
the checks easier to read.

Change-Id: Ifb46729cee631a3305f557863818e3487b8eed71
Reviewed-on: https://go-review.googlesource.com/c/go/+/71753
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-14 21:10:00 +00:00
Giovanni Bajo
19532d04bf cmd/compile: add debugging mode for poset
Add an internal mode to simplify debugging of posets
by checking the integrity after every mutation. Turn
it on within SSA checked builds.

Change-Id: Idaa8277f58e5bce3753702e212cea4d698de30ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/196780
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2019-10-14 21:00:36 +00:00
Emmanuel T Odeke
19e0799ba0 net/http: fix and lock-in Client.Do docs on request cancelation
Fixes the docs to correctly match the implementation
and also adds a test locking-in the behavior to prevent
any accidental future regressions on the docs.

Fixes #33545

Change-Id: I6fdac6048cce8ac99beaa2db0dfc81d0dccc10f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/200798
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-14 20:50:54 +00:00
Matthew Dempsky
b649bdc7f3 cmd/compile: remove period from "not allowed in runtime" errors
We don't punctuate compiler diagnostics.

Change-Id: I19e1f30fbf04f0d1bfe6648fae26beaf3a06ee92
Reviewed-on: https://go-review.googlesource.com/c/go/+/201077
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-14 19:32:08 +00:00
Matthew Dempsky
06b12e660c cmd/compile: move some ONAME-specific flags from Node to Name
The IsClosureVar, IsOutputParamHeapAddr, Assigned, Addrtaken,
InlFormal, and InlLocal flags are only interesting for ONAME nodes, so
it's better to set these flags on Name.flags instead of Node.flags.

Two caveats though:

1. Previously, we would set Assigned and Addrtaken on the entire
expression tree involved in an assignment or addressing operation.
However, the rest of the compiler only actually cares about knowing
whether the underlying ONAME (if any) was assigned/addressed.

2. This actually requires bumping Name.flags from bitset8 to bitset16,
whereas it doesn't allow shrinking Node.flags any. However, Name has
some trailing padding bytes, so expanding Name.flags doesn't cost any
memory.

Passes toolstash-check.

Change-Id: I7775d713566a38d5b9723360b1659b79391744c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/200898
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-14 18:57:11 +00:00
Emmanuel T Odeke
9969c72080 net/http: fix Transport panic with nil Request.Header
For Go 1.13 we introduced Header.Clone and it returns
nil if a nil Header is cloned. Unfortunately, though,
this exported Header.Clone nil behavior differed from
the old Go 1.12 and earlier internal header clone
behavior which always returned non-nil Headers.
This CL fixes the places where that distinction mattered.

Fixes #34878

Change-Id: Id19dea2272948c8dd10883b18ea7f7b8b33ea8eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/200977
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-14 17:53:36 +00:00
Cuong Manh Le
dab199c9c1 cmd/compile: consistenly use CTxxx for works relate to Ctype
Passes toolstash-check

Change-Id: Iaeaf2575b9f492e45619007438c0138f9d22006c
Reviewed-on: https://go-review.googlesource.com/c/go/+/200959
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-14 17:44:32 +00:00
Agniva De Sarker
902d5aa84f cmd/go/internal/work: fix error while passing custom vet tool
For GOROOT packages, we were adding -unsafeptr=false to prevent unsafe.Pointer
checks. But the flag also got passed to invocations of go vet with a custom
vet tool. To prevent this from happening, we add this flag only when no
tools are passed.

Fixes #34053

Change-Id: I8bcd637fd8ec423d597fcdab2a0ceedd20786019
Reviewed-on: https://go-review.googlesource.com/c/go/+/200957
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-14 14:45:59 +00:00
Tobias Klauser
c72199482f internal/syscall/unix: remove unused *Trap consts
These are unused since the darwin port switched to libc calls in
CL 148457.

Change-Id: I309bb5b0a52c9069484e7a649d4a652efcb8e160
Reviewed-on: https://go-review.googlesource.com/c/go/+/200866
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-14 07:02:02 +00:00
Matthew Dempsky
46be01f4e0 cmd/compile: remove Addable flag
This flag is supposed to indicate whether the expression is
"addressable"; but in practice, we infer this from other
attributes about the expression (e.g., n.Op and n.Class()).

Passes toolstash-check.

Change-Id: I19352ca07ab5646e232d98e8a7c1c9aec822ddd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/200897
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-13 01:48:30 +00:00
Matthew Dempsky
9f4fb68152 cmd/compile: remove PDISCARD class
This pseudo-Class was previously used by the importer code to optimize
processing duplicate inline bodies, since we didn't actually care
about the declarations in those contexts.

This functionality is no longer needed with indexed exports, since we
now only process function bodies as needed (and never more than once).

Passes toolstash-check.

Change-Id: I7eab0cb16925ab777079c2a20731dbcfd63cf195
Reviewed-on: https://go-review.googlesource.com/c/go/+/200899
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-13 01:47:43 +00:00
Giovanni Bajo
e49ecaaa0a runtime: adjust expected error threshold in TestSelectFairness
Make it a bit more relaxed on the expected fairness, as fastrand()
isn't a truly perfect random number generator.

Fixes #34808

Change-Id: Ib55b2bbe3c1bf63fb4f446fd1291eb1236efc33b
Reviewed-on: https://go-review.googlesource.com/c/go/+/200857
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-12 16:38:27 +00:00
Meng Zhuo
592d304bdc net: use case-insensitive host string comparison in TestLookup*
Some nameservers alter the case of records as they return, e.g
.google.COM or .Google.com.
However according to RFC4343, DNS name should be treated in case insensitive fashion.
This CL will fix case sensitive testcases.

Fixes #34781

Change-Id: I5f9f6a41ddc1c61993e8d1f934ef0febddc3adc1
Reviewed-on: https://go-review.googlesource.com/c/go/+/200277
Reviewed-by: Andrei Tudor Călin <mail@acln.ro>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-12 14:04:38 +00:00
zdjones
3c56eb4083 cmd/compile: make poset use sufficient conditions for OrderedOrEqual
When assessing whether A <= B, the poset's OrderedOrEqual has a passing
condition which permits A <= B, but is not sufficient to infer that A <= B.
This CL removes that incorrect passing condition.

Having identified that A and B are in the poset, the method will report that
A <= B if any of these three conditions are true:
 (1) A and B are the same node in the poset.
 	- This means we know that A == B.
 (2) There is a directed path, strict or not, from A -> B
 	- This means we know that, at least, A <= B, but A < B is possible.
 (3) There is a directed path from B -> A, AND that path has no strict edges.
 	- This means we know that B <= A, but do not know that B < A.

In condition (3), we do not have enough information to say that A <= B, rather
we only know that B == A (which satisfies A <= B) is possible. The way I
understand it, a strict edge shows a known, strictly-ordered relation (<) but
the lack of a strict edge does not show the lack of a strictly-ordered relation.

The difference is highlighted by the example in #34802, where a bounds check is
incorrectly removed by prove, such that negative indexes into a slice
succeed:

	n := make([]int, 1)
	for i := -1; i <= 0; i++ {
	    fmt.Printf("i is %d\n", i)
	    n[i] = 1  // No Bounds check, program runs, assignment to n[-1] succeeds!!
	}

When prove is checking the negative/failed branch from the bounds check at n[i],
in the signed domain we learn (0 > i || i >= len(n)). Because prove can't learn
the OR condition, we check whether we know that i is non-negative so we can
learn something, namely that i >= len(n). Prove uses the poset to check whether
we know that i is non-negative.  At this point the poset holds the following
relations as a directed graph:

	-1 <= i <= 0
	-1 < 0

In poset.OrderedOrEqual, we are testing for 0 <= i. In this case, condition (3)
above is true because there is a non-strict path from i -> 0, and that path
does NOT have any strict edges. Because this condition is true, the poset
reports to prove that i is known to be >= 0. Knowing, incorrectly, that i >= 0,
prove learns from the failed bounds check that i >= len(n) in the signed domain.

When the slice, n, was created, prove learned that len(n) == 1. Because i is
also the induction variable for the loop, upon entering the loop, prove previously
learned that i is in [-1,0]. So when prove attempts to learn from the failed
bounds check, it finds the new fact, i > len(n), unsatisfiable given that it
previously learned that i <= 0 and len(n) = 1.

Fixes #34802

Change-Id: I235f4224bef97700c3aa5c01edcc595eb9f13afc
Reviewed-on: https://go-review.googlesource.com/c/go/+/200759
Run-TryBot: Zach Jones <zachj1@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Giovanni Bajo <rasky@develer.com>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-12 09:17:14 +00:00
Cuong Manh Le
e79c23822c cmd/compile: move OAS2 to its own case in order
Change-Id: Id0f4955588ae8027a24465b456c90d0543d60db2
Reviewed-on: https://go-review.googlesource.com/c/go/+/200581
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-10-12 08:01:10 +00:00
Cuong Manh Le
ba6aeb6ce8 cmd/compile: simplify OAS2XXX nodes handle in order
Passes toolstash-check.

Updates #23017

Change-Id: I0ae82e28a6e9e732ba2a6aa98f9b35551efcea10
Reviewed-on: https://go-review.googlesource.com/c/go/+/200580
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-10-12 08:00:25 +00:00
Ian Lance Taylor
54abb5ff86 net/mail: fix new test for systems with different zoneinfo data
Fixes #34854

Change-Id: I7d6819c439e2fdfb19e181b202797fd5851eb002
Reviewed-on: https://go-review.googlesource.com/c/go/+/200839
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-11 23:48:10 +00:00
Jerrin Shaji George
2df5cdbadf runtime: make nanotime use monotonic clock in Solaris
nanotime() currently uses the REALTIME clock to get the elapsed
time in Solaris. This commit changes it to use the MONOTONIC clock
instead, similar to how it's done in Linux and other OSs. Also changed
nanotime() and walltime() to call clock_gettime() library function
directly from Go code rather than from assembly.

Fixes #33674

Change-Id: Ie4a687b17d2140998ecd97af6ce048c86cf5fc02
Reviewed-on: https://go-review.googlesource.com/c/go/+/199502
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2019-10-11 20:01:28 +00:00
Ian Lance Taylor
c1ccae4d14 os: deflake TestFdReadRace by increasing timeout
This timeout will never be reached if the test passes, so it doesn't
much matter how long it is. The test is t.Parallel so on a slow system
1 second may occasionally not be enough, although on my laptop the
test takes about 0.02 seconds.

Fixes #34431

Change-Id: Ia2184e6be3747933bfe83aa6c8e1f77e6b1e0bba
Reviewed-on: https://go-review.googlesource.com/c/go/+/200764
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-11 19:58:27 +00:00
Ian Lance Taylor
fd33b2c974 runtime: when disabling SIGPROF handler, ignore SIGPROF
If the runtime disables the SIGPROF handler, because this is Go code
that is linked into a non-Go program, then don't go back to the
default handling of SIGPROF; just start ignoring SIGPROF.
Otherwise the program can get killed by a stray SIGPROF that is
delivered, presumably to a different thread, after profiling is disabled.

Fixes #19320

Change-Id: Ifebae477d726699c8c82c867604b73110c1cf262
Reviewed-on: https://go-review.googlesource.com/c/go/+/200740
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-11 19:57:32 +00:00
Ariel Mashraki
33fac9bad8 cmd/compile/internal/gc: preallocate slices in noder
The slice capacity is known for all these cases. Therefore,
we can initialize them with the desired capacity.

Change-Id: I1835b49108d157203d62e4aa119c2d7ab5e5e46f
Reviewed-on: https://go-review.googlesource.com/c/go/+/200119
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-11 18:56:30 +00:00
Bryan C. Mills
0e3e46f0d7 cmd/go/internal/get: simplify scheme lookup
Fixes #26123

Change-Id: If0dad65a3885d2146624f2aac42099e9eca9670e
Reviewed-on: https://go-review.googlesource.com/c/go/+/200758
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-11 18:31:46 +00:00
Jay Conrod
78d67164bb cmd/go: integrate changes made in x/mod packages into internal packages
This change integrates changes made to x/mod packages into our internal
copies of those packages.

This is the first step of a bidirectional synchronization. A follow-up
change will copy changes made to the internal packages after x/mod was
forked. After that, we can vendor x/mod, update imports, and delete
the internal copies.

The following packages are affected:

* internal/module
* internal/semver (no change)
* internal/sumweb (renamed to internal/sumdb)
* internal/dirhash
* internal/note
* internal/tlog

Several integrated changes affect other packages:

* cmd/go/internal/module.MatchPathMajor now wraps a new function,
  CheckPathMajor, which returns error. MatchPathMajor returns
  bool. This will avoid an incompatible change in the next step.
* module.EncodePath renamed to EscapePath, EncodeVersion to
  EscapeVersion, DecodePath to UnescapePath, DecodeVersion to
  UnescapeVersion.
* cmd/go/internal/sumweb moved to cmd/go/internal/sumdb and package
  renamed to sumdb.
* sumdb.Client renamed to ClientOps, Conn to Client, Server to
  ServerOps, Paths to ServerPaths.
* sumdb/encode.go and encode_test.go are not present in x/mod since
  they are redundant with functionality in module. Both files are
  deleted.
* sumdb.TestServer doesn't implement sumdb.ServerOps after changes
  were were made to golang.org/x/mod/sumdb.ServerOps during the fork.
  Local changes made so tests will pass. These will be copied to x/mod
  in the next step.

Updates #34801

Change-Id: I7e820f10ae0cdbec238e59d039e978fd1cdc7201
Reviewed-on: https://go-review.googlesource.com/c/go/+/200138
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-11 18:16:37 +00:00
Richard Musiol
2686e74948 runtime: make goroutine for wasm async events short-lived
An extra goroutine is necessary to handle asynchronous events on wasm.
However, we do not want this goroutine to exist all the time.
This change makes it short-lived, so it ends after the asynchronous
event was handled.

Fixes #34768

Change-Id: I24626ff0af9d803a01ebe33fbb584d04d2059a44
Reviewed-on: https://go-review.googlesource.com/c/go/+/200497
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-11 18:09:33 +00:00
Ian Lance Taylor
426bfbe9a3 runtime: move sighandler into signal_unix.go
We couldn't do this before because sighandler was compiled for nacl.

Updates #30439

Change-Id: Ieec9938b6a1796c48d251cd8b1db1a42c25f3943
Reviewed-on: https://go-review.googlesource.com/c/go/+/200739
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-11 17:28:42 +00:00
Alex Buchanan
df380693f3 mime/multipart: add Part.NextRawPart to avoid QP decoding
NextPart has automatic handling of quoted-printable encoding,
which is sometimes undesirable. NextRawPart adds a method
for reading a part while bypassing such automatic handling.

Fixes #29090

Change-Id: I6a042a4077c64091efa3f5dbecce0d9a34ac7065
Reviewed-on: https://go-review.googlesource.com/c/go/+/152877
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-11 17:03:37 +00:00
Constantin Konstantinidis
a08cb9f473 net/mail: added support to trailing CFWS in date
RFC 5322 date format allows CFWS after the timezone.
If CFWS is valid, it is discarded and parsing is done as before
using time.Parse().
Existing test is extended with limit cases and invalid strings.

Fixes #22661

Change-Id: I54b96d7bc384b751962a76690e7e4786217a7941
Reviewed-on: https://go-review.googlesource.com/c/go/+/117596
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-11 16:35:39 +00:00
Francesco Renzi
ba108c93b8 encoding/json: add Decoder.InputOffset for offset access
This makes Decoder.offset public while renaming it to
Decoder.InputOffset to match encoding/xml Decoder API

Code changes made by Adam Stankiewicz [sheerun@sher.pl]

Fixes #29688

Change-Id: I86dbfd2b2da80160846e92bfa580c53d8d45e2db
Reviewed-on: https://go-review.googlesource.com/c/go/+/200677
Run-TryBot: Johan Brandhorst <johan.brandhorst@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-11 16:34:01 +00:00
Michael Munday
ac8966aa58 cmd/compile/internal/ssa: fix block AuxIntType lookup
Avoid an out-of-range error when calling LongString on a generic
block.

Change-Id: I33ca88940d899bc71e3155bc63d2aa925cf83230
Reviewed-on: https://go-review.googlesource.com/c/go/+/200737
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2019-10-11 16:30:20 +00:00
fenos
2ac8f799d8 crypto/tls: consistently use %v for error formatting
We should keep a consistent way of formatting errors
in this file.

Fixes #34848

Change-Id: Ibb75908504f381fccab0281a42e788ef8c716b6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/200679
Run-TryBot: Johan Brandhorst <johan.brandhorst@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2019-10-11 14:23:52 +00:00
davidsbond
b421b85841 errors: fix typo in TODO comment
Fixes #34846
Change-Id: I24b3e65fc96ec85b2821480e9396c9d1663611c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/200678
Run-TryBot: Johan Brandhorst <johan.brandhorst@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Johan Brandhorst <johan.brandhorst@gmail.com>
2019-10-11 13:33:01 +00:00
Bryan C. Mills
d189bdd684 internal/reflectlite: skip TestMirrorWithReflect reflect package source is unavailable
Fixes #34847

Change-Id: Ibb58c8820cdab8b9f3755fcfba754ad0c9ca982f
Reviewed-on: https://go-review.googlesource.com/c/go/+/200657
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Elias Naur <mail@eliasnaur.com>
2019-10-11 13:25:59 +00:00
Agniva De Sarker
d0f10a6e68 runtime,internal/bytealg: optimize wasmZero, wasmMove, Compare
Coalesce set/get pairs into a tee.

Change-Id: I88ccdcb148465615437bebf24145e941a037e0a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/200357
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-11 04:00:35 +00:00
Brad Fitzpatrick
03ef105dae all: remove nacl (part 3, more amd64p32)
Part 1: CL 199499 (GOOS nacl)
Part 2: CL 200077 (amd64p32 files, toolchain)
Part 3: stuff that arguably should've been part of Part 2, but I forgot
        one of my grep patterns when splitting the original CL up into
        two parts.

This one might also have interesting stuff to resurrect for any future
x32 ABI support.

Updates #30439

Change-Id: I2b4143374a253a003666f3c69e776b7e456bdb9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/200318
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-10 22:38:38 +00:00
alan
26ff21d44d runtime: remove no-op pointer writes in treap rotations
Change-Id: If5a272f331fe9da09467efedd0231a4ce34db0f8
GitHub-Last-Rev: 4b81a79a92
GitHub-Pull-Request: golang/go#28420
Reviewed-on: https://go-review.googlesource.com/c/go/+/144999
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2019-10-10 19:24:35 +00:00
Jay Conrod
68395a66f9 cmd/go: forbid module pattern 'all' when outside a module
Also, in cmd/doc, avoid calling 'go list -m all' when in module mode
outside a module since it's now an error.

Fixes #32027

Change-Id: I7224c7fdf7e950bce6c058ab2a5837c27ba3b899
Reviewed-on: https://go-review.googlesource.com/c/go/+/200297
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-10 19:07:50 +00:00
Jeremy Faller
46b7557836 cmd/compile: walk progs to generate debug_lines data
Walking the progs is simpler than using the is_stmt symbol shenanigans.
This is a reinstatement of CL 196661, which was rolled back due to tests
failing. Unlike that original CL, this change should output the same
debug_lines data the original approach wrote.

The stats for JUST this CLC, note teh small speedup in compilation, and
the lack of difference in binary size.

name                      old time/op       new time/op       delta
Template                        229ms ± 4%        218ms ± 1%  -4.95%  (p=0.000 n=10+8)
Unicode                        92.6ms ± 9%       88.6ms ±13%    ~     (p=0.089 n=10+10)
GoTypes                         850ms ± 2%        831ms ± 4%  -2.23%  (p=0.009 n=10+10)
Compiler                        3.99s ± 1%        3.93s ± 1%  -1.29%  (p=0.000 n=10+9)
SSA                             13.7s ± 1%        13.7s ± 1%    ~     (p=0.912 n=10+10)
Flate                           140ms ± 3%        138ms ± 3%  -1.90%  (p=0.009 n=10+10)
GoParser                        172ms ± 2%        169ms ± 4%    ~     (p=0.095 n=9+10)
Reflect                         530ms ± 3%        516ms ± 5%    ~     (p=0.052 n=10+10)
Tar                             202ms ± 1%        196ms ± 3%  -2.83%  (p=0.002 n=9+10)
XML                             280ms ± 3%        270ms ± 4%  -3.48%  (p=0.009 n=10+10)
LinkCompiler                    927ms ± 2%        907ms ± 4%    ~     (p=0.052 n=10+10)
ExternalLinkCompiler            1.97s ± 2%        1.97s ± 3%    ~     (p=0.853 n=10+10)
LinkWithoutDebugCompiler        549ms ± 3%        543ms ± 5%    ~     (p=0.481 n=10+10)
StdCmd                          12.0s ± 1%        12.0s ± 1%    ~     (p=0.905 n=9+10)

name                      old user-time/op  new user-time/op  delta
Template                        372ms ±18%        344ms ±11%    ~     (p=0.190 n=10+10)
Unicode                         264ms ±23%        241ms ±43%    ~     (p=0.315 n=8+10)
GoTypes                         1.56s ±22%        1.68s ± 5%    ~     (p=0.237 n=10+8)
Compiler                        7.41s ± 2%        7.31s ± 3%    ~     (p=0.123 n=10+10)
SSA                             24.5s ± 2%        24.7s ± 1%    ~     (p=0.133 n=10+9)
Flate                           199ms ± 6%        188ms ±28%    ~     (p=0.353 n=10+10)
GoParser                        243ms ±11%        240ms ± 6%    ~     (p=0.968 n=10+9)
Reflect                         929ms ±21%        862ms ±35%    ~     (p=0.190 n=10+10)
Tar                             284ms ± 9%        296ms ±17%    ~     (p=0.497 n=9+10)
XML                             386ms ±21%        398ms ±28%    ~     (p=1.000 n=9+10)
LinkCompiler                    1.13s ± 9%        1.12s ± 8%    ~     (p=0.546 n=9+9)
ExternalLinkCompiler            2.37s ±15%        2.30s ± 9%    ~     (p=0.549 n=10+9)
LinkWithoutDebugCompiler        646ms ±10%        642ms ±13%    ~     (p=0.853 n=10+10)

name                      old alloc/op      new alloc/op      delta
Template                       36.5MB ± 0%       36.5MB ± 0%  -0.11%  (p=0.000 n=10+9)
Unicode                        28.5MB ± 0%       28.5MB ± 0%    ~     (p=0.190 n=10+10)
GoTypes                         121MB ± 0%        121MB ± 0%  -0.10%  (p=0.000 n=9+10)
Compiler                        549MB ± 0%        549MB ± 0%  -0.10%  (p=0.000 n=9+10)
SSA                            1.92GB ± 0%       1.92GB ± 0%  -0.13%  (p=0.000 n=10+10)
Flate                          23.0MB ± 0%       23.0MB ± 0%  -0.07%  (p=0.000 n=10+10)
GoParser                       27.9MB ± 0%       27.9MB ± 0%  -0.09%  (p=0.000 n=10+10)
Reflect                        77.9MB ± 0%       77.8MB ± 0%  -0.13%  (p=0.000 n=9+10)
Tar                            34.5MB ± 0%       34.4MB ± 0%  -0.09%  (p=0.000 n=10+10)
XML                            44.3MB ± 0%       44.3MB ± 0%  -0.08%  (p=0.000 n=10+10)
LinkCompiler                    229MB ± 0%        225MB ± 0%  -1.74%  (p=0.000 n=10+10)
ExternalLinkCompiler            233MB ± 0%        242MB ± 0%  +3.81%  (p=0.000 n=10+10)
LinkWithoutDebugCompiler        156MB ± 0%        152MB ± 0%  -2.29%  (p=0.000 n=10+9)

name                      old allocs/op     new allocs/op     delta
Template                         373k ± 0%         373k ± 0%  -0.21%  (p=0.000 n=10+10)
Unicode                          340k ± 0%         340k ± 0%  -0.04%  (p=0.000 n=10+10)
GoTypes                         1.33M ± 0%        1.33M ± 0%  -0.20%  (p=0.000 n=10+9)
Compiler                        5.39M ± 0%        5.38M ± 0%  -0.16%  (p=0.000 n=10+10)
SSA                             18.3M ± 0%        18.2M ± 0%  -0.15%  (p=0.000 n=10+10)
Flate                            235k ± 0%         234k ± 0%  -0.23%  (p=0.000 n=10+7)
GoParser                         309k ± 0%         308k ± 0%  -0.20%  (p=0.000 n=10+10)
Reflect                          970k ± 0%         968k ± 0%  -0.30%  (p=0.000 n=10+10)
Tar                              347k ± 0%         347k ± 0%  -0.22%  (p=0.000 n=10+10)
XML                              425k ± 0%         424k ± 0%  -0.16%  (p=0.000 n=10+10)
LinkCompiler                     602k ± 0%         601k ± 0%  -0.03%  (p=0.000 n=9+10)
ExternalLinkCompiler            1.65M ± 0%        1.65M ± 0%  -0.02%  (p=0.000 n=10+10)
LinkWithoutDebugCompiler         220k ± 0%         220k ± 0%  -0.03%  (p=0.016 n=10+9)

name                      old object-bytes  new object-bytes  delta
Template                        553kB ± 0%        553kB ± 0%  -0.01%  (p=0.000 n=10+10)
Unicode                         215kB ± 0%        215kB ± 0%    ~     (all equal)
GoTypes                        2.02MB ± 0%       2.02MB ± 0%  -0.00%  (p=0.000 n=10+10)
Compiler                       7.98MB ± 0%       7.98MB ± 0%  -0.01%  (p=0.000 n=10+10)
SSA                            27.1MB ± 0%       27.1MB ± 0%  -0.00%  (p=0.000 n=10+10)
Flate                           340kB ± 0%        340kB ± 0%  -0.01%  (p=0.000 n=10+10)
GoParser                        434kB ± 0%        434kB ± 0%  -0.00%  (p=0.000 n=10+10)
Reflect                        1.34MB ± 0%       1.34MB ± 0%  -0.01%  (p=0.000 n=10+10)
Tar                             479kB ± 0%        479kB ± 0%  -0.00%  (p=0.000 n=10+10)
XML                             618kB ± 0%        618kB ± 0%  -0.01%  (p=0.000 n=10+10)

name                      old export-bytes  new export-bytes  delta
Template                       20.4kB ± 0%       20.4kB ± 0%    ~     (all equal)
Unicode                        8.21kB ± 0%       8.21kB ± 0%    ~     (all equal)
GoTypes                        36.6kB ± 0%       36.6kB ± 0%    ~     (all equal)
Compiler                        116kB ± 0%        116kB ± 0%  +0.00%  (p=0.000 n=10+10)
SSA                             141kB ± 0%        141kB ± 0%  +0.00%  (p=0.000 n=10+10)
Flate                          5.10kB ± 0%       5.10kB ± 0%    ~     (all equal)
GoParser                       8.92kB ± 0%       8.92kB ± 0%    ~     (all equal)
Reflect                        11.8kB ± 0%       11.8kB ± 0%    ~     (all equal)
Tar                            10.9kB ± 0%       10.9kB ± 0%    ~     (all equal)
XML                            17.4kB ± 0%       17.4kB ± 0%    ~     (all equal)

name                      old text-bytes    new text-bytes    delta
HelloSize                       742kB ± 0%        742kB ± 0%    ~     (all equal)
CmdGoSize                      10.6MB ± 0%       10.6MB ± 0%    ~     (all equal)

name                      old data-bytes    new data-bytes    delta
HelloSize                      10.7kB ± 0%       10.7kB ± 0%    ~     (all equal)
CmdGoSize                       312kB ± 0%        312kB ± 0%    ~     (all equal)

name                      old bss-bytes     new bss-bytes     delta
HelloSize                       122kB ± 0%        122kB ± 0%    ~     (all equal)
CmdGoSize                       146kB ± 0%        146kB ± 0%    ~     (all equal)

name                      old exe-bytes     new exe-bytes     delta
HelloSize                      1.10MB ± 0%       1.10MB ± 0%    ~     (all equal)
CmdGoSize                      14.9MB ± 0%       14.9MB ± 0%  -0.03%  (p=0.000 n=10+10)

Change-Id: Ie078a42b29353b96654fa1f0f47d600b5a53762d
Reviewed-on: https://go-review.googlesource.com/c/go/+/200017
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-10 13:56:58 +00:00
Cuong Manh Le
fb9af8411e encoding/json: support TextUnmarshaler for map keys with string underlying types
When unmarshaling to a map, the map's key type must either be a string,
an integer, or implement encoding.TextUnmarshaler. But for a user
defined type, reflect.Kind will not distinguish between the static type
and the underlying type. In:

	var x MyString = "x"
	t := reflect.TypeOf(x)
	println(t.Kind() == reflect.String)

the Kind of x is still reflect.String, even though the static type of x
is MyString.

Moreover, checking for the map's key type is a string occurs first, so
even if the map key type MyString implements encoding.TextUnmarshaler,
it will be ignored.

To fix the bug, check for encoding.TextUnmarshaler first.

Fixes #34437

Change-Id: I780e0b084575e1dddfbb433fe03857adf71d05fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/200237
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2019-10-10 12:59:11 +00:00
Tom Thorogood
900ebcfe4d encoding/json: stop escaping U+2028 and U+2029 in Compact
Compact has been inconsistently escaping only some problematic characters
(U+2028 and U+2029), but not others (<, > and &). This change addresses
this inconsistency by removing the escaping of U+2028 and U+2029.

Callers who need to escape the output of Compact should use HTMLEscape
which escapes <, >, &, U+2028 and U+2029.

Fixes #34070
Fixes #30357
Updates #5836

Change-Id: Icfce7691d2b8b1d9b05ba7b64d2d1e4f3b67871b
GitHub-Last-Rev: 38859fe3e2
GitHub-Pull-Request: golang/go#34804
Reviewed-on: https://go-review.googlesource.com/c/go/+/200217
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-10 11:31:54 +00:00
Jay Conrod
3322f3e0ce cmd/go: forbid resolving import to modules when outside of a module
When in module mode outside of any module, 'go build' and most other
commands will now report an error instead of resolving a package path
to a module.

Previously, most commands would attempt to find the latest version of
a module providing the package. This could be very slow if many
packages needed to be resolved this way. Since there is no go.mod file
where module requirements can be saved, it's a repeatedly slow and
confusing experience.

After this change, 'go build' and other commands may still be used
outside of a module on packages in std and source files (.go
arguments) that only import packages in std. Listing any other package
on the command line or importing a package outside std will cause an
error.

'go get' is exempted from the new behavior, since it's expected that
'go get' resolves paths to modules at new versions.

Updates #32027

Change-Id: Ia9d3a3b4ad738ca5423472e17818d62b96a2c959
Reviewed-on: https://go-review.googlesource.com/c/go/+/198778
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-09 23:03:55 +00:00
Jay Conrod
aa09e751ff cmd/doc: show original import error when package cannot be found
Updates #34669

Change-Id: I8d0ee68885e804e131f42a512080486f9b25e9dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/199819
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-09 23:03:40 +00:00
Jay Conrod
99b9ee3e44 go/build: import packages in module mode when GO111MODULE is "on"
go/build.Import locates package dirctories using 'go list' when in
module mode (finding, downloading, and extracting modules is
complicated, so go/build does not handle it).

Previously, Import used 'go list' if GO111MODULE was not explicitly
off and a go.mod file was present (plus some other conditions). With
this change, if GO111MODULE is "on", a go.mod file does not need to be
present.

Fixes #34669

Change-Id: I9e56871054d4b07c3fc04b6f14a5c8c8e9f3c333
Reviewed-on: https://go-review.googlesource.com/c/go/+/199818
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-09 23:03:27 +00:00
Brad Fitzpatrick
07b4abd62e all: remove the nacl port (part 2, amd64p32 + toolchain)
This is part two if the nacl removal. Part 1 was CL 199499.

This CL removes amd64p32 support, which might be useful in the future
if we implement the x32 ABI. It also removes the nacl bits in the
toolchain, and some remaining nacl bits.

Updates #30439

Change-Id: I2475d5bb066d1b474e00e40d95b520e7c2e286e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/200077
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-09 22:34:34 +00:00
Jay Conrod
32b6eb80fc cmd/go: eliminate redundancy in import error messages
This change introduces a new interface, load.ImportPathError. An error
may satisfy this by providing an ImportPath method and including the
import path in its error text. modload.ImportMissingError satisfies
this interface. load.ImportErrorf also provides a convenient way to
create an error satisfying this interface with an arbitrary message.

When load.PackageError formats its error text, it may omit the last
path on the import stack if the wrapped error satisfies
ImportPathError and has a matching path.

To make this work, PackageError.Err is now an error instead of a
string. PackageError.MarshalJSON will write Err as a string for
'go list -json' output.

When go/build.Import invokes 'go list' in module mode, it now runs
with '-e' and includes '.Error' in the output format instead of
expecting the error to be in the raw stderr text. If a package error
is printed and a directory was not found, the error will be returned
without extra decoration.

Fixes #34752

Change-Id: I2d81dab7dec19e0ae9f51f6412bc9f30433a8596
Reviewed-on: https://go-review.googlesource.com/c/go/+/199840
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-09 20:31:55 +00:00
Bryan C. Mills
b3104fe3af Revert "cmd/go: fail if a test binary exits with no output"
This reverts CL 184457.

Reason for revert: introduced failures in the regression test for #18153.

Fixes #34791
Updates #29062

Change-Id: I4040965163f809083c023be055e69b1149d6214e
Reviewed-on: https://go-review.googlesource.com/c/go/+/200106
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-09 20:30:46 +00:00
Jason A. Donenfeld
4c7a8d63e4 cmd/go/internal/modfile: remove preceding empty lines when setting require
When rewriting a go.mod file, we currently sort all of the require
lines in a block. The way the parser works is that it considers
preceding blank lines to be empty comment lines, and preceding empty
comment lines are "owned" by their adjoining line. So when we go to sort
them, the empty lines follow around each sorted entry, which doesn't
make a whole lot of sense, since usually vertical space is inserted to
show sections, and if things get moved around by sorting, those sections
are no longer meaningful. This all results in one especially troublesome
edge case: blank lines between a block opening ("require (") and the
first block line ("golang.org/x/sys ...") are not treated the same way
and are rewritten out of existence.

Here's an example of the behavior this fixes.

Starting input file:

    require (
        golang.zx2c4.com/wireguard master

        golang.org/x/crypto latest
        golang.org/x/net latest
        golang.org/x/sys latest
        golang.org/x/text latest

        github.com/lxn/walk latest
        github.com/lxn/win latest
    )

Now we run this through `GOPROXY=direct go get -d`:

    require (

        github.com/lxn/walk v0.0.0-20190619151032-86d8802c197a
        github.com/lxn/win v0.0.0-20190716185335-d1d36f0e4f48

        golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586
        golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7
        golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a
        golang.org/x/text v0.3.2
        golang.zx2c4.com/wireguard v0.0.20190806-0.20190822065259-3cedc22d7b49
    )

Notice how the blank lines before lxn/walk and x/crypto were preserved.

Finally, we have this be rewritten yet again with a call to `go build`:

    require (
        github.com/lxn/walk v0.0.0-20190619151032-86d8802c197a
        github.com/lxn/win v0.0.0-20190716185335-d1d36f0e4f48

        golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586
        golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7
        golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a
        golang.org/x/text v0.3.2
        golang.zx2c4.com/wireguard v0.0.20190806-0.20190822065259-3cedc22d7b49
    )

In this final resting point, the first blank line has been removed.

The discrepancy between those two last stages are especially bothersome,
because it makes for lots of dirty git commits and file contents
bouncing back and forth.

This commit fixes the problem as mentioned above, getting rid of those
preceding blank lines. The output in all cases looks as it should, like
this:

    require (
        github.com/lxn/walk v0.0.0-20190619151032-86d8802c197a
        github.com/lxn/win v0.0.0-20190716185335-d1d36f0e4f48
        golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586
        golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7
        golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a
        golang.org/x/text v0.3.2
        golang.zx2c4.com/wireguard v0.0.20190806-0.20190822065259-3cedc22d7b49
    )

Fixes #33779

Change-Id: I11c894440bd35f343ee62db3e06a50fa871f2599
Reviewed-on: https://go-review.googlesource.com/c/go/+/199917
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-09 20:20:45 +00:00
Emmanuel T Odeke
829fae3b5e net/http: update bundled x/net/http2
Updates x/net/http2 to git rev d66e71096ffb9f08f36d9aefcae80ce319de6d68

    http2: end stream eagerly after sending the request body
    https://golang.org/cl/181157 (fixes #32254)

    all: fix typos
    https://golang.org/cl/193799

    http2: fix memory leak in random write scheduler
    https://golang.org/cl/198462 (fixes #33812)

    http2: do not sniff body if Content-Encoding is set
    https://golang.org/cl/199841 (updates #31753)

Also unskips tests from CL 199799.

Change-Id: I241c0b1cd18cad5041485be92809137a973e33bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/200102
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-09 20:09:29 +00:00
Emmanuel T Odeke
e24a628ab1 net/http: do not sniff response if Content-Encoding header is set
Fixes #31753

Change-Id: I32ec5906ef6714e19b094f67cb0f10a211a9c500
Reviewed-on: https://go-review.googlesource.com/c/go/+/199799
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-09 19:49:39 +00:00
Bryan C. Mills
6cba4dbf80 cmd/go/internal/list: disallow 'list -m' with '-mod=vendor'
Updates #33848

Change-Id: I81663386297282397ce1b546a8b15597bfbcea78
Reviewed-on: https://go-review.googlesource.com/c/go/+/199821
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-09 18:39:22 +00:00
Bryan C. Mills
1736f3a126 cmd/go: automatically check and use vendored packages
This implements the proposal described in
https://golang.org/issue/33848#issuecomment-537222782.

Fixes #33848

Change-Id: Ia34d6500ca396b6aa644b920233716c6b83ef729
Reviewed-on: https://go-review.googlesource.com/c/go/+/198319
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-09 18:12:31 +00:00
Jay Conrod
dae8e71961 cmd/go: document multiple conditions in TestScript
This functionality already exists but was undocumented. Related to
comments in CL 198797.

Change-Id: Icce40bd7c362423e6ed9c20673ce3de1311e5fd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/200040
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-09 17:56:48 +00:00
Daniel Martí
1fba10c999 cmd/go: fail if a test binary exits with no output
For example, if a test calls os.Exit(0), that could trick a 'go test'
run into not running some of the other tests, and thinking that they all
succeeded. This can easily go unnoticed and cause developers headaches.

Add a simple sanity check as part of 'go test': if the test binary
succeeds and doesn't print anything, we should error, as something
clearly went very wrong.

This is done by inspecting each of the stdout writes from the spawned
process, since we don't want to read the entirety of the output into a
buffer. We need to introduce a "buffered" bool var, as there's now an
io.Writer layer between cmd.Stdout and &buf.

A few TestMain funcs in the standard library needed fixing, as they
returned without printing anything as a means to skip testing the entire
package. For that purpose add testenv.MainMust, which prints a warning
and prints SKIP, similar to when -run matches no tests.

Finally, add tests for both os.Exit(0) and os.Exit(1), both as part of
TestMain and as part of a single test, and test that the various stdout
modes still do the right thing.

Fixes #29062.

Change-Id: Ic6f8ef3387dfc64e4cd3e8f903d7ca5f5f38d397
Reviewed-on: https://go-review.googlesource.com/c/go/+/184457
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-09 15:07:29 +00:00
Michael Munday
38c4a73706 cmd/asm: add s390x branch-on-count instructions
The branch-on-count instructions on s390x decrement the input
register and then compare its value to 0. If not equal the branch
is taken.

These instructions are useful for implementing loops with a set
number of iterations (which might be in a register).

For example, this for loop:

	for i := 0; i < n; i++ {
		... // i is not used or modified in the loop
	}

Could be implemented using this assembly:

	MOVD  Rn, Ri
loop:
	...
	BRCTG Ri, loop

Note that i will count down from n in the assembly whereas in the
original for loop it counted up to n which is why we can't use i
in the loop.

These instructions will only be used in hand-written codegen and
assembly for now since SSA blocks cannot currently modify values.
We could look into this in the future though.

Change-Id: Iaab93b8aa2699513b825439b8ea20d8fe2ea1ee6
Reviewed-on: https://go-review.googlesource.com/c/go/+/199977
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-09 15:04:59 +00:00
Michael Munday
ff86ce13b6 cmd/asm: fix element size encoding for VSUMQ instruction on s390x
The element size for VSUMQF and VSUMQG was off by one. Fix this
and add tests for VSUM* instruction encodings.

Change-Id: I6de2dabb383e5bc6f85eef1e0f106ba949c9030b
Reviewed-on: https://go-review.googlesource.com/c/go/+/199978
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-09 14:45:09 +00:00
Bryan C. Mills
421d35cf69 cmd/go: suppress more errors in package-to-module loading
In CL 197059, I suppressed errors if the target package was already found.
However, that does not cover the case of passing a '/v2' module path to
'go get' when the module does not contain a package at its root.

This CL is a minimal fix for that case, intended to be backportable to 1.13.

(Longer term, I intend to rework the version-validation check to treat
all mismatched paths as ErrNotExist.)

Fixes #34746
Updates #34383

Change-Id: Ia963c2ea00fae424812b8f46a4d6c2c668252147
Reviewed-on: https://go-review.googlesource.com/c/go/+/199839
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-09 14:16:09 +00:00
Elias Naur
0b204f958e go/build: allow ~ and ^ in #cgo directives for sr.ht import paths
Fixes #32260

Change-Id: Ib44ee33b8143d523875cf5a2bc5e36bf082801a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/199918
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-09 14:03:15 +00:00
Brad Fitzpatrick
a38a917aee all: remove the nacl port (part 1)
You were a useful port and you've served your purpose.
Thanks for all the play.

A subsequent CL will remove amd64p32 (including assembly files and
toolchain bits) and remaining bits. The amd64p32 removal will be
separated into its own CL in case we want to support the Linux x32 ABI
in the future and want our old amd64p32 support as a starting point.

Updates #30439

Change-Id: Ia3a0c7d49804adc87bf52a4dea7e3d3007f2b1cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/199499
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-09 06:14:44 +00:00
Matthew Dempsky
2197321db1 cmd/compile: split n.Noescape() into separate uses
n.Noescape() was overloaded for two uses: (1) to indicate a function
was annotated with //go:noescape, and (2) to indicate that certain
temporary allocations don't outlive the current statement.

The first use case is redundant with n.Func.Pragma&Noescape!=0, which
is the convention we use for checking other function-level pragmas.

The second use case is better served by renaming "Noescape" to
"Transient".

Passes toolstash-check.

Change-Id: I0f09d2d5767513894b7bf49da9cdabd04aa4a05e
Reviewed-on: https://go-review.googlesource.com/c/go/+/199822
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-08 23:53:55 +00:00
Robert Griesemer
5650a53dac go/types: don't skip defined types when reporting cycles
The newly introduced "late-stage" cycle detection for types
(https://golang.org/cl/196338/) "skips" named types on the
RHS of a type declaration when reporting a cycle. For instance,
for:

	type (
	   A B
	   B [10]C
	   C A
	)

the reported cycle is:

	illegal cycle in declaration of C
	       C refers to
	       C

because the underlying type of C resolves to [10]C (note that
cmd/compile does the same but simply says invalid recursive
type C).

This CL introduces the Named.orig field which always refers
to the RHS type in a type definition (and is never changed).
By using Named.orig rather than Named.underlying for the type
validity check, the cycle as written in the source code is
reported:

 	illegal cycle in declaration of A
 	       A refers to
 	       B refers to
 	       C refers to
 	       A

Fixes #34771.

Change-Id: I41e260ceb3f9a15da87ffae6a3921bd8280e2ac4
Reviewed-on: https://go-review.googlesource.com/c/go/+/199937
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-10-08 23:32:42 +00:00
Katie Hockman
ce83f41fed net/textproto: do not allow multi-line header field names
Fixes #34702

Change-Id: I98320d54726e646a310e583283ddab676c3503e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/199838
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-08 21:04:21 +00:00
Dan Peterson
ed7e43085e cmd/go: respect -mod flag in fmt
Fixes #27841

Change-Id: Ifcfd938aff8680cf7b44dfc09fde01d6105345a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/198257
Run-TryBot: Dan Peterson <dpiddy@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-08 19:19:46 +00:00
Davor Kapsa
decf9f6fef net/http: use err as error var in server.Serve
Change-Id: Icbf97d640fb26eed646f9e85c1f1c94b1469ca4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/199778
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-08 19:00:51 +00:00
Robert Griesemer
868de9a111 go/types: remove objSet type in favor of explicit map type (cleanup)
Avoid confusion between (now gone) objSet and objset types.
Also: rename visited -> seen in initorder.go.

No functional changes.

Change-Id: Ib0aa25e006eee55a79a739194d0d26190354a9f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/198044
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-10-08 17:30:14 +00:00
Robert Griesemer
c7d7042efc go/types: simplify some code and remove TODOs (cleanup)
- remove Checker.cycle in favor of using a "seen" map
- rename Checker.typeCycle -> Checker.cycle
- remove TODO in api.go since the API is frozen

Change-Id: I182a8215978dad54e9c6e79c21c5ec88ec802349
Reviewed-on: https://go-review.googlesource.com/c/go/+/198042
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-10-08 17:29:57 +00:00
Robert Griesemer
37a2290095 go/types: fix cycle detection
For Go 1.13, we rewrote the go/types cycle detection scheme. Unfortunately,
it was a bit too clever and introduced a bug (#34333). Here's an example:

type A struct {
	f1 *B
	f2 B
}

type B A

When type-checking this code, the first cycle A->*B->B->A (via field f1)
is ok because there's a pointer indirection. Though in the process B is
considered "type-checked" (and painted/marked from "grey" to black").
When type-checking f2, since B is already completely set up, go/types
doesn't complain about the invalid cycle A->B->A (via field f2) anymore.
On the other hand, with the fields f1, f2 swapped:

type A struct {
	f2 B
	f1 *B
}

go/types reports an error because the cycle A->B->A is type-checked first.
In general, we cannot know the "right" order in which types need to be
type-checked.

This CL fixes the issue as follows:

1) The global object path cycle detection does not take (pointer, function,
   reference type) indirections into account anymore for cycle detection.
   That mechanism was incorrect to start with and the primary cause for this
   issue. As a consequence we don't need Checker.indirectType and indir anymore.

2) After processing type declarations, Checker.validType is called to
   verify that a type doesn't expand indefinitively. This corresponds
   essentially to cmd/compile's dowidth computation (without size computation).

3) Cycles involving only defined types (e.g.: type (A B; B C; C A))
   require separate attention as those must now be detected when resolving
   "forward chains" of type declarations. Checker.underlying was changed
   to detect these cycles.

All three cycle detection mechanism use an object path ([]Object) to
report cycles. The cycle error reporting mechanism is now factored out
into Checker.cycleError and used by all three mechanisms. It also makes
an attempt to report the cycle starting with the "first" (earliest in the
source) object.

Fixes #34333.

Change-Id: I2c6446445e47344cc2cd034d3c74b1c345b8c1e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/196338
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-10-08 16:59:41 +00:00
Lynn Boger
816ff44479 cmd/compile: use vsx loads and stores for LoweredMove, LoweredZero on ppc64x
This improves the code generated for LoweredMove and LoweredZero by
using LXVD2X and STXVD2X to move 16 bytes at a time. These instructions
are now used if the size to be moved or zeroed is >= 64. These same
instructions have already been used in the asm implementations for
memmove and memclr.

Some examples where this shows an improvement on power8:

MakeSlice/Byte                                  27.3ns ± 1%     25.2ns ± 0%    -7.69%
MakeSlice/Int16                                 40.2ns ± 0%     35.2ns ± 0%   -12.39%
MakeSlice/Int                                   94.9ns ± 1%     77.9ns ± 0%   -17.92%
MakeSlice/Ptr                                    129ns ± 1%      103ns ± 0%   -20.16%
MakeSlice/Struct/24                              176ns ± 1%      131ns ± 0%   -25.67%
MakeSlice/Struct/32                              200ns ± 1%      142ns ± 0%   -29.09%
MakeSlice/Struct/40                              220ns ± 2%      156ns ± 0%   -28.82%
GrowSlice/Byte                                  81.4ns ± 0%     73.4ns ± 0%    -9.88%
GrowSlice/Int16                                  118ns ± 1%       98ns ± 0%   -17.03%
GrowSlice/Int                                    178ns ± 1%      134ns ± 1%   -24.65%
GrowSlice/Ptr                                    249ns ± 4%      212ns ± 0%   -14.94%
GrowSlice/Struct/24                              294ns ± 5%      215ns ± 0%   -27.08%
GrowSlice/Struct/32                              315ns ± 1%      248ns ± 0%   -21.49%
GrowSlice/Struct/40                              382ns ± 4%      289ns ± 1%   -24.38%
ExtendSlice/IntSlice                             109ns ± 1%       90ns ± 1%   -17.51%
ExtendSlice/PointerSlice                         142ns ± 2%      118ns ± 0%   -16.75%
ExtendSlice/NoGrow                              6.02ns ± 0%     5.88ns ± 0%    -2.33%
Append                                          27.2ns ± 0%     27.6ns ± 0%    +1.38%
AppendGrowByte                                  4.20ms ± 3%     2.60ms ± 0%   -38.18%
AppendGrowString                                 134ms ± 3%      102ms ± 2%   -23.62%
AppendSlice/1Bytes                              5.65ns ± 0%     5.67ns ± 0%    +0.35%
AppendSlice/4Bytes                              6.40ns ± 0%     6.55ns ± 0%    +2.34%
AppendSlice/7Bytes                              8.74ns ± 0%     8.84ns ± 0%    +1.14%
AppendSlice/8Bytes                              5.68ns ± 0%     5.70ns ± 0%    +0.40%
AppendSlice/15Bytes                             9.31ns ± 0%     9.39ns ± 0%    +0.86%
AppendSlice/16Bytes                             14.0ns ± 0%      5.8ns ± 0%   -58.32%
AppendSlice/32Bytes                             5.72ns ± 0%     5.68ns ± 0%    -0.66%
AppendSliceLarge/1024Bytes                       918ns ± 8%      615ns ± 1%   -33.00%
AppendSliceLarge/4096Bytes                      3.25µs ± 1%     1.92µs ± 1%   -40.84%
AppendSliceLarge/16384Bytes                     8.70µs ± 2%     4.69µs ± 0%   -46.08%
AppendSliceLarge/65536Bytes                     18.1µs ± 3%      7.9µs ± 0%   -56.30%
AppendSliceLarge/262144Bytes                    69.8µs ± 2%     25.9µs ± 0%   -62.91%
AppendSliceLarge/1048576Bytes                    258µs ± 1%       93µs ± 0%   -63.96%

Change-Id: I21625dbe231a2029ddb9f7d73f5a6417b35c1e49
Reviewed-on: https://go-review.googlesource.com/c/go/+/199639
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-08 16:41:02 +00:00
diaxu01
9ce5cad0aa cmd/internal/obj/arm64: add error checking for system registers.
This CL adds system register error checking test cases. There're two kinds of
error test cases:

1. illegal combination.
MRS should be used in this way: MRS <system register>, <general register>.
MSR should be used in this way: MSR <general register>, <system register>.
Error usage examples:
MRS     R8, VTCR_EL2    // ERROR "illegal combination"
MSR     VTCR_EL2, R8    // ERROR "illegal combination"

2. illegal read or write access.
Error usage examples:
MSR     R7, MIDR_EL1    // ERROR "expected writable system register or pstate"
MRS     OSLAR_EL1, R3   // ERROR "expected readable system register"

This CL reads system registers readable and writeable property to check whether
they're used with legal read or write access. This property is named AccessFlags
in sysRegEnc.go, and it is automatically generated by modifing the system register
generator.

Change-Id: Ic83d5f372de38d1ecd0df1ca56b354ee157f16b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/194917
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-08 16:20:53 +00:00
Tobias Klauser
d458b86836 cmd/compile: regenerate known formats in fmtmap_test.go
This fixes TestFormats after CL 198037

Change-Id: I3fb7d667f7c2a1fd88a320482310d33b75e068c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/199777
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-08 11:41:58 +00:00
Tobias Klauser
cedb561617 syscall: don't use deprecated syscalls on linux/arm64
Reimplement syscall wrappers for linux/arm64 in terms of supported
syscalls (or in case of Ustat make it return ENOSYS) and remove the
manually added SYS_* consts for the deprecated syscalls. Adapted from
golang.org/x/sys/unix where this is already done since CL 119655.

Change-Id: I94ab48a4645924df3822497d0575f1a1573d509f
Reviewed-on: https://go-review.googlesource.com/c/go/+/199140
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-08 10:45:48 +00:00
Michael Munday
6ec4c71eef cmd/compile: add SSA rules for s390x compare-and-branch instructions
This commit adds SSA rules for the s390x combined compare-and-branch
instructions. These have a shorter encoding than separate compare
and branch instructions and they also don't clobber the condition
code (a.k.a. flag register) reducing pressure on the flag allocator.

I have deleted the 'loop_test.go' file and replaced it with a new
codegen test which performs a wider range of checks.

Object sizes from compilebench:

name                      old object-bytes  new object-bytes  delta
Template                        562kB ± 0%        561kB ± 0%   -0.28%  (p=0.000 n=10+10)
Unicode                         217kB ± 0%        217kB ± 0%   -0.17%  (p=0.000 n=10+10)
GoTypes                        2.03MB ± 0%       2.02MB ± 0%   -0.59%  (p=0.000 n=10+10)
Compiler                       8.16MB ± 0%       8.11MB ± 0%   -0.62%  (p=0.000 n=10+10)
SSA                            27.4MB ± 0%       27.0MB ± 0%   -1.45%  (p=0.000 n=10+10)
Flate                           356kB ± 0%        356kB ± 0%   -0.12%  (p=0.000 n=10+10)
GoParser                        438kB ± 0%        436kB ± 0%   -0.51%  (p=0.000 n=10+10)
Reflect                        1.37MB ± 0%       1.37MB ± 0%   -0.42%  (p=0.000 n=10+10)
Tar                             485kB ± 0%        483kB ± 0%   -0.39%  (p=0.000 n=10+10)
XML                             630kB ± 0%        621kB ± 0%   -1.45%  (p=0.000 n=10+10)
[Geo mean]                     1.14MB            1.13MB        -0.60%

name                      old text-bytes    new text-bytes    delta
HelloSize                       763kB ± 0%        754kB ± 0%   -1.30%  (p=0.000 n=10+10)
CmdGoSize                      10.7MB ± 0%       10.6MB ± 0%   -0.91%  (p=0.000 n=10+10)
[Geo mean]                     2.86MB            2.82MB        -1.10%

Change-Id: Ibca55d9c0aa1254aee69433731ab5d26a43a7c18
Reviewed-on: https://go-review.googlesource.com/c/go/+/198037
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-08 10:03:04 +00:00
Cuong Manh Le
77f5adba55 cmd/compile: don't use statictmps for small object in slice literal
Fixes #21561

Change-Id: I89c59752060dd9570d17d73acbbaceaefce5d8ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/197560
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-08 06:09:26 +00:00
Richard Musiol
ecba83520d syscall: on wasm, do not panic if "process" global is not defined
When running wasm in the browser, the "process" global is not defined.
This causes functions like os.Getpid() to panic, which is unusual.
For example on Windows os.Getpid() returns -1 and does not panic.

This change adds a dummy polyfill for "process" which returns -1 or an
error. It also extends the polyfill for "fs".

Fixes #34627
Replaces CL 199357

Change-Id: Ifeb12fe7e152c517848933a9ab5f6f749896dcef
Reviewed-on: https://go-review.googlesource.com/c/go/+/199698
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-08 02:42:57 +00:00
David Chase
01ff213a51 cmd/compile: suppress statement marks on interior of switch tree
The lines on nodes within the IF-tree generated for switch
statements looks like control flow so the lines get marked
as statement boundaries.  Except for the first/root comparison,
explicitly disable the marks.

Change-Id: I64b966ed8e427cdc6b816ff6b6a2eb754346edc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/198738
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-07 22:17:41 +00:00
Matthew Dempsky
ab00f89c27 cmd/compile: remove useless block-indirection in type switch
Previously, when emitting type switches without an explicit "case nil"
clause, we would emit:

    if x == nil { goto Lnil }
    ...
    Lnil: goto Ldefault

But we can instead just emit:

    if x == nil { goto Ldefault }

Doesn't pass toolstash-check; seems like it causes some harmless
instruction scheduling changes.

Change-Id: Ie233dda26756911e93a08b3db40407ba38694c62
Reviewed-on: https://go-review.googlesource.com/c/go/+/199644
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-07 20:58:25 +00:00
Ben Schwartz
e1446d9cee runtime: speed up receive on empty closed channel
Currently, nonblocking receive on an open channel is about
700 times faster than nonblocking receive on a closed channel.
This change makes closed channels equally fast.

Fixes #32529

relevant benchstat output:
name                       old time/op    new time/op    delta
MakeChan/Byte-40            140ns ± 4%     137ns ± 7%   -2.38%  (p=0.023 n=17+19)
MakeChan/Int-40             174ns ± 5%     173ns ± 6%     ~     (p=0.437 n=18+19)
MakeChan/Ptr-40             315ns ±15%     301ns ±15%     ~     (p=0.051 n=20+20)
MakeChan/Struct/0-40        123ns ± 8%      99ns ±11%  -19.18%  (p=0.000 n=20+17)
MakeChan/Struct/32-40       297ns ± 8%     241ns ±18%  -19.13%  (p=0.000 n=20+20)
MakeChan/Struct/40-40       344ns ± 5%     273ns ±23%  -20.49%  (p=0.000 n=20+20)
ChanNonblocking-40         0.32ns ± 2%    0.32ns ± 2%   -1.25%  (p=0.000 n=19+18)
SelectUncontended-40       5.72ns ± 1%    5.71ns ± 2%     ~     (p=0.326 n=19+19)
SelectSyncContended-40     10.9µs ±10%    10.6µs ± 3%   -2.77%  (p=0.009 n=20+16)
SelectAsyncContended-40    1.00µs ± 0%    1.10µs ± 0%  +10.75%  (p=0.000 n=18+19)
SelectNonblock-40          1.22ns ± 2%    1.21ns ± 4%     ~     (p=0.141 n=18+19)
ChanUncontended-40          240ns ± 4%     233ns ± 4%   -2.82%  (p=0.000 n=20+20)
ChanContended-40           86.7µs ± 0%    82.7µs ± 0%   -4.64%  (p=0.000 n=20+19)
ChanSync-40                 294ns ± 7%     284ns ± 9%   -3.44%  (p=0.006 n=20+20)
ChanSyncWork-40            38.4µs ±19%    34.0µs ± 4%  -11.33%  (p=0.000 n=20+18)
ChanProdCons0-40           1.50µs ± 1%    1.63µs ± 0%   +8.53%  (p=0.000 n=19+19)
ChanProdCons10-40          1.17µs ± 0%    1.18µs ± 1%   +0.44%  (p=0.000 n=19+20)
ChanProdCons100-40          985ns ± 0%     959ns ± 1%   -2.64%  (p=0.000 n=20+20)
ChanProdConsWork0-40       1.50µs ± 0%    1.60µs ± 2%   +6.54%  (p=0.000 n=18+20)
ChanProdConsWork10-40      1.26µs ± 0%    1.26µs ± 2%   +0.40%  (p=0.015 n=20+19)
ChanProdConsWork100-40     1.27µs ± 0%    1.22µs ± 0%   -4.15%  (p=0.000 n=20+19)
SelectProdCons-40          1.50µs ± 1%    1.53µs ± 1%   +1.95%  (p=0.000 n=20+20)
ChanCreation-40            82.1ns ± 5%    81.6ns ± 7%     ~     (p=0.483 n=19+19)
ChanSem-40                  877ns ± 0%     719ns ± 0%  -17.98%  (p=0.000 n=18+19)
ChanPopular-40             1.75ms ± 2%    1.78ms ± 3%   +1.76%  (p=0.002 n=20+19)
ChanClosed-40               215ns ± 1%       0ns ± 6%  -99.82%  (p=0.000 n=20+18)

Change-Id: I6d5ca4f1530cc9e1a9f3ef553bbda3504a036448
Reviewed-on: https://go-review.googlesource.com/c/go/+/181543
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-07 20:58:04 +00:00
Matthew Dempsky
a0894ea5b5 cmd/compile: reimplement parameter leak encoding
Currently, escape analysis is able to record at most one dereference
when a parameter leaks to the heap; that is, at call sites, it can't
distinguish between any of these three functions:

    func x1(p ****int) { sink = *p }
    func x2(p ****int) { sink = **p }
    func x3(p ****int) { sink = ***p }

Similarly, it's limited to recording parameter leaks to only the first
4 parameters, and only up to 6 dereferences.

All of these limitations are due to the awkward encoding scheme used
at the moment.

This CL replaces the encoding scheme with a simple [8]uint8 array,
which can handle up to the first 7 parameters, and up to 254
dereferences, which ought to be enough for anyone. And if not, it's
much more easily increased.

Shrinks export data size geometric mean for Kubernetes by 0.07%.

Fixes #33981.

Change-Id: I10a94b9accac9a0c91490e0d6d458316f5ca1e13
Reviewed-on: https://go-review.googlesource.com/c/go/+/197680
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-07 18:50:14 +00:00
Matthew Dempsky
05a805a6de cmd/compile: introduce EscLeaks abstraction
This CL better abstracts away the parameter leak info that was
directly encoded into the uint16 value. Followup CL will rewrite the
implementation.

Passes toolstash-check.

Updates #33981.

Change-Id: I27f81d26f5dd2d85f5b0e5250ca529819a1f11c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/197679
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-07 18:49:53 +00:00
Richard Musiol
1c8e6077f6 runtime: do not omit stack trace of goroutine that handles async events
On wasm there is a special goroutine that handles asynchronous events.
Blocking this goroutine often causes a deadlock. However, the stack
trace of this goroutine was omitted when printing the deadlock error.

This change adds an exception so the goroutine is not considered as
an internal system goroutine and the stack trace gets printed, which
helps with debugging the deadlock.

Updates #32764

Change-Id: Icc8f5ba3ca5a485d557b7bdd76bf2f1ffb92eb3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/199537
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-07 18:13:27 +00:00
Richard Musiol
30521d5126 cmd/link: produce valid binaries with large data section on wasm
CL 170950 had a regression that makes the compiler produce
an invalid wasm binary if the data section is too large.
Loading such a binary gives the following error:
"LinkError: WebAssembly.instantiate(): data segment is out of bounds"

This change fixes the issue by ensuring that the minimum size of the
linear memory is larger than the end of the data section.

Fixes #34395.

Change-Id: I0c8629de7ffd0d85895ad31bf8c9d45fef197a57
Reviewed-on: https://go-review.googlesource.com/c/go/+/199358
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-07 18:09:29 +00:00
Keith Randall
30da79d958 cmd/compile: improve write barrier removal
We're allowed to remove a write barrier when both the old
value in memory and the new value we're writing are not heap pointers.

Improve both those checks a little bit.

A pointer is known to not be a heap pointer if it is read from
read-only memory. This sometimes happens for loads of pointers
from string constants in read-only memory.

Do a better job of tracking which parts of memory are known to be
zero.  Before we just kept track of a range of offsets in the most
recently allocated object. For code that initializes the new object's
fields in a nonstandard order, that tracking is imprecise. Instead,
keep a bit map of the first 64 words of that object, so we can track
precisely what we know to be zeroed.

The new scheme is only precise up to the first 512 bytes of the object.
After that, we'll use write barriers unnecessarily. Hopefully most
initializers of large objects will use typedmemmove, which does only one
write barrier check for the whole initialization.

Fixes #34723
Update #21561

Change-Id: Idf6e1b7d525042fb67961302d4fc6f941393cac8
Reviewed-on: https://go-review.googlesource.com/c/go/+/199558
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-07 17:19:13 +00:00
Cuong Manh Le
54001652d4 internal/reflectlite: add missing copyright header
Change-Id: Id43870de6608ef2e8c0ebef82fd710b2c3061e66
Reviewed-on: https://go-review.googlesource.com/c/go/+/199599
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-10-07 15:39:25 +00:00
Keith Randall
72dc9ab191 cmd/compile: reuse dead register before reusing register holding constant
For commuting ops, check whether the second argument is dead before
checking if the first argument is rematerializeable. Reusing the register
holding a dead value is always best.

Fixes #33580

Change-Id: I7372cfc03d514e6774d2d9cc727a3e6bf6ce2657
Reviewed-on: https://go-review.googlesource.com/c/go/+/199559
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2019-10-07 15:16:26 +00:00
Meng Zhuo
fc2915fabd bytes: add endian base compare test
The current bytes test suit didn't come with endian based test
which causing #34549 can passed the try-bot.
This test will failed when little endian architecture simply using
load and compare uint.

Update #34549

Change-Id: I0973c2cd505ce21c2bed1deeb7d526f1e872118d
Reviewed-on: https://go-review.googlesource.com/c/go/+/198358
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-07 14:49:57 +00:00
Cuong Manh Le
8b39106000 internal/reflectlite: add type mirror with reflect test
Add test to check that struct type in reflectlite is mirror of reflect.
Note that the test does not check the field types, only check for number
of fields and field name are the same.

Updates #34486

Change-Id: Id5f9b26d35faec97863dd1fe7e5eab37d4913181
Reviewed-on: https://go-review.googlesource.com/c/go/+/199280
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-07 13:32:34 +00:00
Michael Munday
c7d81bc086 cmd/compile: reduce amount of code generated for block rewrite rules
Add a Reset method to blocks that allows us to reduce the amount of
code we generate for block rewrite rules.

Thanks to Cherry for suggesting a similar fix to this in CL 196557.

Compilebench result:

name                      old time/op       new time/op       delta
Template                        211ms ± 1%        211ms ± 1%   -0.30%  (p=0.028 n=19+20)
Unicode                        83.7ms ± 3%       83.0ms ± 2%   -0.79%  (p=0.029 n=18+19)
GoTypes                         757ms ± 1%        755ms ± 1%   -0.31%  (p=0.034 n=19+19)
Compiler                        3.51s ± 1%        3.50s ± 1%   -0.20%  (p=0.013 n=18+18)
SSA                             11.7s ± 1%        11.7s ± 1%   -0.38%  (p=0.000 n=19+19)
Flate                           131ms ± 1%        130ms ± 1%   -0.32%  (p=0.024 n=18+18)
GoParser                        162ms ± 1%        162ms ± 1%     ~     (p=0.059 n=20+18)
Reflect                         471ms ± 0%        470ms ± 0%   -0.24%  (p=0.045 n=20+17)
Tar                             187ms ± 1%        186ms ± 1%     ~     (p=0.157 n=20+20)
XML                             255ms ± 1%        255ms ± 1%     ~     (p=0.461 n=19+20)
LinkCompiler                    754ms ± 2%        755ms ± 2%     ~     (p=0.919 n=17+17)
ExternalLinkCompiler            2.82s ±16%        2.37s ±10%  -15.94%  (p=0.000 n=20+20)
LinkWithoutDebugCompiler        439ms ± 4%        442ms ± 6%     ~     (p=0.461 n=18+19)
StdCmd                          25.8s ± 2%        25.5s ± 1%   -0.95%  (p=0.000 n=20+20)

name                      old user-time/op  new user-time/op  delta
Template                        240ms ± 8%        238ms ± 7%     ~     (p=0.301 n=20+20)
Unicode                         107ms ±18%        104ms ±13%     ~     (p=0.149 n=20+20)
GoTypes                         883ms ± 3%        888ms ± 2%     ~     (p=0.211 n=20+20)
Compiler                        4.22s ± 1%        4.20s ± 1%     ~     (p=0.077 n=20+18)
SSA                             14.1s ± 1%        14.1s ± 2%     ~     (p=0.192 n=20+20)
Flate                           145ms ±10%        148ms ± 5%     ~     (p=0.126 n=20+18)
GoParser                        186ms ± 7%        186ms ± 7%     ~     (p=0.779 n=20+20)
Reflect                         538ms ± 3%        541ms ± 3%     ~     (p=0.192 n=20+20)
Tar                             218ms ± 4%        217ms ± 6%     ~     (p=0.835 n=19+20)
XML                             298ms ± 5%        298ms ± 5%     ~     (p=0.749 n=19+20)
LinkCompiler                    818ms ± 5%        825ms ± 8%     ~     (p=0.461 n=20+20)
ExternalLinkCompiler            1.55s ± 4%        1.53s ± 5%     ~     (p=0.063 n=20+18)
LinkWithoutDebugCompiler        460ms ±12%        460ms ± 7%     ~     (p=0.925 n=20+20)

name                      old object-bytes  new object-bytes  delta
Template                        554kB ± 0%        554kB ± 0%     ~     (all equal)
Unicode                         215kB ± 0%        215kB ± 0%     ~     (all equal)
GoTypes                        2.01MB ± 0%       2.01MB ± 0%     ~     (all equal)
Compiler                       7.97MB ± 0%       7.97MB ± 0%   +0.00%  (p=0.000 n=20+20)
SSA                            26.8MB ± 0%       26.9MB ± 0%   +0.27%  (p=0.000 n=20+20)
Flate                           340kB ± 0%        340kB ± 0%     ~     (all equal)
GoParser                        434kB ± 0%        434kB ± 0%     ~     (all equal)
Reflect                        1.34MB ± 0%       1.34MB ± 0%     ~     (all equal)
Tar                             480kB ± 0%        480kB ± 0%     ~     (all equal)
XML                             622kB ± 0%        622kB ± 0%     ~     (all equal)

name                      old export-bytes  new export-bytes  delta
Template                       20.4kB ± 0%       20.4kB ± 0%     ~     (all equal)
Unicode                        8.21kB ± 0%       8.21kB ± 0%     ~     (all equal)
GoTypes                        36.6kB ± 0%       36.6kB ± 0%     ~     (all equal)
Compiler                        115kB ± 0%        115kB ± 0%   +0.08%  (p=0.000 n=20+20)
SSA                             141kB ± 0%        141kB ± 0%   +0.07%  (p=0.000 n=20+20)
Flate                          5.11kB ± 0%       5.11kB ± 0%     ~     (all equal)
GoParser                       8.93kB ± 0%       8.93kB ± 0%     ~     (all equal)
Reflect                        11.8kB ± 0%       11.8kB ± 0%     ~     (all equal)
Tar                            10.9kB ± 0%       10.9kB ± 0%     ~     (all equal)
XML                            17.4kB ± 0%       17.4kB ± 0%     ~     (all equal)

name                      old text-bytes    new text-bytes    delta
HelloSize                       742kB ± 0%        742kB ± 0%     ~     (all equal)
CmdGoSize                      10.7MB ± 0%       10.7MB ± 0%     ~     (all equal)

name                      old data-bytes    new data-bytes    delta
HelloSize                      10.7kB ± 0%       10.7kB ± 0%     ~     (all equal)
CmdGoSize                       312kB ± 0%        312kB ± 0%     ~     (all equal)

name                      old bss-bytes     new bss-bytes     delta
HelloSize                       122kB ± 0%        122kB ± 0%     ~     (all equal)
CmdGoSize                       146kB ± 0%        146kB ± 0%     ~     (all equal)

name                      old exe-bytes     new exe-bytes     delta
HelloSize                      1.10MB ± 0%       1.10MB ± 0%     ~     (all equal)
CmdGoSize                      14.9MB ± 0%       14.9MB ± 0%     ~     (all equal)

Change-Id: Ic89a8e62423b3d9fd9391159e0663acf450803b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/198419
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2019-10-07 09:19:12 +00:00
Shenghou Ma
cfe2320429 os: re-enable TestPipeThreads on darwin
CL 197938 actually fixes those regression on Darwin as syscalls
are no longer labeled as always blocking and consume a thread.

Fixes #33953
Fixes #32326

Change-Id: I82c98516c23cd36f762bc5433d7b71ea8939a0ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/199477
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-10-06 18:18:50 +00:00
Serhat Giydiren
fc8bef06c4 unicode/utf8: add link to formal UTF-8 description.
Fixes #31590

Change-Id: I7fd6dcc5c34496776439ff0295f18b5fb5cb538a
Reviewed-on: https://go-review.googlesource.com/c/go/+/199141
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-10-06 00:33:51 +00:00
Cuong Manh Le
ee3f768d38 internal/reflectlite: updates reflectlite to match runtime rtype/mapType
CL 191198 updated runtime rtype and mapType without adopting the changes
to reflectlite, causing mismatch between them.

This CL updates those changes to reflectlite.

Fixes #34486

Change-Id: I2bb043673d997f97bb0b12c4ad471474803b2160
Reviewed-on: https://go-review.googlesource.com/c/go/+/197559
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-05 23:03:47 +00:00
Cuong Manh Le
1cb61b80bd runtime: add doc to remind adopting changes to reflectlite
Updates #34486

Change-Id: Iec9a5d120013aaa287eccf2999b3f2b831be070e
Reviewed-on: https://go-review.googlesource.com/c/go/+/197558
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-05 23:00:37 +00:00
Daniel Martí
80fb18e3c0 cmd/go: avoid ssh known_hosts prompts on test
TestScripts/mod_get_svn would stop with the following prompt if the real
user didn't have vcs-test.golang.org in their known_hosts file:

	The authenticity of host 'vcs-test.golang.org (35.184.38.56)' can't be established.
	ECDSA key fingerprint is SHA256:[...]
	Are you sure you want to continue connecting (yes/no/[fingerprint])?

This was bad because it relied on the user's real ssh known_hosts file.
Worse even, if the user didn't expert or notice the prompt, it could
hang a 'go test' run for quite a while.

Work around that by forcing svn to not use ssh at all. Other potentially
better approaches were tried, but none worked on svn 1.12.2 with openssh
8.0p1.

Fixes #33883.

Change-Id: I2f925fa892f2fa53c77d86b0034141162517ee69
Reviewed-on: https://go-review.googlesource.com/c/go/+/199142
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-05 22:17:49 +00:00
Tobias Klauser
11b33686d3 syscall: add support for freebsd/arm64
Updates #24715

Change-Id: Ie7cdac346fb024858441bfd4028bf09adab3c9d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/198545
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-05 10:39:30 +00:00
Tobias Klauser
e0a5fae676 cmd/link/internal/arm64: add support for freebsd/arm64
Updates #24715

Change-Id: If5d9591a820f6e921e69e722d46bf91d2ae738cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/198543
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-05 10:38:56 +00:00
Alex Brainman
b106105e52 syscall, internal/syscall/windows, internal/syscall/windows/registry: make go generate use new golang.org/x/sys/windows/mkwinsyscall
Updates #34388

Change-Id: I327a1c1557c47fa6c113c7a1a507a8e7355f9d1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/199277
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-10-05 08:29:48 +00:00
Tai
e13a4d9586 cmd/cgo: build unique C type cache keys from parent names
When translating C types, cache the in-progress type under its parent
names, so that anonymous structs can also be translated for multiple
typedefs, without clashing.

Standalone types are not affected by this change.

Also updated the test for issue 9026 because the C struct name
generation algorithm has changed.

Fixes #31891

Change-Id: I00cc64852a2617ce33da13f74caec886af05b9f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/181857
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-05 00:16:04 +00:00
Alex Gaynor
5f4aa5d79f bufio: simplify bufio.Reader.ReadBytes to avoid an extra loop over a slice
Change-Id: Icb1c3eb30147180ba5949a25c65b48307b14c1ca
GitHub-Last-Rev: 937ae86413
GitHub-Pull-Request: golang/go#34704
Reviewed-on: https://go-review.googlesource.com/c/go/+/199157
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-04 21:22:55 +00:00
David Chase
c1b7f508b0 cmd/compile: modify line number printing for nodes
add preceding "+" for a line that is certainly a statement,
and "_" for a line this is certainly not a statement.

Change-Id: I831435dbc2302f25db1320b99d3513fe61fe1fa2
Reviewed-on: https://go-review.googlesource.com/c/go/+/198737
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-04 21:11:03 +00:00
David Chase
b8fe9f7970 cmd/compile: adjust line numbering for type switch
Two changes, one to cause the back end to not number ITab operations
(these tend to disappear and are also followed by something more robust)
and to explicitly unmark (as statements) all but the first bit of
the code generated to implement a type switch.

Change-Id: I9f7bf7cbf7ccc5d7eda57f7fb080e600eb312eb0
Reviewed-on: https://go-review.googlesource.com/c/go/+/198739
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-04 21:09:33 +00:00
David Chase
c450ace12c cmd/compile: remove statement marks from secondary calls
Calls are code-generated in an alternate path that inherits
its positions from values, not from *SSAGenState.  The
default position on *SSAGenState was marked as not-a-statement,
but this was not applied to the value itself, leading to
spurious "is statement" marks in the output (convention:
after code generation in the compiler, everything is either
definitely a statement or definitely not a statement, nothing
is in the undetermined state).

This CL causes a 35 statement regression in ssa/stmtlines_test.
This is down from the earlier 150 because of all the other
CLs preceding this one that deal with the root causes of the
missing lines (repeated lines on nested calls hid missing lines).

This also removes some line repeats from ssa/debug_test.

Change-Id: Ie9a507bd5447e906b35bbd098e3295211df2ae01
Reviewed-on: https://go-review.googlesource.com/c/go/+/188018
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-04 20:41:52 +00:00
David Chase
9a926911fe cmd/compile: attempt to preserve statements when prove removes code
This was a cause of some statements being lost.

Change-Id: I81c95dcf3df6ed8a03b7578a27f9b21d33b3cf39
Reviewed-on: https://go-review.googlesource.com/c/go/+/198484
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-04 20:40:43 +00:00
Jason A. Donenfeld
7e4d87b770 syscall: replace mksyscall_windows.go with wrapper to new x/sys home
We replace the existing file with a thin wrapper around its target so
that we don't break anybody's workflow.

Updates #34388

Change-Id: I0d00371c483cb78f4be18fe987df33c79cd40f05
Reviewed-on: https://go-review.googlesource.com/c/go/+/198977
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-04 20:26:09 +00:00
David Chase
e06829b977 cmd/compile: preserve statement marks in branch elimination
This reduces the number of missing-statement lines.

Change-Id: Iefa56c2a253220d17d8b53210c8c6af78ee68756
Reviewed-on: https://go-review.googlesource.com/c/go/+/198483
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-04 20:19:44 +00:00
Jay Conrod
86ea7d5171 cmd/go/internal/modfile: report error for extra text around version
Fixes #34697

Change-Id: Iedfa3d46d558510f3bd1fdf9466cd974793d9ecd
Reviewed-on: https://go-review.googlesource.com/c/go/+/199017
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-04 20:18:48 +00:00
Bryan C. Mills
961837dec2 Revert "cmd/go: add a Latest field to the output of 'go mod download -json'"
This reverts CL 183841.

Fixes #34533

Reason for revert: Introduced a significant performance regression for repos with many incompatible-version tags.

Change-Id: I75d7fd76e6e1a0902b114b00167b38439e0f8221
Reviewed-on: https://go-review.googlesource.com/c/go/+/198699
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-04 20:06:56 +00:00
Cuong Manh Le
047141797c cmd/compile: lookup methods of base type for named pointer type
Passed toolstash-check.

Updates #21738
Fixes #21934

Change-Id: I59f0b2c9890146565ff913b04aeeeff7dc7a4499
Reviewed-on: https://go-review.googlesource.com/c/go/+/197561
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-04 18:34:18 +00:00
Brad Fitzpatrick
0fb95e788e crypto/tls: remove NPN support
RELNOTE=yes

Fixes #28362

Change-Id: I43813c0c17bbe6c4cbb4d1f121518c434b3f5aa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/174329
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2019-10-04 18:07:46 +00:00
David Chase
91b55b4fa3 cmd/compile: attempt to preserve statement marks when empty blocks are trimmed.
This was a cause of some statements being lost.

Change-Id: Ia4805c2dafd7a880d485a678a48427de8930d57e
Reviewed-on: https://go-review.googlesource.com/c/go/+/198482
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-04 17:31:51 +00:00
Jordi Martin
3ce29b44bb cmd/go: set expected filename when building a local package with -o is pointing to a folder
In the local package build process, when -o is pointing to an existing folder, the object
the filename is generated from files listed on the command line like when the -o is
not pointing to a folder instead of using the `importPath` that is going to be `command-line-arguments`

Fixes #34535

Change-Id: I09a7609c17a2ccdd83da32f01247c0ef473dea1e
GitHub-Last-Rev: b3224226a3
GitHub-Pull-Request: golang/go#34562
Reviewed-on: https://go-review.googlesource.com/c/go/+/197544
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-04 17:30:40 +00:00
Cuong Manh Le
43a4c61e12 cmd/compile: update comment in order.go to refer new methods/functions
Change-Id: I2d6b73ae7447e4bdeffcdac90f7422a9280666e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/198678
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-10-04 17:26:05 +00:00
David Chase
c8e7c53b40 cmd/compile: preserve statement mark in rematerialized values
Statement markers on rematerializable values were getting lost in
register allocation.  This checks for that case (rematerializable
input and using value share line number, but mark is on the input)
and preserves the mark.

When combined with other CLs in this series, this CL reduces the
"nostmt" count (a line appears in the assembly, but no statement
marker) for cmd/go from 413 to 277.  The rematerialized input is
usually a LEAQ (on AMD64).

The cause is "complicated"; for example, a NilCheck originally has the
statement mark (a good thing, if the NilCheck  remains) but the
NilCheck is removed and the mark floats to a Block end, then to a
SliceMake.  The SliceMake decomposes and goes dead without preserving
its marker (its component values are elided in other rewrites and may
target inputs with different line numbers), but before deadcode
removes it from the graph it moves the mark to an input, which at that
time happens to be a LocalAddr. This eventually transforms to a LEAQ.

Change-Id: Iff91fc2a934357fb59ec46ac87b4a9b1057d9160
Reviewed-on: https://go-review.googlesource.com/c/go/+/198480
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-04 17:09:10 +00:00
David Chase
33ab6ccba0 cmd/compile: don't attach statement marks to OpPhi
OpPhi nodes tend to disappear or get rearranged,
and cause statement marks to vanish.

Change-Id: I2f5a222903b7fcd0d1a72e8f6d7e156036b23f30
Reviewed-on: https://go-review.googlesource.com/c/go/+/198481
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-04 16:54:10 +00:00
Vojtech Bocek
72dc3a0919 crypto/x509: truncate signed hash before DSA signature verification
According to spec, the hash must be truncated, but crypto/dsa
does not do it. We can't fix it in crypto/dsa, because it would break
verification of previously generated signatures.
In crypto/x509 however, go can't generate DSA certs, only verify them,
so the fix here should be safe.

Fixes #22017

Change-Id: Iee7e20a5d76f45da8901a7ca686063639092949f
GitHub-Last-Rev: 8041cde8d2
GitHub-Pull-Request: golang/go#34630
Reviewed-on: https://go-review.googlesource.com/c/go/+/198138
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2019-10-04 16:27:55 +00:00
Bryan C. Mills
6145a80608 cmd/go: remove the -mod flag from 'go get'
'GOFLAGS=-mod=vendor' currently causes 'go get' to always fail unless
the '-mod' flag is explicitly overwritten. Moreover, as of CL 198319
we plan to set -mod=vendor by default if a vendor directory is
present, so all users with vendor directories will be affected — not
just those who set 'GOFLAGS' explicitly.

Similarly, an explicit '-mod=readonly' argument to 'go get' is
currently ignored as a special case, but the fact that it is ignored
(rather than rejected) can be very surprising.

Rather than adding more special cases, we should remove the '-mod'
flag from 'go get' entirely.

Fixes #30345
Fixes #32502
Updates #33848

Change-Id: Iecd3233ca3ef580ca3a66bd5e6ee8d86d4cbd8a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/198438
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-04 15:47:46 +00:00
Duco van Amstel
8c74bfb491 cmd/go: fix listing of ambiguous paths
Passing ambiguous patterns, ending in `.go`, to `go list` results in them
being interpreted as Go files despite potentially being package references.
This can then result in errors on other package references.

The parsing logic is modified to check for a locally present file
corresponding to any pattern ending in `.go`. If no such file is present
the pattern is considered to be a package reference.

We're also adding a variety of non-regression tests that fail with the
original parsing code but passes after applying the fix.

Fixes #32483
Fixes #34653

Change-Id: I073871da0dfc5641a359643f95ac14608fdca09b
GitHub-Last-Rev: 5abc200103
GitHub-Pull-Request: golang/go#34663
Reviewed-on: https://go-review.googlesource.com/c/go/+/198459
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-04 13:47:53 +00:00
Josh Bleecher Snyder
a7042249ab os/exec: simplify doc wording for cmd.StdoutPipe and cmd.StderrPipe
The existing text was hard to parse.
Shorten the sentences and simplify the text.

Change-Id: Ic16f486925090ea303c04e70969e5a4b27a60896
Reviewed-on: https://go-review.googlesource.com/c/go/+/198758
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-04 00:22:44 +00:00
David Chase
adc4d2cc2d cmd/compile: run deadcode before nilcheck for better statement relocation
Nilcheck would move statements from NilCheck values to others that
turned out were already dead, which leads to lost statements.  Better
to eliminate the dead code first.

One "error" is removed from test/prove.go because the code is
actually dead, and the additional deadcode pass removes it before
prove can run.

Change-Id: If75926ca1acbb59c7ab9c8ef14d60a02a0a94f8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/198479
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-03 21:12:13 +00:00
David Chase
08a87938bb cmd/compile: make nilcheck more careful about statement relocations
The earlier code was picking nodes that were "poor choices" and
thus sometimes losing statements altogether.

Change-Id: Ibe5ed800ffbd3c926c0ab1bc10c77d72d3042e45
Reviewed-on: https://go-review.googlesource.com/c/go/+/198478
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-03 21:10:26 +00:00
David Chase
53bd915109 cmd/compile: classify more nodes as "poor choices" for statements
Aggregate-making nodes that are later decomposed
are poor choices for statements, because the decomposition
phase turns them into multiple sub-values, some of which may be
dead.  Better to look elsewhere for a statement mark.

Change-Id: Ibd9584138ab3d1384548686896a28580a2e43f54
Reviewed-on: https://go-review.googlesource.com/c/go/+/198477
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-03 21:08:27 +00:00
David Chase
6139019efa cmd/compile: pick position of implicit break statements more carefully
The previous version used the position of the switch statement,
which makes for potentially jumpy stepping and introduces a large
number of statements repeating the line (tricky for inserting
breaks).  It also shared a single OBREAK node and this was not
really a syntax "tree".

This improves both the nostmt test (by 6 lines) and
reduces the total badness score from dwarf-goodness (by about 200).

Change-Id: I1f71b231a26f152bdb6ce9bc8f95828bb222f665
Reviewed-on: https://go-review.googlesource.com/c/go/+/188218
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-03 21:07:45 +00:00
David Chase
f7f85bdc2c cmd/compile: refine statement marking in numberlines
1) An empty block is treated as not-a-statement unless its line differs
from at least one of its predecessors (it might make sense to
rearrange branches in predecessors, but that is a different issue).

2) When iterating forward to choose a "good" place for a statement,
actually check that the chosen place is in fact good.

3) Refactor same line and same file into methods on XPos and Pos.

This reduces the failure rate of ssa/stmtlines_test by 7-ish lines.
(And interacts favorably with later debugging CLs.)

Change-Id: Idb7cca7068f6fc9fbfdbe25bc0da15bcfc7b9d4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/188217
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-03 21:06:11 +00:00
Matthew Dempsky
3ad350820d cmd/compile: change size diagnostic to use benchmark format
Makes it easier to run

    go build -a -gcflags=-d=export std |& grep ^BenchmarkExportSize

and get useful output for feeding into benchstat.

Change-Id: I2b52e8f5ff33b7ccb6c25b18e464513344bd9ad9
Reviewed-on: https://go-review.googlesource.com/c/go/+/198698
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-10-03 20:43:01 +00:00
Meng Zhuo
a1b1ba7daf internal/bytealg: (re)adding mips64x compare implementation
The original CL of mips64x compare function has been reverted due to wrong
implement for little endian.
Original CL: https://go-review.googlesource.com/c/go/+/196837

name                         old time/op    new time/op    delta
BytesCompare/1                 28.9ns ± 4%    22.1ns ± 0%    -23.60%  (p=0.000 n=9+8)
BytesCompare/2                 34.6ns ± 0%    23.1ns ± 0%    -33.25%  (p=0.000 n=8+10)
BytesCompare/4                 54.6ns ± 0%    40.8ns ± 0%    -25.27%  (p=0.000 n=8+8)
BytesCompare/8                 73.9ns ± 0%    49.1ns ± 0%    -33.56%  (p=0.000 n=8+8)
BytesCompare/16                 113ns ± 0%      24ns ± 0%    -79.20%  (p=0.000 n=9+9)
BytesCompare/32                 190ns ± 0%      26ns ± 0%    -86.53%  (p=0.000 n=10+10)
BytesCompare/64                 345ns ± 0%      44ns ± 0%    -87.19%  (p=0.000 n=10+8)
BytesCompare/128                654ns ± 0%      52ns ± 0%    -91.97%  (p=0.000 n=9+8)
BytesCompare/256               1.27µs ± 0%    0.07µs ± 0%    -94.14%  (p=0.001 n=8+9)
BytesCompare/512               2.51µs ± 0%    0.12µs ± 0%    -95.26%  (p=0.000 n=9+10)
BytesCompare/1024              4.99µs ± 0%    0.21µs ± 0%    -95.85%  (p=0.000 n=8+10)
BytesCompare/2048              9.94µs ± 0%    0.38µs ± 0%    -96.14%  (p=0.000 n=8+8)
CompareBytesEqual               105ns ± 0%      64ns ± 0%    -39.43%  (p=0.000 n=10+9)
CompareBytesToNil              34.8ns ± 1%    38.6ns ± 3%    +11.01%  (p=0.000 n=10+10)
CompareBytesEmpty              33.6ns ± 3%    36.6ns ± 0%     +8.77%  (p=0.000 n=10+8)
CompareBytesIdentical          29.7ns ± 0%    40.5ns ± 1%    +36.45%  (p=0.000 n=10+8)
CompareBytesSameLength         69.1ns ± 0%    51.8ns ± 0%    -25.04%  (p=0.000 n=10+9)
CompareBytesDifferentLength    69.8ns ± 0%    52.5ns ± 0%    -24.79%  (p=0.000 n=10+8)
CompareBytesBigUnaligned       5.15ms ± 0%    2.19ms ± 0%    -57.59%  (p=0.000 n=9+9)
CompareBytesBig                5.28ms ± 0%    0.28ms ± 0%    -94.64%  (p=0.000 n=8+8)
CompareBytesBigIdentical       29.7ns ± 0%    36.9ns ± 2%    +24.11%  (p=0.000 n=8+10)

name                         old speed      new speed      delta
CompareBytesBigUnaligned      204MB/s ± 0%   480MB/s ± 0%   +135.77%  (p=0.000 n=9+9)
CompareBytesBig               198MB/s ± 0%  3704MB/s ± 0%  +1765.97%  (p=0.000 n=8+8)
CompareBytesBigIdentical     35.3TB/s ± 0%  28.4TB/s ± 2%    -19.44%  (p=0.000 n=8+10)

Fixes #34549

Change-Id: I2ef29f13cdd4229745ac2d018bb53c76f2ff1209
Reviewed-on: https://go-review.googlesource.com/c/go/+/197557
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-03 20:32:21 +00:00
Meng Zhuo
2bf7a92571 cmd/asm: add VLD[1-4]R vector instructions on arm64
This change adds VLD1R, VLD2R, VLD3R, VLD4R

Change-Id: Ie19e9ae02fdfc94b9344acde8c9938849efb0bf0
Reviewed-on: https://go-review.googlesource.com/c/go/+/181697
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-03 20:31:11 +00:00
Bryan C. Mills
5fe3b49a05 Revert "cmd/compile: walk the progs to generate debug_lines"
This reverts CL 196661.

Reason for revert: broke TestGdb* tests on mips64le, ppc64le, and s390x builders.

Change-Id: I3b5c97c840819a0d407b943f7cf7e2d97f06042d
Reviewed-on: https://go-review.googlesource.com/c/go/+/198697
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-03 18:18:14 +00:00
Matthew Dempsky
c33d45a898 cmd/compile: don't statically copy string-typed variables
During package initialization, the compiler tries to optimize:

    var A = "foo"
    var B = A

into

    var A = "foo"
    var B = "foo"

so that we can statically initialize both A and B and skip emitting
dynamic initialization code to assign "B = A".

However, this isn't safe in the presence of cmd/link's -X flag, which
might overwrite an initialized string-typed variable at link time. In
particular, if cmd/link changes A's static initialization, it won't
know it also needs to change B's static initialization.

To address this, this CL disables this optimization for string-typed
variables.

Fixes #34675.

Change-Id: I1c18f3b855f6d7114aeb39f96aaaf1b452b88236
Reviewed-on: https://go-review.googlesource.com/c/go/+/198657
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-03 18:08:32 +00:00
Jason A. Donenfeld
6b85fa8051 runtime: iterate ms via allm linked list to avoid race
It's pointless to reach all ms via allgs, and doing so introduces a
race, since the m member of a g can change underneath it. Instead
iterate directly through the allm linked list.

Updates: #31528
Updates: #34130

Change-Id: I34b88402b44339b0a5b4cd76eafd0ce6e43e2be1
Reviewed-on: https://go-review.googlesource.com/c/go/+/198417
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-03 15:55:39 +00:00
Jeremy Faller
9e6a84f2b1 cmd/compile: walk the progs to generate debug_lines
Rather than use the pcln tables, walk progs while generating
debug_lines.  This code slightly increases the number of is_stmt toggles
in the debug information due to a previous bug in how the pcline walking
worked. (Previous versions of the line walking code wouldn't return the
old_value, instead returning 0. This behavior might lose is_stmt toggles
in the line table.)

We suspected there would be a speedup with this change, but benchmarking
hasn't shown this to be true (but has been noisy enough to not really
show any large differences either way). These benchmarks are comparing
non-prog walking code with this prog-walking code:

name                      old time/op       new time/op       delta
Template                        321ms ± 4%        316ms ± 3%     ~     (p=0.165 n=10+10)
Unicode                         146ms ± 5%        142ms ± 4%     ~     (p=0.063 n=10+10)
GoTypes                         1.06s ± 2%        1.07s ± 2%     ~     (p=0.280 n=10+10)
Compiler                        4.07s ± 1%        4.06s ± 1%     ~     (p=0.549 n=10+9)
SSA                             12.6s ± 2%        12.7s ± 2%   +1.27%  (p=0.019 n=10+10)
Flate                           201ms ± 7%        202ms ± 4%     ~     (p=0.436 n=10+10)
GoParser                        248ms ± 4%        250ms ± 2%     ~     (p=0.356 n=9+10)
Reflect                         679ms ± 5%        678ms ± 4%     ~     (p=0.971 n=10+10)
Tar                             281ms ± 2%        283ms ± 3%     ~     (p=0.222 n=9+9)
XML                             381ms ± 3%        384ms ± 5%     ~     (p=0.393 n=10+10)
LinkCompiler                    1.08s ± 2%        1.10s ± 2%   +1.89%  (p=0.009 n=10+10)
ExternalLinkCompiler            2.23s ± 4%        2.23s ± 1%     ~     (p=1.000 n=10+8)
LinkWithoutDebugCompiler        654ms ± 4%        673ms ± 4%   +2.94%  (p=0.019 n=10+10)
StdCmd                          13.6s ± 2%        13.9s ± 1%   +2.00%  (p=0.000 n=10+10)

name                      old user-time/op  new user-time/op  delta
Template                        582ms ±11%        575ms ±14%     ~     (p=0.631 n=10+10)
Unicode                         431ms ±24%        390ms ±38%     ~     (p=0.315 n=10+10)
GoTypes                         2.47s ±11%        2.51s ± 4%     ~     (p=0.280 n=10+10)
Compiler                        9.09s ± 3%        9.04s ± 5%     ~     (p=0.684 n=10+10)
SSA                             25.8s ± 4%        26.0s ± 3%     ~     (p=0.529 n=10+10)
Flate                           318ms ±14%        322ms ±13%     ~     (p=0.912 n=10+10)
GoParser                        386ms ± 6%        386ms ± 5%     ~     (p=0.888 n=9+8)
Reflect                         1.42s ±20%        1.32s ±24%     ~     (p=0.393 n=10+10)
Tar                             476ms ±19%        471ms ±25%     ~     (p=1.000 n=10+10)
XML                             681ms ±25%        745ms ±21%     ~     (p=0.143 n=10+10)
LinkCompiler                    1.75s ±13%        1.86s ±12%     ~     (p=0.075 n=10+10)
ExternalLinkCompiler            2.98s ±18%        3.41s ±13%  +14.48%  (p=0.003 n=10+10)
LinkWithoutDebugCompiler        1.05s ±12%        1.08s ±16%     ~     (p=0.739 n=10+10)

name                      old alloc/op      new alloc/op      delta
Template                       36.4MB ± 0%       36.4MB ± 0%   -0.11%  (p=0.000 n=10+10)
Unicode                        28.6MB ± 0%       28.5MB ± 0%   -0.06%  (p=0.029 n=10+10)
GoTypes                         121MB ± 0%        121MB ± 0%   -0.09%  (p=0.000 n=9+9)
Compiler                        548MB ± 0%        547MB ± 0%   -0.10%  (p=0.000 n=10+10)
SSA                            1.87GB ± 0%       1.87GB ± 0%   -0.13%  (p=0.000 n=10+10)
Flate                          23.0MB ± 0%       22.9MB ± 0%   -0.09%  (p=0.000 n=9+10)
GoParser                       27.9MB ± 0%       27.8MB ± 0%   -0.12%  (p=0.000 n=10+10)
Reflect                        77.7MB ± 0%       77.6MB ± 0%   -0.12%  (p=0.000 n=8+10)
Tar                            34.5MB ± 0%       34.5MB ± 0%   -0.07%  (p=0.003 n=10+10)
XML                            44.4MB ± 0%       44.4MB ± 0%   -0.07%  (p=0.000 n=10+10)
LinkCompiler                    236MB ± 0%        240MB ± 0%   +1.72%  (p=0.000 n=10+10)
ExternalLinkCompiler            246MB ± 0%        254MB ± 0%   +3.02%  (p=0.000 n=10+10)
LinkWithoutDebugCompiler        159MB ± 0%        164MB ± 0%   +3.35%  (p=0.000 n=10+10)

name                      old allocs/op     new allocs/op     delta
Template                         372k ± 0%         371k ± 0%   -0.23%  (p=0.000 n=10+10)
Unicode                          340k ± 0%         340k ± 0%   -0.05%  (p=0.000 n=10+10)
GoTypes                         1.33M ± 0%        1.32M ± 0%   -0.20%  (p=0.000 n=9+10)
Compiler                        5.37M ± 0%        5.36M ± 0%   -0.17%  (p=0.000 n=10+10)
SSA                             17.9M ± 0%        17.9M ± 0%   -0.15%  (p=0.000 n=10+10)
Flate                            234k ± 0%         233k ± 0%   -0.24%  (p=0.000 n=9+10)
GoParser                         309k ± 0%         309k ± 0%   -0.21%  (p=0.000 n=10+10)
Reflect                          969k ± 0%         966k ± 0%   -0.30%  (p=0.000 n=9+10)
Tar                              348k ± 0%         347k ± 0%   -0.22%  (p=0.000 n=10+9)
XML                              426k ± 0%         425k ± 0%   -0.15%  (p=0.000 n=9+10)
LinkCompiler                     638k ± 0%         637k ± 0%   -0.07%  (p=0.000 n=10+10)
ExternalLinkCompiler            1.69M ± 0%        1.69M ± 0%   -0.05%  (p=0.000 n=10+10)
LinkWithoutDebugCompiler         222k ± 0%         221k ± 0%   -0.03%  (p=0.007 n=10+9)

name                      old object-bytes  new object-bytes  delta
Template                        559kB ± 0%        560kB ± 0%   +0.23%  (p=0.000 n=10+10)
Unicode                         216kB ± 0%        216kB ± 0%   +0.01%  (p=0.000 n=10+10)
GoTypes                        2.03MB ± 0%       2.04MB ± 0%   +0.31%  (p=0.000 n=10+10)
Compiler                       8.07MB ± 0%       8.10MB ± 0%   +0.35%  (p=0.000 n=10+10)
SSA                            27.1MB ± 0%       27.3MB ± 0%   +0.72%  (p=0.000 n=10+10)
Flate                           343kB ± 0%        344kB ± 0%   +0.22%  (p=0.000 n=10+10)
GoParser                        441kB ± 0%        442kB ± 0%   +0.34%  (p=0.000 n=10+10)
Reflect                        1.36MB ± 0%       1.36MB ± 0%   +0.23%  (p=0.000 n=10+10)
Tar                             487kB ± 0%        488kB ± 0%   +0.21%  (p=0.000 n=10+10)
XML                             632kB ± 0%        634kB ± 0%   +0.35%  (p=0.000 n=10+10)

name                      old export-bytes  new export-bytes  delta
Template                       18.5kB ± 0%       18.5kB ± 0%     ~     (all equal)
Unicode                        7.92kB ± 0%       7.92kB ± 0%     ~     (all equal)
GoTypes                        35.0kB ± 0%       35.0kB ± 0%     ~     (all equal)
Compiler                        109kB ± 0%        109kB ± 0%   +0.00%  (p=0.000 n=10+10)
SSA                             137kB ± 0%        137kB ± 0%   +0.00%  (p=0.000 n=10+10)
Flate                          4.89kB ± 0%       4.89kB ± 0%     ~     (all equal)
GoParser                       8.49kB ± 0%       8.49kB ± 0%     ~     (all equal)
Reflect                        11.4kB ± 0%       11.4kB ± 0%     ~     (all equal)
Tar                            10.5kB ± 0%       10.5kB ± 0%     ~     (all equal)
XML                            16.7kB ± 0%       16.7kB ± 0%     ~     (all equal)

name                      old text-bytes    new text-bytes    delta
HelloSize                       760kB ± 0%        760kB ± 0%     ~     (all equal)
CmdGoSize                      10.8MB ± 0%       10.8MB ± 0%     ~     (all equal)

name                      old data-bytes    new data-bytes    delta
HelloSize                      10.7kB ± 0%       10.7kB ± 0%     ~     (all equal)
CmdGoSize                       312kB ± 0%        312kB ± 0%     ~     (all equal)

name                      old bss-bytes     new bss-bytes     delta
HelloSize                       122kB ± 0%        122kB ± 0%     ~     (all equal)
CmdGoSize                       146kB ± 0%        146kB ± 0%     ~     (all equal)

name                      old exe-bytes     new exe-bytes     delta
HelloSize                      1.13MB ± 0%       1.13MB ± 0%     ~     (all equal)
CmdGoSize                      15.0MB ± 0%       15.1MB ± 0%   +0.22%  (p=0.000 n=10+10)

Change-Id: If6e0982cd1398062a88e6c0c7513e141f9503531
Reviewed-on: https://go-review.googlesource.com/c/go/+/196661
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2019-10-03 14:09:40 +00:00
Tobias Klauser
64785bf96c cmd/go/internal/modfetch: update TestCodeRepo for gopkg.in/yaml.v2 again
Update the expected data to fix the longtest builder.

Updates #28856

Change-Id: I7fb6ee72e8469d974561b4b4057f40142f5b3654
Reviewed-on: https://go-review.googlesource.com/c/go/+/198557
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-10-03 12:52:41 +00:00
Robert Griesemer
27fc32ff01 cmd/compile: better error message for language version errors
Fixes #33753.
Updates #31747.

Change-Id: Icc42b23405ead4f7f17b0ffa3611405454b6b271
Reviewed-on: https://go-review.googlesource.com/c/go/+/198491
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-03 04:48:44 +00:00
Matthew Dempsky
64e598f783 runtime: use efaceOf where applicable
Prepared with gofmt -r.

Change-Id: Ifea325c209d800b5692d318955930b10debb548b
Reviewed-on: https://go-review.googlesource.com/c/go/+/198494
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-03 02:09:41 +00:00
Ariel Mashraki
debbb1e78d text/template/parse: speed up nodes printing
This CL is a follow up for 198080.
Added a private writeTo method to the Node interface,
in order to use the same builder for printing all nodes
in the tree. Benchmark output against master:

benchmark                     old ns/op     new ns/op     delta
BenchmarkParseLarge-8         24594994      25292054      +2.83%
BenchmarkVariableString-8     117           118           +0.85%
BenchmarkListString-8         10475         3353          -67.99%

benchmark                     old allocs     new allocs     delta
BenchmarkVariableString-8     3              3              +0.00%
BenchmarkListString-8         149            31             -79.19%

benchmark                     old bytes     new bytes     delta
BenchmarkVariableString-8     72            72            +0.00%
BenchmarkListString-8         5698          1608          -71.78%

Change-Id: I2b1cf07cda65c1b80083fb99671289423700feba
Reviewed-on: https://go-review.googlesource.com/c/go/+/198278
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-03 00:16:28 +00:00
Michael Hendricks
f0e940ebc9 net: avoid an infinite loop in LookupAddr
If a request for a PTR record returned a response with a non-PTR
answer, goLookupPTR would loop forever.  Skipping non-PTR answers
guarantees progress through the DNS response.

Fixes #34660

Change-Id: I56f9d21e5342d07e7d843d253267e93a29707904
Reviewed-on: https://go-review.googlesource.com/c/go/+/198460
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-02 20:54:54 +00:00
Egon Elbre
e85ffec784 cmd/cgo: optimize cgoCheckPointer call
Currently cgoCheckPointer is only used with one optional argument.
Using a slice for the optional arguments is quite expensive, hence
replace it with a single interface{}. This results in ~30% improvement.

When checking struct fields, they quite often end up being without
pointers. Check this before calling cgoCheckPointer, which results in
additional ~20% improvement.

Inline some p == nil checks from cgoIsGoPointer which gives
additional ~15% improvement.

All of this translates to:

name                             old time/op  new time/op  delta
CgoCall/add-int-32               46.9ns ± 1%  46.6ns ± 1%   -0.75%  (p=0.000 n=18+20)
CgoCall/one-pointer-32            143ns ± 1%    87ns ± 1%  -38.96%  (p=0.000 n=20+20)
CgoCall/eight-pointers-32         767ns ± 0%   327ns ± 1%  -57.30%  (p=0.000 n=18+16)
CgoCall/eight-pointers-nil-32     110ns ± 1%    89ns ± 2%  -19.10%  (p=0.000 n=19+19)
CgoCall/eight-pointers-array-32  5.09µs ± 1%  3.56µs ± 2%  -30.09%  (p=0.000 n=19+19)
CgoCall/eight-pointers-slice-32  3.92µs ± 0%  2.57µs ± 2%  -34.48%  (p=0.000 n=20+20)

Change-Id: I2aa9f5ae8962a9a41a7fb1db0c300893109d0d75
Reviewed-on: https://go-review.googlesource.com/c/go/+/198081
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-02 20:51:29 +00:00
W. Trevor King
30d7b64008 crypto/x509: add Detail to Expired errors
Because errors like:

    certificate has expired or is not yet valid

make it difficult to distinguish between "certificate has expired" and
"my local clock is skewed".  Including our idea of the local time
makes it easier to identify the clock-skew case, and including the
violated certificate constraint saves folks the trouble of looking it
up in the target certificate.

Change-Id: I52e0e71705ee36f6afde1bb5a47b9b42ed5ead5b
GitHub-Last-Rev: db2ca4029c
GitHub-Pull-Request: golang/go#34646
Reviewed-on: https://go-review.googlesource.com/c/go/+/198046
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-02 19:23:07 +00:00
Dan Scales
0000f0be0a cmd/compile: add an explicit test for compile of arch.ZeroRange
Add a test that causes generation of arch.ZeroRange calls of various sizes 8-136
bytes in the compiler. This is to test that ZeroRanges of various sizes actually
compile on different architectures, but is not testing runtime correctness (which
is hard to do).

Updates #34604

Change-Id: I4131eb86669bdfe8d4e36f4ae5c2a7b069abd6c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/198045
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-02 17:24:11 +00:00
Brad Fitzpatrick
0ba0ea172d net/http: document that Request.Host includes HTTP/2 :authority
Fixes #34640

Change-Id: I4a6c9414fe369cd5e9915472331c4bd8a21d8b0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/198457
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2019-10-02 16:47:29 +00:00
Ruixin(Peter) Bao
ac2ceba01a cmd/compile/internal/gc: intrinsify mulWW on s390x
SSA rule have already been added previously to intrisinfy Mul/Mul64 on s390x. In this CL,
we want to let mulWW use that SSA rule as well. Also removed an extra line for formatting.

Benchmarks:
QuoRem-18                            3.59µs ±15%    2.94µs ± 3%  -18.06%  (p=0.000 n=8+8)
ModSqrt225_Tonelli-18                 806µs ± 0%     800µs ± 0%   -0.85%  (p=0.000 n=7+8)
ModSqrt225_3Mod4-18                   245µs ± 1%     243µs ± 0%   -0.81%  (p=0.001 n=8+8)
ModSqrt231_Tonelli-18                 837µs ± 0%     834µs ± 1%   -0.36%  (p=0.028 n=8+8)
ModSqrt231_5Mod8-18                   282µs ± 0%     280µs ± 0%   -0.76%  (p=0.000 n=8+8)
Sqrt-18                              45.8µs ± 2%    38.6µs ± 0%  -15.63%  (p=0.000 n=8+8)
IntSqr/1-18                          19.1ns ± 0%    13.1ns ± 0%  -31.41%  (p=0.000 n=8+8)
IntSqr/2-18                          48.3ns ± 2%    48.2ns ± 0%     ~     (p=0.094 n=8+8)
IntSqr/3-18                          70.5ns ± 1%    70.7ns ± 0%     ~     (p=0.428 n=8+8)
IntSqr/5-18                           119ns ± 1%     118ns ± 0%   -1.02%  (p=0.000 n=7+8)
IntSqr/8-18                           215ns ± 1%     215ns ± 0%     ~     (p=0.320 n=8+7)
IntSqr/10-18                          302ns ± 1%     301ns ± 0%     ~     (p=0.148 n=8+7)
IntSqr/20-18                          952ns ± 1%     807ns ± 0%  -15.28%  (p=0.000 n=8+8)
IntSqr/30-18                         1.74µs ± 0%    1.53µs ± 0%  -11.93%  (p=0.000 n=8+8)
IntSqr/50-18                         3.91µs ± 0%    3.57µs ± 0%   -8.64%  (p=0.000 n=7+8)
IntSqr/80-18                         8.66µs ± 1%    8.11µs ± 0%   -6.39%  (p=0.000 n=8+8)
IntSqr/100-18                        12.8µs ± 0%    12.2µs ± 0%   -5.19%  (p=0.000 n=8+8)
IntSqr/200-18                        46.0µs ± 0%    44.5µs ± 0%   -3.06%  (p=0.000 n=8+8)
IntSqr/300-18                        81.4µs ± 0%    78.4µs ± 0%   -3.71%  (p=0.000 n=7+8)
IntSqr/500-18                         212µs ± 1%     206µs ± 0%   -2.66%  (p=0.000 n=8+8)
IntSqr/800-18                         419µs ± 1%     406µs ± 0%   -3.07%  (p=0.000 n=8+8)
IntSqr/1000-18                        635µs ± 0%     621µs ± 0%   -2.13%  (p=0.000 n=8+8)

Change-Id: Ib097857186932b902601ab087cbeff3fc9555c3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/197639
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-02 11:08:43 +00:00
Michael Munday
9c2e7e8bed cmd/compile: allow multiple SSA block control values
Control values are used to choose which successor of a block is
jumped to. Typically a control value takes the form of a 'flags'
value that represents the result of a comparison. Some
architectures however use a variable in a register as a control
value.

Up until now we have managed with a single control value per block.
However some architectures (e.g. s390x and riscv64) have combined
compare-and-branch instructions that take two variables in registers
as parameters. To generate these instructions we need to support 2
control values per block.

This CL allows up to 2 control values to be used in a block in
order to support the addition of compare-and-branch instructions.
I have implemented s390x compare-and-branch instructions in a
different CL.

Passes toolstash-check -all.

Results of compilebench:

name                      old time/op       new time/op       delta
Template                        208ms ± 1%        209ms ± 1%    ~     (p=0.289 n=20+20)
Unicode                        83.7ms ± 1%       83.3ms ± 3%  -0.49%  (p=0.017 n=18+18)
GoTypes                         748ms ± 1%        748ms ± 0%    ~     (p=0.460 n=20+18)
Compiler                        3.47s ± 1%        3.48s ± 1%    ~     (p=0.070 n=19+18)
SSA                             11.5s ± 1%        11.7s ± 1%  +1.64%  (p=0.000 n=19+18)
Flate                           130ms ± 1%        130ms ± 1%    ~     (p=0.588 n=19+20)
GoParser                        160ms ± 1%        161ms ± 1%    ~     (p=0.211 n=20+20)
Reflect                         465ms ± 1%        467ms ± 1%  +0.42%  (p=0.007 n=20+20)
Tar                             184ms ± 1%        185ms ± 2%    ~     (p=0.087 n=18+20)
XML                             253ms ± 1%        253ms ± 1%    ~     (p=0.377 n=20+18)
LinkCompiler                    769ms ± 2%        774ms ± 2%    ~     (p=0.070 n=19+19)
ExternalLinkCompiler            3.59s ±11%        3.68s ± 6%    ~     (p=0.072 n=20+20)
LinkWithoutDebugCompiler        446ms ± 5%        454ms ± 3%  +1.79%  (p=0.002 n=19+20)
StdCmd                          26.0s ± 2%        26.0s ± 2%    ~     (p=0.799 n=20+20)

name                      old user-time/op  new user-time/op  delta
Template                        238ms ± 5%        240ms ± 5%    ~     (p=0.142 n=20+20)
Unicode                         105ms ±11%        106ms ±10%    ~     (p=0.512 n=20+20)
GoTypes                         876ms ± 2%        873ms ± 4%    ~     (p=0.647 n=20+19)
Compiler                        4.17s ± 2%        4.19s ± 1%    ~     (p=0.093 n=20+18)
SSA                             13.9s ± 1%        14.1s ± 1%  +1.45%  (p=0.000 n=18+18)
Flate                           145ms ±13%        146ms ± 5%    ~     (p=0.851 n=20+18)
GoParser                        185ms ± 5%        188ms ± 7%    ~     (p=0.174 n=20+20)
Reflect                         534ms ± 3%        538ms ± 2%    ~     (p=0.105 n=20+18)
Tar                             215ms ± 4%        211ms ± 9%    ~     (p=0.079 n=19+20)
XML                             295ms ± 6%        295ms ± 5%    ~     (p=0.968 n=20+20)
LinkCompiler                    832ms ± 4%        837ms ± 7%    ~     (p=0.707 n=17+20)
ExternalLinkCompiler            1.58s ± 8%        1.60s ± 4%    ~     (p=0.296 n=20+19)
LinkWithoutDebugCompiler        478ms ±12%        489ms ±10%    ~     (p=0.429 n=20+20)

name                      old object-bytes  new object-bytes  delta
Template                        559kB ± 0%        559kB ± 0%    ~     (all equal)
Unicode                         216kB ± 0%        216kB ± 0%    ~     (all equal)
GoTypes                        2.03MB ± 0%       2.03MB ± 0%    ~     (all equal)
Compiler                       8.07MB ± 0%       8.07MB ± 0%  -0.06%  (p=0.000 n=20+20)
SSA                            27.1MB ± 0%       27.3MB ± 0%  +0.89%  (p=0.000 n=20+20)
Flate                           343kB ± 0%        343kB ± 0%    ~     (all equal)
GoParser                        441kB ± 0%        441kB ± 0%    ~     (all equal)
Reflect                        1.36MB ± 0%       1.36MB ± 0%    ~     (all equal)
Tar                             487kB ± 0%        487kB ± 0%    ~     (all equal)
XML                             632kB ± 0%        632kB ± 0%    ~     (all equal)

name                      old export-bytes  new export-bytes  delta
Template                       18.5kB ± 0%       18.5kB ± 0%    ~     (all equal)
Unicode                        7.92kB ± 0%       7.92kB ± 0%    ~     (all equal)
GoTypes                        35.0kB ± 0%       35.0kB ± 0%    ~     (all equal)
Compiler                        109kB ± 0%        110kB ± 0%  +0.72%  (p=0.000 n=20+20)
SSA                             137kB ± 0%        138kB ± 0%  +0.58%  (p=0.000 n=20+20)
Flate                          4.89kB ± 0%       4.89kB ± 0%    ~     (all equal)
GoParser                       8.49kB ± 0%       8.49kB ± 0%    ~     (all equal)
Reflect                        11.4kB ± 0%       11.4kB ± 0%    ~     (all equal)
Tar                            10.5kB ± 0%       10.5kB ± 0%    ~     (all equal)
XML                            16.7kB ± 0%       16.7kB ± 0%    ~     (all equal)

name                      old text-bytes    new text-bytes    delta
HelloSize                       761kB ± 0%        761kB ± 0%    ~     (all equal)
CmdGoSize                      10.8MB ± 0%       10.8MB ± 0%    ~     (all equal)

name                      old data-bytes    new data-bytes    delta
HelloSize                      10.7kB ± 0%       10.7kB ± 0%    ~     (all equal)
CmdGoSize                       312kB ± 0%        312kB ± 0%    ~     (all equal)

name                      old bss-bytes     new bss-bytes     delta
HelloSize                       122kB ± 0%        122kB ± 0%    ~     (all equal)
CmdGoSize                       146kB ± 0%        146kB ± 0%    ~     (all equal)

name                      old exe-bytes     new exe-bytes     delta
HelloSize                      1.13MB ± 0%       1.13MB ± 0%    ~     (all equal)
CmdGoSize                      15.1MB ± 0%       15.1MB ± 0%    ~     (all equal)

Change-Id: I3cc2f9829a109543d9a68be4a21775d2d3e9801f
Reviewed-on: https://go-review.googlesource.com/c/go/+/196557
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-02 09:56:36 +00:00
Jason A. Donenfeld
274f4cef93 cmd/link: implement Msync for Windows using FlushViewOfFile
CL 196846 implemented memory mapped output files but forgot to provide
an implementation for Msync. This rectifies that with a simple call to
FlushViewOfFile.

Change-Id: I5aebef9baf3a2a6ad54ceda096952a5d7d660bfe
Reviewed-on: https://go-review.googlesource.com/c/go/+/198418
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-02 09:45:12 +00:00
Kyohei Kadota
148ec3e3bc net/http/cgi: skip tests if not functional perl
TestEnvOverride sets PATH to /wibble before executing a CGI.
So customized Perl that is starting with '#!/usr/bin/env bash' will fail
because /usr/bin/env can't lookup bash.

Fixes #27790

Change-Id: I25e433061a7ff9da8c86429e934418fc15f12f90
Reviewed-on: https://go-review.googlesource.com/c/go/+/196845
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-02 05:52:16 +00:00
Emmanuel T Odeke
e79b57d6c4 os/signal: lazily start signal watch loop only on Notify
By lazily starting the signal watch loop only on Notify,
we are able to have deadlock detection even when
"os/signal" is imported.

Thanks to Ian Lance Taylor for the solution and discussion.

With this change in, fix a runtime gorountine count test that
assumed that os/signal.init would unconditionally start the
signal watching goroutine, but alas no more.

Fixes #21576.

Change-Id: I6eecf82a887f59f2ec8897f1bcd67ca311ca42ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/101036
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-02 03:52:59 +00:00
Bryan C. Mills
a1b0af9904 internal/goversion: update to 1.14
In #33848, we propose to use 'go 1.14' in the go.mod file to enable
new default behavior. That means that 'go mod init' needs to start
generating that directive by default, which requires the presence of
the updated version tag in the build environment.

Updates #33848

Change-Id: I9f3b8845fdfd843fd76de32f4b55d8f765d691de
Reviewed-on: https://go-review.googlesource.com/c/go/+/198318
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-01 22:07:45 +00:00
Ariel Mashraki
93a79bbcc0 text/template/parse: remove duplication in peekNonSpace
nextNonSpace has an identical code except the call to
backup at the end.

Change-Id: Iefa5b13950007da38323a800fb6b0ce3d436254b
Reviewed-on: https://go-review.googlesource.com/c/go/+/198277
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2019-10-01 20:30:37 +00:00
Ariel Mashraki
86cd6c2ee5 text/template/parse: use strings.Builder in Chain and List nodes
This CL is a continuation of 198078. Benchmark output:

benchmark                     old ns/op     new ns/op     delta
BenchmarkParseLarge-8         24759165      24516563      -0.98%
BenchmarkVariableString-8     115           115           +0.00%
BenchmarkListString-8         924           680           -26.41%

benchmark                     old allocs     new allocs     delta
BenchmarkVariableString-8     3              3              +0.00%
BenchmarkListString-8         14             13             -7.14%

benchmark                     old bytes     new bytes     delta
BenchmarkVariableString-8     72            72            +0.00%
BenchmarkListString-8         512           424           -17.19%

Change-Id: I9ec48fe4832437c556a5fa94d4cbf6e29e28d944
Reviewed-on: https://go-review.googlesource.com/c/go/+/198080
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-01 19:03:51 +00:00
Clément Chigot
09c9bced82 cmd/internal/obj/ppc64: Fix ADUFFxxxx generation on aix/ppc64
ADUFFCOPY and ADUFFZERO instructions weren't handled by rewriteToUseTOC.
These instructions are considered as a simple branch except with -dynlink
where they become an indirect call.

Fixes #34604

Change-Id: I16ca6a152164966fb9cbf792219a8a39aad2b53b
Reviewed-on: https://go-review.googlesource.com/c/go/+/197842
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-01 18:30:25 +00:00
Nuno Cruces
a49067aab6 net/http: avoid sending unspecified time for directories
Change applies to sendFile.
This is already done for sendContent.

Change-Id: If43d9ab99e6e66a1363b08e0bdcceb57df1f855c
GitHub-Last-Rev: 1c47620a09
GitHub-Pull-Request: golang/go#34631
Reviewed-on: https://go-review.googlesource.com/c/go/+/198139
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-01 15:27:28 +00:00
Andrew Bonventre
1820cca7d7 Revert "cmd/link: load symbols from .syso in external link mode"
This reverts CL 186417.

Reason for revert: Broke darwin (10_14), linux (ppc), aix (ppc)

Updates #33139

Change-Id: I8bf3c817a96a0e57e45754a097cea7062b2fcdfd
Reviewed-on: https://go-review.googlesource.com/c/go/+/198177
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-01 13:20:16 +00:00
Alex Brainman
af880809d8 cmd/link: MapViewOfFile output file
CL 170738 used mmap for writing most of the output file content.

This change implements similar functionality for Windows.

The output of

compilebench -count=5

command before and after this change

name                      old time/op       new time/op       delta
Template                        254ms ±14%        239ms ±10%    ~     (p=0.222 n=5+5)
Unicode                         119ms ±14%        113ms ±12%    ~     (p=0.421 n=5+5)
GoTypes                         892ms ±23%        850ms ± 1%    ~     (p=0.841 n=5+5)
Compiler                        3.86s ± 2%        3.82s ± 1%    ~     (p=0.222 n=5+5)
SSA                             12.6s ± 1%        12.6s ± 1%    ~     (p=0.095 n=5+5)
Flate                           162ms ±18%        149ms ± 1%  -7.91%  (p=0.016 n=5+5)
GoParser                        199ms ±12%        184ms ± 1%    ~     (p=0.056 n=5+5)
Reflect                         524ms ±13%        507ms ± 3%    ~     (p=0.421 n=5+5)
Tar                             207ms ± 7%        198ms ± 0%  -4.58%  (p=0.016 n=5+4)
XML                             305ms ± 6%        299ms ± 5%    ~     (p=0.690 n=5+5)
LinkCompiler                    1.14s ±11%        1.14s ± 3%    ~     (p=0.222 n=5+5)
ExternalLinkCompiler            2.80s ± 5%        2.92s ±13%    ~     (p=0.222 n=5+5)
LinkWithoutDebugCompiler        727ms ± 2%        750ms ± 7%    ~     (p=0.151 n=5+5)
StdCmd                          44.0s ± 8%        43.3s ± 2%    ~     (p=1.000 n=5+5)

name                      old user-time/op  new user-time/op  delta
Template                        300ms ±27%        259ms ±34%    ~     (p=0.341 n=5+5)
Unicode                         134ms ±51%        144ms ±67%    ~     (p=0.548 n=5+5)
GoTypes                         1.05s ±10%        1.03s ± 6%    ~     (p=0.968 n=5+5)
Compiler                        5.01s ± 3%        4.88s ± 3%    ~     (p=0.286 n=5+5)
SSA                             16.8s ± 1%        16.7s ± 1%  -0.95%  (p=0.008 n=5+5)
Flate                           178ms ±67%        181ms ±38%    ~     (p=0.849 n=5+5)
GoParser                        231ms ±32%        219ms ±21%    ~     (p=0.810 n=5+5)
Reflect                         634ms ±33%        650ms ± 6%    ~     (p=0.135 n=5+5)
Tar                             219ms ±36%        231ms ±19%    ~     (p=0.905 n=5+5)
XML                             378ms ±20%        366ms ±23%    ~     (p=0.913 n=5+5)
LinkCompiler                    1.34s ±15%        1.32s ±10%    ~     (p=0.730 n=5+5)
ExternalLinkCompiler            1.22s ±13%        1.18s ±15%    ~     (p=0.873 n=5+5)
LinkWithoutDebugCompiler        847ms ±13%        841ms ±21%    ~     (p=0.667 n=5+5)

name                      old text-bytes    new text-bytes    delta
HelloSize                       767kB ± 0%        767kB ± 0%    ~     (all equal)
CmdGoSize                      10.6MB ± 0%       10.6MB ± 0%    ~     (all equal)

name                      old data-bytes    new data-bytes    delta
HelloSize                      10.1kB ± 0%       10.1kB ± 0%    ~     (all equal)
CmdGoSize                       310kB ± 0%        310kB ± 0%    ~     (all equal)

name                      old bss-bytes     new bss-bytes     delta
HelloSize                       0.00B             0.00B         ~     (all equal)
CmdGoSize                       0.00B             0.00B         ~     (all equal)

name                      old exe-bytes     new exe-bytes     delta
HelloSize                      1.10MB ± 0%       1.10MB ± 0%    ~     (all equal)
CmdGoSize                      14.7MB ± 0%       14.7MB ± 0%    ~     (all equal)

Change-Id: I653f63213b9cc8a4b05f71938e34b5d53b05e3f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/196846
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-10-01 08:19:15 +00:00
Ariel Mashraki
4f13a9c5b1 text/template/parse: use strings.Builder in String methods
As mentioned in godoc, strings.Builder is more efficient for
concatenating and building strings.
Running a simple bench test on VariableNode.String() gives:

benchmark                     old ns/op     new ns/op     delta
BenchmarkParseLarge-8         25676831      24453285      -4.77%
BenchmarkVariableString-8     296           115           -61.15%

benchmark                     old allocs     new allocs     delta
BenchmarkVariableString-8     8              3              -62.50%

benchmark                     old bytes     new bytes     delta
BenchmarkVariableString-8     112           72            -35.71%

Change-Id: I13c9340080738fcad1edeed859d33ba608e4b05a
Reviewed-on: https://go-review.googlesource.com/c/go/+/198078
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-01 07:16:47 +00:00
Shenghou Ma
c1635ad8f0 runtime: fix darwin syscall performance regression
While understanding why syscall.Read is 2x slower on darwin/amd64, I found
out that, contrary to popular belief, the slowdown is not due to the migration
to use libSystem.dylib instead of direct SYSCALLs, i.e., CL 141639 (and #17490),
but due to a subtle change introduced in CL 141639.

Previously, syscall.Read used syscall.Syscall(SYS_READ), whose preamble called
runtime.entersyscall, but after CL 141639, syscall.Read changes to call
runtime.syscall_syscall instead, which in turn calls runtime.entersyscallblock
instead of runtime.entersyscall. And the entire 2x slow down can be attributed
to this change.

I think this is unnecessary as even though syscalls like Read might block, it
does not always block, so there is no need to handoff P proactively for each
Read. Additionally, we have been fine with not handing off P for each Read
prior to Go 1.12, so we probably don't need to change it. This changes restores
the pre-Go 1.12 behavior, where syscall preamble uses runtime.entersyscall,
and we rely on sysmon to take P back from g blocked in syscalls.

Change-Id: If76e97b5a7040cf1c10380a567c4f5baec3121ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/197938
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-01 04:04:40 +00:00
Andrew Bonventre
e617141b0b cmd/go/internal/modfetch: update TestCodeRepo for gopkg.in/yaml.v2
The new yaml.v2 release broke the longtest builder. Update the expected
data.

Updates #28856

Change-Id: I98ec9e32e55bdb6b26b67e46dc16f34f77c2d40f
Reviewed-on: https://go-review.googlesource.com/c/go/+/198117
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-10-01 02:07:28 +00:00
John Papandriopoulos
5e514b76e2 cmd/link: load symbols from .syso in external link mode
Fix linking with a package having a .syso file in external link mode,
that would otherwise cause an error before executing the external
linker because it can't find symbols that are exported in the said
.syso file.

Fixes #33139

Change-Id: Id3ee737fba1c6f1e37910593dfedf9c84486d398
Reviewed-on: https://go-review.googlesource.com/c/go/+/186417
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-01 00:02:11 +00:00
Rob Pike
27cf81e1b4 text/template: further simplify building the vars list
Followup to https://golang.org/cl/197997

If you know the number of elements, you don't need append at all.
Either use append to grow, or allocate and index. Here we choose
number 2.

Change-Id: Ic58637231789640ff7b293ece04a95a8de7ccf8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/198097
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-01 00:00:02 +00:00
Matthew Dempsky
e76b9e8908 cmd/compile: remove pointer temporaries in walkcompare
When comparing two T-typed values t1 and t2 using the T_eq function,
we used to generate:

    pl := &t1
    pr := &t2
    return T_eq(pl, pr, unsafe.Sizeof(T{}))

This CL changes it to simply generate:

    return T_eq(&t1, &t2, unsafe.Sizeof(T{}))

Surprisingly, this does not pass toolstash. For some reason, it seems
like SSA wasn't able to SSA-ify the pl and pr variables in all cases.

Change-Id: I111fbb068a1741fa169c9922cb8cdb6e21579aa4
Reviewed-on: https://go-review.googlesource.com/c/go/+/197601
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-09-30 23:44:36 +00:00
Matthew Dempsky
ecc2d61798 cmd/compile: remove redundant anylit calls in walkcompare
walkcompare already called walkexpr on n.Left and n.Right, which in
turn calls anylit when appropriate.

Passes toolstash-check.

Change-Id: I6912ac5a42b977c04db9d85cb2e7295e275e083d
Reviewed-on: https://go-review.googlesource.com/c/go/+/197600
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-09-30 23:42:51 +00:00
Pantelis Sampaziotis
f91c850be6 text/template/parse: specify slice capacity in Pipenode.CopyPipe()
The required vars slice capacity is known so it can be specified before appending.

Change-Id: Ifa2fe97602e84198c4d01e5a1b0529f3f65f2df1
GitHub-Last-Rev: a0580df208
GitHub-Pull-Request: golang/go#34613
Reviewed-on: https://go-review.googlesource.com/c/go/+/197997
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-09-30 21:48:20 +00:00
An Xiao
8e032b917a net: update quotation marks in comment
This change updates the use of quotation marks by replacing `ones' with 'ones'.
Quotation like `this' should not be used any more according to
https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html

Change-Id: I58470cdcc207864fbc8ca68ec0e77329bd81dc19
GitHub-Last-Rev: d03c81ebfb
GitHub-Pull-Request: golang/go#33719
Reviewed-on: https://go-review.googlesource.com/c/go/+/190817
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-09-30 21:46:59 +00:00
chauncyc
cde282dbdd crypto/x509: add IPAddresses to list of template fields used by CreateCertificate
Change-Id: Ifbdf33ee4e413c3edba59b7dbed00ab90698cd35
GitHub-Last-Rev: c3bd33c4cf
GitHub-Pull-Request: golang/go#34277
Reviewed-on: https://go-review.googlesource.com/c/go/+/195157
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2019-09-30 21:25:36 +00:00
Pantelis Sampaziotis
0adc89aa96 strconv: add Unwrap to custom error types
Updates #30322

This change adds the Unwrap method to NumError. NumError is the only custom error type of the strconv that has a nested exported error.

Change-Id: I8774886348880365a83f72a1d106276def27dffe
GitHub-Last-Rev: 712f3df884
GitHub-Pull-Request: golang/go#34213
Reviewed-on: https://go-review.googlesource.com/c/go/+/194563
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-09-30 21:07:51 +00:00
Tobias Klauser
ba18c7c42d syscall: fix TestGroupCleanupUserNamespace on CentOS
Update the list of expected "id" outputs in
TestGroupCleanupUserNamespace with SELinux context information as used
on CentOS.

Fixes #34547

Change-Id: I426bbe2d04e2039c87490362a1891ec3de6e36e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/197841
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-30 16:12:05 +00:00
Carlo Alberto Ferraris
5f1aeaeb77 math/rand: devirtualize interface call in Read
This allows to inline the common case in which the Source is a
rngSource. On linux/amd64 in a VM:

name        old time/op  new time/op  delta
Read3-4     33.8ns ± 8%  18.5ns ± 8%  -45.38%  (p=0.000 n=10+10)
Read64-4     371ns ± 8%    70ns ± 7%  -81.00%  (p=0.000 n=10+10)
Read1000-4  5.33µs ± 5%  0.86µs ± 3%  -83.85%  (p=0.000 n=9+9)

Change-Id: Ibf47b0e9ecdfe62ffcb66d6a92f191800bdc740e
Reviewed-on: https://go-review.googlesource.com/c/go/+/191539
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-30 15:43:34 +00:00
Richard Musiol
60f271358f syscall/js: add Value.Delete for deleting JavaScript properties
This change adds the method Value.Delete, which implements
JavaScript's "delete" operator for deleting properties.

Fixes #33079.

Change-Id: Ia5b190240bd59daca48094fcbc32f8d0a06f19d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/197840
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-09-30 14:40:06 +00:00
Julien Schmidt
843fec1c7d database/sql: preallocate list slice in Drivers()
The required slice capacity is already known. Thus, preallocate a slice with the correct capacity before appending to it.

Change-Id: I45ac2c5f1701caeb3dda20451d371713ae7e7365
GitHub-Last-Rev: 2bf575be65
GitHub-Pull-Request: golang/go#34602
Reviewed-on: https://go-review.googlesource.com/c/go/+/197917
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-30 00:45:38 +00:00
Carlo Alberto Ferraris
931365763a math/rand: devirtualize interface in lockedSource
Avoid interface calls, enable inlining, and store the rngSource close to the
Mutex to exploit better memory locality.

Also add a benchmark to properly measure the threadsafe nature of globalRand.

On a linux/amd64 VM:

name                       old time/op  new time/op  delta
Int63Threadsafe-4          36.4ns ±12%  20.6ns ±11%  -43.52%  (p=0.000 n=30+30)
Int63ThreadsafeParallel-4  79.3ns ± 5%  56.5ns ± 5%  -28.69%  (p=0.000 n=29+30)

Change-Id: I6ab912c1a1e9afc7bacd8e72c82d4d50d546a510
Reviewed-on: https://go-review.googlesource.com/c/go/+/191538
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-29 14:27:05 +00:00
Richard Musiol
57662b1575 cmd/link: add producer section to wasm binaries
This change adds an optional "producer" section that reports the source
language and compiler version. See
https://github.com/WebAssembly/tool-conventions/blob/master/ProducersSection.md.

It also removes the now redundant "go.version" section.

Fixes #33295.

Change-Id: Ib4c80528728caf9e524fbd3f26822cbbc8b05a75
Reviewed-on: https://go-review.googlesource.com/c/go/+/196804
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-09-29 09:13:13 +00:00
Alberto Donizetti
2c47caa900 cmd/compile: use %v for Node formatting
CL 197817 replaced a use of n.Rlist with n.Right in a Fprintf call,
but it left the corresponding format as %.v, which broke the
TestFormats test on the longtest builder.

Since with n.Right is custom to use %v (and not %.v), replace the
format with %v.

Fixes the longtest builder.

Change-Id: Icf5bf820a936c51e633c25ada1a71a1ffb6d28c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/197837
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-09-28 13:50:34 +00:00
Mohit Verma
c729116332 cmd/compile: use Node.Right for OAS2* nodes (cleanup)
This CL changes cmd/compile to use Node.Right instead of
Node.Rlist for OAS2FUNC/OAS2RECV/OAS2MAPR/OAS2DOTTYPE nodes.
Fixes #32293

Change-Id: I4c9d9100be2d98d15e016797f934f64d385f5faa
Reviewed-on: https://go-review.googlesource.com/c/go/+/197817
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-09-28 05:04:49 +00:00
Pantelis Sampaziotis
9748e64fe5 regexp: add examples for FindSubmatchIndex and Longest
updates #21450

Change-Id: Ibffe0dadc1e1523c55cd5f5b8a69bc1c399a255d
GitHub-Last-Rev: 507f555081
GitHub-Pull-Request: golang/go#33497
Reviewed-on: https://go-review.googlesource.com/c/go/+/189177
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-09-28 00:37:35 +00:00
David Crawshaw
2d1c033259 reflect: let StructOf define unexported fields
This was missing from the original StructOf CL because I couldn't
think of a use for it. Now I can: even with types used entirely
by reflect, unexported fields can be set using UnsafeAddr.

Change-Id: I5e7e3d81d16e8817cdd69d85796ce33930ef523b
Reviewed-on: https://go-review.googlesource.com/c/go/+/85661
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-09-28 00:19:19 +00:00
Hasit Bhatt
739bf6b929 cmd: update x/tools version to enforce only one %w
As mentioned in https://golang.org/issue/34062#issuecomment-529692313
src/cmd refers to older version of golang.org/x/tools.
Hence, not checking if multiple errors are used in the same fmt.Errorf.
Updating golang.org/x/tools version to latest in src/cmd.

Fixes #34062

Change-Id: I358dec2c3d3af2b19add766b8488b919109b81d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/196843
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-09-27 21:17:15 +00:00
Daniel Martí
bdf0fe5448 cmd/compile: minor simplifications in rulegen
First, be consistent about declaring typ as &b.Func.Config.Types and
not &config.Types. Not particularly better, and it barely changes the
output, but we're more consistent now.

Second, remove a bit of duplication when handling the typ, auxint, and
aux variables.

Third and last, remove a stray canFail assignment; we ended up setting
that in add, not breakf, so it's not necessary to set it manually if we
don't use breakf.

Updates #33644.

Change-Id: I75999cb223a201969266fbfeae043599fa27fac5
Reviewed-on: https://go-review.googlesource.com/c/go/+/196803
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-27 18:58:08 +00:00
Matthew Dempsky
95b8cbfee9 cmd/compile: add column details to export data
This CL updates the export data format to include column details when
writing out position data. cmd/compile is updated to generate and make
use of the new details, but go/internal/gcimporter only knows how to
read the data. It doesn't yet actually make use of it.

Experimentally across a wide range of packages, this increases export
data size by around 4%. However, it has no impact on binary size.
(Notably, it actually shrinks k8s.io/kubernetes/cmd/kubelet's binary
size by 24kB, but it's unclear to me why at this time.)

Updates #28259.

Change-Id: I351fb340839df8d3adced49b3757c4537fb91b3f
Reviewed-on: https://go-review.googlesource.com/c/go/+/196963
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2019-09-27 18:38:37 +00:00
Justin Nuß
683ef8c844 html/template: document handling of namespaced and data- attributes
Attributes with a namespace or a data- prefix are handled as if they
had no namespace/data- prefix.

There is also a special case, where attributes with a "xmlns" namespace
are always treated as containing URLs.

This could surprise users of the package, since this behaviour was not
documented anywhere, so this change adds some documentation for all
three cases.

Fixes #12648

Change-Id: If57a2ec49fec91a330fc04795726e8cffa9b75c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/79895
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-09-27 17:59:33 +00:00
Bryan C. Mills
db87c9f2d0 cmd/go: do not reject internal double-dots in path elements
The relative path element ".." is already rejected
by the checks for leading and trailing dots.

Fixes #27299

Change-Id: Ia8ab543c93288cdc0615abd6d22521d44bc56d72
Reviewed-on: https://go-review.googlesource.com/c/go/+/197720
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-27 17:28:24 +00:00
Emmanuel T Odeke
55738850c4 net/http: remove TestTimeoutHandlerAndFlusher due to flakes
Removes TestTimeoutHandlerAndFlusher due to flakes on
one of the builders due to timing issues.

Perhaps later, we might need to bring it back when we've
figured out the timing issues.

Fixes #34573.

Change-Id: Ia88d4da31fb228296144dc31f9a4288167fb4a53
Reviewed-on: https://go-review.googlesource.com/c/go/+/197757
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-27 15:38:16 +00:00
Than McIntosh
70a1efbb5c cmd/link: remove reading/processing of function Autom records
Remove linker reading and processing of automs (no longer needed, now
that the compiler is emitting R_USETYPE relocations on functions). So
as to avoid changing the object file format, the object still contains
a count of automs, but this count is required to be zero.

Updates #34554.

Change-Id: I10230e191057c5c5705541eeb06f747d5f73c42d
Reviewed-on: https://go-review.googlesource.com/c/go/+/197500
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-09-27 13:59:05 +00:00
Than McIntosh
cdd59205c4 cmd/compile: don't emit autom's into object file
Don't write Autom records when writing a function to the object file;
we no longer need them in the linker for DWARF processing. So as to
keep the object file format unchanged, write out a zero-length list of
automs to the object, as opposed to removing all references.

Updates #34554.

Change-Id: I42a1d67207ea7114ae4f3a315cf37effba57f190
Reviewed-on: https://go-review.googlesource.com/c/go/+/197499
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-09-27 13:58:59 +00:00
Than McIntosh
e72f002ed0 cmd/link: create DWARF types for autos based R_USETYPE relocs
Switch the linker over to use dummy R_USETYPE relocations on DWARF
subprogram DIEs as a means of insuring that DWARF types are created
for types of autotmp values used in live functions.

This change is part of a series intended to clean up handling of
autotmp types and remove use of autom's in the compiler and linker.

Updates #34554.

Change-Id: Ic74da6bd723ab7e4d8a16ad46e23228650d4b525
Reviewed-on: https://go-review.googlesource.com/c/go/+/197498
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-09-27 13:56:45 +00:00
Than McIntosh
0b486d2a87 cmd/compile: add R_USETYPE relocs to func syms for autom types
During DWARF processing, keep track of the go type symbols for types
directly or indirectly referenced by auto variables in a function,
and add a set of dummy R_USETYPE relocations to the function's DWARF
subprogram DIE symbol.

This change is not useful on its own, but is part of a series of
changes intended to clean up handling of autom's in the compiler
and linker.

Updates #34554.

Change-Id: I974afa9b7092aa5dba808f74e00aa931249d6fe9
Reviewed-on: https://go-review.googlesource.com/c/go/+/197497
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-09-27 13:56:32 +00:00
Matthew Dempsky
ac1d440ea6 cmd/compile: apply constant folding to ORUNESTR
ORUNESTR represents the special case of integer->string conversion. If
the integer is a constant, then the string is a constant too, so
evconst needs to perform constant folding here.

Passes toolstash-check.

Fixes #34563.

Change-Id: Ieab3d76794d8ce570106b6b707a4bcd725d156e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/197677
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-26 23:54:29 +00:00
Giovanni Bajo
0a5116493c cmd/compile: in poset, simplify usage of CheckIntegrity
Instead of returning an error, just panic: the function is
used only for debugging purposes anyway.

Change-Id: Ie81b2309daaf1efb9470992391534bce2141b3c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/196779
Reviewed-by: David Chase <drchase@google.com>
2019-09-26 21:24:48 +00:00
Giovanni Bajo
490646e476 cmd/compile: in poset, move all constants to the first DAG
In poset, all constants are always related to each other, so they
are part of the same DAG. Currently, it can be any of the DAGs in
the forest. Since we're about to start visiting that DAG for the
task of calculating bounds, make sure that it's conventionally
always the first, so that we don't need to search for it.

Change-Id: Ia7ca312b52336b4731b070d45cf0d768a0d6aeeb
Reviewed-on: https://go-review.googlesource.com/c/go/+/196599
Reviewed-by: David Chase <drchase@google.com>
2019-09-26 21:24:24 +00:00
Emmanuel T Odeke
4faf8a8dc4 net/http, doc/go1.13.html: revert TimeoutHandler.Flush
Also added a test to ensure that any interactions
between TimeoutHandler and Flusher result in the
correct status code and body, but also that we don't
get superfluous logs from stray writes as was seen
in the bug report.

Fixes #34439.

Change-Id: I4af62db256742326f9353f98a2fcb5f71d2a5fd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/197659
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-26 21:12:34 +00:00
Matthew Dempsky
616c39f6a6 cmd/compile: remove DDD array types
Currently we handle [...]T array literals by treating [...]T as
special "DDD array" types. However, these array literals are just
composite literal syntax, not a distinct Go type. Moreover,
representing them as Go types contributes to complexity in a number of
unrelated bits of code.

This CL changes OCOMPLIT typechecking to look for the [...]T syntax
and handle it specially, so we can remove DDD arrays.

Passes toolstash-check.

Change-Id: Ibbf701eac4caa7a321e2d10e256658fdfaa8a160
Reviewed-on: https://go-review.googlesource.com/c/go/+/197604
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-09-26 20:45:09 +00:00
Brad Fitzpatrick
e1b1b7856f cmd/dist: fix bootstrap failure when GOHOSTARCH is set
Fixes #33977

Change-Id: I4b136788f08b08c53087af8d3cd56125e620b51b
Reviewed-on: https://go-review.googlesource.com/c/go/+/197602
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-09-26 20:45:09 +00:00
Matthew Dempsky
f672e221fc cmd/compile: extract typecheckarraylit function
Typechecking slice literals, array literals, and array literals using
"..." notation all use very similar logic, but tie into the logic for
checking the OCOMPLIT node in slightly different ways.

By refactoring this function out into a separate helper, it makes it
easier to separate slice and array literals, and the subsequent CL
will further separate array literals that do use "..." notation from
those that do not.

Passes toolstash-check.

Change-Id: I4c572e0d9d08bcc86b5c224bd6f9e1c498726c19
Reviewed-on: https://go-review.googlesource.com/c/go/+/197603
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-09-26 20:44:28 +00:00
Giovanni Bajo
740d2c8c22 cmd/compile: adjust top-level documentation of poset
Change-Id: I29e24c734e5e0041008771c805a0285aac3e02e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/196598
Reviewed-by: David Chase <drchase@google.com>
2019-09-26 18:47:41 +00:00
Giovanni Bajo
1658263bbf cmd/compile: detect indvars that are bound by other indvars
prove wasn't able to detect induction variables that was bound
by another inducation variable. This happened because an indvar
is a Phi, and thus in case of a dependency, the loop bounding
condition looked as Phi < Phi. This triggered an existing
codepath that checked whether the upper bound was a Phi to
detect loop conditions written in reversed order respect to the
idiomatic way (eg: for i:=0; len(n)>i; i++).

To fix this, we call the indvar pattern matching on both operands
of the loop condition, so that the first operand that matches
will be treated as the indvar.

Updates #24660 (removes a boundcheck from Fannkuch)

Change-Id: Iade83d8deb54f14277ed3f2e37b190e1ed173d11
Reviewed-on: https://go-review.googlesource.com/c/go/+/195220
Reviewed-by: David Chase <drchase@google.com>
2019-09-26 18:47:12 +00:00
Giovanni Bajo
9740b60e14 cmd/compile: refactor some code in loopbce.go
This CL extracts the logic for pattern-matching an induction
variable into a separate function, in preparation for next CL
where we would need to call it multiple times.

No functional changes, passes toolstash -cmp.

Change-Id: Ic52391e6c1b2e72bae32a0f3f65dfea321caaf4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/195737
Reviewed-by: David Chase <drchase@google.com>
2019-09-26 18:46:30 +00:00
Matthew Dempsky
fd5ba54f7c cmd/compile: stop exporting OPTRLIT
Removes TODO left by previous commit to appease toolstash.

Change-Id: I5c0bf25f21ba5c0abe3b1b2ed0b17c604717f39b
Reviewed-on: https://go-review.googlesource.com/c/go/+/197121
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-09-26 18:46:09 +00:00
Matthew Dempsky
00b773a4a9 cmd/compile: simplify OPTRLIT handling
Previously, we would recognize &(T{...}) expressions during type
checking, rewrite them into (*T){...}, and then do a lot of extra work
to make sure the user doesn't write (*T){...} themselves and
resynthesizing the OPTRLIT later on.

This CL simply handles &T{...} directly in the straight forward
manner, by changing OADDR directly to OPTRLIT when appropriate.

While here, match go/types's invalid composite literal type error
message.

Passes toolstash-check.

Change-Id: I902b14c7e2cd9fa93e6915dd58272d2352ba38f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/197120
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-09-26 18:45:53 +00:00
Giovanni Bajo
87e2b34f7b cmd/compile: in prove, learn facts from OpSliceMake
Now that OpSliceMake is called by runtime.makeslice callers,
prove can see and record the actual length and cap of each
slice being constructed.

This small patch is enough to remove 260 additional bound checks
from cmd+std.

Thanks to Martin Möhrmann for pointing me to CL141822 that
I had missed.

Updates #24660

Change-Id: I14556850f285392051f3f07d13b456b608b64eb9
Reviewed-on: https://go-review.googlesource.com/c/go/+/196784
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2019-09-26 18:27:38 +00:00
Joel Sing
08165932f7 cmd/internal/obj/riscv: require memory targets for load and store instructions
This allows for `LD 4(X5), X6' rather than `LD $4, X5, X6'. Similar for other
load and store instructions. It is worth noting that none of these are likely
to be used directly once the MOV pseudo-instructions are implemented.

Updates #27532

Change-Id: Ie043c2dedd2cdaceb258b27976cfb3f74aa1cc1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/196842
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-26 17:56:30 +00:00