]> Cypherpunks repositories - gostls13.git/log
gostls13.git
5 years agoos/user: make Current return better error w/o cgo & complete environment
Brad Fitzpatrick [Thu, 9 May 2019 21:04:39 +0000 (21:04 +0000)]
os/user: make Current return better error w/o cgo & complete environment

Fixes #31949

Change-Id: Ib96a43e4c56a00c5ba04e4d213255a063058ae08
Reviewed-on: https://go-review.googlesource.com/c/go/+/176337
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime: fix vet complaints for js/wasm
Russ Cox [Thu, 9 May 2019 13:51:17 +0000 (09:51 -0400)]
runtime: fix vet complaints for js/wasm

Change-Id: Ifc8a731a2efd94fdc4fc6f26ca6e16f0c0292211
Reviewed-on: https://go-review.googlesource.com/c/go/+/176178
Reviewed-by: Austin Clements <austin@google.com>
5 years agoruntime: fix vet complaints for all nacl
Russ Cox [Wed, 8 May 2019 22:40:58 +0000 (18:40 -0400)]
runtime: fix vet complaints for all nacl

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

This CL makes "go vet -unsafeptr=false runtime" happy for nacl/*,
while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too.

For #31916.

Change-Id: I6adb4a7b0c2b03d901fba37f9c05e74e5b7b6691
Reviewed-on: https://go-review.googlesource.com/c/go/+/176107
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime, crypto/x509: fix vet complaints for all windows
Russ Cox [Wed, 8 May 2019 22:28:21 +0000 (18:28 -0400)]
runtime, crypto/x509: fix vet complaints for all windows

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

This CL makes "go vet -unsafeptr=false runtime" happy for windows/*,
while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too.

For #31916.

Change-Id: If37ab2b3f6fca4696b8a6afb2ef11ba6c4fb42e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/176106
Reviewed-by: Austin Clements <austin@google.com>
5 years agoruntime: fix vet complaints for all freebsd, netbsd, openbsd
Russ Cox [Wed, 8 May 2019 19:30:33 +0000 (15:30 -0400)]
runtime: fix vet complaints for all freebsd, netbsd, openbsd

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

This CL makes "go vet -unsafeptr=false runtime" happy for these GOOSes,
while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too.

For #31916.

Change-Id: I63c4805bdd44b301072da66c77086940e2a2765e
Reviewed-on: https://go-review.googlesource.com/c/go/+/176105
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agosyscall: fix vet complaints for all dragonfly, freebsd, netbsd, openbsd
Russ Cox [Wed, 8 May 2019 19:10:29 +0000 (15:10 -0400)]
syscall: fix vet complaints for all dragonfly, freebsd, netbsd, openbsd

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

This CL makes "go vet -unsafeptr=false runtime" happy for these GOOSes,
while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too.

For #31916.

Change-Id: Id2e1223497bd0cd6e880cd81f3ece6363e58219f
Reviewed-on: https://go-review.googlesource.com/c/go/+/176104
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agoruntime: fix vet complaints for solaris/amd64, illumos/amd64
Russ Cox [Wed, 8 May 2019 18:56:48 +0000 (14:56 -0400)]
runtime: fix vet complaints for solaris/amd64, illumos/amd64

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

This CL makes "go vet -unsafeptr=false runtime" happy for these GOOS/GOARCHes,
while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too.

For #31916.

Change-Id: Ic64f7f4034695dd4c32c9b7f258960faf3742a83
Reviewed-on: https://go-review.googlesource.com/c/go/+/176103
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: fix vet complaints for linux/arm64, linux/mips*, linux/ppc64*, linux/s390x
Russ Cox [Wed, 8 May 2019 17:59:48 +0000 (13:59 -0400)]
runtime: fix vet complaints for linux/arm64, linux/mips*, linux/ppc64*, linux/s390x

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

This CL makes "go vet -unsafeptr=false runtime" happy for these GOOS/GOARCHes,
except for an unresolved complaint on mips/mipsle that is a bug in vet,
while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too.

For #31916.

Change-Id: I6ef7e982a2fdbbfbc22cee876ca37ac54d8109e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/176102
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agoruntime: fix vet complaints for linux/arm
Russ Cox [Wed, 8 May 2019 17:43:44 +0000 (13:43 -0400)]
runtime: fix vet complaints for linux/arm

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

This CL makes "GOOS=linux GOARCH=arm go vet -unsafeptr=false runtime" happy,
while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too.

For #31916.

Change-Id: Ifae75b832320b5356ac8773cf85055bfb2bd7214
Reviewed-on: https://go-review.googlesource.com/c/go/+/176101
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: fix vet complaints for linux/amd64
Russ Cox [Wed, 8 May 2019 17:16:05 +0000 (13:16 -0400)]
runtime: fix vet complaints for linux/amd64

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

This CL makes "GOOS=linux GOARCH=amd64 go vet -unsafeptr=false runtime" happy,
while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too.

For #31916.

Change-Id: I4ca1acb02f4666b102d25fcc55fac96b8f80379a
Reviewed-on: https://go-review.googlesource.com/c/go/+/176100
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agoruntime: fix vet complaints for linux/386
Russ Cox [Wed, 8 May 2019 15:44:15 +0000 (11:44 -0400)]
runtime: fix vet complaints for linux/386

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

This CL makes "GOOS=linux GOARCH=386 go vet -unsafeptr=false runtime" happy,
while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too.

For #31916.

Change-Id: I3e5586a7ff6e359357350d0602c2259493280ded
Reviewed-on: https://go-review.googlesource.com/c/go/+/176099
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agoruntime: fix js/wasm lock implementation
Michael Anthony Knyszek [Thu, 9 May 2019 19:55:39 +0000 (19:55 +0000)]
runtime: fix js/wasm lock implementation

Trybots started failing on js/wasm after golang.org/cl/175797 landed,
but it seemed completely unrelated. It would fail very consistently on
the heapsampling.go test.

Digging deeper it was very difficult to ascertain what was going wrong,
but clearly m.locks for some m was non-zero when calling into the
scheduler.

The failure comes from the fact that lock calls into gosched, but it's
unclear how exactly we got there in the first place; there should be no
preemption in this single-threaded context.

Furthermore, lock shouldn't be calling gosched_m at all because in a
single-threaded context, the thread shouldn't be preempted until it
actually unlocks.

But, digging further it turns out the implementation in lock_js.go never
incremented or decremented m.locks. This is definitely wrong because
many parts of the runtime depend on that value being set correctly.

So, this change removes the loop which calls into gosched_m (which
should be unnecessary) and increments and decrements m.locks
appropriately. This appears to fix the aforementioned failure.

Change-Id: Id214c0762c3fb2b405ff55543d7e2a78c17443c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/176297
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/link: use standard-syntax struct tags in large-tag test
Russ Cox [Wed, 8 May 2019 22:55:33 +0000 (18:55 -0400)]
cmd/link: use standard-syntax struct tags in large-tag test

These ridiculous tags are testing what happens with very long tags.
There is no need for them to be malformed as well.
Fix them to make vet happier.

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

For #31916.

Change-Id: I100aed5230fcde41676c79c7074c69c16ea4b96d
Reviewed-on: https://go-review.googlesource.com/c/go/+/176111
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoencoding/gob: rename encBuffer.WriteByte to writeByte
Russ Cox [Wed, 8 May 2019 22:50:52 +0000 (18:50 -0400)]
encoding/gob: rename encBuffer.WriteByte to writeByte

Renaming the method makes clear, both to readers and to vet,
that this method is not the implementation of io.ByteWriter.

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

For #31916.

Change-Id: I5b509eb7f0118d5f2d3c6e352ff2849cd5a3071e
Reviewed-on: https://go-review.googlesource.com/c/go/+/176110
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agofmt: rename buffer.WriteByte to writeByte
Russ Cox [Wed, 8 May 2019 22:47:32 +0000 (18:47 -0400)]
fmt: rename buffer.WriteByte to writeByte

Renaming the method makes clear, both to readers and to vet,
that this method is not the implementation of io.ByteWriter.

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

For #31916.

Change-Id: I79da062ca6469b62a6b9e284c6cf2413c7425249
Reviewed-on: https://go-review.googlesource.com/c/go/+/176109
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoall: document vendoring in the standard library
Jay Conrod [Fri, 3 May 2019 22:06:41 +0000 (18:06 -0400)]
all: document vendoring in the standard library

Added documentation that explains special cases for vendored packages
in the standard library and provides instructions for updating vendor
directories.

Fixes #31806

Change-Id: Ib697ed18eae28023ab0bfb9f4d250992c393571d
Reviewed-on: https://go-review.googlesource.com/c/go/+/174999
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/internal/bio: rename Reader.Seek to MustSeek
Russ Cox [Wed, 8 May 2019 22:46:04 +0000 (18:46 -0400)]
cmd/internal/bio: rename Reader.Seek to MustSeek

Renaming the method makes clear, both to readers and to vet,
that this method is not the implementation of io.Seeker:
it cannot fail.

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

For #31916.

Change-Id: I3e6ad7264cb0121b4b76935450cccb71d533e96b
Reviewed-on: https://go-review.googlesource.com/c/go/+/176108
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: split spans when scavenging if it's more than we need
Michael Anthony Knyszek [Tue, 7 May 2019 19:04:41 +0000 (19:04 +0000)]
runtime: split spans when scavenging if it's more than we need

This change makes it so that during scavenging we split spans when the
span we have next for scavenging is larger than the amount of work we
have left to do.

The purpose of this change is to improve the worst-case behavior of the
scavenger: currently, if the scavenger only has a little bit of work to
do but sees a very large free span, it will scavenge the whole thing,
spending a lot of time to get way ahead of the scavenge pacing for no
reason.

With this change the scavenger should follow the pacing more closely,
but may still over-scavenge by up to a physical huge page since the
splitting behavior avoids breaking up huge pages in free spans.

This change is also the culmination of the scavenging improvements, so
we also include benchmark results for this series (starting from
"runtime: merge all treaps into one implementation" until this patch).

This patch stack results in average and peak RSS reductions (up to 11%
and 7% respectively) for some benchmarks, with mostly minimal
performance degredation (3-4% for some benchmarks, ~0% geomean). Each of
these benchmarks was executed with GODEBUG=madvdontneed=1 on Linux; the
performance degredation is even smaller when MADV_FREE may be used, but
the impact on RSS is much harder to measure. Applications that generally
maintain a steady heap size for the most part show no change in
application performance.

These benchmarks are taken from an experimental benchmarking suite
representing a variety of open-source Go packages, the raw results may
be found here:

https://perf.golang.org/search?q=upload:20190509.1

For #30333.

Change-Id: I618a48534d2d6ce5f656bb66825e3c383ab1ffba
Reviewed-on: https://go-review.googlesource.com/c/go/+/175797
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
5 years agoruntime: add background scavenger
Michael Anthony Knyszek [Wed, 17 Oct 2018 23:29:42 +0000 (23:29 +0000)]
runtime: add background scavenger

This change adds a background scavenging goroutine whose pacing is
determined when the heap goal changes. The scavenger is paced to use
at most 1% of the mutator's time for most systems. Furthermore, the
scavenger's pacing is computed based on the estimated number of
scavengable huge pages to take advantage of optimizations provided by
the OS.

The purpose of this scavenger is to deal with a shrinking heap: if the
heap goal is falling over time, the scavenger should kick in and start
returning free pages from the heap to the OS.

Also, now that we have a pacing system, the credit system used by
scavengeLocked has become redundant. Replace it with a mechanism which
only scavenges on the allocation path if it makes sense to do so with
respect to the new pacing system.

Fixes #30333.

Change-Id: I6203f8dc84affb26c3ab04528889dd9663530edc
Reviewed-on: https://go-review.googlesource.com/c/go/+/142960
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agoruntime: remove periodic scavenging
Michael Anthony Knyszek [Thu, 18 Oct 2018 20:09:03 +0000 (20:09 +0000)]
runtime: remove periodic scavenging

This change removes the periodic scavenger which goes over every span
in the heap and scavenges it if it hasn't been used for 5 minutes. It
should no longer be necessary if we have background scavenging
(follow-up).

For #30333.

Change-Id: Ic3a1a4e85409dc25719ba4593a3b60273a4c71e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/143157
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agocmd/vendor: import vet fixes from x/tools
Russ Cox [Thu, 9 May 2019 15:45:38 +0000 (11:45 -0400)]
cmd/vendor: import vet fixes from x/tools

Fixes build - I did not understand that vetall was
effectively pinned to a vet version by cmd/go.mod.

Change-Id: I56bfd8f62eadacc97cad0ed48e41a178bbc18b8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/176179
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: emit DWARF call_line attrs with data4 form on iOS
Than McIntosh [Tue, 30 Apr 2019 18:45:35 +0000 (14:45 -0400)]
cmd/compile: emit DWARF call_line attrs with data4 form on iOS

When targeting iOS, change the format (DWARF "form") of the call line
attribute for inlined subroutine DIEs, to work around an apparent bug
in /usr/bin/symbols on Darwin.

[Just for posterity: there is nothing wrong with using DW_FORM_udata
for the call_line attribute form; this is perfectly legal DWARF (and
is in fact recommended by the standard relative to data4, which is
less descriptive and often takes more space). The form switch is there
just to make the Apple tools happy.]

Updates #31459.

Change-Id: Iaf362788a8c6684eea4cde8956c0661b694cecc1
Reviewed-on: https://go-review.googlesource.com/c/go/+/174538
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
5 years agocmd/vet/all: update whitelist for vet fixes
Russ Cox [Thu, 9 May 2019 12:57:20 +0000 (08:57 -0400)]
cmd/vet/all: update whitelist for vet fixes

The vetall builder runs vet straight out of golang.org/x/tools,
so submiting CL 176097 in that repo will break the builder
by making all these whitelist entries stale.
Submiting this CL will fix it, by removing them.

The addition of the gcWriteBarrier declaration in runtime/stubs.go
is necessary because the diagnostic is no longer emitted on arm,
so it must be removed from all.txt. Adding it to runtime is better
than adding it to every-other-goarch.txt.

For #31916.

Change-Id: I432f6049cd3ee5a467add5066c440be8616d9d54
Reviewed-on: https://go-review.googlesource.com/c/go/+/176177
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agocmd/compile: test delve instead of gdb in ssa/debug_test.go
David Chase [Wed, 8 May 2019 20:44:05 +0000 (16:44 -0400)]
cmd/compile: test delve instead of gdb in ssa/debug_test.go

This seems to deflake the test, and also allows testing
on macOS.

Fixes #31786.

Change-Id: I10bfba46dd4b8e64cb09fdd4dd9d175c1ce1f022
Reviewed-on: https://go-review.googlesource.com/c/go/+/176058
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/link: fix link time regression in object file reading
Than McIntosh [Wed, 8 May 2019 19:44:49 +0000 (15:44 -0400)]
cmd/link: fix link time regression in object file reading

In CL 173938, the linker's object file reader was switched over to
selectively create strings backed with read-only mmap'd memory.
In the process a call to r.rd.Offset() was added to readSymName(),
which greatly increased the number of system calls (Offset does a
seek system call).

This patch changes the object file reader so that all reads are done
directly from the mmap'd data if it is present, and adds logic to keep
track of the offset within the rodata consumed so far. Doing this gets
rid of the calls to r.rd.Offset() and the corresponding seek system
calls.

Also as part of this change, hoist the calls to objabi.PathToPrefix
up into the initial setup code for object reading, and store the
result in the reader (since objabi.PathToPrefix was also coming up
as hot in the profile).

Numbers for this change from compilebench:

benchmark                 old ns/op       new ns/op       delta
BenchmarkTemplate         172053975       170357597       -0.99%
BenchmarkUnicode          64564850        64333653        -0.36%
BenchmarkGoTypes          627931042       628043673       +0.02%
BenchmarkCompiler         2982468893      2924575043      -1.94%
BenchmarkSSA              9701681721      9799342557      +1.01%
BenchmarkFlate            106847240       107509414       +0.62%
BenchmarkGoParser         132082319       130734905       -1.02%
BenchmarkReflect          386810586       383036621       -0.98%
BenchmarkTar              154360072       152670594       -1.09%
BenchmarkXML              217725693       216858727       -0.40%
BenchmarkLinkCompiler     908813802       734363234       -19.20%
BenchmarkStdCmd           32378532486     31222542974     -3.57%

Fixes #31898.

Change-Id: Ibf253a52ce9213325f42b1c2b20d0410f5c88c3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/176039
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agomisc/android: silence adb output unless an error occurs
Elias Naur [Wed, 8 May 2019 21:45:06 +0000 (23:45 +0200)]
misc/android: silence adb output unless an error occurs

Fixes #31917

Change-Id: I794e457b2245d355e2df5077078c67aa09e00ff9
Reviewed-on: https://go-review.googlesource.com/c/go/+/175920
Run-TryBot: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/asm: accept TEXT f+0(SB) in -gensymabis mode
Russ Cox [Tue, 30 Apr 2019 18:00:07 +0000 (14:00 -0400)]
cmd/asm: accept TEXT f+0(SB) in -gensymabis mode

f+0(SB) is a non-standard but acceptable alias for f(SB).

Fixes #30968.

Change-Id: I499ccee4d3ff3ab4e47f75d99407aace858e59aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/174537
Reviewed-by: Austin Clements <austin@google.com>
6 years agocmd/go: diagnose go.mod and vendor out of sync in std and cmd
Russ Cox [Tue, 30 Apr 2019 20:04:50 +0000 (16:04 -0400)]
cmd/go: diagnose go.mod and vendor out of sync in std and cmd

The most common failure mode of the current std/cmd setup is
going to be people running "go get m@latest" and then not running
"go mod vendor" and being confused about getting the old m.
Diagnose and report what to do.

Also, having done the check, when in the standard library,
switch the go command to -mod=vendor mode.
This avoids some network accesses I saw when running
'go clean -modcache' before doing some work in cmd.

Change-Id: I0ba4a66637b67225a9b97a1c89f26f9015b41673
Reviewed-on: https://go-review.googlesource.com/c/go/+/174528
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agocmd/go: set the "generate" build tag in go generate, per design doc
Brad Fitzpatrick [Wed, 8 May 2019 21:28:14 +0000 (21:28 +0000)]
cmd/go: set the "generate" build tag in go generate, per design doc

And use it in two internal windows packages, so they don't show up in
"go list std" or binary releases on non-Windows platforms.

Fixes #31920

Change-Id: Iaa292b6015c9d7310dd677c9e296006440ba5e27
Reviewed-on: https://go-review.googlesource.com/c/go/+/175983
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/compile: add countRule rewrite rule helper
Josh Bleecher Snyder [Tue, 12 Mar 2019 02:22:49 +0000 (19:22 -0700)]
cmd/compile: add countRule rewrite rule helper

noteRule is useful when you're trying to debug
a particular rule, or get a general sense for
how often a rule fires overall.

It is less useful if you're trying to figure
out which functions might be useful to benchmark
to ascertain the impact of a newly added rule.

Enter countRule. You use it like noteRule,
except that you get per-function summaries.

Sample output:

 # runtime
(*mspan).sweep: idx1=1
evacuate_faststr: idx1=1
evacuate_fast32: idx1=1
evacuate: idx1=2
evacuate_fast64: idx1=1
sweepone: idx1=1
purgecachedstats: idx1=1
mProf_Free: idx1=1

This suggests that the map benchmarks
might be good to run for this added rule.

Change-Id: Id471c3231f1736165f2020f6979ff01c29677808
Reviewed-on: https://go-review.googlesource.com/c/go/+/167088
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agointernal/syscall/windows/sysdll: mark package as Windows-only
Brad Fitzpatrick [Wed, 8 May 2019 18:40:20 +0000 (18:40 +0000)]
internal/syscall/windows/sysdll: mark package as Windows-only

Updates #31920

Change-Id: Ie24ed5bab249e2f90d1740f42a8b8d94fd0983f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/176019
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
6 years agocmd/link: write memprofile in legacy format for compilebench
Austin Clements [Wed, 8 May 2019 20:42:53 +0000 (16:42 -0400)]
cmd/link: write memprofile in legacy format for compilebench

compilebench depends on the legacy heap profile format to read the
allocation stats of build tools. We're adding a benchmark for the
linker to compilebench, so we need the linker to emit the heap profile
in the legacy format.

This is the linker equivalent of CL 35484, which did this for the
compiler.

Change-Id: I16ad60c4f0fd80b4b6d608a5677ebe04e1fb5e5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/176057
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agocmd/go: disallow go.sum updates in -mod=readonly
Marwan Sulaiman [Fri, 8 Mar 2019 07:33:59 +0000 (02:33 -0500)]
cmd/go: disallow go.sum updates in -mod=readonly

When running go build with the flag -mod=readonly, it fails the build if
go.sum files requires updating. This ensures that CI/CD systems get a
complete go.sum file so that they'd never hit a notary,
assuming the CI/CD system passes the above flag.
I am not familiar with the entire codebase but I assume goSum.dirty
will always be true if go.sum has any missing lines.

Fixes #30667

Change-Id: I767d3b594055d8c10048f4c68e6687c94bb0545c
Reviewed-on: https://go-review.googlesource.com/c/go/+/166237
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agogo/types: add CheckExpr function to type-check an expression
Alan Donovan [Thu, 25 Oct 2018 20:44:44 +0000 (16:44 -0400)]
go/types: add CheckExpr function to type-check an expression

In IDE-like applications (and also in tests), there is often a need to
type-check an expression as if it appeared at a particular position in
the source code of an already typed-checked package.

Eval was added to address this need, but did so only partially,
stopping short of exposing a type-annotated expression tree. This
makes it impossible to resolve an expression such as new(T).x and
discover what Object x refers to.  CheckExpr exposes that generality.
Eval is now implemented in terms of CheckExpr.

This change includes a test that demonstrates the object resolution
functionality just described.

Historical context:
- https://go-review.googlesource.com/c/tools/+/10800
- https://codereview.appspot.com/10748044/

Change-Id: I715ba934b9fc0c9ceb61270e20c5f91f4eff20c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/144677
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agomath/big: stack allocate scaleDenom return value
JT Olio [Mon, 6 May 2019 23:38:23 +0000 (17:38 -0600)]
math/big: stack allocate scaleDenom return value

benchmark             old ns/op     new ns/op     delta
BenchmarkRatCmp-4     154           77.9          -49.42%

Change-Id: I932710ad8b6905879e232168b1777927f86ba22a
Reviewed-on: https://go-review.googlesource.com/c/go/+/175460
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agoregexp: clarify docs re Submatch result
Dmitry Vyukov [Tue, 7 May 2019 07:41:46 +0000 (09:41 +0200)]
regexp: clarify docs re Submatch result

Currently we say that a negative index means no match,
but we don't say how "no match" is expressed when 'Index'
is not present. Say how it is expressed.

Change-Id: I82b6c9038557ac49852ac03642afc0bc545bb4a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/175677
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoapi: update next.txt
Brad Fitzpatrick [Wed, 8 May 2019 16:30:29 +0000 (16:30 +0000)]
api: update next.txt

Change-Id: I2f2a70dd9279ab95fdabee51579d49363a9f65b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/176018
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agodoc: fixed some links
Lorenz Nickel [Wed, 8 May 2019 16:29:27 +0000 (16:29 +0000)]
doc: fixed some links

Change-Id: I8563a20a4ba43cee7d4b73377c405a6ff12636e5
GitHub-Last-Rev: 0dae408845c7cf42667a65fff6f7d1a382e2d320
GitHub-Pull-Request: golang/go#31914
Reviewed-on: https://go-review.googlesource.com/c/go/+/176017
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/link/internal/ld: bump macOS and macOS SDK version to 10.9
Elias Naur [Wed, 8 May 2019 07:36:07 +0000 (09:36 +0200)]
cmd/link/internal/ld: bump macOS and macOS SDK version to 10.9

Satisfies the Apple Notary.

Fixes #30488

Change-Id: I91cf2d706a3ebe79bafdb759a0d32266ed6b9096
Reviewed-on: https://go-review.googlesource.com/c/go/+/175918
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agodoc: update /doc/asm compiler output example
Russ Cox [Tue, 7 May 2019 16:17:05 +0000 (12:17 -0400)]
doc: update /doc/asm compiler output example

The compiler output shown in the doc is now quite old
(most of the changes happened in Go 1.5).
Update it to be more like what users will actually see.

Also explain how to get literal machine code again.

Prompted by #30968.

Change-Id: I0ce139c3fe299ccc43e85b6aca81c6e0aac1a2df
Reviewed-on: https://go-review.googlesource.com/c/go/+/175757
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
6 years agocmd/link/internal/ld: add missing Close
Elias Naur [Wed, 8 May 2019 07:21:06 +0000 (09:21 +0200)]
cmd/link/internal/ld: add missing Close

Noticed while working on issue 30488.

Change-Id: Ia3655e07c939d03925b3560eeba24c60e24c136c
Reviewed-on: https://go-review.googlesource.com/c/go/+/175917
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoreflect: add a test for Calling a Method of a direct interface type
Cherry Zhang [Wed, 8 May 2019 03:34:13 +0000 (23:34 -0400)]
reflect: add a test for Calling a Method of a direct interface type

Gccgo's implementation of direct interface types has bugs that
causes reflect Call of method from Type.Method fail. CL 175837
and CL 175798 fix the bug. This CL adds a test.

Change-Id: I4e5f2cb96304c1ac7be04ca6d2851bac52b8eb24
Reviewed-on: https://go-review.googlesource.com/c/go/+/175880
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoimage/png: fix palette extension to handle 255 color images
Stephan Zuercher [Mon, 6 May 2019 17:55:45 +0000 (10:55 -0700)]
image/png: fix palette extension to handle 255 color images

The PNG decode path attempts to handle paletted images that refer to
non-existent palette indicies. This PR fixes a corner case were images
that have exactly 255 palette colors and an IDAT chunk that references
palette index 255 produce an invalid image such that invoking At on
the pixel(s) in question causes an index out of range panic.

Fixes #31830

Change-Id: I34c44d9de5b9d76fe8c45c04e866fbc7f51f2a9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/175397
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agomath/big: fix the bug in assembly implementation of shlVU on arm64
erifan01 [Thu, 28 Mar 2019 10:53:42 +0000 (10:53 +0000)]
math/big: fix the bug in assembly implementation of shlVU on arm64

For the case where the addresses of parameter z and x of the function
shlVU overlap and the address of z is greater than x, x (input value)
can be polluted during the calculation when the high words of x are
overlapped with the low words of z (output value).

Fixes #31084

Change-Id: I9bb0266a1d7856b8faa9a9b1975d6f57dece0479
Reviewed-on: https://go-review.googlesource.com/c/go/+/169780
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agocmd/compile: avoid compiler crash for recursive interface type
Robert Griesemer [Mon, 6 May 2019 23:26:15 +0000 (16:26 -0700)]
cmd/compile: avoid compiler crash for recursive interface type

This change is a simple work-around to avoid a compiler crash
and provide a reasonable error message. A future change should
fix the root cause for this problem.

Fixes #23823.

Change-Id: Ifc80d9f4d35e063c378e54d5cd8d1cf4c0d2ec6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/175518
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/compile: note that some rules know the name of the opt pass
Josh Bleecher Snyder [Mon, 6 May 2019 01:34:18 +0000 (18:34 -0700)]
cmd/compile: note that some rules know the name of the opt pass

Change-Id: I4a70f4a52f84cf50f99939351319504b1c5dff76
Reviewed-on: https://go-review.googlesource.com/c/go/+/175777
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/go: don't print phdrs running "go version" on ELF files
Ian Lance Taylor [Mon, 6 May 2019 21:23:05 +0000 (14:23 -0700)]
cmd/go: don't print phdrs running "go version" on ELF files

I assume this was for debugging purposes.

Updates #31624

Change-Id: Ie158fde0574c9bbbd9d1b684f51af5681974aff7
Reviewed-on: https://go-review.googlesource.com/c/go/+/175449
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
6 years agocmd/go: fix sumdb test failure
Baokun Lee [Thu, 2 May 2019 07:48:13 +0000 (15:48 +0800)]
cmd/go: fix sumdb test failure

Fixes #31779

Change-Id: Iae80d9adcb39d12c36c525fc2738625cadcc8e41
Reviewed-on: https://go-review.googlesource.com/c/go/+/174838
Run-TryBot: Baokun Lee <nototon@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agocmd/cgo: fix unexpected semicolon in rewritten line
Russ Cox [Tue, 30 Apr 2019 18:56:12 +0000 (14:56 -0400)]
cmd/cgo: fix unexpected semicolon in rewritten line

Followup to CL 157961 and CL 158457.
Finish the list of operators and punctuation
that disable semicolon insertion at end-of-line
The reported case was "(" but "." was also missing.

Fixes #31017.

Change-Id: I0c06443f38dc8250c62e3aadd104abfa0e3be074
Reviewed-on: https://go-review.googlesource.com/c/go/+/174524
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: simplify some modfetch code
Ian Lance Taylor [Sat, 4 May 2019 17:58:42 +0000 (10:58 -0700)]
cmd/go: simplify some modfetch code

No point to s[:].

Change-Id: I9ba5483010180015555ecbed87c1ac82903fd9dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/175277
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocrypto/ed25519: promote from golang.org/x/crypto/ed25519
Filippo Valsorda [Thu, 2 May 2019 21:31:56 +0000 (17:31 -0400)]
crypto/ed25519: promote from golang.org/x/crypto/ed25519

The crypto/tls and crypto/x509 APIs leak PublicKey and PrivateKey types,
so in order to add support for Ed25519 certificates we need the ed25519
package in the stdlib.

It's also a primitive that's reasonable to use directly in applications,
as it is a modern, safe and fast signing algorithm, for which there
aren't higher level APIs. (The nacl/sign API is limiting in that it
repeats the message.)

A few docs changes will come in a follow-up, and a CL will land on
golang.org/x/crypto/ed25519 to make it a type alias wrapper on Go 1.13+.

Updates #25355

Change-Id: I057f20cc7d1aca2b95c29ce73eb03c3b237e413f
Reviewed-on: https://go-review.googlesource.com/c/go/+/174945
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
6 years agonet/url: add tests for URLHostname
Bobby DeSimone [Mon, 6 May 2019 21:26:08 +0000 (21:26 +0000)]
net/url: add tests for URLHostname

These changes add tests for URLHostname.

Change-Id: Ie474516401a2236a9be65fb5c4e478322b1a199c
GitHub-Last-Rev: 18f2d597be960c4d13cde12fef5d115926bff7bd
GitHub-Pull-Request: golang/go#31832
Reviewed-on: https://go-review.googlesource.com/c/go/+/175142
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/dist: allow builders to control granularity of test/ directory sharding
Brad Fitzpatrick [Sun, 5 May 2019 02:25:42 +0000 (02:25 +0000)]
cmd/dist: allow builders to control granularity of test/ directory sharding

Even with 10 shards on builders, it still takes about ~2.5 minutes per
shard (and getting slower all the time as the test/ directory grows).
I'm currently experimenting with massively sharding out testing on
Cloud Run (each dist test & normal TestFoo func all running in
parallel), and in such a setup, 2.5 minutes is an eternity. I'd like
to increase that dist test's sharding from 10 to more like 1,000.

Updates golang/go#31834

Change-Id: I8b02989727793b5b5b2013d67e1eb01ef4786e28
Reviewed-on: https://go-review.googlesource.com/c/go/+/175297
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoall: simplify code using "gofmt -s -w"
Shulhan [Sat, 9 Mar 2019 04:36:37 +0000 (11:36 +0700)]
all: simplify code using "gofmt -s -w"

Most changes are removing redundant declaration of type when direct
instantiating value of map or slice, e.g. []T{T{}} become []T{{}}.

Small changes are removing the high order of subslice if its value
is the length of slice itself, e.g. T[:len(T)] become T[:].

The following file is excluded due to incompatibility with go1.4,

- src/cmd/compile/internal/gc/ssa.go

Change-Id: Id3abb09401795ce1e6da591a89749cba8502fb26
Reviewed-on: https://go-review.googlesource.com/c/go/+/166437
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoreflect: special-case panic message when returning Value{} from MakeFunc function
Keith Randall [Mon, 6 May 2019 19:58:54 +0000 (12:58 -0700)]
reflect: special-case panic message when returning Value{} from MakeFunc function

Before this CL we used to panic with "nil pointer dereference" because
the value we're calling assignTo on is the zero Value. Provide a better
error message.

Fixes #28748

Change-Id: I7dd4c9e30b599863664d91e78cc45878d8b0052e
Reviewed-on: https://go-review.googlesource.com/c/go/+/175440
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoruntime: ensure free and unscavenged spans may be backed by huge pages
Michael Anthony Knyszek [Thu, 18 Apr 2019 15:42:58 +0000 (15:42 +0000)]
runtime: ensure free and unscavenged spans may be backed by huge pages

This change adds a new sysHugePage function to provide the equivalent of
Linux's madvise(MADV_HUGEPAGE) support to the runtime. It then uses
sysHugePage to mark a newly-coalesced free span as backable by huge
pages to make the freeHugePages approximation a bit more accurate.

The problem being solved here is that if a large free span is composed
of many small spans which were coalesced together, then there's a chance
that they have had madvise(MADV_NOHUGEPAGE) called on them at some point,
which makes freeHugePages less accurate.

For #30333.

Change-Id: Idd4b02567619fc8d45647d9abd18da42f96f0522
Reviewed-on: https://go-review.googlesource.com/c/go/+/173338
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
6 years agoruntime: split spans during allocation without treap removal
Michael Anthony Knyszek [Thu, 2 May 2019 07:05:21 +0000 (07:05 +0000)]
runtime: split spans during allocation without treap removal

Now that the treap is first-fit, we can make a nice optimization.
Mainly, since we know that span splitting doesn't modify the relative
position of a span in a treap, we can actually modify a span in-place
on the treap. The only caveat is that we need to update the relevant
metadata.

To enable this optimization, this change introduces a mutate method on
the iterator which takes a callback that is passed the iterator's span.
The method records some properties of the span before it calls into the
callback and then uses those records to see what changed and update
treap metadata appropriately.

Change-Id: I74f7d2ee172800828434ba0194d3d78d3942acf2
Reviewed-on: https://go-review.googlesource.com/c/go/+/174879
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
6 years agoruntime: track the number of free unscavenged huge pages
Michael Anthony Knyszek [Mon, 29 Apr 2019 21:02:18 +0000 (21:02 +0000)]
runtime: track the number of free unscavenged huge pages

This change tracks the number of potential free and unscavenged huge
pages which will be used to inform the rate at which scavenging should
occur.

For #30333.

Change-Id: I47663e5ffb64cac44ffa10db158486783f707479
Reviewed-on: https://go-review.googlesource.com/c/go/+/170860
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
6 years agoruntime: scavenge huge spans first
Michael Anthony Knyszek [Mon, 29 Apr 2019 20:58:39 +0000 (20:58 +0000)]
runtime: scavenge huge spans first

This change adds two new treap iteration types: one for large
unscavenged spans (contain at least one huge page) and one for small
unscavenged spans. This allows us to scavenge the huge spans first by
first iterating over the large ones, then the small ones.

Also, since we now depend on physHugePageSize being a power of two,
ensure that that's the case when it's retrieved from the OS.

For #30333.

Change-Id: I51662740205ad5e4905404a0856f5f2b2d2a5680
Reviewed-on: https://go-review.googlesource.com/c/go/+/174399
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
6 years agoruntime: make treap iteration more efficient
Michael Anthony Knyszek [Wed, 1 May 2019 18:02:14 +0000 (18:02 +0000)]
runtime: make treap iteration more efficient

This change introduces a treapIterFilter type which represents the
power set of states described by a treapIterType.

This change then adds a treapIterFilter field to each treap node
indicating the types of spans that live in that subtree. The field is
maintained via the same mechanism used to maintain maxPages. This allows
pred, succ, start, and end to be judicious about which subtrees it will
visit, ensuring that iteration avoids traversing irrelevant territory.

Without this change, repeated scavenging attempts can end up being N^2
as the scavenger walks over what it already scavenged before finding new
spans available for scavenging.

Finally, this change also only scavenges a span once it is removed from
the treap. There was always an invariant that spans owned by the treap
may not be mutated in-place, but with this change violating that
invariant can cause issues with scavenging.

For #30333.

Change-Id: I8040b997e21c94a8d3d9c8c6accfe23cebe0c3d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/174878
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
6 years agoruntime: merge all treaps into one implementation
Michael Anthony Knyszek [Mon, 29 Apr 2019 20:42:27 +0000 (20:42 +0000)]
runtime: merge all treaps into one implementation

This change modifies the treap implementation to support holding all
spans in a single treap, instead of keeping them all in separate treaps.

This improves ergonomics for nearly all treap-related callsites.
With that said, iteration is now more expensive, but it never occurs on
the fast path, only on scavenging-related paths.

This change opens up the opportunity for further optimizations, such as
splitting spans without treap removal (taking treap removal off the span
allocator's critical path) as well as improvements to treap iteration
(building linked lists for each iteration type and managing them on
insert/removal, since those operations should be less frequent).

For #30333.

Change-Id: I3dac97afd3682a37fda09ae8656a770e1369d0a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/174398
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
6 years agocmd/go/internal/modfile: make error message for module path more clear
Baokun Lee [Thu, 2 May 2019 17:28:52 +0000 (01:28 +0800)]
cmd/go/internal/modfile: make error message for module path more clear

Fixes #31775

`

Change-Id: I59c4e90f20d1b31161c259680b48b7be7218bf58
Reviewed-on: https://go-review.googlesource.com/c/go/+/175017
Run-TryBot: Baokun Lee <nototon@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agodoc: document Go 1.12.5
Andrew Bonventre [Mon, 6 May 2019 19:56:43 +0000 (15:56 -0400)]
doc: document Go 1.12.5

Change-Id: I9986a323db2a8f5fa74b071cfd04e8c786da0cb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/175438
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agodoc: document Go 1.11.10
Andrew Bonventre [Mon, 6 May 2019 19:59:07 +0000 (15:59 -0400)]
doc: document Go 1.11.10

Change-Id: Icca4495f727e3921b717a4bbb441cd832d321d46
Reviewed-on: https://go-review.googlesource.com/c/go/+/175439
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/internal/obj: write package path at compile time if possible
Cherry Zhang [Wed, 1 May 2019 00:47:48 +0000 (20:47 -0400)]
cmd/internal/obj: write package path at compile time if possible

Currently, when the compiler emits a symbol name in the object
file, it uses "". for the package path of the package being
compiled. This is then expanded in the linker to the actual
package path.

With CL 173938, it does not need an allocation if the symbol name
does not need expansion. In many cases, the compiler actually
knows the package path (through the -p flag), so we could just
write it out in compile time, without fixing it up in the linker.
This reduces allocations in the linker.

In case that the package path is not known (compiler's -p flag is
missing, or the object file is generated by the assembler), the
linker still does the expansion.

This reduces ~100MB allocations (~10% inuse_space) in linking
k8s.io/kubernetes/cmd/kube-apiserver on Linux/AMD64.

Also makes the linker a little faster: linking cmd/go on
Linux/AMD64:
Real  1.13 ± 1%  1.11 ± 1%  -2.13%  (p=0.000 n=10+10)
User  1.17 ± 3%  1.14 ± 5%  -3.14%  (p=0.003 n=10+10)
Sys   0.34 ±15%  0.34 ±15%    ~     (p=0.986 n=10+10)

The caveat is that the object files get slightly bigger. On
Linux/AMD64, runtime.a gets 2.1% bigger, cmd/compile/internal/ssa
(which has a longer import path) gets 2.8% bigger.

This reveals that when building an unnamed plugin (e.g.
go build -buildmode=plugin x.go), the go command passes different
package paths to the compiler and to the linker. Before this CL
there seems nothing obviously broken, but given that the compiler
already emits the package's import path in various places (e.g.
debug info), I guess it is possible that this leads to some
unexpected behavior. Now that the compiler writes the package
path in more places, this disagreement actually leads to
unresolved symbols. Adjust the go command to use the same package
path for both compiling and linking.

Change-Id: I19f08981f51db577871c906e08d9e0fd588a2dd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/174657
Reviewed-by: Austin Clements <austin@google.com>
6 years agonet/http: add support for SameSite=None
Vivek Sekhar [Mon, 6 May 2019 17:49:47 +0000 (17:49 +0000)]
net/http: add support for SameSite=None

Section 4.2 of the Internet-Draft for SameSite includes the possible
SameSite value of "None".

https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00

Change-Id: I44f246024429ec175db13ff6b36bee465f3d233d
GitHub-Last-Rev: 170d24aaca4f00d750fca88740100f7c0b440d19
GitHub-Pull-Request: golang/go#31842
Reviewed-on: https://go-review.googlesource.com/c/go/+/175337
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

6 years agonet: use same TCP Keep Alive interval between dial and accept
Dong-hee Na [Sun, 5 May 2019 08:23:20 +0000 (17:23 +0900)]
net: use same TCP Keep Alive interval between dial and accept

Fixes #31510

Change-Id: I601d114b617a055380bf3c805e2d9a9b0795b656
Reviewed-on: https://go-review.googlesource.com/c/go/+/175259
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/compile: make numberlines line mismatch check ignore columns
David Chase [Thu, 2 May 2019 17:36:10 +0000 (13:36 -0400)]
cmd/compile: make numberlines line mismatch check ignore columns

This does not repair #31786, and in fact also unfixes the revert
of CL 174617.  We were just getting lucky when it looked like
it was working.  And unfortunately for the bug, there does not
appear to be any particular problems with the line numbers;
if anything they're a couple of extras, i.e., stepping might
repeat, rather than skip.  Delve works fine either way.

Updates #31786.

Change-Id: I5c2fdc2a0265bb99773b3a85492a3db557dffee4
Reviewed-on: https://go-review.googlesource.com/c/go/+/174948
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agohtml/template: add support for JavaScript modules
Andrew Bonventre [Sun, 5 May 2019 13:35:14 +0000 (09:35 -0400)]
html/template: add support for JavaScript modules

html/template does not properly treat JavaScript code as
JavaScript when using a <script> tag with "module" set as
the type attribute.

See also:
https://www.w3.org/TR/html5/semantics-scripting.html#element-attrdef-script-type and
https://html.spec.whatwg.org/multipage/scripting.html#the-script-element:module-script-2

Original change from tomut at https://golang.org/cl/135417

Fixes #31327

Change-Id: I6239be69cd7994990d091400664e4474124a98fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/175218
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/dist: delete unnecessary dirs from GOROOT on completion
Josh Bleecher Snyder [Mon, 6 May 2019 16:18:08 +0000 (09:18 -0700)]
cmd/dist: delete unnecessary dirs from GOROOT on completion

On my machine, these directories add up to 276mb
and account for 40% of the size of the GOROOT directory.

Once bootstrapping is complete, they are never used again.

Fixes #31851

Change-Id: Idbf8f21bae3d64655aa43761cc778677add6234a
Reviewed-on: https://go-review.googlesource.com/c/go/+/175377
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoerrors: fix Is panics if target is uncomparable
LE Manh Cuong [Sun, 5 May 2019 16:20:26 +0000 (23:20 +0700)]
errors: fix Is panics if target is uncomparable

Fixes #31841

Change-Id: I3f068686154fd2fa5755b0df47b4eaa5c9a19107
Reviewed-on: https://go-review.googlesource.com/c/go/+/175260
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agonet/http: update bundled x/net/http2
Brad Fitzpatrick [Wed, 1 May 2019 02:47:14 +0000 (02:47 +0000)]
net/http: update bundled x/net/http2

Updates x/net/http2 to git rev 1da14a5a36f220ea3f03470682b737b1dfd5de22 for:

    http2: make empty method mean GET
    https://golang.org/cl/169557 (Fixes golang/go#31061)

    http2: don't hang a stream if trailers values are not provided
    https://golang.org/cl/161958

Change-Id: I628af8c6d07d19e8f19ee37637243f6c242ef3a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/174677
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
6 years agosyscall: remove unused {dragonfly,illumos,solaris}64Bit constants
Tobias Klauser [Sun, 5 May 2019 13:49:47 +0000 (15:49 +0200)]
syscall: remove unused {dragonfly,illumos,solaris}64Bit constants

These are unused since CL 153837. illumos64Bit was added by CL 174457
but was never used.

Change-Id: I34a1bd41cf70f8a07e57f93a71de3c6034fcaf7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/175358
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agosyscall: support generating netbsd/arm64 files in mkall.sh
Tobias Klauser [Sat, 4 May 2019 09:36:13 +0000 (11:36 +0200)]
syscall: support generating netbsd/arm64 files in mkall.sh

CL 155739 added the generated files but didn't update mkall.sh. Do so
now.

Updates #30824

Change-Id: I642bbff6afbc976091a0dc291fa2beff5e245246
Reviewed-on: https://go-review.googlesource.com/c/go/+/175237
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoall: remove commented-out print statements
Iskander Sharipov [Thu, 31 Jan 2019 10:00:51 +0000 (13:00 +0300)]
all: remove commented-out print statements

Those print statements are not a good debug helpers
and only clutter the code.

Change-Id: Ifbf450a04e6fa538af68e6352c016728edb4119a
Reviewed-on: https://go-review.googlesource.com/c/go/+/160537
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
6 years agoall: add Unwrap and Is methods to various error types
Damien Neil [Wed, 27 Mar 2019 15:40:12 +0000 (08:40 -0700)]
all: add Unwrap and Is methods to various error types

Add Unwrap methods to types which wrap an underlying error:

  "encodinc/csv".ParseError
  "encoding/json".MarshalerError
  "net/http".transportReadFromServerError
  "net".OpError
  "net".DNSConfigError
  "net/url".Error
  "os/exec".Error
  "signal/internal/pty".PtyError
  "text/template".ExecError

Add os.ErrTemporary. A case could be made for putting this error
value in package net, since no exported error types in package os
include a Temporary method. However, syscall errors returned from
the os package do include this method.

Add Is methods to error types with a Timeout or Temporary method,
making errors.Is(err, os.Err{Timeout,Temporary}) equivalent to
testing the corresponding method:

  "context".DeadlineExceeded
  "internal/poll".TimeoutError
  "net".adrinfoErrno
  "net".OpError
  "net".DNSError
  "net/http".httpError
  "net/http".tlsHandshakeTimeoutError
  "net/pipe".timeoutError
  "net/url".Error

Updates #30322
Updates #29934

Change-Id: I409fb20c072ea39116ebfb8c7534d493483870dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/170037
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
6 years agocmd/go: fix clang test break as a result of golang.org/cl/127495
Paul Jolly [Fri, 3 May 2019 19:46:52 +0000 (20:46 +0100)]
cmd/go: fix clang test break as a result of golang.org/cl/127495

golang.org/cl/127495 incorrectly tested against environment specifc
details that do not form part of the script test conditions. This broke
the clang build.

Fix by removing the specific check; the existing checks are sufficient.

Change-Id: Ic6ec873df9343c809968a08dd676e210046da5fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/175179
Run-TryBot: Paul Jolly <paul@myitcv.org.uk>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/compile,runtime/internal/atomic: add Load8
Austin Clements [Thu, 28 Mar 2019 18:58:06 +0000 (14:58 -0400)]
cmd/compile,runtime/internal/atomic: add Load8

Change-Id: Id52a5730cf9207ee7ccebac4ef12791dc5720e7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/172283
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
6 years agoruntime: remove sys.HugePageSize
Michael Anthony Knyszek [Wed, 24 Apr 2019 17:01:11 +0000 (17:01 +0000)]
runtime: remove sys.HugePageSize

sys.HugePageSize was superceded in the last commit by physHugePageSize
which is determined dynamically by querying the operating system.

For #30333.

Change-Id: I827bfca8bdb347e989cead31564a8fffe56c66ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/173757
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
6 years agoruntime: add physHugePageSize
Michael Anthony Knyszek [Fri, 29 Mar 2019 20:03:29 +0000 (20:03 +0000)]
runtime: add physHugePageSize

This change adds the global physHugePageSize which is initialized in
osinit(). physHugePageSize contains the system's transparent huge page
(or superpage) size in bytes.

For #30333.

Change-Id: I2f0198c40729dbbe6e6f2676cef1d57dd107562c
Reviewed-on: https://go-review.googlesource.com/c/go/+/170858
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
6 years agocmd/go: update go bug to be more consistent with Github issue template
Paul Jolly [Thu, 2 Aug 2018 11:41:14 +0000 (12:41 +0100)]
cmd/go: update go bug to be more consistent with Github issue template

As a result of using go env, the following new environment variables are
shown as part of the env section:

+CGO_CFLAGS="-g -O2"
+CGO_CPPFLAGS=""
+CGO_CXXFLAGS="-g -O2"
+CGO_FFLAGS="-g -O2"
+CGO_LDFLAGS="-g -O2"
+PKG_CONFIG="pkg-config"
+GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build612849170=/tmp/go-build -gno-record-gcc-switches"

The diff between the web-based template and the result of go bug is now:

+GOROOT/bin/go version: go version devel +478f3a5384 Wed Mar 27 16:21:00 2019 +0000 linux/amd64
+GOROOT/bin/go tool compile -V: compile version devel +478f3a5384 Wed Mar 27 16:21:00 2019 +0000
+uname -sr: Linux 4.15.0-46-generic
+Distributor ID:        Ubuntu
+Description:   Ubuntu 18.04.2 LTS
+Release:       18.04
+Codename:      bionic
+/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Ubuntu GLIBC 2.27-3ubuntu1) stable release version 2.27.

Fixes #26751

Change-Id: I32baca1c3c06d08068dad0041a43a1f5532bd91e
Reviewed-on: https://go-review.googlesource.com/c/go/+/127495
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>

6 years agonet/http: fix TestTransportMaxConnsPerHost flakes
Michael Fraenkel [Fri, 3 May 2019 02:59:27 +0000 (22:59 -0400)]
net/http: fix TestTransportMaxConnsPerHost flakes

The testcase created a race between the close of the current connection
and the client grabbing a connection for the next request. The client
may receive the current connection which may be closed during its use.
We can have the trasnport close all idle connections thereby forcing the
client to receive a new connection.

Closing idle connections did not handle cleaning up host connection
counts for http/2. We will now decrement the host connection count for
http/2 connections.

Fixes #31784

Change-Id: Iefc0d0d7ed9fa3acd8b4f42004f1579fc1de63fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/174950
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agonet/http: strip escaped password from error
Thanabodee Charoenpiriyakij [Fri, 3 May 2019 04:41:54 +0000 (11:41 +0700)]
net/http: strip escaped password from error

Using password that returns from User.Password() won't work in this case
because password in Userinfo already unescaped. The solution is uses
User.String() to escape password back again and then stringify it to error.

Fixes #31808

Change-Id: I723aafd5a57a5b69f2dd7d3a21b82ebbd4174451
Reviewed-on: https://go-review.googlesource.com/c/go/+/175018
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agonet/http: add func NewRequestWithContext, Request.Clone
Brad Fitzpatrick [Mon, 29 Apr 2019 17:57:10 +0000 (17:57 +0000)]
net/http: add func NewRequestWithContext, Request.Clone

Fixes #23544

Change-Id: Iaa31d76c4cda8ce22412d73c9025fc57e4fb1967
Reviewed-on: https://go-review.googlesource.com/c/go/+/174324
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years agonet/http: add Transport.Clone
Brad Fitzpatrick [Tue, 30 Apr 2019 20:03:57 +0000 (20:03 +0000)]
net/http: add Transport.Clone

Fixes #26013

Change-Id: I2c82bd90ea7ce6f7a8e5b6c460d3982dca681a93
Reviewed-on: https://go-review.googlesource.com/c/go/+/174597
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years agonet: skip DNS tests on self-hosted Android
Elias Naur [Thu, 2 May 2019 07:12:12 +0000 (03:12 -0400)]
net: skip DNS tests on self-hosted Android

They were already skipped on tethered Android builders because
the tests are gated on GO_BUILDER_NAME being set and the Android
exec wrapper does not propagate GO_BUILDER_NAME.

Updates #31722

Change-Id: Ifd2c7daecc19a4e540d86d1f38083f43cc3e6b15
Reviewed-on: https://go-review.googlesource.com/c/go/+/175177
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agomisc/ios: don't refer to iostest.bash
Elias Naur [Fri, 3 May 2019 11:21:49 +0000 (13:21 +0200)]
misc/ios: don't refer to iostest.bash

iostest.bash might not live much longer, and all.bash is much
less confusing and more explicit.

Change-Id: If42e8716bbbb02aa3f817dceaabb1aa8076aae1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/175178
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: add math/bits.{Add,Sub}64 intrinsics on s390x
Michael Munday [Tue, 30 Apr 2019 16:46:23 +0000 (17:46 +0100)]
cmd/compile: add math/bits.{Add,Sub}64 intrinsics on s390x

This CL adds intrinsics for the 64-bit addition and subtraction
functions in math/bits. These intrinsics use the condition code
to propagate the carry or borrow bit.

To make the carry chains more efficient I've removed the
'clobberFlags' property from most of the load and store
operations. Originally these ops did clobber flags when using
offsets that didn't fit in a signed 20-bit integer, however
that is no longer true.

As with other platforms the intrinsics are faster when executed
in a chain rather than a loop because currently we need to spill
and restore the carry bit between each loop iteration. We may
be able to reduce the need to do this on s390x (e.g. by using
compare-and-branch instructions that do not clobber flags) in the
future.

name           old time/op  new time/op  delta
Add64          1.21ns ± 2%  2.03ns ± 2%  +67.18%  (p=0.000 n=7+10)
Add64multiple  2.98ns ± 3%  1.03ns ± 0%  -65.39%  (p=0.000 n=10+9)
Sub64          1.23ns ± 4%  2.03ns ± 1%  +64.85%  (p=0.000 n=10+10)
Sub64multiple  3.73ns ± 4%  1.04ns ± 1%  -72.28%  (p=0.000 n=10+8)

Change-Id: I913bbd5e19e6b95bef52f5bc4f14d6fe40119083
Reviewed-on: https://go-review.googlesource.com/c/go/+/174303
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agocmd/compile: fix isStaticCompositeLiteral reports wrong for struct field
LE Manh Cuong [Wed, 1 May 2019 20:57:29 +0000 (03:57 +0700)]
cmd/compile: fix isStaticCompositeLiteral reports wrong for struct field

golang.org/cl/174498 add ONAME case to isStaticCompositeLiteral, to
detect global variable as compile-time constant.

It does report wrong for struct field, e.g:

o := one{i: two{i: 42}.i}

field i in two{i: 42} was reported as static composite literal, while it
should not.

In general, adding ONAME case for isStaticCompositeLiteral is probably
wrong.

Fixes #31782

Change-Id: Icde7d43bbb002b75df5c52b948b7126a4265e07b
Reviewed-on: https://go-review.googlesource.com/c/go/+/174837
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agomath/big: document Int.String
Brian Kessler [Fri, 3 May 2019 02:37:27 +0000 (20:37 -0600)]
math/big: document Int.String

Int.String had no documentation and the documentation for Int.Text
did not mention the handling of the nil pointer case.

Change-Id: I9f21921e431c948545b7cabc7829e4b4e574bbe9
Reviewed-on: https://go-review.googlesource.com/c/go/+/175118
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agocrypto/cipher: disable broken js/wasm test from nodejs v8 to v12 upgrade
Brad Fitzpatrick [Thu, 2 May 2019 22:05:41 +0000 (22:05 +0000)]
crypto/cipher: disable broken js/wasm test from nodejs v8 to v12 upgrade

Updates #31812

Change-Id: Id9898f89205c116009e25033afb5b9026594e80f
Reviewed-on: https://go-review.googlesource.com/c/go/+/175099
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years agocmd: update golang.org/x/sys dependency
Filippo Valsorda [Thu, 2 May 2019 21:46:29 +0000 (17:46 -0400)]
cmd: update golang.org/x/sys dependency

$ go get -u golang.org/x/sys
$ go mod vendor
$ go mod tidy

Change-Id: Ie0a4646aef41b00ec8e27bc6f7e3ec9c270c8ccb
Reviewed-on: https://go-review.googlesource.com/c/go/+/174946
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoreflect: MakeFunc: allow assignment conversions on values returned from the wrapped...
Keith Randall [Tue, 30 Apr 2019 23:10:43 +0000 (16:10 -0700)]
reflect: MakeFunc: allow assignment conversions on values returned from the wrapped function

Instead of requiring exact type match, allow assignment conversions
(those conversions allowed in the language spec without a cast) on the
returned values.

Particularly useful when the type being returned is an interface type,
but the Value actually returned is a concrete value implementing that
type (as it is tricky to return a Value which has interface type).

RELNOTE=y

Fixes #28761

Change-Id: I69eef07ca51690b2086dfa1eb549db5e4724c657
Reviewed-on: https://go-review.googlesource.com/c/go/+/174531
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agonet/http: skip flaky TestTransportMaxConnsPerHost for now
Brad Fitzpatrick [Thu, 2 May 2019 21:22:05 +0000 (21:22 +0000)]
net/http: skip flaky TestTransportMaxConnsPerHost for now

Updates #31784

Change-Id: Iee056c850c03939606b227a12715c76b0339d268
Reviewed-on: https://go-review.googlesource.com/c/go/+/175097
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agosort: simplify bootstrap
Russ Cox [Tue, 30 Apr 2019 19:23:14 +0000 (15:23 -0400)]
sort: simplify bootstrap

We compile package sort as part of the compiler bootstrap,
to make sure the compiler uses a consistent sort algorithm
no matter what version of Go it is compiled against.
(This matters for elements that compare "equal" but are distinguishable.)

Package sort was compiled in such a way as to disallow
sort.Slice entirely during bootstrap (at least with some compilers),
while cmd/internal/obj was compiled in such a way as to
make obj.SortSlice available to all compilers, precisely because
sort.Slice was not. This is all highly confusing.
Simplify by making sort.Slice available all the time.

Followup to CL 169137 and #30440
(and also CL 40114 and CL 73951).

Change-Id: I127f4e02d6c71392805d256c3a90ef7c51f9ba0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/174525
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/link: support PIE mode with internal link on linux arm64
erifan01 [Wed, 26 Sep 2018 10:12:18 +0000 (10:12 +0000)]
cmd/link: support PIE mode with internal link on linux arm64

This CL improves internal link to provide basic support for cgo and PIE:
1, add support for GOT, PLT and GOTPLT.
2, add support for following ELF relocation types which have been used by std
   packages:
     R_AARCH64_ADR_GOT_PAGE
     R_AARCH64_LD64_GOT_LO12_NC
     R_AARCH64_ADR_PREL_PG_HI21
     R_AARCH64_ADD_ABS_LO12_NC
     R_AARCH64_LDST8_ABS_LO12_NC
     R_AARCH64_LDST32_ABS_LO12_NC
     R_AARCH64_LDST64_ABS_LO12_NC
     R_AARCH64_JUMP26
     R_AARCH64_ABS64
     R_AARCH64_PREL32
     R_AARCH64_PREL64

With this change, Go toolchain can be built in internal linking mode, and
pure Go programs can be built with PIE mode in internal linking mode on arm64.

Updates #10373
The prototype of this CL is contributed by Wei Xiao <wei.xiao@arm.com>

Change-Id: I2253923c69e855fd1524d54def309a961dce6247
Reviewed-on: https://go-review.googlesource.com/c/go/+/163579
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>

6 years agocmd/dist: don't generate exec wrappers for compatible cross compiles
Elias Naur [Thu, 2 May 2019 07:12:12 +0000 (03:12 -0400)]
cmd/dist: don't generate exec wrappers for compatible cross compiles

This change will allow android/arm64 hosts to build for android/arm,
and likewise for iOS.

Updates #31722

Change-Id: Id410bd112abbab585ebb13b61fe4d3a38a1a81fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/174705
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/go/internal/modload: make 'list -u' consider current pseudoversion
Pontus Leitzler [Mon, 29 Apr 2019 09:50:53 +0000 (09:50 +0000)]
cmd/go/internal/modload: make 'list -u' consider current pseudoversion

As pointed out by thepudds in #30634, the 'list -u' documentation states that the current version should be considered for upgrade:
The -u flag adds information about available upgrades. When the latest version of a given module is newer than the current one, list -u sets the Module's Update field to information about the newer module.

In go 1.12.4 (and current tip), an older version will be suggested as upgrade to a newer pseudo version.

Updates: #30634

Change-Id: If2c8887198884b8e7ccb3a604908065aa1f1878a
Reviewed-on: https://go-review.googlesource.com/c/go/+/174206
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
6 years agocmd/go: make modconv test more robust
Baokun Lee [Thu, 2 May 2019 10:34:04 +0000 (18:34 +0800)]
cmd/go: make modconv test more robust

Change-Id: I3e75201c56779eda1bcd725691c72d384da56f73
Reviewed-on: https://go-review.googlesource.com/c/go/+/174840
Run-TryBot: Baokun Lee <nototon@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
6 years agocmd/compile: remove outdate TODO in inl.go
LE Manh Cuong [Thu, 2 May 2019 08:48:14 +0000 (15:48 +0700)]
cmd/compile: remove outdate TODO in inl.go

Mid-stack inlining is enable now, see #19348, but we still can not
remove the special case for runtime.heapBits.nextArena, because
runtime.heapBits.next is too complex to be inlined
(cost 96 exceeds budget 80).

Change-Id: I04ea86509074afdc83a3f70d68b8a1a8829763d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/174839
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>