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

44382 Commits

Author SHA1 Message Date
Dmitri Shuralyov
dea6d928f6 bufio: test for exact error value in TestNegativeEOFReader and TestLargeReader
CL 225357 added tests for Scanner not panicking on bad readers.
CL 225557 created a named error value that is returned instead.
CL 237739 documents that the bufio.ErrBadReadCount is returned
when bufio.Scanner is used with an invalid io.Reader.

This suggests we wouldn't want that behavior to be able to change
without a test noticing it, so modify the tests to check for the
exact error value instead of just any non-nil one.

For #38053.

Change-Id: I4b0b8eb6804ebfe2c768505ddb94f0b1017fcf8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/238217
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-17 14:47:32 +00:00
Than McIntosh
d1a186d29c [dev.link] cmd/link: parallelize second-stage DWARF generation
This patch introduces parallelization of DWARF generation on a per
compilation unit basis. Each compilation unit now operates on a
separate set of symbols, so it's safe to send each compilation unit to
a goroutine to be processed in parallel.

Doing this requires some restructing to ensure that any new symbols
needed are created up front, since we can't create any new syms during
the parallel portion. Similarly, the parallel portion can't set any
symbol attributes, so the check that verifies we haven't doubly listed
any DIE syms had to be reworked, and setting of reachability has to be
delayed until after the parallel phase is complete.

Change-Id: I3042b76e9b597bb1a6a44dce19efba2d02bed76b
Reviewed-on: https://go-review.googlesource.com/c/go/+/237679
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-06-17 12:33:29 +00:00
Than McIntosh
0fb1517b3f [dev.link] cmd/link: remove implicit reachability setting from SymbolBuilder
The loader's SymbolBuilder Add*/Set* methods include a call to mark
the underlying symbol as reachable (as a convenience, so that callers
would not have to set it explicitly). This code was carried over from
the corresponding sym.Symbol methods; back in the sym.Symbol world
unreachable symbols were never removed from the AllSyms slice, hence
setting and checking reachability was a good deal more important.

With the advent of the loader and the new deadcode implementation,
there is less of a need for this sort of fallback, and in addition the
implicit attr setting introduces data races in the the loader if there
are SymbolBuilder Add*/Set* method calls in parallel threads, as well
as adding overhead to the methods.

This patch gets rid of the implicit reachability setting, and instead
marks reachability in CreateSymForUpdate, as well as adding a few
explicit SetAttrReachable calls where needed.

Change-Id: I029a0c5a4a24237826a7831f9cbe5180d44cbc40
Reviewed-on: https://go-review.googlesource.com/c/go/+/237678
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-06-17 12:04:40 +00:00
Than McIntosh
27144d166b [dev.link] cmd/link: refactor dwarf gen methods to be comp-unit centric
Refactor some of the linker's DWARF generation methods so as to have
helper routines that do all the work for a given comp unit for a given
section (range, loc, etc). No change in functionality, this is just a
reorg in preparation for a later patch in this sequence.

Change-Id: I86fc789220326a4e522904a5924c8971d6757189
Reviewed-on: https://go-review.googlesource.com/c/go/+/237677
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-06-17 12:01:20 +00:00
Than McIntosh
d08bab99b7 [dev.link] cmd/link: rework line table generation to reduce heap mem
Rework the way symbols are handled in DWARF line table generation to
eliminate copying the data payload for all SWDWARFLINES syms (emitted
by the compiler) into the payload of the ".debug_line" section symbol
(generated by the linker). Instead, chain together the SWDWARFLINES
symbols into a list, then append that list to the section sym list in
dwarfp (this moves us from a single monolithic .debug_line to a
.debug_line section sym followed by a list symbols (one per function
and an epilog symbol per compilation unit). To enable this work, move
the emission of the DW_LNE_set_address op (at the start of each
function) from the linker to the compiler.

Change-Id: Iec61b44a451f7a386c82a89bf944de482b018789
Reviewed-on: https://go-review.googlesource.com/c/go/+/237427
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-06-17 12:01:09 +00:00
Than McIntosh
bc1dbe58cf [dev.link] cmd/link: stop emitting .debug_pubnames/.debug_pubtypes
Don't emit the .debug_pubnames/.debug_pubtypes sections. These sections
are not used by either GDB or Delve, and C++ compilers [notably GCC
and Clang] no longer emit the sections by default.

Change-Id: Ic3309755e88c8e1aa28a29366bc7f0df1748fe64
Reviewed-on: https://go-review.googlesource.com/c/go/+/237426
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-06-17 12:00:56 +00:00
Than McIntosh
188e995ae9 [dev.link] cmd/link: reduce alignment requirement for symtab/elfstr
The linker's asmb phase for ELF has a chunk of code that decides where
to place the .symtab and .strtab sections, which appear after after
the DWARF data; this code currently tries to align the start of the
.symtab section using the value of -R (stored in *FlagRound). This
patch gets rid of this additional alignment and instead just aligns
.symtab by pointer size. The -R value is needed for loadable
segments/sections (such as text or data), not for non-loadable
sections (e.g. symtab). On most architectures the *FlagRound value is
4k, however on ARM64 it is 64k, meaning that aligning symtab on this
boundary can waste a good chunk of space.

Change-Id: Ib51f3ad5611f5614768355eb8533084ba117a8e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/238019
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-06-17 11:15:12 +00:00
Than McIntosh
ef9e8fbfbc [dev.link] cmd/link: remove dwarf2.go
Relocate the last few functions in dwarf2.go to dwarf.go,
and remove dwarf2.go. No change in functionality.

Change-Id: Id1b5f0d1c496d5912b955b8ba942e33bc43aa93b
Reviewed-on: https://go-review.googlesource.com/c/go/+/237425
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-06-17 11:14:31 +00:00
Robert Griesemer
340efd3608 go/token: explain file base offset better in documentation
Fixes #36648.

Change-Id: I92d4462fea0079f63697fb8f407fd2d50b7d68f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/238117
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-17 05:23:15 +00:00
Austin Clements
e25aa4fcea doc/go1.15: enumerate ELF-based OSes
Users don't necessarily know if their OS is ELF-based.

For #37419.

Change-Id: I4a4256c5f5eb34211729e1311582bb0e210f1f8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/238240
Reviewed-by: Than McIntosh <thanm@google.com>
2020-06-17 00:18:55 +00:00
Than McIntosh
96354f1516 [dev.link] cmd/internal/goobj2: fix comment
Fix a stale comment.

Change-Id: Ic14616310cd8e8703cfc7b1ce50c411be34488fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/238243
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-06-16 22:15:53 +00:00
Fazlul Shahriar
9ca2474fd2 cmd/go: fix mod_gomodcache and generate_env TestScripts on Plan 9
Adjust these two tests for Plan 9,
which uses $path instead of $PATH,
and $home instead of $HOME.

Fixes #39599

Change-Id: Idba95e07d307e76f0f61acd904905b417c52d43a
Reviewed-on: https://go-review.googlesource.com/c/go/+/237941
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-06-16 21:19:08 +00:00
Ainar Garipov
844bf11ecd doc/go1.15: fix two typos
Updates #37419.

Change-Id: I9ecc706d44950b7de3e8fe4dde8cfab1904eee58
Reviewed-on: https://go-review.googlesource.com/c/go/+/238139
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-16 19:29:32 +00:00
Toshihiro Shiino
dd3bfb39eb doc/go1.15: add missing slashes
This saves a redirect and makes the document more consistent.

For #37419

Change-Id: Ic3bd62f8caacf67ffe43a359624e11bed8b8cfaf
Reviewed-on: https://go-review.googlesource.com/c/go/+/237540
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-06-16 16:50:31 +00:00
Jay Conrod
1c95530b0d cmd: update golang.org/x/tools
This pulls in CL 235797.

Fixes #39151

Change-Id: I367cff2e9b432a778213501c42fb510c1514643f
Reviewed-on: https://go-review.googlesource.com/c/go/+/238157
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Akhil Indurti <aindurti@gmail.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2020-06-16 15:47:27 +00:00
Cherry Zhang
d286e61b67 runtime: set g to gsignal before adjustSignalStack
When a signal is received, the runtime probes whether an
alternate signal stack is set, if so, adjust gsignal's stack to
point to the alternate signal stack. This is done in
adjustSignalStack, which calls sigaltstack "syscall", which is a
libc call on darwin through asmcgocall. asmcgocall decides
whether to do stack switch based on whether we're running on g0
stack, gsignal stack, or regular g stack. If g is not set to
gsignal, asmcgocall may make wrong decision. Set g first.
adjustSignalStack is recursively nosplit, so it is okay that
temporarily gsignal.stack doesn't match the stack we're running
on.

May fix #39079.

Change-Id: I59b2c5dc08c3c951f1098fff038bf2e06d7ca055
Reviewed-on: https://go-review.googlesource.com/c/go/+/238020
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-15 23:29:23 +00:00
Ian Lance Taylor
41bdb9357a doc/go1.15: document go/printer.StdFormat
For #37419
For #37453
For #37476

Change-Id: Ia032ec844773af421bc4217d5dd6e60996d8e91f
Reviewed-on: https://go-review.googlesource.com/c/go/+/237740
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-06-15 22:28:10 +00:00
Tobias Klauser
15e3e0d4dc doc/gccgo: change gold build instructions to use Git repository
Use the binutils Git repository instead of CVS.

Change-Id: I10100ca44d64ab3621367d1d4ac9e9a50d212d0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/237839
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-15 19:05:29 +00:00
Tobias Klauser
583a5918aa doc/gccgo: update GCC repository after migration to Git
The GCC code repository is now hosted on Git. Adjust the instructions in
gccgo_install.html accordingly.

Change-Id: I443a8b645b63e63785979bc0554521e3dc3b0bf7
Reviewed-on: https://go-review.googlesource.com/c/go/+/237798
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-15 19:05:11 +00:00
Keith Randall
8c8045fd38 cmd/compile: fix ordering problems in struct equality
Make sure that if a field comparison might panic, we evaluate
(and short circuit if not equal) all previous fields, and don't
evaluate any subsequent fields.

Add a bunch more tests to the equality+panic checker.

Update #8606

Change-Id: I6a159bbc8da5b2b7ee835c0cd1fc565575b58c46
Reviewed-on: https://go-review.googlesource.com/c/go/+/237919
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-06-15 18:03:08 +00:00
nikita
8a33a8c652 A+C: add Nikita Gillmann (individual CLA)
previous contribution: https://go-review.googlesource.com/c/go/+/178397/

Change-Id: Ia4038153d0083c1004d0e48c0c6c1eec0774ddc4
GitHub-Last-Rev: de08e86449
GitHub-Pull-Request: golang/go#39584
Reviewed-on: https://go-review.googlesource.com/c/go/+/237821
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-15 17:29:18 +00:00
Daniel Martí
11389baf2e encoding/json: revert "avoid work when unquoting strings, take 2"
This reverts golang.org/cl/190659 and golang.org/cl/226218, minus the
regression tests in the latter.

The original work happened in golang.org/cl/151157, which was reverted
in golang.org/cl/190909 due to a crash found by fuzzing.

We tried a second time in golang.org/cl/190659, which shipped with Go
1.14. A bug was found, where strings would be mangled in certain edge
cases. The fix for that was golang.org/cl/226218, which was backported
into Go 1.14.4.

Unfortunately, a second regression was just reported in #39555, which is
a similar case of strings getting mangled when decoding under certain
conditions. It would be possible to come up with another small patch to
fix that edge case, but instead, let's just revert the entire
optimization, as it has proved to do more harm than good. Moreover, it's
hard to argue or prove that there will be no more such regressions.

However, all the work wasn't for nothing. First, we learned that the way
the decoder unquotes tokenized strings isn't simple; initially, we had
wrongly assumed that each string was unquoted exactly once and in order.
Second, we have gained a number of regression tests which will be useful
to prevent the same mistakes in the future, including the test cases we
add in this CL.

Fixes #39555.

Change-Id: I66a6919c2dd6d9789232482ba6cf3814eaa70f61
Reviewed-on: https://go-review.googlesource.com/c/go/+/237838
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-06-15 16:10:18 +00:00
Richard Miller
9340bd610b runtime: avoid lock starvation in TestNetpollBreak on Plan 9
TestNetpollBreak was sometimes timing out on Plan 9, where
netpoll_stub.go implements only enough of the network poller
to support runtime timers, using a notetsleep / notewakeup
pair. The runtime.lock which serialises the use of the note
doesn't guarantee fairness, and in practice the netpoll call
used by the test can be starved by the netpoll call from the
scheduler which supports the overall 'go test' timeout.
Calling osyield after relinquishing the lock gives the two
callers a more even chance to take a turn, which prevents
the test from timing out.

Fixes #39437

Change-Id: Ifbe6aaf95336d162d9d0b6deba19b8debf17b071
Reviewed-on: https://go-review.googlesource.com/c/go/+/237698
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-14 17:50:11 +00:00
Nigel Tao
9701910588 image/gif: speed up initializing test image
The benchmark throughput numbers don't change, but the set-up time (the
time taken before the b.ResetTimer() call) drops from 460ms to 4ms.

Change-Id: I5a6756643dff6127f6d902455d83459c084834fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/237757
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-06-14 12:41:37 +00:00
Ainar Garipov
bd486c39ba doc/go1.15: add release notes for database/sql and database/sql/driver
Updates #37419.

Change-Id: Ifb6aa9a671f677e1a3e908f0b75bf0da17a57ad0
Reviewed-on: https://go-review.googlesource.com/c/go/+/237397
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2020-06-13 16:03:19 +00:00
Ian Lance Taylor
b05b254e9d doc/go1.15: sort debug/pe entry alphabetically
For #37419

Change-Id: If98ecffbfd976cb66a87b1cce4e82b3ddee1639e
Reviewed-on: https://go-review.googlesource.com/c/go/+/237738
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-06-12 23:50:08 +00:00
Keith Randall
8dae5390cb runtime: raise alert threshold on window smhasher test
This alert is triggering occasionally. I've investigated the
collisions that happen, and they all seem to be pairwise, so they are
not a big deal.  "pairwise" = when there are 32 collisions, it is two
keys mapping to the same hash, 32 times, not 33 keys all mapping to
the same hash.

Add some t.Logf calls in case this comes back, which will help isolate
the problem.

Fixes #39352

Change-Id: I1749d7c8efd0afcf9024d8964d15bc0f58a86e4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/237718
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-12 20:46:27 +00:00
Meng Zhuo
7d975ae9c0 A+C: change email address for Meng Zhuo
Change-Id: I60965f6193256959055824749ed08ce86f6ba482
Reviewed-on: https://go-review.googlesource.com/c/go/+/237541
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-12 17:25:26 +00:00
Dmitri Shuralyov
cc3b303a6f cmd/compile/internal/ssa: skip TestNexting with old Delve on linux/386
Support for linux/386 was added to Delve in version 1.4.1, but the
version of Delve currently installed on the linux-386-longtest
builder is 1.2.0. That isn't new enough, which causes the test
to fail. Skip it on that builder until it can be made to work.

The only reason it used to pass on the linux-386-longtest builder
before is because that builder was misconfigured to run tests for
linux/amd64. This was resolved in CL 234520.

Also improve internal documentation and the text of skip reasons.

Fixes #39309.

Change-Id: I395cb1f076e59dd3a3feb53e1dcdce5101e9a0f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/237603
Reviewed-by: David Chase <drchase@google.com>
2020-06-12 16:44:36 +00:00
Cherry Zhang
95848fc5c6 [dev.link] cmd/compile, cmd/link: remove dead methods if type is not used in interface
Currently, a method of a reachable type is live if it matches a
method of a reachable interface. In fact, we only need to retain
the method if the type is actually converted to an interface. If
the type is never converted to an interface, there is no way to
call the method through an interface method call (but the type
descriptor could still be used, e.g. in calling
runtime.newobject).

A type can be used in an interface in two ways:
- directly converted to interface. (Any interface counts, as it
  is possible to convert one interface to another.)
- obtained by reflection from a related type (e.g. obtaining an
  interface of T from []T).

For the former, we let the compiler emit a marker on the type
descriptor symbol when it is converted to an interface. In the
linker, we only need to check methods of marked types.

For the latter, when the linker visits a marked type, it needs to
visit all its "child" types as marked (i.e. potentially could be
converted to interface).

This reduces binary size:
cmd/compile	18792016	18706096 (-0.5%)
cmd/go		14120572	13398948 (-5.1%)

Change-Id: I4465c7eeabf575f4dc84017214c610fa05ae31fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/237298
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-06-11 22:32:49 +00:00
Toshihiro Shiino
509ee70642 doc/go1.15: add code tags
Other command line arguments are written in code tags, so add a code tag for consistency.

For #37419

Change-Id: I1948536c3a1860d93726484be2dc7bcb03dfdc2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/237539
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-06-11 22:18:30 +00:00
Toshihiro Shiino
7495a42598 doc/go1.15: replace tab indentation with spaces
Replace tab indentation with spaces for consistency, as all other indentation is done with spaces.

For #37419

Change-Id: I728a75ae0d00e637f57eb455b6039ffc1a5feed2
Reviewed-on: https://go-review.googlesource.com/c/go/+/237538
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-06-11 22:17:59 +00:00
Ian Lance Taylor
a5a9a06d71 cmd/cgo: in -godefs mode, don't change constant to type
Fixes #39534

Change-Id: Icbc1745935dd7098c09e2d35c61cd5bfbaa31c63
Reviewed-on: https://go-review.googlesource.com/c/go/+/237558
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-06-11 21:53:45 +00:00
Cherry Zhang
3187b05b87 [dev.link] all: merge branch 'master' into dev.link
Change-Id: I446db56b20ef2189e23e225a91a17736c1d11e4c
2020-06-11 16:49:19 -04:00
Baokun Lee
f7ba82d68f cmd/go/internal/web: don't follow an infinite number of redirects
We replaced http.DefaultClient with securityPreservingHTTPClient,
but we still need that too many redirects check. This issue introduced
by CL 156838.

We introduce a special path to test rediret requests in the script test
framework. You can specify the number of redirects in the path.

	$GOPROXY/redirect/<count>/...

Redirect request sequence details(count=8):

 request:  $GOPROXY/mod/redirect/8/rsc.io/quote/@v/v1.2.0.mod
redirect:  $GOPROXY/mod/redirect/7/rsc.io/quote/@v/v1.2.0.mod
redirect:  $GOPROXY/mod/redirect/6/rsc.io/quote/@v/v1.2.0.mod
redirect:  $GOPROXY/mod/redirect/5/rsc.io/quote/@v/v1.2.0.mod
redirect:  $GOPROXY/mod/redirect/4/rsc.io/quote/@v/v1.2.0.mod
redirect:  $GOPROXY/mod/redirect/3/rsc.io/quote/@v/v1.2.0.mod
redirect:  $GOPROXY/mod/redirect/2/rsc.io/quote/@v/v1.2.0.mod
redirect:  $GOPROXY/mod/redirect/1/rsc.io/quote/@v/v1.2.0.mod
the last:  $GOPROXY/mod/rsc.io/quote/@v/v1.2.0.mod

Fixes #39482

Change-Id: I149a3702b2b616069baeef787b2e4b73afc93b0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/237177
Run-TryBot: Baokun Lee <nototon@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-06-11 14:40:28 +00:00
Vee Zhang
5adaa1290e A+C: add Vee Zhang (individual CLA)
Change-Id: Id52c5fef2e5b65056d3c87e70e176b67998cea90
GitHub-Last-Rev: b88e3afa38
GitHub-Pull-Request: golang/go#39520
Reviewed-on: https://go-review.googlesource.com/c/go/+/237223
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-11 06:04:57 +00:00
Matthew Dempsky
6aadfcdfad go/types: rename UsesCgo to go115UsesCgo
This API and functionality was added late in the Go 1.15 release
cycle, and use within gopls has revealed some shortcomings. It's
possible (but not decided) that we'll want a different API long-term,
so for now this CL renames UsesCgo to a non-exported name to avoid
long-term commitment under the Go 1 compat guarantee.

Updates #16623.
Updates #39072.

Change-Id: I04bc0c161a84adebe43e926df5df406bc794c3db
Reviewed-on: https://go-review.googlesource.com/c/go/+/237417
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-06-10 21:39:03 +00:00
Gawen Arab
ec177e4c83 cmd/internal/objabi: enable frame-pointer for iOS arm64
This improves stack unwinding of Go code running on iOS arm64.

Change-Id: I0494f750c15dcb895f9d4a072352f050d731df17
GitHub-Last-Rev: 435a2a1690
GitHub-Pull-Request: golang/go#37403
Reviewed-on: https://go-review.googlesource.com/c/go/+/220588
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-06-10 20:58:11 +00:00
Rodolfo Carvalho
e92be18fd8 runtime: fix typo in FuncForPC doc
Change-Id: I04037e13b131e79ebc5af84896bfeda49ddc0eaa
GitHub-Last-Rev: b0d0de9308
GitHub-Pull-Request: golang/go#39500
Reviewed-on: https://go-review.googlesource.com/c/go/+/237220
Reviewed-by: Keith Randall <khr@golang.org>
2020-06-10 14:56:01 +00:00
Michael Munday
ac743dea8e cmd/compile: always tighten and de-duplicate tuple selectors
The scheduler assumes two special invariants that apply to tuple
selectors (Select0 and Select1 ops):

  1. There is only one tuple selector of each type per generator.
  2. Tuple selectors and generators reside in the same block.

Prior to this CL the assumption was that these invariants would
only be broken by the CSE pass. The CSE pass therefore contained
code to move and de-duplicate selectors to fix these invariants.

However it is also possible to write relatively basic optimization
rules that cause these invariants to be broken. For example:

  (A (Select0 (B))) -> (Select1 (B))

This rule could result in the newly added selector (Select1) being
in a different block to the tuple generator (see issue #38356). It
could also result in duplicate selectors if this rule matches
multiple times for the same tuple generator (see issue #39472).

The CSE pass will 'fix' these invariants. However it will only do
so when optimizations are enabled (since disabling optimizations
disables the CSE pass).

This CL moves the CSE tuple selector fixup code into its own pass
and makes it mandatory even when optimizations are disabled. This
allows tuple selectors to be treated like normal ops for most of
the compilation pipeline until after the new pass has run, at which
point we need to be careful to maintain the invariant again.

Fixes #39472.

Change-Id: Ia3f79e09d9c65ac95f897ce37e967ee1258a080b
Reviewed-on: https://go-review.googlesource.com/c/go/+/237118
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-06-10 14:55:29 +00:00
Bryan C. Mills
2a4e71c752 run.bat: do not unset GOROOT_FINAL before running tests
This removes the same logic from run.bat that was removed from
cmd/dist in CL 236819.

The duplicated logic was removed from run.bash and run.rc in CL 6531,
but that part of run.bat was apparently missed (and not noticed
because its effect was redundant).

Also fix a path-separator bug in cmd/addr2line.TestAddr2Line that was
exposed as a result.

Fixes #39478
Updates #39385

Change-Id: I00054966cf92ef92a03681bf23de7f45f46fbb5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/237359
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-06-10 03:27:28 +00:00
Russ Cox
b9332ed31a doc: document encoding/xml change in CL 203417
Change-Id: Ibc0228f166f449ec28d813f33bdb550fe7ba2b3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/236739
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-06-10 01:31:35 +00:00
Roland Shoemaker
7b872b6d95 crypto/tls: restore OCSP and SCTs during session resumption
Restore previously sent SCTs and stapled OCSP response during session
resumption for both TLS 1.2 and 1.3. This behavior is somewhat
complicated for TLS 1.2 as SCTs are sent during the server hello,
so they override what is saved in ClientSessionState. It is likely
that if the server is sending a different set of SCTs there is probably
a reason for doing so, such as a log being retired, or SCT validation
requirements changing, so it makes sense to defer to the server in
that case.

Fixes #39075

Change-Id: I3c0fa2f69c6bf0247a447c48a1b4c733a882a233
Reviewed-on: https://go-review.googlesource.com/c/go/+/234237
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2020-06-09 23:24:08 +00:00
Alexander Rakoczy
c4f77b11df api: promote next to go1.15
Change-Id: I42e0d096b28614b95b0af21144f8f118e3eafcd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/237297
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2020-06-09 22:30:06 +00:00
Brad Fitzpatrick
619072be41 runtime: fix typo in comment (object -> objects)
Change-Id: I2af1f9dcd1a9609681e58ab07e73e6d7a5f8a12b
Reviewed-on: https://go-review.googlesource.com/c/go/+/237160
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-09 21:24:52 +00:00
Vee Zhang
281f0ed7bf internal/poll: correct function name in comment
Change-Id: I3b28a45e942a6d6032855758fcc41e4edd64aa32
GitHub-Last-Rev: 9c994bbee7
GitHub-Pull-Request: golang/go#39467
Reviewed-on: https://go-review.googlesource.com/c/go/+/237059
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-09 20:45:39 +00:00
Filippo Valsorda
cd8f8026bb doc/go1.15: add remaining release notes for net/http and net/http/httputil
Updates #37419

Change-Id: I3e37b650475aad4430aacd4655c02e5081ca6f5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/237019
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-06-09 16:23:52 +00:00
eric fang
e5e386938f cmd/asm: fix the encoding error of VCNT instruction for arm64
When the arrangement specifier is "B16", the 30-bit should be 1 rather than 0.
This CL fixes this error.

Fixes #39445

Change-Id: Ib44881cdb8b3aab855cb30f2c52a085cd73a6a2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/236638
Run-TryBot: eric fang <eric.fang@arm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-06-09 15:58:36 +00:00
Xiangdong Ji
e031318ca6 cmd/compile: ARM comparisons with 0 incorrect on overflow
Some ARM rewriting rules convert 'comparing to zero' conditions of if
statements to a simplified version utilizing CMN and CMP instructions to
branch over condition flags, in order to save one Add or Sub caculation.

Such optimizations lead to wrong branching in case an overflow/underflow
occurs when executing CMN or CMP.

Fix the issue by introducing new block opcodes that don't honor the
overflow/underflow flag:

  Block-Op         Meaning                   ARM condition codes
  1. LTnoov        less than                 MI
  2. GEnoov        greater than or equal     PL
  3. LEnoov        less than or equal        MI || EQ
  4. GTnoov        greater than              NEQ & PL

The patch also adds a few test cases to cover scenarios that are specific
to ARM and fine-tunes the code generation tests for 'x-const'.

For more details please refer to the previous fix on 64-bit ARM:
  https://go-review.googlesource.com/c/go/+/233097

Go1 perf, 'old' is the non-optimized version, that is removing all concerned
rewriting rules.

name                     old time/op    new time/op     delta
BinaryTree17-8              7.73s ± 0%      7.81s ± 0%  +0.97%  (p=0.000 n=7+8)
Fannkuch11-8                7.06s ± 0%      7.00s ± 0%  -0.83%  (p=0.000 n=8+8)
FmtFprintfEmpty-8           181ns ± 1%      183ns ± 1%  +1.31%  (p=0.001 n=8+8)
FmtFprintfString-8          319ns ± 1%      325ns ± 2%  +1.71%  (p=0.009 n=7+8)
FmtFprintfInt-8             358ns ± 1%      359ns ± 1%    ~     (p=0.293 n=7+7)
FmtFprintfIntInt-8          459ns ± 3%      456ns ± 1%    ~     (p=0.869 n=8+8)
FmtFprintfPrefixedInt-8     535ns ± 4%      538ns ± 4%    ~     (p=0.572 n=8+8)
FmtFprintfFloat-8          1.01µs ± 2%     1.01µs ± 2%    ~     (p=0.625 n=8+8)
FmtManyArgs-8              1.93µs ± 2%     1.93µs ± 1%    ~     (p=0.979 n=8+7)
GobDecode-8                16.1ms ± 1%     16.5ms ± 1%  +2.32%  (p=0.000 n=8+8)
GobEncode-8                15.9ms ± 0%     15.8ms ± 1%  -1.00%  (p=0.000 n=8+7)
Gzip-8                      690ms ± 1%      670ms ± 0%  -2.90%  (p=0.000 n=8+8)
Gunzip-8                    109ms ± 1%      109ms ± 1%    ~     (p=0.694 n=7+8)
HTTPClientServer-8          149µs ± 3%      146µs ± 2%  -1.70%  (p=0.028 n=8+8)
JSONEncode-8               50.5ms ± 1%     49.2ms ± 0%  -2.60%  (p=0.001 n=7+7)
JSONDecode-8                135ms ± 2%      137ms ± 1%    ~     (p=0.054 n=8+7)
Mandelbrot200-8             951ms ± 0%      952ms ± 0%    ~     (p=0.852 n=6+8)
GoParse-8                  9.47ms ± 1%     9.66ms ± 1%  +2.01%  (p=0.000 n=8+8)
RegexpMatchEasy0_32-8       288ns ± 2%      277ns ± 2%  -3.61%  (p=0.000 n=8+8)
RegexpMatchEasy0_1K-8      1.66µs ± 1%     1.69µs ± 2%  +2.21%  (p=0.001 n=7+7)
RegexpMatchEasy1_32-8       334ns ± 1%      305ns ± 2%  -8.86%  (p=0.000 n=8+8)
RegexpMatchEasy1_1K-8      2.14µs ± 2%     2.15µs ± 0%    ~     (p=0.099 n=8+8)
RegexpMatchMedium_32-8     13.3ns ± 1%     13.3ns ± 0%    ~     (p=1.000 n=7+7)
RegexpMatchMedium_1K-8     81.1µs ± 3%     80.7µs ± 1%    ~     (p=0.955 n=7+8)
RegexpMatchHard_32-8       4.26µs ± 0%     4.26µs ± 0%    ~     (p=0.933 n=7+8)
RegexpMatchHard_1K-8        124µs ± 0%      124µs ± 0%  +0.31%  (p=0.000 n=8+8)
Revcomp-8                  14.7ms ± 2%     14.5ms ± 1%  -1.66%  (p=0.003 n=8+8)
Template-8                  197ms ± 2%      200ms ± 3%  +1.62%  (p=0.021 n=8+8)
TimeParse-8                1.33µs ± 1%     1.30µs ± 1%  -1.86%  (p=0.002 n=8+8)
TimeFormat-8               3.04µs ± 1%     3.02µs ± 0%  -0.60%  (p=0.000 n=8+8)

name                     old speed      new speed       delta
GobDecode-8              47.6MB/s ± 1%   46.5MB/s ± 1%  -2.28%  (p=0.000 n=8+8)
GobEncode-8              48.1MB/s ± 0%   48.6MB/s ± 1%  +1.02%  (p=0.000 n=8+7)
Gzip-8                   28.1MB/s ± 1%   29.0MB/s ± 0%  +2.97%  (p=0.000 n=8+8)
Gunzip-8                  178MB/s ± 1%    179MB/s ± 2%    ~     (p=0.694 n=7+8)
JSONEncode-8             38.4MB/s ± 1%   39.4MB/s ± 0%  +2.67%  (p=0.001 n=7+7)
JSONDecode-8             14.3MB/s ± 2%   14.2MB/s ± 1%  -0.81%  (p=0.043 n=8+7)
GoParse-8                6.12MB/s ± 1%   5.99MB/s ± 1%  -2.00%  (p=0.000 n=8+8)
RegexpMatchEasy0_32-8     111MB/s ± 2%    115MB/s ± 2%  +3.77%  (p=0.000 n=8+8)
RegexpMatchEasy0_1K-8     618MB/s ± 1%    604MB/s ± 2%  -2.16%  (p=0.001 n=7+7)
RegexpMatchEasy1_32-8    95.7MB/s ± 1%  105.1MB/s ± 2%  +9.76%  (p=0.000 n=8+8)
RegexpMatchEasy1_1K-8     479MB/s ± 2%    477MB/s ± 0%    ~     (p=0.105 n=8+8)
RegexpMatchMedium_32-8   75.2MB/s ± 1%   75.2MB/s ± 0%    ~     (p=0.247 n=7+7)
RegexpMatchMedium_1K-8   12.6MB/s ± 3%   12.7MB/s ± 1%    ~     (p=0.538 n=7+8)
RegexpMatchHard_32-8     7.52MB/s ± 0%   7.52MB/s ± 0%    ~     (p=0.968 n=7+8)
RegexpMatchHard_1K-8     8.26MB/s ± 0%   8.24MB/s ± 0%  -0.30%  (p=0.001 n=8+8)
Revcomp-8                 173MB/s ± 2%    176MB/s ± 1%  +1.68%  (p=0.003 n=8+8)
Template-8               9.85MB/s ± 2%   9.69MB/s ± 3%  -1.59%  (p=0.021 n=8+8)

Fixes   #39303
Updates #38740

Change-Id: I0a5f87bfda679f66414c0041ace2ca2e28363f36
Reviewed-on: https://go-review.googlesource.com/c/go/+/236637
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-06-09 15:50:33 +00:00
Dmitri Shuralyov
bdcf33f1c0 doc/go1.15: remove TODO in minor library changes section
The minor changes to the library section has been populated
with TODOs for individual packages using relnote in CL 235757,
and they've been resolved in the following CLs.

We will look things over as part of finishing touches on
the release notes, but this TODO is resolved for beta 1.

For #37419.

Change-Id: I942f81a957fe8df8f630b4406ca29f73602d080a
Reviewed-on: https://go-review.googlesource.com/c/go/+/237157
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2020-06-09 15:44:15 +00:00