1
0
mirror of https://github.com/golang/go synced 2024-11-17 22:05:02 -07:00
Commit Graph

39608 Commits

Author SHA1 Message Date
cia-rana
b47f31f68c image/png: delete unused statement
Change-Id: I91378d5d5ecc1fc6741127a3924c631904da736b
Reviewed-on: https://go-review.googlesource.com/c/164199
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2019-02-28 18:24:51 +00:00
Damien Neil
444039e054 fmt: fix %d and other non-string verbs on errors
When formatting an error with a non-string formatting verb such as %d,
use the default formatting behavior rather than treating this as a bad
verb.

For example, this should print 42, not %!d(main.E=42):

  var E int
  func (E) Error() string { return "error" }
  fmt.Printf("%d", E(42))

Fixes #30472

Change-Id: I62fd309c8ee9839a69052b0ec7f1808449dcee8e
Reviewed-on: https://go-review.googlesource.com/c/164557
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-28 17:31:37 +00:00
Richard Musiol
72d24a7484 cmd/compile: simplify zero ext operations on wasm
On wasm every integer is stored with 64 bits. We can do zero
extension by simply zeroing the upper bits.

Change-Id: I02c54a38b3b2b7654fff96055edab1b92d48ff32
Reviewed-on: https://go-review.googlesource.com/c/164461
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-02-28 15:25:42 +00:00
Michael Munday
1f17d61026 internal/cpu: change s390x API to match x/sys/cpu
This CL changes the internal/cpu API to more closely match the
public version in x/sys/cpu (added in CL 163003). This will make it
easier to update the dependencies of vendored code. The most prominent
renaming is from VE1 to VXE for the vector-enhancements facility 1.
VXE is the mnemonic used for this facility in the HWCAP vector.

Change-Id: I922d6c8bb287900a4bd7af70567e22eac567b5c1
Reviewed-on: https://go-review.googlesource.com/c/164437
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-28 13:46:45 +00:00
Benny Siegert
336ae0d242 cmd: update vendored golang.org/x/sys/unix
This pulls in CL 164497.

Fixes #24771

Change-Id: I88f2062e2c42363591dcb9e592a7a8381268ddeb
Reviewed-on: https://go-review.googlesource.com/c/164460
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-28 13:29:53 +00:00
Benny Siegert
c2b707bcf1 syscall: use 64-bit alignment on netbsd-arm
netbsd-arm needs the same override to the alignment function as
openbsd-arm. This fixes the TestPassFD failure.

Update golang/go#24771

Change-Id: Ib124fc776f6e2e3b3932784365c2bd3944523a52
Reviewed-on: https://go-review.googlesource.com/c/164458
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-28 11:24:52 +00:00
Daniel Martí
6a72dd77f4 cmd/go: delay parsing the testmain template
The template is over a hundred lines and full of pipelines, and
text/template isn't optimised to parse quickly, so it's no wonder that
delaying the parsing to the first template use makes 'go env' much
faster.

Like in the previous patches to get rid of global regexp.MustCompile
vars, use the newly introduced lazytemplate package. Close to two full
milliseconds are shaved off of 'go env' runs.

name         old time/op    new time/op    delta
ExecGoEnv-8    4.27ms ± 0%    2.63ms ± 1%  -38.43%  (p=0.002 n=6+6)

Updates #29382.

Change-Id: I4e2569e51ddf2afe1b46eb1a9e9e5845f7a3b0bd
Reviewed-on: https://go-review.googlesource.com/c/155962
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-28 09:34:47 +00:00
Rob Pike
61170f85e6 time: move the explanation of u/micro to the ParseDuration example
Fix a few missing capitalizations in drive-by.

Change-Id: I7353c12f3ccddefc0f26a98590caf9e446129558
Reviewed-on: https://go-review.googlesource.com/c/163918
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-28 00:24:56 +00:00
Daniel Martí
bd23e84b73 internal/lazytemplate: add a lazy template wrapper
Similar to internal/lazyregexp, this will allow removing unnecessary
work from init functions with trivial refactors, thanks to sync.Once.

Copy the structure. The only major difference is that a template also
carries a name.

For #29382.

Change-Id: I65d096dc2e2072b310bf59a814cd62669856b5b5
Reviewed-on: https://go-review.googlesource.com/c/164337
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-27 23:49:01 +00:00
Clément Chigot
8e8abf368d archive/tar, syscall: add statUnix for aix/ppc64
This commit add statUnix function for aix/ppc64. It also adds Unix
and Nano methods for AIX time structure.

Change-Id: I9fd62d34a47e87cd46f2f936cb736da0bdff7959
Reviewed-on: https://go-review.googlesource.com/c/163957
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-27 23:40:20 +00:00
Clément Chigot
d3631955d4 cmd/link: set correct sizes for XCOFF outer symbols
This commit fixes the size of outer symbols like type.*.
Outer symbols cannot have a nil size on AIX or they will be
removed by ld as long as all their sub-symbols.

Change-Id: I68ff3ce5a3a034e3c3eb23431aba31245073cf20
Reviewed-on: https://go-review.googlesource.com/c/163999
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-27 23:24:03 +00:00
Clément Chigot
2deda8792a cmd/link: improve XCOFF symbol table
This commit improves symbol table for XCOFF format.
It adds symbol alignment, TLS symbols and move the whole symbol table at
the end of the FILE. As relocations in the future external linking will
need symbols' index, we cannot write the symbol table when it's
generated.

Change-Id: I5dcae85b95e538b65f1a128faf56d4e2aa15baf1
Reviewed-on: https://go-review.googlesource.com/c/163998
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-27 22:49:58 +00:00
Ian Lance Taylor
e32203f647 doc/go1.12: new go line in go.mod can break builds with Go 1.11 - 1.11.3
Fixes #30446

Change-Id: If069f72fa9735f839df92f3ede3bf7b6d7a695a5
Reviewed-on: https://go-review.googlesource.com/c/164317
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-02-27 22:38:32 +00:00
Valentin Vidic
56f0c046cf regexp: add ReplaceAllStringFunc example
Change-Id: I016312f3ecf3dfcbf0eaf24e31b6842d80abb029
GitHub-Last-Rev: 360047c900
GitHub-Pull-Request: golang/go#30445
Reviewed-on: https://go-review.googlesource.com/c/164257
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-27 21:48:41 +00:00
Clément Chigot
9f9c5fa8c7 cmd/link: fix -a with external linker
This commit fixes a panic when -a was used with external linkmode.

Fixes #29807

Change-Id: I8cd42775f2953cec620cbc9ab345421c2694c9a2
Reviewed-on: https://go-review.googlesource.com/c/158998
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-27 21:41:32 +00:00
ZZMarquis
b00ef3b865 crypto/x509: remove the redundant type declaration
Change-Id: I50668a4c943ecab91b2b33370f6cfb3784afafd1
GitHub-Last-Rev: c8223adfc8
GitHub-Pull-Request: golang/go#29654
Reviewed-on: https://go-review.googlesource.com/c/157338
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2019-02-27 20:52:17 +00:00
Daniel Martí
df557fe3ea cmd/go: avoid compiling most regexes at init
These regexes are all related to commands like get and build, so they're
unnecessary for simpler commands like env. In particular, we need env to
be fast, since libraries like go/packages call it early and often. Some
external Go tools are interactive, so milliseconds matter.

lazyregexp eagerly compiles the patterns when running from within a test
binary, so there's no longer any need to do that as part of non-test
binaries.

Picking up the low-hanging fruit spotted by 'perf record' shaves off
well over a full millisecond off the benchmark on my laptop:

name         old time/op    new time/op    delta
ExecGoEnv-8    4.92ms ± 1%    3.81ms ± 0%  -22.52%  (p=0.004 n=6+5)

This CL required adding a few more methods to the lazy regexp wrapper.

Updates #29382.

Change-Id: I22417ab6258f7437a2feea0d25ceb2bb4d735a15
Reviewed-on: https://go-review.googlesource.com/c/155540
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-27 19:39:47 +00:00
Arash Bina
694ee61277 crypto/x509: improve error when PKCS1, PKCS8, EC keys are mixed up
Improve error messages if ParsePKCS8PrivateKey/ParseECPrivateKey
/ParsePKCS1PrivateKey or ParsePKIXPublicKey/ParsePKCS1PublicKey
are called erroneously instead of one another.

Fixes #30094

Change-Id: Ia419c5f320167791aa82e174b4e9ce0f3275ec63
Reviewed-on: https://go-review.googlesource.com/c/161557
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-27 19:34:12 +00:00
Marcel van Lohuizen
6be6f114e0 fmt: add frame info to Errorf and support %w
Partly implements proposal Issue #29934.

Change-Id: Ibcf12f383158dcfbc313ab29c417a710571d1acb
Reviewed-on: https://go-review.googlesource.com/c/163559
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2019-02-27 19:29:14 +00:00
Marcel van Lohuizen
62f5e8156e errors: add Unwrap, Is, and As
Unwrap, Is and As are as defined in proposal
Issue #29934.

Also add Opaque for enforcing an error cannot
be unwrapped.

Change-Id: I4f3feaa42e3ee7477b588164ac622ba4d5e77cad
Reviewed-on: https://go-review.googlesource.com/c/163558
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2019-02-27 19:09:40 +00:00
Marcel van Lohuizen
37f8481724 errors: add Frame and Formatter/Printer interfaces
errors.New now implements Formatter and includes Frame
information that is reported when detail is requested.

Partly implements proposal Issue #29934.

Change-Id: Id76888d246d7d862595b5e92d517b9c03f23a7a6
Reviewed-on: https://go-review.googlesource.com/c/163557
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2019-02-27 19:07:22 +00:00
Juraj Sukop
1d992f2e36 math/big: better initial guess for nat.sqrt
The proposed change introduces a better initial guess which is closer to the final value and therefore converges in fewer steps. Consider for example sqrt(8): previously the guess was 8, whereas now it is 4 (and the result is 2). All this change does is it computes the division by two more accurately while it keeps the guess ≥ √x.

Change-Id: I917248d734a7b0488d14a647a063f674e56c4e30
GitHub-Last-Rev: c06d9d4876
GitHub-Pull-Request: golang/go#28981
Reviewed-on: https://go-review.googlesource.com/c/163866
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-02-27 18:48:56 +00:00
Marcel van Lohuizen
9650726e79 internal/reflectlite: lite version of reflect package
to be used by errors package for checking assignability
and setting error values in As.

Updates #29934.

Change-Id: I8c1d02a2c6efa0919d54b286cfe8b4edc26da059
Reviewed-on: https://go-review.googlesource.com/c/161759
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2019-02-27 18:27:01 +00:00
Marcel van Lohuizen
b9596aea50 encoding/json: remove use of DeepEqual for testing errors
Comparing errors using DeepEqual breaks if frame information
is added as proposed in Issue #29934.

Updates #29934.

Change-Id: Ib430c9ddbe588dd1dd51314c408c74c07285e1ff
Reviewed-on: https://go-review.googlesource.com/c/162179
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2019-02-27 18:24:23 +00:00
Marcel van Lohuizen
b34c5f0cb4 net/http: remove use of DeepEqual for testing errors
Comparing errors using DeepEqual breaks if frame information
is added as proposed in Issue #29934.

Updates #29934.

Change-Id: I4ef076e262109a9d6f5b18846129df2535611d71
Reviewed-on: https://go-review.googlesource.com/c/162178
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2019-02-27 18:24:06 +00:00
Marcel van Lohuizen
36b09f334f strconv: remove use of DeepEqual for testing errors
Comparing errors using DeepEqual breaks if frame information
is added as proposed in Issue #29934.

Updates #29934.

Change-Id: I0372883288f974998138f95f6c7c79a60f922a3e
Reviewed-on: https://go-review.googlesource.com/c/162177
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2019-02-27 18:23:19 +00:00
Bryan C. Mills
1413e94178 cmd/dist: execute cgo_stdio and cgo_life as host tests
Now that these tests are written in Go, they must be run in host mode
in order to be able to exec `go run` as a subprocess.

Updates #30228

Change-Id: Ibedf86a8e18ae1b6f583c1bbdcb99d19c8e01744
Reviewed-on: https://go-review.googlesource.com/c/164137
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-27 18:18:04 +00:00
Josh Bleecher Snyder
58bf401293 time: reject tzdata with no zones
Fixes #29437

Change-Id: Ice0a03a543e564d66651bfdfce5cd32ebaa35926
Reviewed-on: https://go-review.googlesource.com/c/155746
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-27 18:08:03 +00:00
Josh Bleecher Snyder
9892ccff23 cmd/compile: add types.SoleComponent, use in convFuncName
The specialized conversion functions care only
about a type's layout in memory, so e.g.
[1]string is equivalent to string.

Add types.SoleComponent to assist with such use cases,
and use it for the specialized conversion functions.

Increases the number of convTstring calls by ~1%.

Change-Id: I09a392909f2037387b30642781e65f707a048af5
Reviewed-on: https://go-review.googlesource.com/c/148577
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-27 18:07:42 +00:00
Josh Bleecher Snyder
694cd005c3 runtime: speed up ifaceeq for direct ifaces
name                    old time/op  new time/op  delta
EfaceCmpDiff-8           421ns ± 3%   299ns ± 3%  -28.93%  (p=0.000 n=92+94)
EfaceCmpDiffIndirect-8   497ns ± 4%   496ns ± 3%     ~     (p=0.840 n=98+92)

Change-Id: Id1a8c779413ba35ab0f58d055870b6a0714b51b7
Reviewed-on: https://go-review.googlesource.com/c/152163
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-02-27 18:07:25 +00:00
Elias Naur
c33a9511e7 cmd/dist: fix variable name
Noticed by Bryan after CL 163618 went in.

Change-Id: Ia33c80dca60321f6a8329097ff55118e5d2634ab
Reviewed-on: https://go-review.googlesource.com/c/164042
Run-TryBot: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-27 18:04:36 +00:00
Bryan C. Mills
5f8ca7ee24 misc: add go.mod file
Updates #30228
Updates #30241

Change-Id: I7ee839f4d2840873f7e37b3aff93fe534c6b52e6
Reviewed-on: https://go-review.googlesource.com/c/163207
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-27 17:47:31 +00:00
Bryan C. Mills
fa8a3f3080 cmd/link: do not close over the loop variable in testDWARF
Fixes #30429
Updates #16520
Updates #20733

Change-Id: Iae41f06c09aaaed500936f5496d90cefbe8293e4
Reviewed-on: https://go-review.googlesource.com/c/164119
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-27 17:42:49 +00:00
Bryan C. Mills
c81b830023 cmd/dist: execute misc/cgo/testso{,var} as regular tests, not host tests
These tests use runtime.GOOS and runtime.GOARCH to determine whether
to run, so must be built and run using the destination's — not the
host's — GOOS and GOARCH.

Updates #30228

Change-Id: I6774dacd01c68b395fca8ca61f70d5879270af8a
Reviewed-on: https://go-review.googlesource.com/c/164117
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-02-27 17:36:09 +00:00
Bryan C. Mills
5c9a96c420 misc/cgo/test: skip TestCrossPackageTests on Android
This test currently fails in the Android builders, with the message
	pkg_test.go:64: go test -short: exec: "go": executable file not found in $PATH
(https://build.golang.org/log/39ec0da5bfb7793359e199cc8e358ca5a8257840)

I was not able to test this change, because I can't get 'gomote
create' to return an instance of anything Android. However, I will
watch the build dashboard after submitting to verify that the fix
works.

Updates #30228

Android appears to lack a 'go' command in the.

Change-Id: Ieacac7f50d19e2cfef2f5d60e79a159e55b5cfa8
Reviewed-on: https://go-review.googlesource.com/c/164097
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Elias Naur <mail@eliasnaur.com>
2019-02-27 16:41:26 +00:00
Bryan C. Mills
2c86713303 cmd/go: expand tests for standard-library vendoring in GOPATH mode
This should help to catch any regressions in the course of implementing #26924.

Updates #26924

Change-Id: Ide28a9aa0235867e0ce72f855fbed51c50e2c2f2
Reviewed-on: https://go-review.googlesource.com/c/163520
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-02-27 16:33:34 +00:00
Alberto Donizetti
d7518ac518 doc: add 1.10.8 and 1.11.5 to the releases list
Fixes #30431

Change-Id: I379e78a1c385942a19e1a10b91d732f9a73899e6
Reviewed-on: https://go-review.googlesource.com/c/164041
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-27 16:27:34 +00:00
Daniel Martí
a1925076fe cmd/go: add benchmark that execs 'go env GOARCH'
'go env' is used for many quick operations, such as in go/packages to
query GOARCH and GOMOD. It often is a bottleneck; for example,
go/packages doesn't know whether or not to use Go modules until it has
queried GOMOD.

As such, this go command should be fast. Right now it's slower than it
should be. This commit adds a simple benchmark with os/exec, since we're
particularly interested in the cost of cmd/go's large init function.

Updates #29382.

Change-Id: Ifee6fb9997b9b89565fbfc2739a00c86117b1d37
Reviewed-on: https://go-review.googlesource.com/c/155961
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-02-27 16:18:23 +00:00
erifan01
dd91269b7c cmd/compile: optimize math/bits Len32 intrinsic on arm64
Arm64 has a 32-bit CLZ instruction CLZW, which can be used for intrinsic Len32.
Function LeadingZeros32 calls Len32, with this change, the assembly code of
LeadingZeros32 becomes more concise.

Go code:

func f32(x uint32) { z = bits.LeadingZeros32(x) }

Before:

"".f32 STEXT size=32 args=0x8 locals=0x0 leaf
        0x0000 00000 (test.go:7)        TEXT    "".f32(SB), LEAF|NOFRAME|ABIInternal, $0-8
        0x0004 00004 (test.go:7)        MOVWU   "".x(FP), R0
        0x0008 00008 ($GOROOT/src/math/bits/bits.go:30) CLZ     R0, R0
        0x000c 00012 ($GOROOT/src/math/bits/bits.go:30) SUB     $32, R0, R0
        0x0010 00016 (test.go:7)        MOVD    R0, "".z(SB)
        0x001c 00028 (test.go:7)        RET     (R30)

After:

"".f32 STEXT size=32 args=0x8 locals=0x0 leaf
        0x0000 00000 (test.go:7)        TEXT    "".f32(SB), LEAF|NOFRAME|ABIInternal, $0-8
        0x0004 00004 (test.go:7)        MOVWU   "".x(FP), R0
        0x0008 00008 ($GOROOT/src/math/bits/bits.go:30) CLZW    R0, R0
        0x000c 00012 (test.go:7)        MOVD    R0, "".z(SB)
        0x0018 00024 (test.go:7)        RET     (R30)

Benchmarks:
name              old time/op  new time/op  delta
LeadingZeros-8    2.53ns ± 0%  2.55ns ± 0%   +0.67%  (p=0.000 n=10+10)
LeadingZeros8-8   3.56ns ± 0%  3.56ns ± 0%     ~     (all equal)
LeadingZeros16-8  3.55ns ± 0%  3.56ns ± 0%     ~     (p=0.465 n=10+10)
LeadingZeros32-8  3.55ns ± 0%  2.96ns ± 0%  -16.71%  (p=0.000 n=10+7)
LeadingZeros64-8  2.53ns ± 0%  2.54ns ± 0%     ~     (p=0.059 n=8+10)

Change-Id: Ie5666bb82909e341060e02ffd4e86c0e5d67e90a
Reviewed-on: https://go-review.googlesource.com/c/157000
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-02-27 16:09:33 +00:00
Daniel Martí
f40cb19aff internal/lazyregexp: add a lazy Regexp package
This was implemented as part of go/doc, but it's going to be useful in
other packages. In particular, many packages under cmd/go like web and
vcs make somewhat heavy use of global regexes, which add a non-trivial
amount of init work to the cmd/go program.

A lazy wrapper around regexp.Regexp will make it trivial to get rid of
the extra cost with a trivial refactor, so make it possible for other
packages in the repository to make use of it. While naming the package,
give the members better names, such as lazyregexp.New and
lazyregexp.Regexp.

We're also considering adding some form of a lazy API to the public
regexp package, so this internal package will allow us to get some
initial experience across std and cmd.

For #29382.

Change-Id: I30b0e72871d5267c309786f95f4cb15c68b2393d
Reviewed-on: https://go-review.googlesource.com/c/164040
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-27 15:58:10 +00:00
Clément Chigot
0d8c3637b1 cmd/go: fix -Wl,--whole-archive for aix/ppc64
--whole-archive doesn't exist on AIX. It was already removed most of
the time but was still added with c-archive or c-shared buildmodes.

Change-Id: Ia7360638509d4a4d91674b0281ed4b112508a2c9
Reviewed-on: https://go-review.googlesource.com/c/164037
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-27 15:56:45 +00:00
Mikio Hara
850e3636d5 Revert "net: add missing error check in test"
This reverts commit ec521467e3.

Reson for revert: The test cases using slowDst4 and slowDst6 are
fragile. We need to find out a better approach to the trick on the IP
routeability.

Change-Id: I544453886e809d1c7b339673d8f1d5bdef357147
Reviewed-on: https://go-review.googlesource.com/c/163919
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-27 15:42:26 +00:00
Agniva De Sarker
43732816be syscall/js: add a note about a bug in TypedArray
Fixes #29355

Change-Id: I4018d420c8d413b2681744af18ffb65da03ac504
Reviewed-on: https://go-review.googlesource.com/c/155778
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
2019-02-27 15:08:01 +00:00
Bryan C. Mills
bd98628676 math/cmplx: avoid panic in Pow(x, NaN())
Fixes #30088

Change-Id: I08cec17feddc86bd08532e6b135807e3c8f4c1b2
Reviewed-on: https://go-review.googlesource.com/c/161197
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-02-27 14:01:03 +00:00
Clément Chigot
4a9aba5afe syscall: add missing Setrlimit and Termios on aix/ppc64
This commits adds a missing syscall and a missing structure in syscall
package.

Change-Id: I9d630454c56337267f7bbb023e601246e14fc929
Reviewed-on: https://go-review.googlesource.com/c/163978
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-27 13:47:27 +00:00
Gergely Brautigam
8ee9bca272 cmd/compile: suppress typecheck errors in a type switch case with broken type
If a type switch case expression has failed typechecking, the case body is
likely to also fail with confusing or spurious errors. Suppress
typechecking the case body when this happens.

Fixes #28926

Change-Id: Idfdb9d5627994f2fd90154af1659e9a92bf692c4
Reviewed-on: https://go-review.googlesource.com/c/158617
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-02-27 08:22:03 +00:00
Tobias Klauser
9cb2471334 debug/pe: prevent slice out of bounds access in (*File).ImportedSymbols
Fixes #30253

Change-Id: I0c3d67649ea379b67f3575c1219fe05a04f056ae
Reviewed-on: https://go-review.googlesource.com/c/162859
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-02-27 08:10:14 +00:00
Tobias Klauser
8da1b01e4c debug/pe: omit panic in (*File).ImportedSymbols on empty optional headers
If a PE file with invalid optional header size (neither
sizeofOptionalHeader32 nor sizeofOptionalHeader64) is passed to NewFile,
the File.OptionalHeader will be nil which leads to a panic in
(*File).ImportedSymbols().

Fixes #30250

Change-Id: Ie97306de4a0e2dcfdc7b1b599891f574aa63adca
Reviewed-on: https://go-review.googlesource.com/c/162858
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-02-27 08:10:00 +00:00
Filippo Valsorda
5a1c7b5841 crypto/tls: enable TLS 1.3 by default
Updates #30055

Change-Id: I3e79dd7592673c5d76568b0bcded6c391c3be6b3
Reviewed-on: https://go-review.googlesource.com/c/163081
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2019-02-27 07:54:19 +00:00
Filippo Valsorda
8834353072 Revert "crypto/tls: disable RSA-PSS in TLS 1.2"
In Go 1.13 we will enable RSA-PSS in TLS 1.2 at the same time as we make
TLS 1.3 enabled by default.

This reverts commit 7ccd3583ed.

Updates #30055

Change-Id: I6f2ddf7652d1172a6b29f4e335ff3a71a89974bc
Reviewed-on: https://go-review.googlesource.com/c/163080
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2019-02-27 07:54:00 +00:00