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

44007 Commits

Author SHA1 Message Date
Austin Clements
3633d2c545 runtime: perform debug call injection on a new goroutine
Currently, when a debugger injects a call, that call happens on the
goroutine where the debugger injected it. However, this requires
significant runtime complexity that we're about to remove.

To prepare for this, this CL switches to a different approach that
leaves the interrupted goroutine parked and runs the debug call on a
new goroutine. When the debug call returns, it resumes the original
goroutine.

This should be essentially transparent to debuggers. It follows the
exact same call injection protocol and ensures the whole protocol
executes indivisibly on a single OS thread. The only difference is
that the current G and stack now change part way through the protocol.

For #36365.

Change-Id: I68463bfd73cbee06cfc49999606410a59dd8f653
Reviewed-on: https://go-review.googlesource.com/c/go/+/229299
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-29 21:29:11 +00:00
Austin Clements
b3863fbbc2 runtime: make newproc1 not start the goroutine
Currently, newproc1 allocates, initializes, and schedules a new
goroutine. We're about to change debug call injection in a way that
will need to create a new goroutine without immediately scheduling it.
To prepare for that, make scheduling the responsibility of newproc1's
caller. Currently, there's exactly one caller (newproc), so this
simply shifts that responsibility.

For #36365.

Change-Id: Idacd06b63e738982e840fe995d891bfd377ce23b
Reviewed-on: https://go-review.googlesource.com/c/go/+/229298
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-29 21:29:08 +00:00
Austin Clements
197a2a3799 runtime/pprof: fix units of MaxRSS on Linux
Rusage.Maxrss is in bytes on Darwin but in KiB on Linux. Fix this
discrepancy so it's always in bytes.

Change-Id: Ic714abc3276566b8fe5e30565072092212610854
Reviewed-on: https://go-review.googlesource.com/c/go/+/230979
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-04-29 20:33:31 +00:00
Austin Clements
45cd312394 runtime: fix debuglog traceback printing off-by-one
The debuglog traceback printer wasn't adjusting for call/return PCs.

Change-Id: I98dda1c0f22cd78651d88124ea51dc166dc91c7a
Reviewed-on: https://go-review.googlesource.com/c/go/+/227646
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2020-04-29 20:33:30 +00:00
Alberto Donizetti
c8b42f9aa5 cmd/compile: convert CCop arm64 rules to typed aux
Passes

  GOARCH=arm64 gotip build -toolexec 'toolstash -cmp' -a std

Change-Id: Id88141dfc0dfb02c3e958e48ab4adfbac7ba1380
Reviewed-on: https://go-review.googlesource.com/c/go/+/230837
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-04-29 20:32:48 +00:00
Martin Möhrmann
f2163c4d45 bytes, strings: align requirements for functions passed to FieldFuncs
golang.org/cl/229763 removed the documentation of requirements of
the function passed to FieldsFunc. The current implementation does
not require functions to return consistent results but this had not
been the case for previous implementations.

Add the requirement for consistent results back to the documentation
to allow for future implementations to be more allocation efficient
for an output with more than 32 fields. This is possible with a two
pass algorithm first determining the number of fields used to allocate
the output slice and then splitting the input into fields.

While at it align the documentation of bytes.FieldsFunc with
strings.FieldFunc.

Fixes #38630

Change-Id: Iabbf9ca3dff0daa41f4ec930a21a3dd98e19f122
Reviewed-on: https://go-review.googlesource.com/c/go/+/230797
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2020-04-29 19:58:47 +00:00
Jay Conrod
35dce1d67c cmd/go: trim source paths when compiling C with -trimpath
When then go command is run with -trimpath, it will now use
-fdebug-prefix-map when invoking the C compiler (if supported) to
replace the source root directory with a dummy root directory.

This should prevent source directories from appearing either literally
or in compressed DWARF in linked binaries.

Updates #36072

Change-Id: Iedd08d5e886f81e981f11248a1be4ed4f58bdd29
Reviewed-on: https://go-review.googlesource.com/c/go/+/212101
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-04-29 19:03:10 +00:00
Russ Cox
5a550b6951 go/ast: drop //directive comments from doc.Text
This allows writing

	// F does a thing.
	//go:noinline
	func F()

without the //go:noinline or other directive (such as //line)
ending up looking like extra words in the doc comment.

Fixes #37974.

Change-Id: Ic738d72802cc2fa448f7633915e7126d2f76d8ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/224737
Reviewed-by: Robert Griesemer <gri@golang.org>
2020-04-29 19:02:32 +00:00
Richard Miller
b13ce66d1b cmd/go/internal/modload: use lockedfile to read path-replacement go.mod files
When parsing go.mod files found via file-path replacements, it's safer to
use lockedfile.Read instead of ioutil.ReadFile, in case of overwriting by
other concurrent go commands.

Change-Id: I7dcac3bb5ada84bee1eb634b39f813c461ef103a
Reviewed-on: https://go-review.googlesource.com/c/go/+/230838
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
2020-04-29 18:56:19 +00:00
Katie Hockman
202c43b2ad crypto/x509/pkix: improve docs and Name.String()
Previously, non-standard attributes in Name.Names were being
omitted when printed using Name.String(). Now, any non-standard
attributes that would not already be printed in Name.String()
are being added temporarily to Name.ExtraNames to be printed.

Fixes #33094
Fixes #23069

Change-Id: Id9829c20968e16db7194549f69c0eb5985044944
Reviewed-on: https://go-review.googlesource.com/c/go/+/229864
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2020-04-29 18:50:32 +00:00
Cherry Zhang
2a33f5368a [dev.link] cmd/link: use new reloc on Wasm
Change-Id: Icf4d075b64340964068ed038911a14194d241960
Reviewed-on: https://go-review.googlesource.com/c/go/+/230977
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-29 18:47:15 +00:00
Ruixin Bao
3dc4d37387 crypto/ed25519: drop the purego build tag
Per suggestion in CL 202578, this CL drops the purego build tag used
within this package.

Change-Id: I33626c73d6602e321528544ee601741f7e634c1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/230677
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Michael Munday <mike.munday@ibm.com>
2020-04-29 18:33:42 +00:00
Lynn Boger
f512041eca cmd/asm: update ppc64enc.s testcase
Adds a few instructions to ppc64enc.s that were missing from the
previous update.

Change-Id: Ieafce39e905cdf4da3bfb00fdd5a39ab28089cb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/230437
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-29 18:15:08 +00:00
Cherry Zhang
0bbc19760b [dev.link] cmd/link: free compressed symbols after dwarfcompress
Once the symbol is compressed, we will not need the uncompressed
symbol content. Free its memory.

Linking cmd/compile,

name               old live-B     new live-B     delta
Dwarfcompress_GC      42.7M ± 0%     37.9M ± 0%   -11.31%  (p=0.008 n=5+5)

Change-Id: Ib6cc73832946d158ff4f5b4f31be9c35ba7cf103
Reviewed-on: https://go-review.googlesource.com/c/go/+/230859
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-04-29 18:10:53 +00:00
Jeremy Faller
65c1805e77 [dev.link] cmd/link: add loader.ExtReloc to Archreloc2
Non functional, but required by the majority of the architectures.

Change-Id: I57601016c28ce665a9d434e283a1db8bded9b133
Reviewed-on: https://go-review.googlesource.com/c/go/+/230858
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-29 17:41:33 +00:00
Keith Randall
3d34c77829 cmd/compile: convert constant divide strength reduction rules to typed aux
Passes toolstash-check.

Change-Id: Ia5d11c099b8c6c0ed670960b2af808200e3b1ca1
Reviewed-on: https://go-review.googlesource.com/c/go/+/230739
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-29 16:45:32 +00:00
Cherry Zhang
f886ff7b41 [dev.link] cmd/link: free loader memory after LoadFull
After LoadFull, we'll be using sym.Symbols mostly. We still need
the loader information for symbol index mappings and name
lookups, but not much else. Free some memory.

Linking cmd/compile,

name           old time/op    new time/op    delta
Loadlibfull_GC    44.5M ± 0%     35.8M ± 0%    -19.66%  (p=0.008 n=5+5)
Archive_GC        46.4M ± 0%     37.6M ± 0%    -18.89%  (p=0.008 n=5+5)

Linking cmd/compile with external linking,

name           old time/op    new time/op    delta
Loadlibfull_GC    82.5M ± 0%     57.4M ± 0%    -30.41%  (p=0.008 n=5+5)
Archive_GC        86.8M ± 0%     61.7M ± 0%    -28.90%  (p=0.008 n=5+5)

Change-Id: I6859d488172ef8968918b86de527fbfed6832ebf
Reviewed-on: https://go-review.googlesource.com/c/go/+/230300
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-04-29 16:21:37 +00:00
Cherry Zhang
df2a46f85a [dev.link] cmd/link: fix R_GOTOFF handling
When applying relocations, we need to resolve ABI aliases.
relocsym does that. Architecture-specific archreloc also needs to
do that. The old code doesn't do that since ABI aliases are
resolved in loadlibfull, or, in the old linker, in a much earlier
stage. We don't do this in the new linker, as we want to avoid
mutating relocations.

While here, move R_CONST and R_GOTOFF handling to generic code.
They appear on several architectures and the handling are same.

Should fix 386-clang and *bsd-386 builds.

Change-Id: I6681c94f0327555d6cf329d0a518c88848773671
Reviewed-on: https://go-review.googlesource.com/c/go/+/230857
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-04-29 15:32:58 +00:00
Cherry Zhang
095d2a4532 [dev.link] cmd/link: support external linking in new reloc implementation
Support external linking for the new reloc pass as well, and
enable it on AMD64 and 386.

Change-Id: Ia71aec3d7c14e9d661e0748d2e988f29f220d1e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/230308
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-29 15:31:14 +00:00
Than McIntosh
9a3bf7d542 [dev.link] cmd/link: remove Sub field from sym.Symbol
Remove 'Sub' field from sym.Symbol, replacing uses (those downstream of
loadlibfull) with loader method calls.

NB: removing the Outer field will have to wait for now; it is accessed
in archreloc methods that don't have access to link ctxt or loader
currently.

Change-Id: I2abe5906fc169c64b2ab7d5ad213619bea5a17c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/230617
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-29 15:05:14 +00:00
Lynn Boger
56933fb838 cmd/compile,cmd/internal/obj/ppc64: use mod instructions on power9
This updates the PPC64.rules file to use the MOD instructions
that are available in power9. Prior to power9 this is done
using a longer sequence with multiply and divide.

Included in this change is removal of the REM* opcode variations
that set the CC or OV bits since their settings are based
on the DIV and are not appropriate for the REM.

Change-Id: Iceed9ce33e128e1911c15592ee674276ce8ba3fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/229761
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-29 14:45:56 +00:00
Nigel Tao
07d9ea64ab image: guard against NewXxx integer overflow
Prior to this commit, NewXxx could panic when passed an image.Rectangle
with one of width or height being negative. But it might not panic if
both were negative, because (bpp * w * h) could still be positive. After
this commit, it will panic if both are negative.

With overflow, NewXxx might not have panicked if (bpp * w * h), the
length passed to "make([]uint8, length)", was still non-negative (after
truncation), but even if w and h were valid (non-negative), the overall
byte slice wasn't long enough. Iterating over the pixels would possibly
panic later with index out of bounds. This change moves the panic
earlier, closer to where the mistake is.

Change-Id: I011feb2d53515fc3f0fe72bb6c23b3953772c577
Reviewed-on: https://go-review.googlesource.com/c/go/+/230220
Reviewed-by: Rob Pike <r@golang.org>
2020-04-29 11:57:50 +00:00
Than McIntosh
8493b64527 [dev.link] all: merge branch 'master' into dev.link
Change-Id: Ied39f4f701a2e64b87262f7cc34108a60b15e08c
2020-04-29 07:49:35 -04:00
Nigel Tao
7250dd2540 image/jpeg: accept "\xff\x00" before a RST marker
Fixes #28717

Change-Id: I0a1e4ef1583fff89b6f46ef647fb6e4499bdf999
Reviewed-on: https://go-review.googlesource.com/c/go/+/230122
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2020-04-29 11:48:24 +00:00
Nigel Tao
03efd42631 image: add a NewUniform doc comment
Fixes #38739

Change-Id: I42b9b601e63ab8df69a0e5ce9bcabf75bb98d83e
Reviewed-on: https://go-review.googlesource.com/c/go/+/230777
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-29 11:47:27 +00:00
Ruixin Bao
e1a96b82df cmd/compile: adopt strong aux typing for some s390x rules
Convert some optimizations rules to strongly-typed versions. Similar to
CL 230338, this CL only converts rules that need no additional changes
(i.e: only need to change '->' to '=>').

This CL covers the rules from line 800 - 1219.

Passes toolstash-check

Change-Id: I94181a809fa38918b78301f1c0c680b7a8ab552f
Reviewed-on: https://go-review.googlesource.com/c/go/+/230738
Reviewed-by: Michael Munday <mike.munday@ibm.com>
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-29 08:57:33 +00:00
Meng Zhuo
67d40873ad cmd/compile: adjust MIPS64x rewrite rules to use typed aux fields
Pass toolstash-check

Change-Id: I673c9a24bf69c09573be5aeddbd6072ef35d2d83
Reviewed-on: https://go-review.googlesource.com/c/go/+/228937
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-04-29 04:16:08 +00:00
Jeremy Faller
09cd065875 [dev.link] cmd/link: add archrelocsym x86 support for loader
Change-Id: I34822e5610caf537d62203fb6e0023c382a1e60a
Reviewed-on: https://go-review.googlesource.com/c/go/+/230678
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-28 23:11:16 +00:00
Cherry Zhang
76c6cce116 [dev.link] cmd/link: convert reloc pass to using the loader when internal linking
Only enabled for AMD64 when internal linking for now.

Change-Id: I2aa9ee47c0f7413ea7bbcdd31b8317c14220bba3
Reviewed-on: https://go-review.googlesource.com/c/go/+/230302
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-28 22:44:41 +00:00
Ian Gudger
b1b67841d1 net: add (*Resolver).LookupIP
Previously, looking up only IPv4 or IPv6 addresses was only possible
with DefaultResolver via ResolveIPAddr. Add this functionality to the
Resolver type with a new method, LookupIP. This largely brings Resolver
functionally to parity with the global functions. The name LookupIP is
used over ResolveIPAddr to be consistent with the other Resolver
methods.

There are two main benefits to (*Resolver).LookupIP over
(*Resolver).LookupHost. First is an ergonomic benefit. Wanting a
specific family of address is common enough to justify a method, evident
by the existence of ResolveIPAddr. Second, this opens the possibility of
not performing unnecessary DNS requests when only a specific family of
addresses are needed. This optimization is left to follow up work.

Updates #30452

Change-Id: I241f61019588022a39738f8920b0ddba900cecdd
Reviewed-on: https://go-review.googlesource.com/c/go/+/228641
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-28 21:46:16 +00:00
Martin Möhrmann
17d5cef257 reflect: reduce allocations for Select with up to 4 cases
Allocate the runcases slice on the stack if the number
of select cases is small (up to 4).

Found while looking at production profiles of common
proto based RPC server framework code in Google which do
not have a large number of cases.

name      old time/op    new time/op    delta
Select/1     147ns ± 2%     120ns ± 6%  -18.32%  (p=0.000 n=7+10)
Select/4     316ns ± 5%     249ns ± 2%  -21.23%  (p=0.000 n=10+10)
Select/8     516ns ± 3%     515ns ± 3%     ~     (p=0.858 n=10+9)

name      old alloc/op   new alloc/op   delta
Select/1     96.0B ± 0%     64.0B ± 0%  -33.33%  (p=0.000 n=10+10)
Select/4      336B ± 0%      208B ± 0%  -38.10%  (p=0.000 n=10+10)
Select/8      672B ± 0%      672B ± 0%     ~     (all equal)

name      old allocs/op  new allocs/op  delta
Select/1      4.00 ± 0%      3.00 ± 0%  -25.00%  (p=0.000 n=10+10)
Select/4      7.00 ± 0%      6.00 ± 0%  -14.29%  (p=0.000 n=10+10)
Select/8      11.0 ± 0%      11.0 ± 0%     ~     (all equal)

Change-Id: I1687e74fc8e86606a27f03fa8a561bcfb68775d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/230657
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-04-28 21:08:32 +00:00
Daniel Theophanes
ca854f3cda database/sql: document Connect and Close may need a timeout
Opening a connection with Connect should still create a derived
context with a timeout because some clients will not use a timeout
and the connection pool may open a connection asynchronously.

Likewise, if a connection close makes a network operation it should
provide some type of sane timeout for the operation.

Fixes #38185

Change-Id: I9b7ce2996c81c486170dcc84b12672a99610fa27
Reviewed-on: https://go-review.googlesource.com/c/go/+/230438
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-04-28 20:42:02 +00:00
Robert Griesemer
e193725184 strings: simpler and slightly faster implementation of FieldsFunc
Removed the need for maintaining an extra variable in one of the inner loops,
leading to a slight speed-up for short strings.

Benchmarks run on a "quiet" MacBook Pro, 3.3GHz Dual-Core Intel Core i7,
with 16GB 2133MHz LPDDR3 RAM running macOS 10.15.4.

name                        old time/op    new time/op    delta
FieldsFunc/ASCII/16-4          147ns ± 0%     144ns ± 1%  -2.04%  (p=0.000 n=4+5)
FieldsFunc/ASCII/256-4        1.63µs ± 0%    1.59µs ± 1%  -2.50%  (p=0.008 n=5+5)
FieldsFunc/ASCII/4096-4       30.0µs ± 0%    29.3µs ± 2%    ~     (p=0.190 n=4+5)
FieldsFunc/ASCII/65536-4       491µs ± 5%     473µs ± 2%    ~     (p=0.095 n=5+5)
FieldsFunc/ASCII/1048576-4    8.02ms ± 7%    7.85ms ± 4%    ~     (p=0.548 n=5+5)
FieldsFunc/Mixed/16-4          182ns ± 1%     181ns ± 4%    ~     (p=0.357 n=5+5)
FieldsFunc/Mixed/256-4        1.74µs ± 1%    1.74µs ± 1%    ~     (p=0.881 n=5+5)
FieldsFunc/Mixed/4096-4       34.9µs ± 2%    34.7µs ± 0%    ~     (p=0.310 n=5+5)
FieldsFunc/Mixed/65536-4       595µs ± 1%     589µs ± 2%    ~     (p=0.095 n=5+5)
FieldsFunc/Mixed/1048576-4    10.1ms ± 3%     9.8ms ± 2%    ~     (p=0.095 n=5+5)

name                        old speed      new speed      delta
FieldsFunc/ASCII/16-4        109MB/s ± 1%   111MB/s ± 1%  +2.33%  (p=0.008 n=5+5)
FieldsFunc/ASCII/256-4       157MB/s ± 0%   161MB/s ± 1%  +2.57%  (p=0.008 n=5+5)
FieldsFunc/ASCII/4096-4      137MB/s ± 0%   140MB/s ± 2%    ~     (p=0.190 n=4+5)
FieldsFunc/ASCII/65536-4     134MB/s ± 4%   139MB/s ± 2%    ~     (p=0.095 n=5+5)
FieldsFunc/ASCII/1048576-4   131MB/s ± 6%   134MB/s ± 4%    ~     (p=0.548 n=5+5)
FieldsFunc/Mixed/16-4       87.8MB/s ± 1%  88.3MB/s ± 4%    ~     (p=0.421 n=5+5)
FieldsFunc/Mixed/256-4       147MB/s ± 1%   147MB/s ± 1%    ~     (p=0.841 n=5+5)
FieldsFunc/Mixed/4096-4      117MB/s ± 2%   118MB/s ± 0%    ~     (p=0.310 n=5+5)
FieldsFunc/Mixed/65536-4     110MB/s ± 1%   111MB/s ± 2%    ~     (p=0.095 n=5+5)
FieldsFunc/Mixed/1048576-4   104MB/s ± 3%   107MB/s ± 2%    ~     (p=0.095 n=5+5)

name                        old alloc/op   new alloc/op   delta
FieldsFunc/ASCII/16-4          32.0B ± 0%     32.0B ± 0%    ~     (all equal)
FieldsFunc/ASCII/256-4          352B ± 0%      352B ± 0%    ~     (all equal)
FieldsFunc/ASCII/4096-4       21.9kB ± 0%    21.9kB ± 0%    ~     (all equal)
FieldsFunc/ASCII/65536-4       448kB ± 0%     448kB ± 0%    ~     (all equal)
FieldsFunc/ASCII/1048576-4    8.85MB ± 0%    8.85MB ± 0%    ~     (p=0.738 n=5+5)
FieldsFunc/Mixed/16-4          48.0B ± 0%     48.0B ± 0%    ~     (all equal)
FieldsFunc/Mixed/256-4          416B ± 0%      416B ± 0%    ~     (all equal)
FieldsFunc/Mixed/4096-4       21.5kB ± 0%    21.5kB ± 0%    ~     (all equal)
FieldsFunc/Mixed/65536-4       448kB ± 0%     448kB ± 0%    ~     (all equal)
FieldsFunc/Mixed/1048576-4    8.85MB ± 0%    8.85MB ± 0%    ~     (p=0.690 n=5+5)

name                        old allocs/op  new allocs/op  delta
FieldsFunc/ASCII/16-4           1.00 ± 0%      1.00 ± 0%    ~     (all equal)
FieldsFunc/ASCII/256-4          1.00 ± 0%      1.00 ± 0%    ~     (all equal)
FieldsFunc/ASCII/4096-4         5.00 ± 0%      5.00 ± 0%    ~     (all equal)
FieldsFunc/ASCII/65536-4        12.0 ± 0%      12.0 ± 0%    ~     (all equal)
FieldsFunc/ASCII/1048576-4      24.0 ± 0%      24.0 ± 0%    ~     (all equal)
FieldsFunc/Mixed/16-4           1.00 ± 0%      1.00 ± 0%    ~     (all equal)
FieldsFunc/Mixed/256-4          1.00 ± 0%      1.00 ± 0%    ~     (all equal)
FieldsFunc/Mixed/4096-4         5.00 ± 0%      5.00 ± 0%    ~     (all equal)
FieldsFunc/Mixed/65536-4        12.0 ± 0%      12.0 ± 0%    ~     (all equal)
FieldsFunc/Mixed/1048576-4      24.0 ± 0%      24.0 ± 0%    ~     (all equal)

Change-Id: I06828d798ca1a624a26edd7f7b68c3bf2fc28f84
Reviewed-on: https://go-review.googlesource.com/c/go/+/229765
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
2020-04-28 20:18:12 +00:00
Josh Bleecher Snyder
71e0cd815d cmd/compile: simplify readonly sym checks in writebarrier pass
CL 220499 started marking readonly syms as SRODATA earlier,
so we can use that in the writebarrier pass now.

Passes toolstash-check.

Change-Id: Ic4d49714b8bffbe03c8e9a75ca96df4475bae732
Reviewed-on: https://go-review.googlesource.com/c/go/+/230559
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-04-28 19:49:53 +00:00
Cherry Zhang
1adae7fe76 [dev.link] cmd/link: convert asmb pass to new style
Change-Id: I8675f56a7f7f18653754eb87b95f5a7aec31ad74
Reviewed-on: https://go-review.googlesource.com/c/go/+/229860
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-04-28 19:32:45 +00:00
Than McIntosh
0722a49b37 [dev.link] cmd/link: remove elf sym fields from sym.Symbol
Remove the "ElfSym" and "LocalElfSym" fields from sym.Symbol,
replacing uses with loader method calls as needed.

Change-Id: I3828f13203ece2bdc03eeb09ab37a5c94e21a726
Reviewed-on: https://go-review.googlesource.com/c/go/+/230462
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-28 19:04:47 +00:00
Than McIntosh
3f408fc7fd [dev.link] cmd/link: remove Unit field from sym.Symbol
Remove sym.Symbol 'Unit' field, replacing accesses to the field with
calls into the loader instead.

Change-Id: Ia1abd4c3d93036705dd624a49cb3d9cbe6a5188b
Reviewed-on: https://go-review.googlesource.com/c/go/+/230307
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-04-28 18:59:09 +00:00
Than McIntosh
12b11f3af9 [dev.link] cmd/link/internal/loader: add elf symbol methods
Add new get/set methods to the loader for recording the ELF symbol
index for a given loader symbol. These are map-based, since it is
expected that many/most symbols will not need an ELF symbol table
entry.

Change-Id: I1102c3637775515ccc6650118e8b059468a2c3ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/230461
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-28 18:57:48 +00:00
Than McIntosh
183d25d996 [dev.link] cmd/link/internal/sym: remove SortSub
Remove SortSub; this function no longer referenced.

Change-Id: Ie0c78f5cd048a8f465f84ceeab30db57be5c05a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/230457
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-04-28 18:57:33 +00:00
Than McIntosh
43a85a39bf [dev.link] cmd/link: remove Gotype and File fields from sym.Symbol
Remove the 'Gotype' field from sym.Symbol, as it is now no longer
used. Store the loader.Sym for a symbol as a field in sym.Symbol
("SymIdx"). Then remove sym.Symbol 'File' field, and replace the field
accesses in question with calls into the loader instead.

Change-Id: I01c5504425006b8d3fe77fac2b69a86e198c7a5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/230304
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-04-28 18:54:37 +00:00
Than McIntosh
0612e78f0f [dev.link] cmd/link: tweak genasmsym to eliminate Gotype ref
None of the users of genasmsym are doing anything with the Gotype
field of sym.Symbol, so remove that param from the callback function.

Change-Id: Ie902c4cdbcc6b68d353daf5ce21a99012161a946
Reviewed-on: https://go-review.googlesource.com/c/go/+/230545
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-28 18:54:27 +00:00
Michael Anthony Knyszek
39380e8e01 runtime: fix block leak due to race in span set
The span set data structure may leak blocks due to a race in the logic
to check whether it's safe to free a block. The simplest example of this
race is between two poppers:

1. Popper A claims slot spanSetEntries-2.
2. Popper B claims slot spanSetEntries-1.
3. Popper A gets descheduled before it subtracts from block.used.
4. Popper B subtracts from block.used, sees that claimed
   spanSetEntries-1, but also that block.used != 0, so it returns.
5. Popper A comes back and subtracts from block.used, but it didn't
   claim spanSetEntries-1 so it also returns.

The spine is left with a stale block pointer and the block later gets
overwritten by pushes, never to be re-used again.

The problem here is that we designate the claimer of slot
spanSetEntries-1 to be the one who frees the block, but that may not be
the thread that actually does the last subtraction from block.used.

Fixing this problem is tricky, and the fundamental problem there is that
block.used is not stable: it may be observed to be zero, but that
doesn't necessarily mean you're the last popper!

Do something simpler: keep a counter of how many pops have happened to a
given block instead of block.used. This counter monotonically increases
when a pop is _completely done_.  Because this counter is monotonically
increasing, and only increases when a popper is done, then we know for
sure whichever popper is the last to increase it (i.e. its value is
spanSetBlockEntries) is also the last popper in the block. Because the
race described above still exists, the last popper may not be the one
which claimed the last slot in the block, but we know for certain nobody
else is popping from that block anymore so we can safely free it.
Finally, because pops serialize with pushes to the same slot, we need
not worry about concurrent pushers at all.

Updates #37487.

Change-Id: I6697219372774c8ca7d8ee6895eaa230a64ce9e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/230497
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-28 18:41:07 +00:00
Cherry Zhang
dd34841de7 [dev.link] cmd/link: write data sections to heap in Asmb on Wasm
Make Wasm more like other architectures, writing data sections to
heap in Asmb instead of Asmb2. Then we can remove the
copy-on-write logic in applying relocations.

Change-Id: I26d5315ea9fba032fe4bdb9b5c7fe483611c4373
Reviewed-on: https://go-review.googlesource.com/c/go/+/230465
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-04-28 18:36:45 +00:00
Cherry Zhang
3e8975172f [dev.link] cmd/link: convert dwarfcompress to using the loader
Change-Id: I34f806b54e8e0985a30ef38ea4324352aabfc845
Reviewed-on: https://go-review.googlesource.com/c/go/+/229995
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-04-28 18:36:18 +00:00
Michael Anthony Knyszek
0ddde4ada2 runtime: flush mcaches to mcentral before reading memstats
Currently mcaches are flushed to mcentral after a bunch of memstats have
already been read. This is not safe (in the sense that it doesn't ensure
consisent memstats) since memstats may in general change when mcentral
data structures are manipulated.

Note that prior to the new mcentral implementation this was not a
problem because mcentral operations happened to never modify certain
memstats. As of the new mcentral implementation, we might for example
persistentalloc when uncaching a span, which would change memstats. This
can cause a skew between the value of sys (which currently is calculated
before mcaches are flushed) and the value of gc_sys and other_sys.

Fix this by moving mcache flushing to the very top of updatememstats.
Also leave a comment explaining that this must be done first, in
general, because mcentrals make no guarantee that they will not
influence memstats (and doing so would be unnecessarily restrictive).

Fixes #38712.

Change-Id: I15bacb313c54a46e380a945a71bb75db67169c1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/230498
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2020-04-28 17:42:24 +00:00
Alberto Donizetti
bd01a1b756 cmd/compile: port first part of arm64 opt rules to typed aux
Fairly minimal changes.

Passes

  GOARCH=arm64 gotip build -toolexec 'toolstash -cmp' -a std

Change-Id: I14b2e3ad4933ef14b1b6993f427bf84fe85b1818
Reviewed-on: https://go-review.googlesource.com/c/go/+/229939
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-04-28 17:39:36 +00:00
Jay Conrod
495a287f0b doc/go1.15: add notes for GOMODCACHE, modcacheunzipinplace
For #36568
For #34527

Change-Id: Ieea4b4a7644e9c957f48d08d2e172e39b571502f
Reviewed-on: https://go-review.googlesource.com/c/go/+/230537
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-04-28 17:17:53 +00:00
Jeremy Faller
dc83274c95 [dev.link] cmd/link: move wavefront past address
This change is just the mechanical work of moving the wavefront past
address.

Change-Id: I519ec49fa8ba50760c7d23fc084fcd3bb0544546
Reviewed-on: https://go-review.googlesource.com/c/go/+/229700
Run-TryBot: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-28 16:04:30 +00:00
Bryan C. Mills
863424beb2 internal/goversion: update to 1.15
This is a second attempt at CL 230024, with
cmd/go/testdata/script/mod_retention.txt updated to perform a
version-independent comparison on the 'go' version added to a go.mod
file that lacks one.

Fixes #38708

Change-Id: I15dcd83b51ed5ec57946b419bcbaec41e85a46f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/230382
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-04-28 15:02:35 +00:00
Cherry Zhang
b85a03ccc2 Revert "[dev.link] cmd/link: stop overwriting symbol types in loadlibfull"
This reverts CL 229994.

Reason for revert: break AIX build.

This is nice to have but isn't critical. We can revisit later.

Change-Id: Ifc56a0a4c0fb36859cf7666ab149e25e0e5d4cc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/230459
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-28 14:15:26 +00:00