1
0
mirror of https://github.com/golang/go synced 2024-11-17 15:44:40 -07:00
Commit Graph

42732 Commits

Author SHA1 Message Date
Michael Matloob
c6d281e5ac cmd/go: convert some tests in vendor_test to the script framework
Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: I601e0fcee32b8c5bf2107b520d1dfbe12a19ad3f
Reviewed-on: https://go-review.googlesource.com/c/go/+/213223
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-27 21:32:59 +00:00
Michael Matloob
2cfc5e2b2f cmd/go: convert TestGoBuildGOPATHOrder to the script framework
It looks like TestGoBuildGOPATHOrderBroken has been fixed so I've converted
that too, without the skip.

Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: I7ee77f22fb888811c175bcdc5eb814c80fbec420
Reviewed-on: https://go-review.googlesource.com/c/go/+/214432
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-27 21:31:52 +00:00
Michael Matloob
4d6c171a1b cmd/go: convert more tests to the script framework
Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: I394844da1ffc0dcde7f5862c41ed8efa7c5ca088
Reviewed-on: https://go-review.googlesource.com/c/go/+/214429
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-27 21:27:56 +00:00
Michael Matloob
ff811c8396 cmd/go: convert TestGoTestRaceInstallsCgo to script framework
Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: I9a99aa5d37300c83a2f95fb906949cb4c1d5356f
Reviewed-on: https://go-review.googlesource.com/c/go/+/214426
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-27 21:25:53 +00:00
Michael Matloob
c40914b726 cmd/go: convert TestGoBuildARM to the script framework
Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: If1e591f28d6399a07b37ed7f4a1419bf7cd915eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/214425
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-27 21:25:17 +00:00
Michael Matloob
1c4e5152ae cmd/go: convert TestGoTestBuildsAnXtestContainingOnly... to the script framework
The name of the test is too long to fit on the first line. It's
TestGoTestBuildsAnXtestContainingOnlyNonRunnableExamples.

Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: I490748271b10a85cbe1d34f9dbecb86ccf0101a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/214423
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-27 21:24:58 +00:00
Michael Matloob
bec91cecef cmd/go: convert TestPackageNotStaleWithTrailingSlash to script framework
Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: I1020feaa4ddb40ff52c46728bc4973cea4c7b066
Reviewed-on: https://go-review.googlesource.com/c/go/+/214391
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-27 21:24:40 +00:00
Josh Bleecher Snyder
2c859eae1d cmd/compile: ignore div/mod in prove on non-x86 architectures
Instead of writing AuxInt during prove and then zeroing it during lower,
just don't write it in the first place.

Passes toolstash-check -all.

Change-Id: Iea4b555029a9d69332e835536f9cf3a42b8223db
Reviewed-on: https://go-review.googlesource.com/c/go/+/220682
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-02-27 20:34:49 +00:00
Josh Bleecher Snyder
4ae1879dda cmd/compile: document Move's type
Fixes #37381

Change-Id: I8abf07d6342c10fc8d52e11c6a70fb0ec09220d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/220683
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-02-27 20:32:29 +00:00
Bryan C. Mills
c739bc487d cmd/go/internal/modload: make PackageNotInModuleError reasonable for the Target module
Updates #28459
Updates #32917

Change-Id: Iced562cb7c2e0ac075d8345f1e4ad3b073842dcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/185343
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-27 20:07:49 +00:00
Josh Bleecher Snyder
956f64888d cmd/compile: make inlining intrinsics cost one
We were assigning a cost of 2 for intrinsics:
One when we recognized an intrinsic,
and one for the OCALLFUNC node.

I believe that the intent was that intrinsics should
cost 1, since they are typically an arithmetic op,
and because they tend to occur in performance-sensitive code.
(Not that any of this is particularly principled right now.)

Stop charging when we recognize an intrinsic;
let the OCALLFUNC node cover the cost.

This has a negligible impact on std+cmd.

Change-Id: Ie6ae5c18da3ae7e40aec425aed95c6999c2831a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/221357
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-02-27 20:01:59 +00:00
Ian Lance Taylor
173dce8d20 cmd/compile: check rune type bounds as int32, not uint32
Also, avoid string(i) where i has type int.

Updates #32479

Change-Id: If3c6edc8523860082726e034ef9e887b5f7fabd1
Reviewed-on: https://go-review.googlesource.com/c/go/+/221382
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-02-27 19:30:09 +00:00
Ziheng Liu
42f8199290 all: fix incorrect channel and API usage in some unit tests
This CL changes some unit test functions, making sure that these tests (and goroutines spawned during test) won't block.
Since they are just test functions, I use one CL to fix them all. I hope this won't cause trouble to reviewers and can save time for us.
There are three main categories of incorrect logic fixed by this CL:
1. Use testing.Fatal()/Fatalf() in spawned goroutines, which is forbidden by Go's document.
2. Channels are used in such a way that, when errors or timeout happen, the test will be blocked and never return.
3. Channels are used in such a way that, when errors or timeout happen, the test can return but some spawned goroutines will be leaked, occupying resource until all other tests return and the process is killed.

Change-Id: I3df931ec380794a0cf1404e632c1dd57c65d63e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/219380
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-02-27 19:04:17 +00:00
Josh Bleecher Snyder
ea3bfba87c cmd/compile: handle more cases in isNonNegative
The gains from this aren't particularly impressive.
Still, it is cheap and easy, and
it will keep me from wondering about whether it
might help to add X every time I look at this function.

This updated function is pretty exhaustive;
I examined every op encountered in a call to isNonNegative
when compiling all the stuff hanging around in my GOPATH,
for both 386 and amd64.

(32 bit architectures were somewhat neglected before.)

Object file size impact, 64 bit:

file                       before    after     Δ       %       
archive/zip.a              359352    359284    -68     -0.019% 
cmd/compile/internal/ssa.a 30715960  30717526  +1566   +0.005% 
cmd/internal/obj/arm64.a   2972532   2972440   -92     -0.003% 
cmd/internal/obj/riscv.a   297714    297672    -42     -0.014% 
debug/dwarf.a              656336    655346    -990    -0.151% 
debug/gosym.a              183352    183122    -230    -0.125% 
encoding/gob.a             901130    900798    -332    -0.037% 
image/gif.a                171884    171890    +6      +0.003% 
internal/trace.a           506930    507270    +340    +0.067% 
math.a                     233506    233490    -16     -0.007% 
reflect.a                  1431740   1431476   -264    -0.018% 
runtime.a                  3854480   3854332   -148    -0.004% 
unicode/utf16.a            8920      8980      +60     +0.673% 
total                      133000610 133000400 -210    -0.000% 

Object file size impact, 32 bit:

file                                          before    after     Δ       %       
archive/zip.a                                 330794    329640    -1154   -0.349% 
cmd/compile/internal/gc.a                     8090204   8090026   -178    -0.002% 
cmd/compile/internal/ssa.a                    29392460  29393890  +1430   +0.005% 
cmd/internal/goobj2.a                         189512    189492    -20     -0.011% 
cmd/internal/obj/arm64.a                      2444942   2444860   -82     -0.003% 
cmd/internal/obj/riscv.a                      272848    272806    -42     -0.015% 
cmd/link/internal/loader.a                    388548    388544    -4      -0.001% 
cmd/link/internal/loadpe.a                    158776    158684    -92     -0.058% 
cmd/vendor/golang.org/x/arch/ppc64/ppc64asm.a 511824    511316    -508    -0.099% 
cmd/vendor/golang.org/x/arch/x86/x86asm.a     512812    512704    -108    -0.021% 
cmd/vendor/golang.org/x/sys/unix.a            942422    942218    -204    -0.022% 
compress/bzip2.a                              88768     88680     -88     -0.099% 
crypto/tls.a                                  1655542   1655396   -146    -0.009% 
debug/dwarf.a                                 608520    605822    -2698   -0.443% 
debug/gosym.a                                 168282    168276    -6      -0.004% 
debug/pe.a                                    173146    173108    -38     -0.022% 
encoding/gob.a                                797978    797724    -254    -0.032% 
encoding/hex.a                                44080     44020     -60     -0.136% 
image/gif.a                                   152142    152148    +6      +0.004% 
internal/xcoff.a                              186480    185834    -646    -0.346% 
math.a                                        257866    257854    -12     -0.005% 
net/http.a                                    3588246   3588150   -96     -0.003% 
net/textproto.a                               162384    162120    -264    -0.163% 
reflect.a                                     1316204   1316058   -146    -0.011% 
regexp.a                                      373346    373248    -98     -0.026% 
runtime/pprof.a                               345318    345088    -230    -0.067% 
runtime.a                                     3513902   3513714   -188    -0.005% 
syscall.a                                     781406    781018    -388    -0.050% 
time.a                                        483814    483750    -64     -0.013% 
unicode/utf16.a                               8394      8364      -30     -0.357% 
vendor/golang.org/x/crypto/cryptobyte.a       287100    286706    -394    -0.137% 
vendor/golang.org/x/net/route.a               175042    174724    -318    -0.182% 
total                                         121677354 121670234 -7120   -0.006% 

Change-Id: Ie672752feb5e94dd151836f852181980710e820d
Reviewed-on: https://go-review.googlesource.com/c/go/+/212777
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-02-27 16:38:23 +00:00
Mark Rushakoff
7bb33179ca net: fix typo in unexported variable name
Change-Id: Idf64716ef8cc3ceee2fc94462cba33ba60049f7b
GitHub-Last-Rev: ba550c5d13
GitHub-Pull-Request: golang/go#36237
Reviewed-on: https://go-review.googlesource.com/c/go/+/212300
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-02-27 05:56:21 +00:00
Ian Lance Taylor
98858c4380 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>
2020-02-27 02:37:10 +00:00
Cherry Zhang
af1f3b0082 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>
2020-02-27 01:41:50 +00:00
Cherry Zhang
c70f069902 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>
2020-02-27 01:40:38 +00:00
Constantin Konstantinidis
12cd55c062 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>
2020-02-26 23:27:55 +00:00
Nikson Kanti Paul
8bdd24df6a 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>
2020-02-26 21:54:09 +00:00
Josh Bleecher Snyder
f5b5d77ee2 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>
2020-02-26 19:30:29 +00:00
Josh Bleecher Snyder
eb5cd0fb40 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>
2020-02-26 19:30:21 +00:00
Josh Bleecher Snyder
390c096ee9 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>
2020-02-26 18:59:58 +00:00
Tobias Klauser
e95b858530 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>
2020-02-26 18:56:51 +00:00
Josh Bleecher Snyder
f510cddcd1 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>
2020-02-26 18:43:30 +00:00
Josh Bleecher Snyder
9c60094986 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>
2020-02-26 18:43:22 +00:00
HowJMay
75619d199f bytes: deflake TestGrow by using testing.AllocsPerRun
Fixes #36695

Change-Id: I4392246015252018b49f321a5a839cc68cc611d7
GitHub-Last-Rev: c2fb1f7ddb
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>
2020-02-26 18:40:56 +00:00
Joel Sing
025a4faf5f 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>
2020-02-26 18:00:53 +00:00
Joel Sing
c27dd0c9e5 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>
2020-02-26 17:59:57 +00:00
codesoap
a1103dcc27 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: 7d81961688
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>
2020-02-26 17:58:41 +00:00
Katie Hockman
d0e9a4ebfd 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>
2020-02-26 16:58:30 +00:00
Joel Sing
e3b536a054 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>
2020-02-26 16:54:17 +00:00
GrigoriyMikhalkin
8992f7c459 cmd/go: escape $WORK in ccompile when -n is set
Fixes #37012

Change-Id: I169807788c022042a2b5cf04f67ae41a7325fbcf
GitHub-Last-Rev: 9e77301c7a
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>
2020-02-26 15:51:45 +00:00
Katie Hockman
975c01342a 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>
2020-02-26 15:50:14 +00:00
Jay Conrod
bb644e7982 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>
2020-02-26 15:38:51 +00:00
TennyZhuang
ee46f135a9 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>
2020-02-26 14:44:24 +00:00
Joshua Crowgey
26aadfa044 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: ea39a1c622
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>
2020-02-26 14:31:35 +00:00
Michael Munday
cb74dcc172 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>
2020-02-26 13:11:53 +00:00
Michael Munday
44fe355694 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>
2020-02-26 10:32:22 +00:00
Elias Naur
e6d7326fb6 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>
2020-02-26 09:47:21 +00:00
yah01
42b93b7fe6 fmt: do not remove trailing zeros for %g and %G with #(sharp) flag
Fixes #36562

Change-Id: Id98ae9f7362cfb825b306c36649d505692d6d60e
GitHub-Last-Rev: 405d51b12e
GitHub-Pull-Request: golang/go#36588
Reviewed-on: https://go-review.googlesource.com/c/go/+/215001
Reviewed-by: Rob Pike <r@golang.org>
2020-02-26 08:43:57 +00:00
Emmanuel T Odeke
7a03d79498 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 12a765a523/crypto/x509/by_dir.c (L153-L209)
* BoringSSL 3ba9586bc0/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>
2020-02-26 05:45:54 +00:00
Ian Lance Taylor
6052838bc3 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>
2020-02-26 04:38:19 +00:00
Cherry Zhang
c46ffdd2ec 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>
2020-02-26 01:52:42 +00:00
Keith Randall
089e482b3d 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>
2020-02-25 23:41:03 +00:00
Michael Matloob
0652c80e2a 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>
2020-02-25 22:42:00 +00:00
Brad Fitzpatrick
f0ee49b5bc 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>
2020-02-25 21:09:55 +00:00
Brad Fitzpatrick
46f9aea801 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>
2020-02-25 21:08:47 +00:00
Bryan C. Mills
583419e5d2 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>
2020-02-25 20:54:34 +00:00
Alexander Rakoczy
8e2dad5529 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>
2020-02-25 20:52:15 +00:00