1
0
mirror of https://github.com/golang/go synced 2024-09-29 18:34:33 -06:00
Commit Graph

40089 Commits

Author SHA1 Message Date
Alex Brainman
e85d619530 cmd/go/internal/renameio: use ERROR_ACCESS_DENIED to check for errors
CL 172418 added code to check for "Access is denied" error.
But "Access is denied" error will be spelled differently on
non-English version of Windows.

Check if error is ERROR_ACCESS_DENIED instead.

Updates #31247

Change-Id: I7b1633013d563f7c06c1f12a9be75122106834f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/174123
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-04-28 03:20:38 +00:00
Elias Naur
4fdeb73fed cmd/link/internal/ld,syscall: replace getfsstat64 with getfsstat
getfsstat64 is deprecated but not yet caught by the App Store checks.
Use the supported getfsstat$INODE64 form instead to ensure forward
compatibility.

Change-Id: I0d97e8a8b254debb3de1cfcb3778dbed3702c249
Reviewed-on: https://go-review.googlesource.com/c/go/+/174200
Run-TryBot: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Keith Randall <khr@golang.org>
2019-04-27 21:47:58 +00:00
Elias Naur
096ab3c21b cmd/link/internal/ld,syscall: drop $INODE64 suffixes on simulators
Some libc functions are suffixed with "$INODE64" on macOS.
Unfortunately, the iOS simulator doesn't have the suffixes, so we can't
use GOARCH to distinguish the two platform.

Add linker support for adding the suffix, using the macho platform
to determine whether it is needed.

While here, add the correct suffix for fdopendir on 386. It's
"$INODE64$UNIX2003", believe it or not. Without the suffix,

GOARCH=386 go test -short syscall

crashes on my Mojave machine.

Fixes #31447

Change-Id: I9bd3de40ece7df62f744bc24cd00909e56b00b78
Reviewed-on: https://go-review.googlesource.com/c/go/+/174199
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-04-27 21:47:07 +00:00
Elias Naur
a74e01204e cmd/link/internal/ld: consolidate macho platform setup
Determine the macho platform once and use that the two places that
need it. This makes it easier to add a third platform check for a
follow-up change.

Updates #31447

Change-Id: I522a5fface647ab8e608f816c5832d531534df7a
Reviewed-on: https://go-review.googlesource.com/c/go/+/174198
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-04-27 21:29:58 +00:00
Brian Kessler
a28a942768 cmd/compile: add unsigned divisibility rules
"Division by invariant integers using multiplication" paper
by Granlund and Montgomery contains a method for directly computing
divisibility (x%c == 0 for c constant) by means of the modular inverse.
The method is further elaborated in "Hacker's Delight" by Warren Section 10-17

This general rule can compute divisibilty by one multiplication and a compare
for odd divisors and an additional rotate for even divisors.

To apply the divisibility rule, we must take into account
the rules to rewrite x%c = x-((x/c)*c) and (x/c) for c constant on the first
optimization pass "opt".  This complicates the matching as we want to match
only in the cases where the result of (x/c) is not also available.
So, we must match on the expanded form of (x/c) in the expression x == c*(x/c)
in the "late opt" pass after common subexpresion elimination.

Note, that if there is an intermediate opt pass introduced in the future we
could simplify these rules by delaying the magic division rewrite to "late opt"
and matching directly on (x/c) in the intermediate opt pass.

Additional rules to lower the generic RotateLeft* ops were also applied.

On amd64, the divisibility check is 25-50% faster.

name                     old time/op  new time/op  delta
DivconstI64-4            2.08ns ± 0%  2.08ns ± 1%     ~     (p=0.881 n=5+5)
DivisibleconstI64-4      2.67ns ± 0%  2.67ns ± 1%     ~     (p=1.000 n=5+5)
DivisibleWDivconstI64-4  2.67ns ± 0%  2.67ns ± 0%     ~     (p=0.683 n=5+5)
DivconstU64-4            2.08ns ± 1%  2.08ns ± 1%     ~     (p=1.000 n=5+5)
DivisibleconstU64-4      2.77ns ± 1%  1.55ns ± 2%  -43.90%  (p=0.008 n=5+5)
DivisibleWDivconstU64-4  2.99ns ± 1%  2.99ns ± 1%     ~     (p=1.000 n=5+5)
DivconstI32-4            1.53ns ± 2%  1.53ns ± 0%     ~     (p=1.000 n=5+5)
DivisibleconstI32-4      2.23ns ± 0%  2.25ns ± 3%     ~     (p=0.167 n=5+5)
DivisibleWDivconstI32-4  2.27ns ± 1%  2.27ns ± 1%     ~     (p=0.429 n=5+5)
DivconstU32-4            1.78ns ± 0%  1.78ns ± 1%     ~     (p=1.000 n=4+5)
DivisibleconstU32-4      2.52ns ± 2%  1.26ns ± 0%  -49.96%  (p=0.000 n=5+4)
DivisibleWDivconstU32-4  2.63ns ± 0%  2.85ns ±10%   +8.29%  (p=0.016 n=4+5)
DivconstI16-4            1.54ns ± 0%  1.54ns ± 0%     ~     (p=0.333 n=4+5)
DivisibleconstI16-4      2.10ns ± 0%  2.10ns ± 1%     ~     (p=0.571 n=4+5)
DivisibleWDivconstI16-4  2.22ns ± 0%  2.23ns ± 1%     ~     (p=0.556 n=4+5)
DivconstU16-4            1.09ns ± 0%  1.01ns ± 1%   -7.74%  (p=0.000 n=4+5)
DivisibleconstU16-4      1.83ns ± 0%  1.26ns ± 0%  -31.52%  (p=0.008 n=5+5)
DivisibleWDivconstU16-4  1.88ns ± 0%  1.89ns ± 1%     ~     (p=0.365 n=5+5)
DivconstI8-4             1.54ns ± 1%  1.54ns ± 1%     ~     (p=1.000 n=5+5)
DivisibleconstI8-4       2.10ns ± 0%  2.11ns ± 0%     ~     (p=0.238 n=5+4)
DivisibleWDivconstI8-4   2.22ns ± 0%  2.23ns ± 2%     ~     (p=0.762 n=5+5)
DivconstU8-4             0.92ns ± 1%  0.94ns ± 1%   +2.65%  (p=0.008 n=5+5)
DivisibleconstU8-4       1.66ns ± 0%  1.26ns ± 1%  -24.28%  (p=0.008 n=5+5)
DivisibleWDivconstU8-4   1.79ns ± 0%  1.80ns ± 1%     ~     (p=0.079 n=4+5)

A follow-up change will address the signed division case.

Updates #30282

Change-Id: I7e995f167179aa5c76bb10fbcbeb49c520943403
Reviewed-on: https://go-review.googlesource.com/c/go/+/168037
Run-TryBot: Brian Kessler <brian.m.kessler@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-04-27 20:46:46 +00:00
Joel Sing
f67f5511ee cmd/dist: add support for openbsd/arm64
Updates #31656

Change-Id: If481df050cd879f7c7c22a79c17c33af00a8b389
Reviewed-on: https://go-review.googlesource.com/c/go/+/174125
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-27 18:17:28 +00:00
Joel Sing
4abf3598a4 runtime, syscall: address vet errors in openbsd/arm64 assembly
Updates #31656

Change-Id: Ie28734298bf1a2d5243f1ac15569311c1887176e
Reviewed-on: https://go-review.googlesource.com/c/go/+/174126
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-27 18:05:25 +00:00
Joel Sing
17a7f21790 runtime: correct exitThread on openbsd/arm64
The notdead argument to sys___threxit() is a pointer, hence requires a 64-bit
move rather than a 32-bit one.

Updates #31656

Change-Id: I52ad31ed5afaf43ccc3d934025288216e8052528
Reviewed-on: https://go-review.googlesource.com/c/go/+/174124
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-27 17:15:55 +00:00
Dmitri Goutnik
930d6ecb69 bootstrap.bash: preserve file times when copying
Preserve file modification times when copying bootstrap tree,
this makes generated bootstrap more friendly to rsyncing.

Change-Id: I32cde58c25b48d3c00d4413860dbd49a265b0ff2
Reviewed-on: https://go-review.googlesource.com/c/go/+/174217
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-27 14:36:00 +00:00
Mark Rushakoff
2b325f8d52 cmd/go: fix typo in "go help version" output
Change-Id: I38b22786aae3d7a08cf2863ef5d15e476fe30093
GitHub-Last-Rev: 57d07dd1c7
GitHub-Pull-Request: golang/go#31711
Reviewed-on: https://go-review.googlesource.com/c/go/+/174086
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-04-27 04:45:15 +00:00
Daniel Theophanes
2177bfb343 database/sql: add NullInt32
It is common for database integers to be represented as int32
internally. Although NullInt64 is already defined,
this should remove some type casts and make working with those eaiser.

For #31231

Change-Id: Ia0c37ecef035fee0734c1d1fb6f58aef6905cf5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/174178
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-26 21:54:41 +00:00
Cherry Zhang
8ef45cf60b cmd/link: reduce the size of Reloc struct
For linking large binaries, the slice of Relocs consumes a large
amount of memory. We can reduce this memory consumption by
shrinking the size of the Reloc struct. This CL moves the fields
used only in external linking or only on PPC64 and S390X to a
lazily initialized side struct.

Linking k8s.io/kubernetes/cmd/kube-apiserver on Linux/AMD64,
before:
inuse_space 1240.25MB total
438.11MB 35.32% 35.32%   438.11MB 35.32%  cmd/link/internal/objfile.(*objReader).readSlices

after:
inuse_space 1123.39MB total
306.85MB 27.31% 55.03%   306.85MB 27.31%  cmd/link/internal/objfile.(*objReader).readSlices

Under GOGC=5 (to simulate system under memory pressure), the max
RSS reduces from ~2.05G to ~1.83G. Even with external linking the
max RSS doesn't increase.

Change-Id: I9bb8a8effaed24a8b3c4b1cfb93e6992b8740f91
Reviewed-on: https://go-review.googlesource.com/c/go/+/173437
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-26 20:50:31 +00:00
Daniel Theophanes
1805f425ad database/sql: check if src is nil before converting to string
A nil src (NULL database value) will result in a "nil" string,
which will never parse correctly in a ParseInt or similar
numeric conversion. The resulting error is confusing. Check
for a nil src prior to converting the value to string
if the resulting string will be parsed after that.

Closes #31274

Change-Id: I90f12cceff00fbbfdd3e343b04fa7e2596390e6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/174177
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-26 19:59:11 +00:00
Marcel van Lohuizen
2ae5e7f9bf vendor: pull in text@v0.3.2
This updates the packages from text and net to use
the Unicode 11 tables.

Updates golang/go#27945

Change-Id: I096e80283f37b596f2aa8bd3e5ffec6b7045469a
Reviewed-on: https://go-review.googlesource.com/c/go/+/174057
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-26 19:27:51 +00:00
Russ Cox
511484afa2 cmd/go: add internal/note, internal/sumweb, internal/tlog from golang.org/x/exp/sumdb
Copied and updated import paths.
Eventually we will probably publish
these packages somewhere in golang.org/x
(as non-internal packages) and then we will
be able to vendor them properly.
For now, copy.

sumweb.globsMatchPath moved to str.GlobsMatchPath.

Change-Id: I4585e6dc5daa423e4ca9669195d41e58e7c8c275
Reviewed-on: https://go-review.googlesource.com/c/go/+/173950
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-04-26 19:23:46 +00:00
Russ Cox
3cafbeab2a cmd/vendor: add golang.org/x/crypto/ed25519
Needed for Go checksum database integration in cmd/go.
Generated with "go mod vendor" in client with that CL already applied.

Change-Id: I1aa84977ba3a62504d3f4c069f48c07c67b83023
Reviewed-on: https://go-review.googlesource.com/c/go/+/173949
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-04-26 19:23:39 +00:00
Joel Sing
a4f9c2a29e cmd/link: add support for openbsd/arm64
Updates #31656

Change-Id: Iff0b2c2b2ca95f8c246436e35a22b70efb8e61d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/174121
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-26 17:52:27 +00:00
Joel Sing
6c04c26c65 syscall: add support for openbsd/arm64
Generated on OpenBSD 6.5.

Updates #31656

Change-Id: I0a7ddeee42d982ecbc226e82dec983c63e6c836d
Reviewed-on: https://go-review.googlesource.com/c/go/+/174120
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-26 17:34:54 +00:00
Joel Sing
3d94dd78d4 runtime: add support for openbsd/arm64
Updates #31656

Change-Id: I0b7486f7381fd8bd16a76278c0e9ec9763671fcc
Reviewed-on: https://go-review.googlesource.com/c/go/+/174119
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-26 17:34:45 +00:00
Ian Lance Taylor
80704ec3fa runtime: test for cgo build tag in TestGdbPythonCgo
Testing whether cgo is enabled in go/build is not the same as testing
whether the go tool supports cgo. They differ, for example, when using
GOARCH=386 on an amd64 system, as for a cross-build cgo is disabled by default.

Change-Id: Ib59106c92a3131b73ac6a91c0f7658a1769acf73
Reviewed-on: https://go-review.googlesource.com/c/go/+/174098
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-26 17:13:13 +00:00
Joel Sing
3f7276c029 cmd: update vendored golang.org/x/sys
This brings in support for openbsd/arm64.

Updated via 'go get' and 'go mod vendor'.

Updates #31656

Change-Id: I18ffbc622d542f61ca0442b9dab28271fa2cfa85
Reviewed-on: https://go-review.googlesource.com/c/go/+/174118
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-26 16:55:16 +00:00
Brandon Ryan
06a8f68407 doc: clarify to use MinGW-W64 for amd64 systems
Fixes #19686

Change-Id: I5c2dd60636b521425647afd0725fdd7c18e7bbbe
GitHub-Last-Rev: a1c5f56940
GitHub-Pull-Request: golang/go#31682
Reviewed-on: https://go-review.googlesource.com/c/go/+/173997
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-26 15:09:02 +00:00
Clément Chigot
f61353f2d9 runtime: enable runtime_mmap_test.go on AIX
AIX doesn't allow to mmap an address range which is already mmap.
Therefore, once the region has been allocated, it must munmap before
being able to play with it.

Change-Id: I1547782f0379024f57869f1dda8c1c9bb12d831f
Reviewed-on: https://go-review.googlesource.com/c/go/+/174059
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-26 15:06:36 +00:00
LE Manh Cuong
8feeada50c time: fix misleading error with the leading zero format
When the leading zero format is used, we currently don't handle the
month and year properly.

For the month, we were reporting an out of range error when getnum
returns zero of its own, as it also returns the month 0. That's
confusing, so only check the range when getnum returns a nil error.

For the year, we don't restore the value when parsing error occurs. For
example, with the incorrect input "111-01", "01" will be used to report
an error. So restore the value when an error occurs fix the problem.

Fixes #29918
Fixes #29916

Change-Id: I3145f8c46813a0457766b7c302482e6b56f94ed6
Reviewed-on: https://go-review.googlesource.com/c/go/+/160338
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-26 14:01:55 +00:00
Ian Lance Taylor
bc48cc770f runtime: gofmt defs1_netbsd_arm64.go
Updates #30824

Change-Id: I3d9ad7896d528d8274ec78378a546b0356986b9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/174078
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-26 14:01:21 +00:00
Russ Cox
a7dc6ca4b1 net/url: document, test that PathEscape escapes / to %2F
I couldn't remember and couldn't tell from the docs,
so I added a test and documented what I found.

Change-Id: Ic5d837c2d620b15d7a831823e94e70080f5e5324
Reviewed-on: https://go-review.googlesource.com/c/go/+/173948
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-26 13:52:08 +00:00
Russ Cox
216797b63b cmd/go: make 'go version' apply to files
Expand "go version" from printing just the version of the
go command itself to being able to print the version of any
go binary (when listed on the command line).

This is a simplified version of rsc.io/goversion, which will
now be deprecated in favor of "go version".

(Preparatory changes to runtime, cmd/go, and cmd/link
made this version information easier to find, allowing a
much simpler implementation than in rsc.io/goversion.)

Fixes #31624.

Change-Id: I5f6f5b8392ce86a617e32ce287f6bf2aceafccff
Reviewed-on: https://go-review.googlesource.com/c/go/+/173343
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-04-26 13:52:01 +00:00
Russ Cox
d6b06f0254 cmd/link: make it easy to find binary versions
It is useful to be able to dig the Go version out of a binary,
even a stripped binary. rsc.io/goversion does this for x86
binaries by disassembling the binary to find runtime/proc.go's
startup-time reference to runtime.buildVersion's address.
That approach is quite fragile: the implementation doesn't
work for non-x86 and must be updated as the generated
code changes.

rsc.io/goversion finds the module version string by looking
for random 16-byte framing around the actual string.
This is less fragile but fairly kludgy and requires scanning
the entire data segment.

cmd/buildid finds the build ID by looking for an ELF note
or else falling back to scanning the beginning of the text
segment for a magic string. This has proved quite reliable
and doesn't require scanning much of the binary.

This CL makes it possible to find the Go and module versions
using a scan more like the build ID scan: a symbol early in
the writable data segment starts with a magic number and
then has pointers to the two string variables.

Setting up for "go version <binary>".

For #31624.

Change-Id: I78ea8c52fe1686b5cc5a829ca5f198104d10ebf0
Reviewed-on: https://go-review.googlesource.com/c/go/+/173342
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-26 13:51:52 +00:00
Russ Cox
a62887aade api: add recent Go 1.13 work
Change-Id: I0d1048723057dff0caf2059ce2efd63eb953ed82
Reviewed-on: https://go-review.googlesource.com/c/go/+/173947
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-26 05:16:33 +00:00
Than McIntosh
9ac471a87d cmd/link: use read-only mmap to back selected symbol name strings
When reading symbol names from an object file, if a name does not
need fixup (conversion of "". to package path), then generate
a string whose backing store is in read-only memory (from an mmap
of the object file), avoiding the need for an allocation. This
yields a modest reduction in total linker heap use.

Change-Id: I95719c93026b6cc82eb6947a9d14063cf3a6679c
Reviewed-on: https://go-review.googlesource.com/c/go/+/173938
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-25 23:42:12 +00:00
Austin Clements
4598c23c6c runtime: switch to P 0 before destroying current P
Ps are strictly numbered from 0 to GOMAXPROCS-1, so if procresize
happens to be running on a P that's being destroyed, it moves itself
to P 0.

However, currently procresize destroys the unused Ps *before* moving
itself to P 0. This means it may briefly run on a destroyed P. This is
basically harmless, but has at least one very confusing consequence:
since destroying a P has write barriers, it may enqueue pointers to a
destroyed write barrier buffer. As far as I can tell, there are no
negative consequences of this, but this seems really fragile.

This CL swaps the order of things, so now procresize moves itself to P
0 if necessary before destroying Ps. This ensures it always has a
valid P.

This is part of refactoring for #10958 and #24543, but is a good
cleanup regardless.

Change-Id: I91a23dd6ed27e372f8d6291feec9bc991bcf9812
Reviewed-on: https://go-review.googlesource.com/c/go/+/173941
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-04-25 22:56:11 +00:00
Austin Clements
b0c6165605 runtime: document P statuses
We're about to change some of these rules, so it's about time we wrote
them down!

For #10958, #24543.

Change-Id: I3efce0c44b53bfb6f31ce2d299809b2b4eb329f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/172857
Reviewed-by: Russ Cox <rsc@golang.org>
2019-04-25 22:08:33 +00:00
Marcel van Lohuizen
34fc6ced76 all: update to Unicode 11
This does *not* update the vendored tables.
A commit updating these tables should follow soon,

Mostly generated running UNICODE_VERSION=11.0.0 in x/text.

Manually updated next.txt file.

Updates golang/go#27945.

Change-Id: I939a01e235aeca898ee9afc99a531e7ad8444e12
Reviewed-on: https://go-review.googlesource.com/c/go/+/154420
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-04-25 20:33:22 +00:00
Michael Anthony Knyszek
8c05d67661 runtime: make mTreap.find actually find the best fit
This change modifies the implementation of mTreap.find to find the
best-fit span with the lowest possible base address.

Fixes #31616.

Change-Id: Ib4bda0f85d7d0590326f939a243a6e4665f37d3f
Reviewed-on: https://go-review.googlesource.com/c/go/+/173479
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-04-25 18:15:21 +00:00
Cherry Zhang
93fcebaf31 cmd/link: avoid writing to read-only memory in addstrdata
When the linker's -X flag is used, it will overwrite the symbol's
content (sym.P) in addstrdata. The symbol's content may be in
read-only memory, in which case overwriting it will fault. Do
copy-on-write to fix this.

Change-Id: I34d583f44c30d187042757e19a14c1ef7d3e613c
Reviewed-on: https://go-review.googlesource.com/c/go/+/173937
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-25 17:52:31 +00:00
Jay Conrod
41d1bf0efc cmd/go/internal/modfetch: workaround file URL parsing on Windows
Remove the leading slash from GOPROXY file:// URLs.

Updates #31675

Change-Id: Id45af2a806afc3c216181c13f6bc73713b925693
Reviewed-on: https://go-review.googlesource.com/c/go/+/173499
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-25 16:32:34 +00:00
Russ Cox
f30c564529 cmd/go: add support for GOPROXY list
Following discussion on golang.org/issue/26334, this CL changes
the GOPROXY environment setting to be a list of proxies, tried in
sequence. The first successful or non-404/410 error is taken as
authoritative. Otherwise the next proxy is tried, and so on.

As in earlier releases, GOPROXY=direct means "connect directly",
but now it can appear in a longer list as well.

This will let companies run a proxy holding only their private modules
and let users set GOPROXY=thatproxy,publicproxy or GOPROXY=thatproxy,direct
to fall back to an alternate mechanism for fetching public modules.

Fixes #26334.

Change-Id: I642f0ae655ec307d9cdcad0830c0baac8670eb9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/173441
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-04-25 14:54:09 +00:00
Russ Cox
5fa14a31b0 cmd/go/internal/web: minor api cleanup
- rename PasswordRedacted to Redacted
- move URL into Response in redacted form, remove from Get result list
- add Response.Err to construct non-200 errors
  (otherwise GetBytes is not just a wrapper)
- make 404/410 errors satisfy Is(err, os.ErrNotExist)

Change-Id: Id15899c1e3dfd30cffb1a75ba79a9a1999913258
Reviewed-on: https://go-review.googlesource.com/c/go/+/173717
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-04-25 14:54:07 +00:00
David du Colombier
be857a6365 net: fix lookupHost to return DNSError on Plan 9
CL 168597 added IsNotFound field to DNSError.
However, this change broke TestLookupNonLDH on Plan 9
because LookupHost is expected to return a DNSError,
while on Plan 9, it returned an error string.

This change fixes the implementation of lookupHost on
Plan 9 to return a DNSError instead of an error string.

Fixes #31672.

Change-Id: Ia805c8965af63ddee7ccfdebb9462a5502b0269d
Reviewed-on: https://go-review.googlesource.com/c/go/+/173857
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-25 14:25:10 +00:00
Baokun Lee
70ac1c2f3f cmd/go/internal/modconv: support convert replacements in Gopkg.lock
Fixes #24087.
Updates #26711.

Change-Id: I7fe6b21fd391253a19cb1d35709a061872ea7b6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/126915
Run-TryBot: Baokun Lee <nototon@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-04-25 14:03:58 +00:00
Brian Kessler
44343c777c cmd/compile: add signed divisibility by power of 2 rules
For powers of two (c=1<<k), the divisibility check x%c == 0 can be made
just by checking the trailing zeroes via a mask x&(c-1) == 0 even for signed
integers. This avoids division fix-ups when just divisibility check is needed.

To apply this rule, we match on the fixed-up version of the division. This is
neccessary because the mod and division rewrite rules are already applied
during the initial opt pass.

The speed up on amd64 due to elimination of unneccessary fix-up code is ~55%:

name                     old time/op  new time/op  delta
DivconstI64-4            2.08ns ± 0%  2.09ns ± 1%     ~     (p=0.730 n=5+5)
DivisiblePow2constI64-4  1.78ns ± 1%  0.81ns ± 1%  -54.66%  (p=0.008 n=5+5)
DivconstU64-4            2.08ns ± 0%  2.08ns ± 0%     ~     (p=0.683 n=5+5)
DivconstI32-4            1.53ns ± 0%  1.53ns ± 1%     ~     (p=0.968 n=4+5)
DivisiblePow2constI32-4  1.79ns ± 1%  0.81ns ± 1%  -54.97%  (p=0.008 n=5+5)
DivconstU32-4            1.78ns ± 1%  1.80ns ± 2%     ~     (p=0.206 n=5+5)
DivconstI16-4            1.54ns ± 2%  1.54ns ± 0%     ~     (p=0.238 n=5+4)
DivisiblePow2constI16-4  1.78ns ± 0%  0.81ns ± 1%  -54.72%  (p=0.000 n=4+5)
DivconstU16-4            1.00ns ± 5%  1.01ns ± 1%     ~     (p=0.119 n=5+5)
DivconstI8-4             1.54ns ± 0%  1.54ns ± 2%     ~     (p=0.571 n=4+5)
DivisiblePow2constI8-4   1.78ns ± 0%  0.82ns ± 8%  -53.71%  (p=0.008 n=5+5)
DivconstU8-4             0.93ns ± 1%  0.93ns ± 1%     ~     (p=0.643 n=5+5)

A follow-up CL will address the general case of x%c == 0 for signed integers.

Updates #15806

Change-Id: Iabadbbe369b6e0998c8ce85d038ebc236142e42a
Reviewed-on: https://go-review.googlesource.com/c/go/+/173557
Run-TryBot: Brian Kessler <brian.m.kessler@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-04-25 03:00:32 +00:00
Josh Bleecher Snyder
2693b42466 cmd/compile: don't initialize blank struct fields
We already skipped blank field initialization in non-global contexts.
This change makes the global context treatment match.

Fixes #31546

Change-Id: I40acce49b0a9deb351ae0da098f4c114e425ec63
Reviewed-on: https://go-review.googlesource.com/c/go/+/173723
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-25 01:30:56 +00:00
Josh Bleecher Snyder
7596ad0b24 unicode/utf8: remove some bounds checks from DecodeRune
The compiler couldn't quite see that reading p[2] and p[3] was safe.
This change provides a few hints to help it.
First, make sz an int throughout, rather than just when checking the input length.
Second, use <= instead of == in later comparisons.

name                  old time/op  new time/op  delta
DecodeASCIIRune-8     2.62ns ± 3%  2.60ns ± 5%     ~     (p=0.126 n=18+19)
DecodeJapaneseRune-8  4.46ns ±10%  4.01ns ± 5%  -10.00%  (p=0.000 n=19+20)

Change-Id: I2f78a17e38156fbf8b0f5dd6c07c20d6a47e9209
Reviewed-on: https://go-review.googlesource.com/c/go/+/173662
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-25 00:01:23 +00:00
Josh Bleecher Snyder
2be64d3645 unicode/utf8: use binary literals
We were using hex literals and had the binary literal in a comment.
When I was working with this code, I always referred to the comment.
That's an indicator that we should just use the binary literal directly.

Updates #19308

Change-Id: I2279cb8efb4ae5f2e1558c15979058ab09eb4f6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/173663
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-24 23:51:16 +00:00
Than McIntosh
57076b8e6e test: new test for issue 31637
This pair of packages caused a crash in gollvm, due to a glitch in the
way the front end handles empty/non-name parameters for functions that
are inline candidates.

Updates #31637.

Change-Id: I571c0658a00974dd36025e571638c0c836a3cdfd
Reviewed-on: https://go-review.googlesource.com/c/go/+/173617
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-24 19:55:13 +00:00
Caleb Spare
562b7c27ec testing: fix minor bug with mutex profile error message
Change-Id: I92b7a44476cfd9e2f099477b9d7903bbaa2fd8da
Reviewed-on: https://go-review.googlesource.com/c/go/+/173720
Run-TryBot: Caleb Spare <cespare@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-24 19:48:39 +00:00
Than McIntosh
d152ff286f go/internal/gccgoimporter: revise previous anonymous field fix.
Revise the fix for #31540 to take into account the possibility that we
may see an alias to a name that has already been installed into
package scope. This scenario is not possible to reproduce with the
current importer unit tests; changes to the harness to enable this
scenario will be added in a later CL.

Updates #31540.

Change-Id: Ie155d5e0b998604177a78471cba2413f57d40229
Reviewed-on: https://go-review.googlesource.com/c/go/+/173440
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-24 19:36:29 +00:00
Brad Fitzpatrick
13d0af4e70 net/http: export Header.Clone, reduce its allocations, use it everywhere
Fixes #29915

Change-Id: I6e6edf4f9a0e062211f74d120ae1a242bce1b274
Reviewed-on: https://go-review.googlesource.com/c/go/+/173658
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ingo Oeser <nightlyone@googlemail.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2019-04-24 18:43:11 +00:00
Joel Sing
2417b0d006 cmd: re-enable tests with external linking on openbsd/arm
Go on openbsd/arm has supported external linking for a while now, so
re-enable the external linking related tests that were previously
disabled.

Fixes #10619

Change-Id: I304eeabf3b462d53b7feda17ae390bbe2fa22069
Reviewed-on: https://go-review.googlesource.com/c/go/+/173597
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-24 16:17:27 +00:00
Fangming.Fang
f84d28b775 cmd/dist: skip race detector test failure for unsupported VMA
Fixes #29948

Change-Id: I01d041655d34a5de32701dec8b360e347593a45d
Reviewed-on: https://go-review.googlesource.com/c/go/+/160919
Reviewed-by: Russ Cox <rsc@golang.org>
2019-04-24 16:11:35 +00:00