]> Cypherpunks repositories - gostls13.git/log
gostls13.git
5 years agoruntime: don't panic on racy use of timers
Ian Lance Taylor [Wed, 26 Feb 2020 04:23:15 +0000 (20:23 -0800)]
runtime: don't panic on racy use of timers

If we see a racy use of timers, as in concurrent calls to Timer.Reset,
do the operations in an unpredictable order, rather than crashing.

Fixes #37400

Change-Id: Idbac295df2dfd551b6d762909d5040fc532c1b34
Reviewed-on: https://go-review.googlesource.com/c/go/+/221077
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 years agocmd/dist: enable cgo and PIE tests on android/arm64
Cherry Zhang [Wed, 26 Feb 2020 15:24:39 +0000 (10:24 -0500)]
cmd/dist: enable cgo and PIE tests on android/arm64

Now that android/arm64 supports internal linking PIE, enable the
test. While here, I realized that some cgo tests are also not
enabled on android/arm64. Enable them as well. Let's see if it
works.

Change-Id: Ibf186fe402ebf0bbec82873fd56d0eb752b48180
Reviewed-on: https://go-review.googlesource.com/c/go/+/221099
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/link: reenable internal linking PIE on linux/amd64 and linux/arm64
Cherry Zhang [Wed, 26 Feb 2020 15:08:30 +0000 (10:08 -0500)]
cmd/link: reenable internal linking PIE on linux/amd64 and linux/arm64

It was enabled in CL 207877, but then accidentally disabled in
CL 207299 due to a bad rebase. Reenable.

Change-Id: I147bf724a4263d4aae54576a36cc7e1cad5e8a2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/221098
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoio/ioutil: reject path separators in TempDir, TempFile pattern
Constantin Konstantinidis [Wed, 25 Dec 2019 16:24:07 +0000 (17:24 +0100)]
io/ioutil: reject path separators in TempDir, TempFile pattern

Fixes #33920

Change-Id: I2351a1caa80c086ff5a8e02aad70d996be7aac35
Reviewed-on: https://go-review.googlesource.com/c/go/+/212597
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agobuild: in clean.bash, look for 'go' in GOROOT/bin instead of GOBIN
Nikson Kanti Paul [Tue, 21 Jan 2020 00:50:27 +0000 (01:50 +0100)]
build: in clean.bash, look for 'go' in GOROOT/bin instead of GOBIN

Updates #14340
Updates #32674
Fixes #36659

Change-Id: I5bfaba4e53dab894d113dd5065794d66f1a25f2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/215478
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/compile: use immediates for MOVO of readonly sym
Josh Bleecher Snyder [Sun, 23 Feb 2020 06:05:05 +0000 (22:05 -0800)]
cmd/compile: use immediates for MOVO of readonly sym

file      before    after     Δ       %
addr2line 4307760   4303616   -4144   -0.096%
api       5968600   5968568   -32     -0.001%
asm       5109928   5122120   +12192  +0.239%
buildid   2843752   2839608   -4144   -0.146%
cgo       4823768   4819624   -4144   -0.086%
compile   20687848  20691800  +3952   +0.019%
cover     5259896   5255752   -4144   -0.079%
dist      3665176   3661032   -4144   -0.113%
doc       4668648   4668600   -48     -0.001%
fix       3368792   3368744   -48     -0.001%
link      6613328   6609200   -4128   -0.062%
nm        4253312   4253280   -32     -0.001%
objdump   4655360   4655312   -48     -0.001%
pack      2294312   2294280   -32     -0.001%
pprof     14747332  14747284  -48     -0.000%
test2json 2819416   2815272   -4144   -0.147%
trace     11669436  11665292  -4144   -0.036%
vet       8274184   8270040   -4144   -0.050%
total     116030848 116009424 -21424  -0.018%

Change-Id: Ice37222c4d76540b3591459f605321cbf142872d
Reviewed-on: https://go-review.googlesource.com/c/go/+/220690
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: mark Lsyms as readonly earlier
Josh Bleecher Snyder [Mon, 17 Feb 2020 01:00:52 +0000 (17:00 -0800)]
cmd/compile: mark Lsyms as readonly earlier

The SSA backend has rules to read the contents of readonly Lsyms.
However, this rule was failing to trigger for many readonly Lsyms.
This is because the readonly attribute that was set on the Node.Name
was not propagated to its Lsym until the dump globals phase, after SSA runs.

To work around this phase ordering problem, introduce Node.SetReadonly,
which sets Node.Name.Readonly and also configures the Lsym
enough that SSA can use it.

This change also fixes a latent problem in the rewrite rule function,
namely that reads past the end of lsym.P were treated as entirely zero,
instead of merely requiring padding with trailing zeros.

This change also adds an amd64 rule needed to fully optimize
the results of this change. It would be better not to need this,
but the zero extension that should handle this for us
gets optimized away too soon (see #36897 for a similar problem).
I have not investigated whether other platforms also need new
rules to take full advantage of the new optimizations.

Compiled code for (interface{})(true) on amd64 goes from:

LEAQ type.bool(SB), AX
MOVBLZX ""..stmp_0(SB), BX
LEAQ runtime.staticbytes(SB), CX
ADDQ CX, BX

to

LEAQ type.bool(SB), AX
LEAQ runtime.staticbytes+1(SB), BX

Prior to this change, the readonly symbol rewrite rules
fired a total of 884 times during make.bash.
Afterwards they fire 1807 times.

file    before    after     Δ       %
cgo     4827832   4823736   -4096   -0.085%
compile 24907768  24895656  -12112  -0.049%
fix     3376952   3368760   -8192   -0.243%
pprof   14751700  14747604  -4096   -0.028%
total   120343528 120315032 -28496  -0.024%

Change-Id: I59ea52138276c37840f69e30fb109fd376d579ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/220499
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: make clobber variadic
Josh Bleecher Snyder [Tue, 25 Feb 2020 01:30:44 +0000 (17:30 -0800)]
cmd/compile: make clobber variadic

There are often many values to clobber.
Allow passing them all in at once.
The goal is increased rule readability.
As a bonus, it shrinks cmd/compile by ~97k, almost half a percent.
Package SSA requires 1.2% less memory to compile.

The single-line changes were make via regex,
and the remaining multi-line clobbers were manually combined.

Passes toolstash-check -all.

Change-Id: Ib310e9265d3616211f8192c9040b4c8933824d19
Reviewed-on: https://go-review.googlesource.com/c/go/+/220691
Reviewed-by: Michael Munday <mike.munday@ibm.com>
5 years agocmd/link/internal/ld: bump NetBSD ABI version to 7.0
Tobias Klauser [Tue, 25 Feb 2020 09:18:55 +0000 (10:18 +0100)]
cmd/link/internal/ld: bump NetBSD ABI version to 7.0

According to https://golang.org/wiki/NetBSD, NetBSD 7.0 is supported as
of Go 1.3 (with Go 1.5 recommended). NetBSD 6.0 was last supported in Go
1.9.7. Thus, bump the minimal ABI version to NetBSD 7.0

Suggested by Benny Siegert in CL 212461.

Change-Id: I11dd14c6b835ac9fc156880b2551f71893c7f267
Reviewed-on: https://go-review.googlesource.com/c/go/+/220428
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: constant fold SHLxconst of a constant on amd64
Josh Bleecher Snyder [Sun, 23 Feb 2020 05:47:49 +0000 (21:47 -0800)]
cmd/compile: constant fold SHLxconst of a constant on amd64

These rules fire in particular when comparing to a constant
string of length two. They should trigger even more after CL 220499.

file    before    after     Δ       %
compile 20639976  20635880  -4096   -0.020%
total   116003456 115999360 -4096   -0.004%

Change-Id: I21c1c02cf32d710d7a4eb12efab00f02796ccb84
Reviewed-on: https://go-review.googlesource.com/c/go/+/220694
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: merge const into storeidx on amd64
Josh Bleecher Snyder [Sun, 23 Feb 2020 04:05:12 +0000 (20:05 -0800)]
cmd/compile: merge const into storeidx on amd64

file    before    after     Δ       %
compile 20652264  20639976  -12288  -0.059%
trace   11673532  11669436  -4096   -0.035%
total   116019840 116003456 -16384  -0.014%

Change-Id: Id0522e08f10e77c885fba1d0d9b65f8981a647ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/220693
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agobytes: deflake TestGrow by using testing.AllocsPerRun
HowJMay [Wed, 26 Feb 2020 18:19:18 +0000 (18:19 +0000)]
bytes: deflake TestGrow by using testing.AllocsPerRun

Fixes #36695

Change-Id: I4392246015252018b49f321a5a839cc68cc611d7
GitHub-Last-Rev: c2fb1f7ddbe9b80059eed69f31781abe0a1db185
GitHub-Pull-Request: golang/go#36732
Reviewed-on: https://go-review.googlesource.com/c/go/+/216237
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/compile: simplify Slicemask on riscv64
Joel Sing [Tue, 25 Feb 2020 17:01:29 +0000 (04:01 +1100)]
cmd/compile: simplify Slicemask on riscv64

Slicemask can be performed with three immediate instructions, rather than the
six currently in use.

Change-Id: I3f8ca2d5affd1403db8fa79b356f248e6e9332c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/220923
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: improve Eq32/Neq32 on riscv64
Joel Sing [Tue, 25 Feb 2020 16:58:59 +0000 (03:58 +1100)]
cmd/compile: improve Eq32/Neq32 on riscv64

Use SUBW to perform a 32-bit subtraction, rather than zero extending from
32 to 64 bits. This reduces Eq32 and Neq32 to two instructions, rather than
the four instructions required previously.

Change-Id: Ib2798324881e9db842c864e91a0c1b1e48c4b67b
Reviewed-on: https://go-review.googlesource.com/c/go/+/220921
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoencoding/json: consolidate the isSpace function
codesoap [Wed, 26 Feb 2020 17:36:01 +0000 (17:36 +0000)]
encoding/json: consolidate the isSpace function

The new code is easier to read, and practically equivalent in terms of
performance.

name                  old time/op    new time/op    delta
CodeUnmarshal-2          166ms ± 1%     166ms ± 1%    ~     (p=0.863 n=11+10)
CodeUnmarshalReuse-2     139ms ± 1%     139ms ± 1%    ~     (p=0.050 n=10+12)
UnmarshalString-2       1.08µs ± 1%    1.07µs ± 1%  -0.64%  (p=0.001 n=10+11)
UnmarshalFloat64-2      1.01µs ± 1%    1.01µs ± 1%    ~     (p=0.280 n=12+11)
UnmarshalInt64-2         850ns ± 0%     851ns ± 0%    ~     (p=0.455 n=11+12)

name                  old speed      new speed      delta
CodeUnmarshal-2       11.7MB/s ± 1%  11.7MB/s ± 1%    ~     (p=0.904 n=11+10)
CodeUnmarshalReuse-2  14.0MB/s ± 1%  14.0MB/s ± 1%  +0.40%  (p=0.041 n=10+12)

name                  old alloc/op   new alloc/op   delta
CodeUnmarshal-2         3.28MB ± 0%    3.28MB ± 0%    ~     (p=0.907 n=10+11)
CodeUnmarshalReuse-2    2.19MB ± 0%    2.19MB ± 0%    ~     (p=0.306 n=12+12)
UnmarshalString-2         192B ± 0%      192B ± 0%    ~     (all equal)
UnmarshalFloat64-2        180B ± 0%      180B ± 0%    ~     (all equal)
UnmarshalInt64-2          176B ± 0%      176B ± 0%    ~     (all equal)

name                  old allocs/op  new allocs/op  delta
CodeUnmarshal-2          92.7k ± 0%     92.7k ± 0%    ~     (all equal)
CodeUnmarshalReuse-2     80.4k ± 0%     80.4k ± 0%    ~     (all equal)
UnmarshalString-2         2.00 ± 0%      2.00 ± 0%    ~     (all equal)
UnmarshalFloat64-2        2.00 ± 0%      2.00 ± 0%    ~     (all equal)
UnmarshalInt64-2          1.00 ± 0%      1.00 ± 0%    ~     (all equal)

Change-Id: I6d5a48c624d436551409a17c21542e26d29e26b3
GitHub-Last-Rev: 7d81961688b5ee3a7e4718188c0eaf3413521f97
GitHub-Pull-Request: golang/go#37385
Reviewed-on: https://go-review.googlesource.com/c/go/+/220581
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Joe Tsai <joetsai@google.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocrypto/tls: use new ecdsa.VerifyASN1 API
Katie Hockman [Mon, 24 Feb 2020 22:23:19 +0000 (17:23 -0500)]
crypto/tls: use new ecdsa.VerifyASN1 API

Change-Id: I2a233190bda78ca022ff4074b4553788847d7583
Reviewed-on: https://go-review.googlesource.com/c/go/+/220720
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years agotest: re-enable open-coded defer test on riscv64
Joel Sing [Tue, 25 Feb 2020 16:17:01 +0000 (03:17 +1100)]
test: re-enable open-coded defer test on riscv64

Open-coded defers were fixed and re-enabled on riscv64, however this test was
inadvertantly left disabled.

Updates #36786

Change-Id: I128fc84baa3d51f50d173e19e52051dc4d9a07c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/220920
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/go: escape $WORK in ccompile when -n is set
GrigoriyMikhalkin [Wed, 26 Feb 2020 15:02:36 +0000 (15:02 +0000)]
cmd/go: escape $WORK in ccompile when -n is set

Fixes #37012

Change-Id: I169807788c022042a2b5cf04f67ae41a7325fbcf
GitHub-Last-Rev: 9e77301c7ab3125a6f21f2c9cd998503976a5d5d
GitHub-Pull-Request: golang/go#37289
Reviewed-on: https://go-review.googlesource.com/c/go/+/219919
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocrypto/x509: use new ecdsa.VerifyASN1 API
Katie Hockman [Mon, 24 Feb 2020 22:25:08 +0000 (17:25 -0500)]
crypto/x509: use new ecdsa.VerifyASN1 API

Change-Id: Ia4f77d2965e34454e8dd3f2d8bf9c4f3065a9fbc
Reviewed-on: https://go-review.googlesource.com/c/go/+/220721
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years agocmd/go/internal/modfetch: retry rename for unzipped directories
Jay Conrod [Tue, 25 Feb 2020 19:54:18 +0000 (14:54 -0500)]
cmd/go/internal/modfetch: retry rename for unzipped directories

No test because this is difficult to reproduce, and such a test would
always be flaky.

Updates #36568

Change-Id: I8170410a7729ecc6f90baf8005444d6b1241185e
Reviewed-on: https://go-review.googlesource.com/c/go/+/220978
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
5 years agocmd/compile: output cost while inlining function with Debug['m'] > 1
TennyZhuang [Wed, 29 Jan 2020 03:47:49 +0000 (11:47 +0800)]
cmd/compile: output cost while inlining function with Debug['m'] > 1

The existing implementation outputs inline cost iff function cannot be inlined with Debug['m'] > 1, the cost info is also useful if the function is inlineable.

Fixes #36780

Change-Id: Ic96f6baf96aee25fb4b33d31d4d644dc2310e536
Reviewed-on: https://go-review.googlesource.com/c/go/+/216778
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
5 years agocmd/vendor: create modules.txt even for unused deps
Joshua Crowgey [Thu, 13 Feb 2020 06:02:10 +0000 (06:02 +0000)]
cmd/vendor: create modules.txt even for unused deps

`go mod vendor`  should create vendor/modules.txt even when the only deps
in go.mod are unused.

Fixes: #36580
Change-Id: I92a746d3f013bc2bdc3d2cec6e14b16f606c2edd
GitHub-Last-Rev: ea39a1c62294f42e5e5aab049f466189de0fd42d
GitHub-Pull-Request: golang/go#36920
Reviewed-on: https://go-review.googlesource.com/c/go/+/217135
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/compile: remove Greater* and Geq* generic integer ops
Michael Munday [Thu, 20 Feb 2020 17:46:08 +0000 (17:46 +0000)]
cmd/compile: remove Greater* and Geq* generic integer ops

The generic Greater and Geq ops can always be replaced with the Less and
Leq ops. This CL therefore removes them. This simplifies the compiler since
it reduces the number of operations that need handling in both code and in
rewrite rules. This will be especially true when adding control flow
optimizations such as the integer-in-range optimizations in CL 165998.

Change-Id: If0648b2b19998ac1bddccbf251283f3be4ec3040
Reviewed-on: https://go-review.googlesource.com/c/go/+/220417
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: canonicalize comparison argument order
Michael Munday [Sun, 23 Feb 2020 22:08:24 +0000 (22:08 +0000)]
cmd/compile: canonicalize comparison argument order

Ensure that any comparison between two values has the same argument
order. This helps ensure that they can be eliminated during the
lowered CSE pass which will be particularly important if we eliminate
the Greater and Geq ops (see #37316).

Example:

  CMP R0, R1
  BLT L1
  CMP R1, R0 // different order, cannot eliminate
  BEQ L2

  CMP R0, R1
  BLT L1
  CMP R0, R1 // same order, can eliminate
  BEQ L2

This does have some drawbacks. Notably comparisons might 'flip'
direction in the assembly output after even small changes to the
code or compiler. It should help make optimizations more reliable
however.

compilecmp master -> HEAD
master (218f4572f5): text/template: make reflect.Value indirections more robust
HEAD (f1661fef3e): cmd/compile: canonicalize comparison argument order
platform: linux/amd64

file      before    after     Δ       %
api       6063927   6068023   +4096   +0.068%
asm       5191757   5183565   -8192   -0.158%
cgo       4893518   4901710   +8192   +0.167%
cover     5330345   5326249   -4096   -0.077%
fix       3417778   3421874   +4096   +0.120%
pprof     14889456  14885360  -4096   -0.028%
test2json 2848138   2844042   -4096   -0.144%
trace     11746239  11733951  -12288  -0.105%
total     132739173 132722789 -16384  -0.012%

Change-Id: I11736b3fe2a4553f6fc65018f475e88217fa22f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/220425
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/link: default to internal linking for android/arm64
Elias Naur [Fri, 15 Nov 2019 23:30:19 +0000 (18:30 -0500)]
cmd/link: default to internal linking for android/arm64

The bootstrapping process (make.bash) on all other platforms use
internal linking. This change brings android/arm64 in line, fixing the
scary warning on our self-hosted Corellium builders:

warning: unable to find runtime/cgo.a

The linkmode default is changed to internal for all Android programs,
but in practice that won't matter outside our builders: using Go with
Android apps requires buildmode=c-shared which uses linkmode external.

Fixes #31343
Updates #31819

Change-Id: I3b3ada5ed69a7989e6d8e5960bbebf5e1c22aada
Reviewed-on: https://go-review.googlesource.com/c/go/+/207299
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agofmt: do not remove trailing zeros for %g and %G with #(sharp) flag
yah01 [Wed, 26 Feb 2020 08:17:14 +0000 (08:17 +0000)]
fmt: do not remove trailing zeros for %g and %G with #(sharp) flag

Fixes #36562

Change-Id: Id98ae9f7362cfb825b306c36649d505692d6d60e
GitHub-Last-Rev: 405d51b12eb04da8cc3559c92f1546e69a8c1a19
GitHub-Pull-Request: golang/go#36588
Reviewed-on: https://go-review.googlesource.com/c/go/+/215001
Reviewed-by: Rob Pike <r@golang.org>
5 years agocrypto/x509: load roots from colon separated SSL_CERT_DIR in loadSystemRoots
Emmanuel T Odeke [Mon, 4 Nov 2019 17:19:59 +0000 (09:19 -0800)]
crypto/x509: load roots from colon separated SSL_CERT_DIR in loadSystemRoots

"SSL_CERT_DIR" is meant to hold more than one directory, when a colon
is used as a delimiter. However, we assumed it'd be a single directory
for all root certificates.
OpenSSL and BoringSSL properly respected the colon separated
"SSL_CERT_DIR", as per:
* OpenSSL https://github.com/openssl/openssl/blob/12a765a5235f181c2f4992b615eb5f892c368e88/crypto/x509/by_dir.c#L153-L209
* BoringSSL https://github.com/google/boringssl/blob/3ba9586bc081f67903c89917f23e74a0662ba953/crypto/x509/by_dir.c#L194-L247

This change adds that parity to loadSystemRoots.

RELNOTE=yes

Fixes #35325

Change-Id: I0d554a00ccc34300a7f0529aa741ee7e2d5762f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/205237
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoall: avoid string(i) where i has type int
Ian Lance Taylor [Tue, 25 Feb 2020 02:35:17 +0000 (18:35 -0800)]
all: avoid string(i) where i has type int

Instead use string(r) where r has type rune.

This is in preparation for a vet warning for string(i).

Updates #32479

Change-Id: Ic205269bba1bd41723950219ecfb67ce17a7aa79
Reviewed-on: https://go-review.googlesource.com/c/go/+/220844
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Akhil Indurti <aindurti@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Toshihiro Shiino <shiino.toshihiro@gmail.com>
5 years agoruntime: guard VZEROUPPER on CPU feature
Cherry Zhang [Wed, 26 Feb 2020 01:30:37 +0000 (20:30 -0500)]
runtime: guard VZEROUPPER on CPU feature

In CL 219131 we inserted a VZEROUPPER instruction on darwin/amd64.
The instruction is not available on pre-AVX machines. Guard it
with CPU feature.

Fixes #37459.

Change-Id: I9a064df277d091be4ee594eda5c7fd8ee323102b
Reviewed-on: https://go-review.googlesource.com/c/go/+/221057
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agoruntime: reorder race detector calls in slicecopy
Keith Randall [Sun, 16 Feb 2020 03:23:07 +0000 (19:23 -0800)]
runtime: reorder race detector calls in slicecopy

In rare circumstances, this helps report a race which would
otherwise go undetected.

Fixes #36794

Change-Id: I8a3c9bd6fc34efa51516393f7ee72531c34fb073
Reviewed-on: https://go-review.googlesource.com/c/go/+/220685
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
5 years agocmd/go: emit an error for extraneous files in GOROOT/src in module mode
Michael Matloob [Fri, 24 Jan 2020 22:21:48 +0000 (17:21 -0500)]
cmd/go: emit an error for extraneous files in GOROOT/src in module mode

If there's a go file immediately in GOROOT/src, it was probably
accidentally added by the user. Since that package shouldn't
exist, return an error if a user tries to list it. We're only making
this change for GOPATH mode because we don't want to break cases
where users have been doing this historically, but want to fix
this case for the future.

This also leaves open the weird cases where files are placed directly
in vendor directories.

Fixes #36587

Change-Id: I9738e47b1e89fd5048cbb8dd28e44648834b8ea7
Reviewed-on: https://go-review.googlesource.com/c/go/+/216381
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agomime: fix ExtensionsByType bug when there are duplicates
Brad Fitzpatrick [Tue, 14 Jan 2020 18:15:25 +0000 (18:15 +0000)]
mime: fix ExtensionsByType bug when there are duplicates

Also, sort them so the results aren't random.

Thanks to @junedev for the bug report & repro.

Fixes #36524

Change-Id: Ic9197ebeceddfb3d0aee895d8fc12ce4d205b164
Reviewed-on: https://go-review.googlesource.com/c/go/+/214680
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agomisc/wasm: avoid implicit boolean to number conversion
Brad Fitzpatrick [Wed, 15 Jan 2020 20:26:56 +0000 (20:26 +0000)]
misc/wasm: avoid implicit boolean to number conversion

Fixes #36561

Change-Id: I20cbf95ef4fd7c5c255a93ed3ec3e027a0ce2bc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/214944
Reviewed-by: Richard Musiol <neelance@gmail.com>
5 years agocmd/go/internal/{test,vet}: use a standard flag.FlagSet to parse flags
Bryan C. Mills [Wed, 11 Dec 2019 14:12:25 +0000 (09:12 -0500)]
cmd/go/internal/{test,vet}: use a standard flag.FlagSet to parse flags

This removes much of the complexity of the implementation and use of
the cmd/go/internal/cmdflag package, and makes the behavior of GOFLAGS
in 'go test' and 'go vet' more consistent with other subcommands.

Some of the complexity reduction has been offset by code comments and
bug fixes, particularly for the handling of GOPATH arguments and flag
terminators ('--').

Fixes #32471
Fixes #18682

Change-Id: I1f6e46a7c679062e1e409e44a2b9f03b9172883b
Reviewed-on: https://go-review.googlesource.com/c/go/+/211358
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agodoc/go1.14: add link to module migration guide
Alexander Rakoczy [Tue, 25 Feb 2020 18:44:18 +0000 (13:44 -0500)]
doc/go1.14: add link to module migration guide

Adding a link to this guide will provide more value to instructing Go
users to migrate to modules.

Updates #36878

Change-Id: Ie6ab45efcd35cc5e5ba5adc16ba0ca4cca4292bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/220906
Run-TryBot: Alexander Rakoczy <alex@golang.org>
Reviewed-by: thepudds <thepudds1460@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc/articles/race_detector: mention memory leak potential
Kevin Burke [Mon, 24 Feb 2020 04:45:51 +0000 (20:45 -0800)]
doc/articles/race_detector: mention memory leak potential

As far as I can tell, there is no public documentation on this topic,
which cost me several days of debugging.

I am possibly unusual in that I run binaries in production with the
race detector turned on, but I think that others who do the same may
want to be aware of the risk.

Updates #26813.
Updates #37233.

Change-Id: I1f8111bd01d0000596e6057b7cb5ed017d5dc655
Reviewed-on: https://go-review.googlesource.com/c/go/+/220586
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years agocmd/link: stop requiring the math package on ARM
Cherry Zhang [Mon, 24 Feb 2020 22:10:50 +0000 (17:10 -0500)]
cmd/link: stop requiring the math package on ARM

It was needed for the old softfloat implementation, which has
long gone.

Change-Id: Ib8d53689209a3b003d62f84c7c6047d8ec5df859
Reviewed-on: https://go-review.googlesource.com/c/go/+/220719
Reviewed-by: Than McIntosh <thanm@google.com>
5 years agocmd/asm: add asimd instruction 'rev16' on arm64
Xiangdong Ji [Tue, 7 Jan 2020 11:09:33 +0000 (11:09 +0000)]
cmd/asm: add asimd instruction 'rev16' on arm64

Add support to the asimd instruction rev16 which reverses elements in
16-bit halfwords.

syntax:
VREV16 <Vn>.<T>, <Vd>.<T>
<T> should be either B8 or B16.

Change-Id: I7a7b8e772589c51ca9eb6dca98bab1aac863c6c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/213738
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agomath/big: initial vector arithmetic in riscv64 assembly
Joel Sing [Tue, 25 Feb 2020 16:09:59 +0000 (03:09 +1100)]
math/big: initial vector arithmetic in riscv64 assembly

Provide an assembly implementation of mulWW - for now all others run the
Go code.

Change-Id: Icb594c31048255f131bdea8d64f56784fc9db4d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/220919
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agomath: implement Sqrt in assembly for riscv64
Joel Sing [Tue, 25 Feb 2020 16:05:57 +0000 (03:05 +1100)]
math: implement Sqrt in assembly for riscv64

Change-Id: I9a5dc33271434e58335f5562a30cc131c6a8332c
Reviewed-on: https://go-review.googlesource.com/c/go/+/220918
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agodoc: add Go 1.14 to release history
Carlos Amedee [Tue, 25 Feb 2020 16:05:35 +0000 (11:05 -0500)]
doc: add Go 1.14 to release history

Change-Id: I02afbd08ce9e0cd2af8953693b9c3066f6465914
Reviewed-on: https://go-review.googlesource.com/c/go/+/220900
Run-TryBot: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years agocmd/compile: use ellipses in RISCV64 rules
Josh Bleecher Snyder [Thu, 23 Jan 2020 22:28:04 +0000 (14:28 -0800)]
cmd/compile: use ellipses in RISCV64 rules

Also, explicitly zero AuxInt in some ops (like Div),
to make it clear why they do not use an ellipsis.

Passes toolstash-check -all.

Change-Id: Iefd8891fca5d7be8aa1bb91eb1fe2c99c8bf9c88
Reviewed-on: https://go-review.googlesource.com/c/go/+/217011
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoRevert "cmd/compile: don't allow NaNs in floating-point constant ops"
Bryan C. Mills [Tue, 25 Feb 2020 14:36:38 +0000 (14:36 +0000)]
Revert "cmd/compile: don't allow NaNs in floating-point constant ops"

This reverts CL 213477.

Reason for revert: tests are failing on linux-mips*-rtrk builders.

Change-Id: I8168f7450890233f1bd7e53930b73693c26d4dc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/220897
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoruntime: fix file permission
Meng Zhuo [Tue, 25 Feb 2020 14:07:40 +0000 (22:07 +0800)]
runtime: fix file permission

Remove executable flag of .s files.

Change-Id: I8ba0c758b3650238643da50fbfe8f6cd07458f1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/220878
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoRevert "Revert "cmd/go/internal/modload: record the replacement for the module contai...
Bryan C. Mills [Tue, 25 Feb 2020 14:58:30 +0000 (14:58 +0000)]
Revert "Revert "cmd/go/internal/modload: record the replacement for the module containing package main in BuildInfo""

This reverts CL 220722.

Reason for revert: rolling forward with fix.

Fixes #37392

Change-Id: Iba8b0c645267777fbb7019976292d691a10b906a
Reviewed-on: https://go-review.googlesource.com/c/go/+/220898
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/link: Revert -buildmode=pie to internal linking
Corne van der Plas [Tue, 19 Nov 2019 12:22:55 +0000 (13:22 +0100)]
cmd/link: Revert -buildmode=pie to internal linking

When internal linking was broken buildmode PIE is set to external
linking. Now internal linking is fixed, -buildmode=pie can default to
internal linking again.

Fixes #35545

Change-Id: Iaf86b3047eb76babebc1545a79125586a7a3980e
Reviewed-on: https://go-review.googlesource.com/c/go/+/207877
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/go: fix typo in comment
nu50218 [Tue, 25 Feb 2020 14:16:07 +0000 (14:16 +0000)]
cmd/go: fix typo in comment

fix CompiledGoFIles to CompiledGoFiles.

Change-Id: I1f21c2254e716197cb65a877ba7468e3d7009c6f
GitHub-Last-Rev: 177aa1a4962b3a70642c7761f9ab99723f22bc3e
GitHub-Pull-Request: golang/go#37440
Reviewed-on: https://go-review.googlesource.com/c/go/+/220879
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Toshihiro Shiino <shiino.toshihiro@gmail.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agosync: add new Map method LoadAndDelete
Changkun Ou [Fri, 8 Nov 2019 10:23:58 +0000 (11:23 +0100)]
sync: add new Map method LoadAndDelete

This CL implements a LoadAndDelete method in sync.Map. Benchmark:

name                                              time/op
LoadAndDeleteBalanced/*sync_test.RWMutexMap-12    98.8ns ± 1%
LoadAndDeleteBalanced/*sync.Map-12                10.3ns ±11%
LoadAndDeleteUnique/*sync_test.RWMutexMap-12      99.2ns ± 2%
LoadAndDeleteUnique/*sync.Map-12                  6.63ns ±10%
LoadAndDeleteCollision/*sync_test.DeepCopyMap-12   140ns ± 0%
LoadAndDeleteCollision/*sync_test.RWMutexMap-12   75.2ns ± 2%
LoadAndDeleteCollision/*sync.Map-12               5.21ns ± 5%

In addition, Delete is bounded and more efficient if many collisions:

DeleteCollision/*sync_test.DeepCopyMap-12   120ns ± 2%   125ns ± 1%   +3.80%  (p=0.000 n=10+9)
DeleteCollision/*sync_test.RWMutexMap-12   73.5ns ± 3%  79.5ns ± 1%   +8.03%  (p=0.000 n=10+9)
DeleteCollision/*sync.Map-12               97.8ns ± 3%   5.9ns ± 4%  -94.00%  (p=0.000 n=10+10)

Fixes #33762

Change-Id: Ic8469a7861d27ab0edeface0078aad8af9b26c2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/205899
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoruntime: allow float syscall return values on windows amd64
Richard Wilkes [Mon, 24 Feb 2020 23:46:00 +0000 (23:46 +0000)]
runtime: allow float syscall return values on windows amd64

RELNOTE=yes
Fixes #37273

Change-Id: Iedb7eab185dfeccb1b26902ef36411d2c53ea3e0
GitHub-Last-Rev: bbe30ba45d4a1bd53757b5824ad28024d5e2b179
GitHub-Pull-Request: golang/go#37380
Reviewed-on: https://go-review.googlesource.com/c/go/+/220578
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
5 years agoRevert "reflect: when Converting between float32s, don't lose signal NaNs"
Keith Randall [Tue, 25 Feb 2020 05:57:22 +0000 (05:57 +0000)]
Revert "reflect: when Converting between float32s, don't lose signal NaNs"

This reverts commit 7485050c0f55492c0fdfc41f7564f3da37a1a308.

Reason for revert: Breaking some builders (387, mips, mips64)

Change-Id: I33e5125b7a9a96b55bc5e71880fca4ee30d226a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/220695
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agotime: add basic YYYY/MM/DD example to time docs
Jean de Klerk [Mon, 24 Feb 2020 20:44:56 +0000 (13:44 -0700)]
time: add basic YYYY/MM/DD example to time docs

This is a _very_ common question [1]. Let's just make an example for it.

1: https://www.google.com/search?q=golang+yyyy-mm-dd&oq=golang+yyyy-mm-dd&aqs=chrome..69i57j0l4j69i64l3.6015j0j7&sourceid=chrome&ie=UTF-8

Change-Id: I32ae689b91018d326f31a2442a1beaf68dddf13c
Reviewed-on: https://go-review.googlesource.com/c/go/+/220595
Run-TryBot: Jean de Klerk <deklerk@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoreflect: when Converting between float32s, don't lose signal NaNs
Keith Randall [Mon, 6 Jan 2020 23:36:42 +0000 (15:36 -0800)]
reflect: when Converting between float32s, don't lose signal NaNs

When converting from float32->float64->float32, any signal NaNs
get converted to quiet NaNs. Avoid that so using reflect.Value.Convert
between two float32 types keeps the signal bit of NaNs.

Update #36400

Change-Id: Ic4dd04c4be7189d2171d12b7e4e8f7cf2fb22bb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/213497
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: don't allow NaNs in floating-point constant ops
Keith Randall [Mon, 6 Jan 2020 19:23:08 +0000 (11:23 -0800)]
cmd/compile: don't allow NaNs in floating-point constant ops

We store 32-bit floating point constants in a 64-bit field, by
converting that 32-bit float to 64-bit float to store it, and convert
it back to use it.

That works for *almost* all floating-point constants. The exception is
signaling NaNs. The round trip described above means we can't represent
a 32-bit signaling NaN, because conversions strip the signaling bit.

To fix this issue, just forbid NaNs as floating-point constants in SSA
form. This shouldn't affect any real-world code, as people seldom
constant-propagate NaNs (except in test code).

Additionally, NaNs are somewhat underspecified (which of the many NaNs
do you get when dividing 0/0?), so when cross-compiling there's a
danger of using the compiler machine's NaN regime for some math, and
the target machine's NaN regime for other math. Better to use the
target machine's NaN regime always.

This has been a bug since 1.10, and there's an easy workaround
(declare a global varaible containing the signaling NaN pattern, and
use that as the argument to math.Float32frombits) so we'll fix it in
1.15.

Fixes #36400
Update #36399

Change-Id: Icf155e743281560eda2eed953d19a829552ccfda
Reviewed-on: https://go-review.googlesource.com/c/go/+/213477
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
5 years agocmd/link: improve gap detection in TestPIESize
Cherry Zhang [Mon, 24 Feb 2020 21:24:29 +0000 (16:24 -0500)]
cmd/link: improve gap detection in TestPIESize

In CL 210180 we detect gaps between PT_LOAD segments and subtract
them from size calculation. The code there only works when
PT_LOAD segments are next to each other. But it is possible that
there are other segments in between (e.g. a GNU_RELRO segment).
Relax the gap detection to count gaps between PT_LOAD segments
regardless of whether they are next to each other.

Updates #36023.
Updates #35545.

Change-Id: I8b94506359fa649a4478acc742d86d4b16022dbc
Reviewed-on: https://go-review.googlesource.com/c/go/+/220654
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoos/exec: use environment variables for user token when present
Liam 'Auzzie' Haworth [Tue, 25 Feb 2020 00:11:28 +0000 (00:11 +0000)]
os/exec: use environment variables for user token when present

Builds upon the changes from #32000 which supported sourcing environment
variables for a new process from the environment of a Windows user token
when supplied.

But due to the logic of os/exec, the Env field of a process was
always non-nil when it reached that change.

This change moves the logic up to os/exec, specifically when
os.ProcAttr is being built for the os.StartProcess call, this
ensures that if a user token has been supplied and no Env slice has
been provided on the command it will be sourced from the user's
environment.

If no token is provided, or the program is compiled for any other
platform than Windows, the default environment will be sourced from
syscall.Environ().

Fixes #35314

Change-Id: I4c1722e90b91945eb6980d5c5928183269b50487
GitHub-Last-Rev: 32216b7291418f9285147a93ed6d0ba028f94ef2
GitHub-Pull-Request: golang/go#37402
Reviewed-on: https://go-review.googlesource.com/c/go/+/220587
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: delete stray file
Josh Bleecher Snyder [Mon, 24 Feb 2020 22:52:19 +0000 (14:52 -0800)]
cmd/compile: delete stray file

This found its way in accidentally.

Change-Id: I830f1e3ec4852a213901a679ad20094a6958cb07
Reviewed-on: https://go-review.googlesource.com/c/go/+/220680
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: use ellipses in MIPS64 rules
Josh Bleecher Snyder [Thu, 23 Jan 2020 21:04:05 +0000 (13:04 -0800)]
cmd/compile: use ellipses in MIPS64 rules

Passes toolstash-check -all.

Change-Id: Ib9f2dc75e3063928ebe4aeb63e69fd79e439585d
Reviewed-on: https://go-review.googlesource.com/c/go/+/217008
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: use ellipses in S390X rules
Josh Bleecher Snyder [Thu, 23 Jan 2020 22:06:00 +0000 (14:06 -0800)]
cmd/compile: use ellipses in S390X rules

Also, explicitly zero AuxInt in some ops (like Div),
to make it clear why they do not use an ellipsis.

Passes toolstash-check -all.

Change-Id: I47b4ed745196ed734927dbb5923edec33ce286da
Reviewed-on: https://go-review.googlesource.com/c/go/+/217013
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Munday <mike.munday@ibm.com>
5 years agocmd/compile: use ellipses in PPC64 rules
Josh Bleecher Snyder [Thu, 23 Jan 2020 21:33:11 +0000 (13:33 -0800)]
cmd/compile: use ellipses in PPC64 rules

Also, explicitly zero AuxInt in some ops (like Div),
to make it clear why they do not use an ellipsis.

Passes toolstash-check -all.

Change-Id: I2e234e7b779422f7577037813f277e7586061880
Reviewed-on: https://go-review.googlesource.com/c/go/+/217012
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: use ellipses in dec64 rules
Josh Bleecher Snyder [Thu, 23 Jan 2020 22:28:40 +0000 (14:28 -0800)]
cmd/compile: use ellipses in dec64 rules

Passes toolstash-check -all.

Change-Id: I1b56c3b00e7fb7875165b337a93d5fce158b9df0
Reviewed-on: https://go-review.googlesource.com/c/go/+/217010
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: use ellipses in wasm rules
Josh Bleecher Snyder [Thu, 23 Jan 2020 22:20:53 +0000 (14:20 -0800)]
cmd/compile: use ellipses in wasm rules

Also, explicitly zero AuxInt in some ops (like Div),
to make it clear why they do not use an ellipsis.

Passes toolstash-check -all.

Change-Id: I2294d10e47d904d03e489e6ca43d46679323f75d
Reviewed-on: https://go-review.googlesource.com/c/go/+/217009
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: use ellipses in MIPS rules
Josh Bleecher Snyder [Thu, 23 Jan 2020 20:03:26 +0000 (12:03 -0800)]
cmd/compile: use ellipses in MIPS rules

Passes toolstash-check -all.

Change-Id: I14db0acb9b531029c613fa31bc076928651b6448
Reviewed-on: https://go-review.googlesource.com/c/go/+/217007
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoRevert "cmd/go/internal/modload: record the replacement for the module containing...
Andrew Bonventre [Mon, 24 Feb 2020 22:47:00 +0000 (22:47 +0000)]
Revert "cmd/go/internal/modload: record the replacement for the module containing package main in BuildInfo"

This reverts CL 220645 (commit e092fc352ad393a4d2f1f7fa641df2d23572ccff).

Reason for revert: Seems to have broken windows/amd64 longtest

Change-Id: Iffa8c882524250e5845514bc827fcd8927645a44
Reviewed-on: https://go-review.googlesource.com/c/go/+/220722
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/compile: use ellipses in ARM64 rules
Josh Bleecher Snyder [Thu, 23 Jan 2020 01:06:15 +0000 (17:06 -0800)]
cmd/compile: use ellipses in ARM64 rules

Also, explicitly zero AuxInt in some ops (like Div),
to make it clear why they do not use an ellipsis.

Passes toolstash-check -all.

Change-Id: Iea0e807949f0899c43d2d21b9551a2cf00a829b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/217006
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: use ellipses in ARM rules
Josh Bleecher Snyder [Thu, 23 Jan 2020 00:34:26 +0000 (16:34 -0800)]
cmd/compile: use ellipses in ARM rules

Passes toolstash-check -all.

Change-Id: I390789ca5bfe45967ed156590f2690c91d416187
Reviewed-on: https://go-review.googlesource.com/c/go/+/217005
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: use ellipses in 386 rules
Josh Bleecher Snyder [Wed, 22 Jan 2020 17:58:43 +0000 (09:58 -0800)]
cmd/compile: use ellipses in 386 rules

Passes toolstash-check -all.

Change-Id: I8ca47b7b7987cb81edaded23331f25c40a8e80dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/217004
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: use ADDQ instead of LEAQ when we can
Keith Randall [Sat, 30 Nov 2019 22:04:35 +0000 (14:04 -0800)]
cmd/compile: use ADDQ instead of LEAQ when we can

The address calculations in the example end up doing x << 4 + y + 0.
Before this CL we use a SHLQ+LEAQ. Since the constant offset is 0,
we can use SHLQ+ADDQ instead.

Change-Id: Ia048c4fdbb3a42121c7e1ab707961062e8247fca
Reviewed-on: https://go-review.googlesource.com/c/go/+/209959
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoruntime/cgo: fix unsetenv wrapper
Keith Randall [Thu, 23 Jan 2020 04:48:21 +0000 (20:48 -0800)]
runtime/cgo: fix unsetenv wrapper

The wrapper takes a pointer to the argument, not the argument itself.

Fixes #36705

Change-Id: I566d4457d00bf5b84e4a8315a26516975f0d7e10
Reviewed-on: https://go-review.googlesource.com/c/go/+/215942
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc/go1.14: document that freebsd/arm64 requires FreeBSD 12.0 or later
Tobias Klauser [Mon, 24 Feb 2020 20:08:27 +0000 (21:08 +0100)]
doc/go1.14: document that freebsd/arm64 requires FreeBSD 12.0 or later

Updates #24715
Updates #37345

Change-Id: I787a9b2ab1c68e1d379aac0a31bdf6217f04f911
Reviewed-on: https://go-review.googlesource.com/c/go/+/220426
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years agomisc/cgo/testshared: explicitly set GOBIN (instead of unsetting it)
Bryan C. Mills [Mon, 24 Feb 2020 18:58:29 +0000 (13:58 -0500)]
misc/cgo/testshared: explicitly set GOBIN (instead of unsetting it)

If GOBIN is set in the GOENV file, then merely unsetting it in the
process environment is not sufficient. We can instead either set GOBIN
explicitly, or disable GOENV explicitly. For now, we (semi-arbitrary)
choose the former.

Fixes #37390

Change-Id: Iec54532c804b70546d695105cd89e9169eac5dbb
Reviewed-on: https://go-review.googlesource.com/c/go/+/220652
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: avoid memmove -> SSA move rewrite when size is negative
Keith Randall [Tue, 24 Dec 2019 02:16:22 +0000 (18:16 -0800)]
cmd/compile: avoid memmove -> SSA move rewrite when size is negative

We should panic in this situation. Rewriting to a SSA op just leads
to a compiler panic.

Fixes #36259

Change-Id: I6e0bccbed7dd0fdac7ebae76b98a211947947386
Reviewed-on: https://go-review.googlesource.com/c/go/+/212405
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
5 years agocmd/go/internal/modload: record the replacement for the module containing package...
Bryan C. Mills [Mon, 24 Feb 2020 16:27:38 +0000 (11:27 -0500)]
cmd/go/internal/modload: record the replacement for the module containing package main in BuildInfo

Fixes #37392

Change-Id: I2cb051e6f556b0af95e059611dda3f62e7c1f21a
Reviewed-on: https://go-review.googlesource.com/c/go/+/220645
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/compile: assign correct declaration line to DIE of captured vars
Alessandro Arzilli [Tue, 14 Jan 2020 07:57:03 +0000 (08:57 +0100)]
cmd/compile: assign correct declaration line to DIE of captured vars

Fixes the declaration line reported in the DW_AT_decl_line for
variables captured in a closure.

Fixes #36542

Change-Id: I228d32b57121fd62c4615c2ef71a6e8da616a1e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/214637
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>

5 years agoruntime: special case interface hashing for pointers
Keith Randall [Thu, 13 Feb 2020 16:34:41 +0000 (08:34 -0800)]
runtime: special case interface hashing for pointers

Interfaces often contain pointers. Implement a fast path for this case.

name                   old time/op  new time/op  delta
MapInterfaceString-16  21.4ns ±19%  20.5ns ±10%     ~     (p=0.361 n=10+10)
MapInterfacePtr-16     25.8ns ± 8%  17.3ns ± 7%  -33.11%  (p=0.000 n=10+9)

Fixes #37086

Change-Id: Ice52820e6259a3edeafcbbbeb25b1e363bef00d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/219338
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agodoc/go1.14: remove draft notice
Dmitri Shuralyov [Mon, 24 Feb 2020 17:51:45 +0000 (12:51 -0500)]
doc/go1.14: remove draft notice

Use consistent indentation for one of the paragraphs.

Include issue number in the visible text, so it is easier to read.

Fixes #36878

Change-Id: Iab857b26b1d27b0137e981126207089db108d530
Reviewed-on: https://go-review.googlesource.com/c/go/+/220646
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go/internal/modfetch: delete unused isVendoredPackage function
Bryan C. Mills [Mon, 24 Feb 2020 14:21:04 +0000 (09:21 -0500)]
cmd/go/internal/modfetch: delete unused isVendoredPackage function

This function is apparently unused since CL 204917.

Updates #35290
Updates #37397

Change-Id: Id7f5f5d5176fdbd1c5c6227e81d0854ceafc3f12
Reviewed-on: https://go-review.googlesource.com/c/go/+/220640
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agogo/types: report correct argument types for make() built-in calls
Robert Griesemer [Sun, 23 Feb 2020 21:36:46 +0000 (13:36 -0800)]
go/types: report correct argument types for make() built-in calls

Change Checker.index to return the type and constant index value
rather than just a boolean valid flag and the constant value.
While at it, rename some variables and simplify the control flow.

Adjust all uses of Checker.index to new signature. In code for
make() built-in, collect type information for signature reporting.

Fixes #37393.

Change-Id: Id70196faa9539ed5a0d6b59e0f3ea05e05f2f6a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/220585
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime: remove mcache field from m
Ian Lance Taylor [Mon, 4 Nov 2019 22:25:22 +0000 (14:25 -0800)]
runtime: remove mcache field from m

Having an mcache field in both m and p is confusing, so remove it from m.
Always use mcache field from p. Use new variable mcache0 during bootstrap.

Change-Id: If2cba9f8bb131d911d512b61fd883a86cf62cc98
Reviewed-on: https://go-review.googlesource.com/c/go/+/205239
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agoreflect: update Select to panic early on excessive input cases
Milan Patel [Sun, 23 Feb 2020 20:27:05 +0000 (15:27 -0500)]
reflect: update Select to panic early on excessive input cases

The runtime implementation of select has an upper limit on the number of
select cases that are supported in order to maintain low stack memory
usage. Rather than support an arbitrary number of select cases, we've
opted to panic early with a useful message pointing the user directly
at the problem.

Fixes #37350

Change-Id: Id129ba281ae120387e681ef96be8adcf89725840
Reviewed-on: https://go-review.googlesource.com/c/go/+/220583
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agotest: clean up run.go
Dmitri Shuralyov [Sun, 9 Feb 2020 06:40:45 +0000 (01:40 -0500)]
test: clean up run.go

• Inline check function because it's more readable.
• Delete toolPath because it was unused.
• Use strings.TrimPrefix because it's simpler.
• Remove out variable because its value was unused.
• Rename serr to err because it's more consistent.

Change-Id: I084fb4f8b399578834d5eea29a673c386cf3a357
Reviewed-on: https://go-review.googlesource.com/c/go/+/218701
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
5 years agoruntime: remove unused _F_SETFL const on linux
Tobias Klauser [Mon, 20 Jan 2020 09:23:41 +0000 (10:23 +0100)]
runtime: remove unused _F_SETFL const on linux

This constant is only used on libc-based platforms (aix, darwin,
solaris).

Change-Id: Ic57d1fe3b1501c5b552eddb9aba11f1e02510082
Reviewed-on: https://go-review.googlesource.com/c/go/+/220421
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocrypto/cipher: require non-zero nonce size for AES-GCM
Katie Hockman [Fri, 7 Feb 2020 19:44:58 +0000 (14:44 -0500)]
crypto/cipher: require non-zero nonce size for AES-GCM

Also fix typo in crypto/cipher/gcm_test.go.

Fixes #37118

Change-Id: I8544d1eeeb1f0336cebb977b8c5bfa5e4c5ad8c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/218500
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years agoencoding/json: limit max nesting depth
Jordan Liggitt [Tue, 8 Oct 2019 17:19:48 +0000 (13:19 -0400)]
encoding/json: limit max nesting depth

Limit the maximum nesting depth when parsing to protect against stack
overflow, permitted by https://tools.ietf.org/html/rfc7159#section-9

A nesting depth limit of 10,000 was chosen to be a conservative
balance between avoiding stack overflow and avoiding impacting
legitimate JSON documents.

10,000 is less than 1% of the experimental stack depth limit
with the default stack size:
* On 64-bit systems, the default stack limit is 1GB,
  which allows ~2,800,000 frames of recursive parsing
* On 32-bit systems, the default stack limit is 250MB,
  which allows ~1,100,000 frames of recursive parsing

Fixes #31789

Change-Id: I4f5a90e89dcb4ab1a957ad9d02e1fa0efafaccf6
Reviewed-on: https://go-review.googlesource.com/c/go/+/199837
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
5 years agocmd/link: code cleanup in macho_combine_dwarf.go
Tamir Duberstein [Fri, 7 Feb 2020 20:27:55 +0000 (20:27 +0000)]
cmd/link: code cleanup in macho_combine_dwarf.go

- remove global variables
- add missing error checks
- add missing (*os.File).Close calls
- null-check text section correctly
- reduce some variable scopes
- use bytes.Buffer instead of appended slice
- reduce integer casting

Change-Id: Ib9ad41adefed4d61047f53e27046389182eef786
Reviewed-on: https://go-review.googlesource.com/c/go/+/218501
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years agotext/template: make reflect.Value indirections more robust
Daniel Martí [Thu, 19 Dec 2019 14:13:59 +0000 (14:13 +0000)]
text/template: make reflect.Value indirections more robust

Always shadow or modify the original parameter name. With code like:

func index(item reflect.Value, ... {
v := indirectInterface(item)

It was possible to incorrectly use 'item' and 'v' later in the function,
which could result in subtle bugs. This is precisely the kind of mistake
that led to #36199.

Instead, don't keep both the old and new reflect.Value variables in
scope. Always shadow or modify the original variable.

While at it, simplify the signature of 'length', to receive a
reflect.Value directly and save a few redundant lines.

Change-Id: I01416636a9d49f81246d28b91aca6413b1ba1aa5
Reviewed-on: https://go-review.googlesource.com/c/go/+/212117
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Roberto Clapis <robclap8@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
5 years agosyscall: use dup3 in forkAndExecInChild1 if available
Tobias Klauser [Sun, 23 Feb 2020 17:14:34 +0000 (18:14 +0100)]
syscall: use dup3 in forkAndExecInChild1 if available

The dup3 syscall is available since Linux 2.6.27. Fall back to dup2 (if
available) if dup3 returns ENOSYS.

This allows to omit the additional fcntl call to mark the dup'ed fd as
close-on-exec.

Change-Id: If318b593edd783f2aa988534c6062498e7119ddb
Reviewed-on: https://go-review.googlesource.com/c/go/+/220422
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agomisc/cgo: correct GOOS in skip message
Tobias Klauser [Thu, 30 Jan 2020 09:59:11 +0000 (10:59 +0100)]
misc/cgo: correct GOOS in skip message

Tests are skipped on linux/ppc64, not aix/ppc64.

Change-Id: I6b91b89f24d76b0f9be3eaf816f81ad4246e418f
Reviewed-on: https://go-review.googlesource.com/c/go/+/220423
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agogo/types: report correct number of arguments for make() built-in calls
Robert Griesemer [Sun, 23 Feb 2020 21:08:29 +0000 (13:08 -0800)]
go/types: report correct number of arguments for make() built-in calls

Also: Added test cases for (separate) issue #37393.
      To be enabled when that issue is fixed.

Fixes #37349.
Updates #37393.

Change-Id: Ib78cb0614c0b396241af06a3aa5d37d8045c2f2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/220584
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agohash/maphash: add package-level example
Alberto Donizetti [Fri, 21 Feb 2020 10:48:13 +0000 (11:48 +0100)]
hash/maphash: add package-level example

Change-Id: I05c7ca644410822a527e94a7a8b883a0f8b0a4ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/220420
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agotime: add Ticker.Reset
Changkun Ou [Mon, 3 Feb 2020 13:42:32 +0000 (14:42 +0100)]
time: add Ticker.Reset

This CL implements Ticker.Reset method in time package.

Benchmark:
name                 time/op
TickerReset-12       6.41µs ±10%
TickerResetNaive-12  95.7µs ±12%

Fixes #33184

Change-Id: I4cbd31796efa012b2a297bb342158f11a4a31fef
Reviewed-on: https://go-review.googlesource.com/c/go/+/220424
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agotesting: change benchmark example function
Masahiro Furudate [Thu, 20 Feb 2020 18:29:43 +0000 (03:29 +0900)]
testing: change benchmark example function

Change to rand.Int, a function that the compiler cannot reliably eliminate.
Fix output to actual benchmark values.

Fixes #37341

Change-Id: Ifb5bf49b826ae0bdb4bf9de5a472ad0eaa54569c
Reviewed-on: https://go-review.googlesource.com/c/go/+/220397
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agotime: don't get confused about day 31 when parsing 002
Ian Lance Taylor [Sun, 23 Feb 2020 16:04:13 +0000 (08:04 -0800)]
time: don't get confused about day 31 when parsing 002

The 002 parsing code had a bug that mishandled day 31.

Fixes #37387

Change-Id: Ia5a492a4ddd09a4bc232ce9582aead42d5099bdd
Reviewed-on: https://go-review.googlesource.com/c/go/+/220637
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
5 years agoRevert "time: add Ticker.Reset"
Andrew Bonventre [Sun, 23 Feb 2020 17:28:56 +0000 (17:28 +0000)]
Revert "time: add Ticker.Reset"

This reverts CL 217362 (6e5652bebede2d53484a872f6d1dfeb498b0b50c.)

Reason for revert: Causing failures on arm64 bots. See #33184 for more info

Change-Id: I72ba40047e4138767d95aaa68842893c3508c52f
Reviewed-on: https://go-review.googlesource.com/c/go/+/220638
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agomisc/cgo: enable testso and testsovar on mips64x
Tobias Klauser [Wed, 29 Jan 2020 23:25:19 +0000 (00:25 +0100)]
misc/cgo: enable testso and testsovar on mips64x

External linking on mips64 was implemented in CL 19803 and CL 19809

Updates #12560
Updates #14126

Change-Id: I2cc127d71173aade56ad181bdd947355a76b3e46
Reviewed-on: https://go-review.googlesource.com/c/go/+/217017
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agotime: add Ticker.Reset
Changkun Ou [Mon, 3 Feb 2020 13:42:32 +0000 (14:42 +0100)]
time: add Ticker.Reset

This CL implements Ticker.Reset method in time package.

Benchmark:
name                 time/op
TickerReset-12       6.41µs ±10%
TickerResetNaive-12  95.7µs ±12%

Fixes #33184

Change-Id: I12c651f81e452541bcbbc748b45f038aae1f8dae
Reviewed-on: https://go-review.googlesource.com/c/go/+/217362
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc: remove extra br tags
Sam Chen [Sat, 22 Feb 2020 11:42:19 +0000 (11:42 +0000)]
doc: remove extra br tags

Change-Id: I6db784c67dde058ddaae8d73b295ee02583a1ed4
GitHub-Last-Rev: fea8e66c8ac26809ad1d7f04462cdbde9a41020a
GitHub-Pull-Request: golang/go#37375
Reviewed-on: https://go-review.googlesource.com/c/go/+/220577
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: consistently use OXXX for works relate to Op
Cuong Manh Le [Sat, 14 Dec 2019 19:08:41 +0000 (02:08 +0700)]
cmd/compile: consistently use OXXX for works relate to Op

Passes toolstash-check.

Change-Id: I8ff2a702c445e98c227913369c139a5ef4a04916
Reviewed-on: https://go-review.googlesource.com/c/go/+/211397
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agoencoding/json: fix broken link to json.org
Jon Johnson [Mon, 3 Feb 2020 18:15:41 +0000 (18:15 +0000)]
encoding/json: fix broken link to json.org

This updates the link to a newer image.

Change-Id: Ibdfe8c57d9217a325bcfde98cb6f952ca63d588a
GitHub-Last-Rev: f5970ba395781c0d299dfdaa1ed75e46125b8268
GitHub-Pull-Request: golang/go#36938
Reviewed-on: https://go-review.googlesource.com/c/go/+/217297
Reviewed-by: Toshihiro Shiino <shiino.toshihiro@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
5 years agosyscall: release a js.Func object in fsCall
Hajime Hoshi [Sun, 2 Feb 2020 05:55:29 +0000 (14:55 +0900)]
syscall: release a js.Func object in fsCall

(This is a reland of golang.org/cl/217417.)

A js.Func object in fsCall was created for each call but never
released. This CL fixes this.

Change-Id: Ifc0efb997c9b3e04641839691ccc04de61ef28d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/220537
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years agocmd/compile: allow values with aux Sym to fault on nil args
Josh Bleecher Snyder [Fri, 24 Jan 2020 06:19:39 +0000 (22:19 -0800)]
cmd/compile: allow values with aux Sym to fault on nil args

And use this newfound power to more precisely describe some PPC64 ops.

Change-Id: Idb2b669d74fbab5f3508edf19f7e3347306b0daf
Reviewed-on: https://go-review.googlesource.com/c/go/+/217002
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>