1
0
mirror of https://github.com/golang/go synced 2024-11-23 23:30:10 -07:00
Commit Graph

43031 Commits

Author SHA1 Message Date
Josh Bleecher Snyder
ba0e651130 cmd/compile: add more amd64 constant simplifications
More minor optimization opportunities from CL 220499.

Change-Id: Ic4f34c41ed8ab0fce227ac194731c1be12c602db
Reviewed-on: https://go-review.googlesource.com/c/go/+/221608
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-02-29 17:26:11 +00:00
Josh Bleecher Snyder
74f898360d cmd/compile: constant fold SSA bool to int conversions
Shaves off a few instructions here and there.

file                        before   after    Δ       %       
go/types.s                  322118   321851   -267    -0.083% 
go/internal/gcimporter.s    34937    34909    -28     -0.080% 
go/internal/gccgoimporter.s 56493    56474    -19     -0.034% 
cmd/compile/internal/ssa.s  3926994  3927177  +183    +0.005% 
total                       18862670 18862539 -131    -0.001% 

Change-Id: I724f32317b946b5138224808f85709d9c097a247
Reviewed-on: https://go-review.googlesource.com/c/go/+/221428
Reviewed-by: Keith Randall <khr@golang.org>
2020-02-29 17:02:40 +00:00
Josh Bleecher Snyder
d889f0cb10 cmd/compile: use correct types in phiopt
We try to preserve type correctness of generic ops.
phiopt modified a bool to be an int without a conversion.
Add a conversion. There are a few random fluctations in the
generated code as a result, but nothing noteworthy or systematic.

no binary size changes

file                        before   after    Δ       %       
math.s                      35966    35961    -5      -0.014% 
debug/dwarf.s               108141   108147   +6      +0.006% 
crypto/dsa.s                6047     6044     -3      -0.050% 
image/png.s                 42882    42885    +3      +0.007% 
go/parser.s                 80281    80278    -3      -0.004% 
cmd/internal/obj.s          115116   115113   -3      -0.003% 
go/types.s                  322130   322118   -12     -0.004% 
cmd/internal/obj/arm64.s    151679   151685   +6      +0.004% 
go/internal/gccgoimporter.s 56487    56493    +6      +0.011% 
cmd/test2json.s             1650     1647     -3      -0.182% 
cmd/link/internal/loadelf.s 35442    35443    +1      +0.003% 
cmd/go/internal/work.s      305039   305035   -4      -0.001% 
cmd/link/internal/ld.s      544835   544834   -1      -0.000% 
net/http.s                  558777   558774   -3      -0.001% 
cmd/compile/internal/ssa.s  3926551  3926994  +443    +0.011% 
cmd/compile/internal/gc.s   1552320  1552321  +1      +0.000% 
total                       18862241 18862670 +429    +0.002% 


Change-Id: I4289e773be6be534ea3f907d68f614441b8f9b46
Reviewed-on: https://go-review.googlesource.com/c/go/+/221607
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2020-02-29 17:02:29 +00:00
martin
5756808ce8 runtime: do not exit(2) if a Go built DLL receives a signal
Fixes #35965

Change-Id: I172501fc0b29595e59b058f6e30f31efe5f6d1f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/211139
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-02-29 10:21:33 +00:00
Meng Zhuo
e48a83f077 internal/cpu: add MIPS64x feature detection
Change-Id: Iacdad1758aa15e4703fccef38c08ecb338b95fd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/200579
Run-TryBot: Meng Zhuo <mengzhuo1203@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-02-28 23:18:52 +00:00
Bryan C. Mills
618126b989 cmd/go: avoid matching wildcards rooted outside of available modules
To avoid confusion, also distinguish between packages and dirs in
search.Match results.

No test because this is technically only a performance optimization:
it would be very difficult to write such a test so that it would not
be flaky. (However, tested the change manually.)

Fixes #37521

Change-Id: I17b443699ce6a8f3a63805a7ef0be806f695a4b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/221544
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-28 21:56:35 +00:00
Jeremy Faller
d8b03c4678 [dev.link] cmd/link: remove some dependence on *Link
In an effort to make relocation application thread-safe remove another
dependence on context.

Change-Id: Ic53ea122cce72117fcebe56e386b710755f6eb68
Reviewed-on: https://go-review.googlesource.com/c/go/+/220838
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-02-28 21:24:32 +00:00
Jeremy Faller
e9056a6a73 [dev.link] cmd/link: create Target in order to make relocsym threadsafe
In its current form, relocsym requires the Link context -- largely in a
readonly state. Rather than passing around such heavy-weight object to
the function, this CL separates out the link target. From here, the
number of touchpoints (and thread unsafe portions) of relocing symbols
can be mentally reasoned about.

(NB: My personal intent is to make this more universal -- passing only
the necessary variables/state to reloc functions. This is a taste to see
if we like this form.)

Change-Id: Id9177d03267fedf0bb572a9d61bc07b64309c3b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/220837
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-02-28 21:04:36 +00:00
Cherry Zhang
99eb14a7f4 [dev.link] all: merge branch 'master' into dev.link
Clean merge.

Change-Id: I8098f15f249f7a1c054c708d22dac41e5951cddb
2020-02-28 15:28:43 -05:00
Felix Cornelius
964fac3ee7 doc: update Effective Go with 1.14 language changes
Fixes #37560

Change-Id: Iccb8e53254c45d203c1b42ea9b4d8509b93dd7a9
GitHub-Last-Rev: 5972b67e5d
GitHub-Pull-Request: golang/go#37563
Reviewed-on: https://go-review.googlesource.com/c/go/+/221429
Reviewed-by: Rob Pike <r@golang.org>
2020-02-28 20:15:38 +00:00
Bryan C. Mills
5a61de3fe1 cmd/go: rationalize errors in internal/load and internal/modload
This change is a non-minimal fix for #32917, but incidentally fixes
several other bugs and makes the error messages much more ergonomic.

Updates #32917
Updates #27122
Updates #28459
Updates #29280
Updates #30590
Updates #37214
Updates #36173
Updates #36587
Fixes #36008
Fixes #30992

Change-Id: Iedb26d2e0963697c130df5d0f72e7f83ec2dcf06
Reviewed-on: https://go-review.googlesource.com/c/go/+/185345
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-28 19:09:53 +00:00
Bryan C. Mills
d11e1f92fc cmd/go/internal/search: consolidate package-pattern predicates into Match methods
This change consolidates predicates currently scattered throughout
various parts of the package and module loader into methods on the
search.Match type.

That not only makes them more concise, but also encourages
consistency, both in the code and in reasoning about the kinds of
patterns that need to be handled. (For example, the IsLocal predicate
was previously two different calls, either of which could be easily
forgotten at a given call site.)

Factored out from CL 185344 and CL 185345.

Updates #32917

Change-Id: Ifa450ffaf6101f673e0ed69ced001a487d6f9335
Reviewed-on: https://go-review.googlesource.com/c/go/+/221458
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-28 19:05:54 +00:00
Bryan C. Mills
156c60709e cmd/go/internal/search: record errors in the Match struct
Previously, we would either invoke base.Fatalf (which is too aggressive),
or log.Print (which is too passive).

Updates #32917

Change-Id: I5475e873e76948de7df65dca08bc0ce67a7fc827
Reviewed-on: https://go-review.googlesource.com/c/go/+/185344
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-28 19:04:46 +00:00
Michael Matloob
d464c7ce29 cmd/go/internal/modload: make AmbiguousImportError an ImportPathError
AmbiguousImportErrors will now be formatted like other ImportPathErrors:
this means that now the ambiguously imported package won't be printed
twice. Whereas the error message looked like the following:

	can't load package: package example.com/m/importy: ambiguous import: found package example.com/m/importy in multiple directories:
		$WORK/importy
		$WORK/vendor/example.com/m/importy

It now looks like this:

	can't load package: ambiguous import: found package example.com/m/importy in multiple directories:
		$WORK/importy
		$WORK/vendor/example.com/m/importy

Change-Id: I52a2074a6b3f5eb7d78d331d0852b7ea6b3735e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/221457
Run-TryBot: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-02-28 17:51:13 +00:00
Ian Lance Taylor
719b1ba278 net: report port number correctly in Plan 9 error
The code was incorrectly using a string conversion of a numeric port
to display the port number.

No test because as far as I can tell this code is only executed if
there is some error in a /net file.

Updates #32479

Change-Id: I0b8deebbf3c0b7cb1e1eee0fd059505f3f4c1623
Reviewed-on: https://go-review.googlesource.com/c/go/+/221377
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-02-28 16:22:42 +00:00
Than McIntosh
3fd7d78dec [dev.link] cmd/link: fix up 'top frame' attribute in preload
Populate the 'top frame' attribute for function symbols during preload
(needed for DWARF debug frame generation).

Change-Id: If27836f51ebafa3c1c29b268a22d72d1b59b505a
Reviewed-on: https://go-review.googlesource.com/c/go/+/220983
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-02-28 14:58:15 +00:00
Josh Bleecher Snyder
2cf3ebaf3d cmd/compile: add dedicated ARM64BitField aux type
The goal here is improved AuxInt printing in ssa.html.
Instead of displaying an inscrutable encoded integer,
it displays something like

v25 (28) = UBFX <int> [lsb=4,width=8] v52

which is much nicer for debugging.

Change-Id: I40713ff7f4a857c4557486cdf73c2dff137511ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/221420
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-02-28 14:52:13 +00:00
Joel Sing
8955a56da0 cmd/compile: improve SignExt32to64 on riscv64
SignExt32to64 can be implemented with a single ADDIW instruction, rather than
the two shifts that are in use currently.

Change-Id: Ie1bbaef4018f1ba5162773fc64fa5a887457cfc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/220922
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-02-28 14:33:28 +00:00
Dmitri Shuralyov
44286d09c5 cmd/gofmt, go/format: sync internal.go
Apply CL 40930 to src/cmd/gofmt/internal.go to bring
it into sync with src/go/format/internal.go.

Also revert '\n' back to "\n\n" in one of the comments,
because the previous text was more accurate.
Gofmt replaces the "; " part of "package p; func _() {"
input with two newline characters, not one.

Updates #11844

Change-Id: I6bb8155a931b793311991d3cd8e006a2931b167a
Reviewed-on: https://go-review.googlesource.com/c/go/+/221497
Reviewed-by: Robert Griesemer <gri@golang.org>
2020-02-28 14:23:08 +00:00
Josh Bleecher Snyder
a3fc77aa7e cmd/compile: add ellipsis rule diagnostics to rulegen
These detect opportunities to convert a rule to use an ellipsis,
and provide better error messages when something goes wrong.

This change was used to generate all the preceding changes
converting rules to use ellipses. This change is at the end of those
changes rather than the beginning in order to avoid log spam during rule
generation (say during a git bisection).

The preceding changes collectively shrink the cmd/compile binary by ~2.2%.

Part of this detection is also warning when the presence of an
unmentioned aux or auxint could cause conversion to an ellipsis
rule to change the sematics of the rule.

For example:

(Div64 x y) -> (DIV x y)

looks like a promising rule for an ellipsis. However, Div64 has an auxint,
and (on most platforms) DIV does not. An ellipsis rule would keep the
auxint intact, rather than zeroing it, which can infere with CSE.
So this change flags this rule as doing implicit zeroing;
it should be replaced by

(Div64 [a] x y) -> (DIV x y)

which makes it clear that the auxint is being zeroed.

This detection is not foolproof, but it currently has no false positives.
If false positives arise in the future, we will need to gate the output.

Change-Id: Ie21f284579e5d6e75aa304d0deb024d41ede528b
Reviewed-on: https://go-review.googlesource.com/c/go/+/217014
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2020-02-28 13:21:44 +00:00
Daniel Martí
b8f54e57c2 cmd/go: version command should error when given bad args
For example, 'go version -m' happily gives you Go's own version, even
though the -m flag only makes sense when grabbing the version of a
binary on disk.

Similarly, if any of the directly named files can't be found, the tool
would succeed. That's acceptable if an error is encountered while
walking a large directory, but not when locating a path directly given
by the user.

These added test cases run even in short mode, as 'go build' is not
needed for them.

Change-Id: I7bb40b72853799e31d9f86cc5e999c8d57813eef
Reviewed-on: https://go-review.googlesource.com/c/go/+/221397
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-02-28 09:29:22 +00:00
Josh Bleecher Snyder
18053b7131 cmd/compile: optimize unsigned comparisons to 0/1 on amd64
Plus a bonus optimization I noticed while working on this.

There are no functions (besides the rewrite rules) whose text size
increases as a result of this change.

Updates #21439

The following per-package text size stats were generated by parsing the
output of compiling with -S and summing the function size reported on the
STEXT line. This gives a far more accurate picture of the impact
on generated code than merely looking at the object file size changes
or the resulting binary size changes. The latter are below, for reference.

file                                          before  after   Δ       %       
runtime.s                                     477257  476417  -840    -0.176% 
math.s                                        35985   35976   -9      -0.025% 
vendor/golang.org/x/net/dns/dnsmessage.s      87314   87232   -82     -0.094% 
debug/dwarf.s                                 108444  108432  -12     -0.011% 
regexp.s                                      64535   64467   -68     -0.105% 
internal/xcoff.s                              23175   22945   -230    -0.992% 
cmd/vendor/golang.org/x/arch/arm/armasm.s     45263   45260   -3      -0.007% 
cmd/vendor/golang.org/x/arch/arm64/arm64asm.s 118140  118135  -5      -0.004% 
cmd/internal/obj/arm64.s                      151502  151498  -4      -0.003% 
cmd/compile/internal/ssa.s                    6061483 6063120 +1637   +0.027% 
total                                         9321728 9322112 +384    +0.004% 

file      before    after     Δ       %       
go        15188916  15184820  -4096   -0.027% 
addr2line 4315984   4311888   -4096   -0.095% 
cgo       4836088   4831992   -4096   -0.085% 
compile   24506008  24493720  -12288  -0.050% 
doc       4680952   4676856   -4096   -0.088% 
link      6605336   6601240   -4096   -0.062% 
pprof     14776756  14772660  -4096   -0.028% 
total     135250956 135214092 -36864  -0.027% 

Change-Id: I1243a098a08db452f7d1eb0998e241c9b199e2b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/213058
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-02-28 00:19:12 +00:00
Ian Lance Taylor
117826903a flag: update comment to refer to Output, not out
The out method was renamed to Output in CL 70391 for #17628 and #21888.

Fixes #37514

Change-Id: I99be47b5030ccbbf10a056df9fcc3c97cb99b015
Reviewed-on: https://go-review.googlesource.com/c/go/+/221383
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2020-02-27 23:20:01 +00:00
Tim Cooper
7340e5a1e8 net/textproto: close channel to signal pipeline event completion
Change-Id: I7e4827b3428b48c67060789a528586a8907ca3db
Reviewed-on: https://go-review.googlesource.com/c/go/+/221418
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 23:19:45 +00:00
Michael Matloob
3061d89651 cmd/go/testdata/script: fix path separator in test to be os-independent
Use ${:} instead of : so to be Windows-friendly.

Change-Id: I5e660af49b0a2ac2da868583cbcb55cf8bf89b68
Reviewed-on: https://go-review.googlesource.com/c/go/+/221461
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-02-27 23:06:33 +00:00
Michael Matloob
a1e057e585 cmd/go: roll forward "convert TestShadowingLogic to the script framework"
This rolls forward the change golang.org/cl/214431, which was reverted
in golang.org/cl/220217. The cl was broken because
TestVersionControlErrorMessageIncludesCorrectDirectory, which is going
to be removed in golang.org/cl/214429 hadn't been submitted yet.

Original change description:

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

Updates #36320
Updates #17751

Change-Id: I87b3f9acb8575fbcbd58d454b5f9bac4923429b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/220178
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-02-27 21:34:55 +00:00
Michael Matloob
6ef25c2ad3 cmd/go: convert testCDAndGOPATHAreDifferent to the script framework
This is a bit complex. There's a driver program to run go with modifications
to the GOPATH used to test Windows.

Also remove the cd method on testgoData, because this was the last function
that used it.

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

Updates #36320
Updates #17751

Change-Id: I3e8e27f37fd3701bd36b6365b128dd73b69181c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/214578
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-27 21:34:42 +00:00
Michael Matloob
e674972e8c cmd/go: convert TestLegacyModGet to the script framework
I think this test needs to be split up eventually. It's one of
the longest tests.

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

Updates #36320
Updates #17751

Change-Id: If2168fac040d78fd0ec3dcbdef2affd2a8f48f6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/214158
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-27 21:34:23 +00:00
Michael Matloob
62ff72d876 cmd/go: convert TestLinkXImportPathEscape to the script framework
Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: Ib386838081abad8bc6b01c1f0a4656553d0b6ff3
Reviewed-on: https://go-review.googlesource.com/c/go/+/214579
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-02-27 21:33:33 +00:00
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
Than McIntosh
48c79db07f [dev.link] cmd/link: simplify DWARF DIE symbol payload
Get rid of of the linker's dwSym struct (which wraps a loader.Loader
and a loader.Sym) in favor of just loader.Sym. This requires some minor
tweaks to the cmd/internal/dwarf interfaces.

Change-Id: Id3ffd7c41b2433ea04417040368700334bb0e611
Reviewed-on: https://go-review.googlesource.com/c/go/+/220982
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-02-27 20:26:16 +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