]> Cypherpunks repositories - gostls13.git/log
gostls13.git
5 years ago[dev.link] cmd/link: assign special indices for builtin functions
Cherry Zhang [Fri, 18 Oct 2019 21:08:35 +0000 (17:08 -0400)]
[dev.link] cmd/link: assign special indices for builtin functions

Compiler-generated function references (e.g. call to
runtime.newobject) appear frequently. We assign special indices
for them, so they don't need to be referenced by name.

Change-Id: I2072594cbc56c9e1037a26e4aae12e68c2436e9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/202085
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
5 years ago[dev.link] cmd/link: use string map for name lookup
Cherry Zhang [Fri, 18 Oct 2019 16:11:56 +0000 (12:11 -0400)]
[dev.link] cmd/link: use string map for name lookup

As we no longer include static symbols into the name lookup table,
it is basically just two maps, one for ABI0, one for ABIInternal.
Just use two maps instead. It may be slightly faster to use
string-keyed maps than struct-keyed maps (still need performance
data to confirm).

For now, allow external symbols being referenced by name, as
external objects don't use index.

Change-Id: I60cedaa7346fce7535970780bc67f93c82160646
Reviewed-on: https://go-review.googlesource.com/c/go/+/201999
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>
5 years ago[dev.link] cmd/link: add in change missed from code review
Than McIntosh [Wed, 23 Oct 2019 15:04:16 +0000 (11:04 -0400)]
[dev.link] cmd/link: add in change missed from code review

Incorporate a change suggested by Cherry for CL 201721 that I missed
accidentally.

Change-Id: I65e6532e78888505573169e56bc4ace9a0f8c510
Reviewed-on: https://go-review.googlesource.com/c/go/+/202760
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years ago[dev.link] cmd/link: do not put static symbols into name lookup table
Cherry Zhang [Fri, 18 Oct 2019 15:19:32 +0000 (11:19 -0400)]
[dev.link] cmd/link: do not put static symbols into name lookup table

Since the previous CL, we will not reference static symbols by
name. Therefore no need to put them into the name lookup table.

On Linux/ARM, in runtime/internal/atomic/sys_linux_arm.s, the
kernelcas function has a definition and a reference written in
two different forms, one with package prefix, one without. This
way, the assembler cannot know they are the same symbol, only the
linker knows. This is quite unusual, unify the names to so the
assembler can resolve it to index.

Change-Id: Ie7223097be6a3b65f3fa43ed4575da9972ef5b69
Reviewed-on: https://go-review.googlesource.com/c/go/+/201998
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/internal/obj: use index for static symbols
Cherry Zhang [Fri, 18 Oct 2019 14:30:04 +0000 (10:30 -0400)]
[dev.link] cmd/internal/obj: use index for static symbols

In assembly we always reference symbols by name. But for static
symbols, as they are reachable only within the current file, we
can assign them local indices and use the indices to reference
them. The index is only meaningful locally, and it is fine.

Change-Id: I16e011cd41575ef703ceb6f35899e5fa58fbcf1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/201997
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/dist: reenable shared library tests
Cherry Zhang [Thu, 17 Oct 2019 01:43:54 +0000 (21:43 -0400)]
[dev.link] cmd/dist: reenable shared library tests

Change-Id: Ifa4de9333b9275d832ebf68c89d3239ed438b104
Reviewed-on: https://go-review.googlesource.com/c/go/+/201819
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd: reference symbols by name when linking against Go shared library
Cherry Zhang [Thu, 17 Oct 2019 01:42:18 +0000 (21:42 -0400)]
[dev.link] cmd: reference symbols by name when linking against Go shared library

When building a program that links against Go shared libraries,
it needs to reference symbols defined in the shared library. At
compile time, we don't know where the shared library boundary is.
If we reference a symbol in package p by index, and package p is
actually part of a shared library, we cannot resolve the index at
link time, as the linker doesn't see the object file of p.

So when linking against Go shared libraries, always use named
reference for now.

To do this, the compiler needs to know whether we will be linking
against Go shared libraries. The -dynlink flag kind of indicates
that (as the document says), but currently it is actually
overloaded: it is also used when building a plugin or a shared
library, which is self-contained (if -linkshared is not otherwise
specified) and could use index for symbol reference. So we
introduce another compiler flag, -linkshared, specifically for
linking against Go shared libraries. The go command will pass
this flag if its -linkshared flag is specified
("go build -linkshared").

There may be better way to handle this. For example, we can
put the symbol indices in a special section in the shared library
that the linker can read. Or we can generate some per-package
description file to include the indices. (Currently we generate
a .shlibname file for each package that is included in a shared
library, which contains the path of the library. We could
consider extending this.) That said, this CL is a stop-gap
solution. And it is no worse than the old object files.

If we were to redesign the build system so that the shared
library boundary is known at compile time, we could use indices
for symbol references that do not cross shared library boundary,
as well as doing other things better.

Change-Id: I9c02aad36518051cc4785dbe25c4b4cef8f3faeb
Reviewed-on: https://go-review.googlesource.com/c/go/+/201818
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/link: allow either of duplicated symbols being dupok
Cherry Zhang [Thu, 17 Oct 2019 22:42:38 +0000 (18:42 -0400)]
[dev.link] cmd/link: allow either of duplicated symbols being dupok

If two symbols have the same name, the old code allows either one
being dupok (preferably both, but either is ok). Currently, the
new code only works when the new symbol being dupok (or both).
Allow only old symbol being dupok as well.

One example for this is the tls_g variable on ARM64 and PPC64
when the race detector is enabled.

Should fix Linux/ARM64 build.

Change-Id: I8dd21c017e826847f13471c30dfd71bf225d8076
Reviewed-on: https://go-review.googlesource.com/c/go/+/201642
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] all: merge branch 'master' into dev.link
Cherry Zhang [Fri, 18 Oct 2019 18:44:05 +0000 (14:44 -0400)]
[dev.link] all: merge branch 'master' into dev.link

Clean merge.

Change-Id: I94d5e621b98cd5b3e1f2007db83d52293edbd9ec

5 years agodoc/go1.14: announce upcoming removal of darwin/386 port
Brad Fitzpatrick [Fri, 18 Oct 2019 16:58:47 +0000 (16:58 +0000)]
doc/go1.14: announce upcoming removal of darwin/386 port

Fixes #34749

Change-Id: Id97afc189ea387fc0fdd044140e30096594e185a
Reviewed-on: https://go-review.googlesource.com/c/go/+/202018
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/internal/obj/arm64: add support of NOOP instruction
diaxu01 [Tue, 3 Sep 2019 02:46:38 +0000 (02:46 +0000)]
cmd/internal/obj/arm64: add support of NOOP instruction

This patch uses symbol NOOP to support arm64 instruction NOP. In
arm64, NOP stands for that No Operation does nothing, other than
advance the value of the program counter by 4. This instruction
can be used for instruction alignment purposes. This patch uses
NOOP to support arm64 instruction NOP, because we have a generic
"NOP" instruction, which is a zero-width pseudo-instruction.

In arm64, instruction NOP is an alias of HINT #0. This patch adds
test cases for instruction HINT #0.

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

5 years agomath/bits: add Rem, Rem32, Rem64
Alberto Donizetti [Sat, 28 Sep 2019 17:02:15 +0000 (19:02 +0200)]
math/bits: add Rem, Rem32, Rem64

The Div functions in math/bits (Div, Div32, and Div64) compute both
quotients and remainders, but they panic if the quotients do not not
fit a 32/64 uint.

Since, on the other hand, the remainder will always fit the size of
the divisor, it is useful to have Div variants that only compute the
remainder, and don't panic on a quotient overflow.

This change adds to the math/bits package three new functions:

  Rem(hi, lo, y uint) uint
  Rem32(hi, lo, y uint32) uint32
  Rem64(hi, lo, y uint64) uint64

which can be used to compute (hi,lo)%y even when the quotient
overflows the uint size.

Fixes #28970

Change-Id: I119948429f737670c5e5ceb8756121e6a738dbdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/197838
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: skip empty init function in fninit
Cuong Manh Le [Sun, 13 Oct 2019 16:06:29 +0000 (23:06 +0700)]
cmd/compile: skip empty init function in fninit

Fixes #34869

Change-Id: I21bc60b9a5d1204dade1cceed6cddccf5b537b0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/200958
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agoruntime/race: add test for midstack inlining
Keith Randall [Tue, 17 Sep 2019 21:10:50 +0000 (14:10 -0700)]
runtime/race: add test for midstack inlining

Add test to make sure we get the right traceback when mid-stack inlining.

Update #33309

Change-Id: I23979cbe6b12fad105dbd26698243648aa86a354
Reviewed-on: https://go-review.googlesource.com/c/go/+/195984
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
5 years agoruntime/race: update race detector shared libraries
Keith Randall [Fri, 18 Oct 2019 04:17:18 +0000 (21:17 -0700)]
runtime/race: update race detector shared libraries

Pulls in a new snapshot of the race detector, containing
a fix that lets it handle mid-stack inlining correctly.

Fixes #33309

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

5 years agogo/types: don't update the underlying type of an imported type
Robert Griesemer [Thu, 17 Oct 2019 23:28:38 +0000 (16:28 -0700)]
go/types: don't update the underlying type of an imported type

Updating the underlying type of an imported type (even though
is was set to the same type again) leads to a race condition
if the imported package is imported by separate, concurrently
type-checked packages.

Fixes #31749.

Change-Id: Iabb8e8593eb067eb4816c1df81e545ff52d32c6c
Reviewed-on: https://go-review.googlesource.com/c/go/+/201838
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: disable checkptr for //go:cgo_unsafe_args functions
Matthew Dempsky [Thu, 17 Oct 2019 20:58:27 +0000 (13:58 -0700)]
cmd/compile: disable checkptr for //go:cgo_unsafe_args functions

Fixes #34968.

Change-Id: I538d653fab6cf7cf9b9b7022a1c2d4ae6ee497b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/201823
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: save g register during arm64 race detector callbacks
Keith Randall [Thu, 17 Oct 2019 21:37:55 +0000 (14:37 -0700)]
runtime: save g register during arm64 race detector callbacks

The race detector C code expects the g register (aka R28) to be
preserved per the C calling convention. Make sure we save/restore it.

Once this is in we can revert the O3 -> O1 change to racebuild.

Change-Id: Ia785b2717c136f565d45bed283e87b744e35c62d
Reviewed-on: https://go-review.googlesource.com/c/go/+/201744
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agodoc: document Go 1.13.3
Alexander Rakoczy [Thu, 17 Oct 2019 20:54:06 +0000 (16:54 -0400)]
doc: document Go 1.13.3

Change-Id: Ia571b8aa791578a77ed5c2b8eaf45c9684eea1c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/201820
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years agocmd/compile: fix -d=checkptr for named unsafe.Pointer types
Matthew Dempsky [Thu, 17 Oct 2019 20:16:15 +0000 (13:16 -0700)]
cmd/compile: fix -d=checkptr for named unsafe.Pointer types

We need to explicitly convert pointers to unsafe.Pointer before
passing to the runtime checkptr instrumentation in case the user
declared their own type with underlying type unsafe.Pointer.

Updates #22218.
Fixes #34966.

Change-Id: I3baa2809d77f8257167cd78f57156f819130baa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/201782
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agodoc: document Go 1.12.12
Alexander Rakoczy [Thu, 17 Oct 2019 20:48:37 +0000 (16:48 -0400)]
doc: document Go 1.12.12

Change-Id: I832ba5f32d513b586bb0b02371231786b25631e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/201817
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years agodoc: document Go 1.13.2 and Go 1.12.11
Katie Hockman [Thu, 17 Oct 2019 14:50:53 +0000 (10:50 -0400)]
doc: document Go 1.13.2 and Go 1.12.11

Change-Id: I73f27924046a0a2493330ddc732d1a2fd3f730a5
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/575981
Reviewed-by: Filippo Valsorda <valsorda@google.com>
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/575983
Reviewed-on: https://go-review.googlesource.com/c/go/+/201785
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years ago[dev.link] cmd/link: restore export data hash
Cherry Zhang [Thu, 17 Oct 2019 05:17:42 +0000 (01:17 -0400)]
[dev.link] cmd/link: restore export data hash

With the previous CL, the export data will not change whether it
is compiled with -dynlink flag or not. Restore the export data
hash, and reenable plugin version check.

TODO: it may be still better to just generate a fingerprint for
each package at compile time.

Change-Id: I1f298ac97c3ab9b8d05d1c95e8be74d10ca7cd0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/201720
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/compile: pass index through when re-exporting
Cherry Zhang [Thu, 17 Oct 2019 05:11:23 +0000 (01:11 -0400)]
[dev.link] cmd/compile: pass index through when re-exporting

When we re-export an imported symbol that has an index, we should
pass the index through. Currently, if the symbol is not
referenced in the generated machine code, it does not get
assigned a package index, and the exporter will not export its
symbol index. Let the exporter handle this case -- if the symbol
has a symbol index but not a package index, still export its
symbol index. This is safe as referenced-by-name symbols always
have their package indices set to a special value.

This should reduce the number of referenced-by-name symbols, and
also make the export data more stable, less dependent on codegen
details.

Change-Id: Ic515a002ae84226e7fdbe68a53496c051b7badcc
Reviewed-on: https://go-review.googlesource.com/c/go/+/201719
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years agocmd/compile: escape unsafe.Pointer conversions when -d=checkptr
Matthew Dempsky [Thu, 17 Oct 2019 19:31:07 +0000 (12:31 -0700)]
cmd/compile: escape unsafe.Pointer conversions when -d=checkptr

This CL tweaks escape analysis to treat unsafe.Pointer(ptr) as an
escaping operation when -d=checkptr is enabled. This allows better
detection of unsafe pointer arithmetic and conversions, because the
runtime checkptr instrumentation can currently only detect object
boundaries for heap objects, not stack objects.

Updates #22218.
Fixes #34959.

Change-Id: I856812cc23582fe4d0d401592583323e95919f28
Reviewed-on: https://go-review.googlesource.com/c/go/+/201781
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[dev.link] cmd/link: new loader method for reading relocations in batch
Than McIntosh [Wed, 16 Oct 2019 20:21:42 +0000 (16:21 -0400)]
[dev.link] cmd/link: new loader method for reading relocations in batch

Add a new loader.Relocs method that reads all of the relocations for a
symbol into a slice. Handy in cases where the client knows in advance
that it wants to visit all the relocations on a symbol (as opposed to
just one or two).

Change-Id: I1a420513e160c8bb4b90c9824ae8d5b5de060c15
Reviewed-on: https://go-review.googlesource.com/c/go/+/201721
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>
5 years agoregexp: skip long-running benchmarks if -short is specified
Keith Randall [Thu, 17 Oct 2019 19:31:53 +0000 (12:31 -0700)]
regexp: skip long-running benchmarks if -short is specified

This CL helps race.bash finish in a reasonable amount of
time. Otherwise the Match/Hard1/32M benchmark takes over 1200 seconds
to finish on arm64, triggering a timeout.  With this change the regexp
benchmarks as a whole take only about a minute.

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

5 years agocmd/compile: detect unsafe conversions from smaller to larger types
Matthew Dempsky [Thu, 17 Oct 2019 19:06:53 +0000 (12:06 -0700)]
cmd/compile: detect unsafe conversions from smaller to larger types

This CL extends the runtime instrumentation for (*T)(ptr) to also
check that the first and last bytes of *(*T)(ptr) are part of the same
heap object.

Updates #22218.
Updates #34959.

Change-Id: I2c8063fe1b7fe6e6145e41c5654cb64dd1c9dd41
Reviewed-on: https://go-review.googlesource.com/c/go/+/201778
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc/go1.14.html: add some TODOs about various ports
Brad Fitzpatrick [Thu, 17 Oct 2019 16:58:56 +0000 (16:58 +0000)]
doc/go1.14.html: add some TODOs about various ports

Updates #15581
Updates #34368

Change-Id: Ife3be7ed484cbe87960bf972ac701954d86127d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/201740
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agosyscall: avoid "just past the end" pointers in UnixRights
Matthew Dempsky [Thu, 17 Oct 2019 01:02:35 +0000 (18:02 -0700)]
syscall: avoid "just past the end" pointers in UnixRights

Caught with -d=checkptr.

Updates #22218.

Change-Id: Ic0fcff4d2c8d83e4e7f5e0c6d01f03c9c7766c6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/201617
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agonet/http, net/textproto: add Header.Values, MIMEHeader.Values methods
Trung Nguyen [Fri, 11 Oct 2019 17:50:01 +0000 (13:50 -0400)]
net/http, net/textproto: add Header.Values, MIMEHeader.Values methods

Fixes #34799

Change-Id: I134b2717fa90c8955902e7eeaaf8510dcc28340e
Reviewed-on: https://go-review.googlesource.com/c/go/+/200760
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoos/exec: re-enable TestExtraFiles checks skipped on various OSes
Bryan C. Mills [Thu, 17 Oct 2019 13:57:42 +0000 (09:57 -0400)]
os/exec: re-enable TestExtraFiles checks skipped on various OSes

The issues associated with these skipped checks are closed.
If they are working around unfixed bugs, the issues should remain open.
If they are working around unfixable properties of the system, the skips
should refer to those properties rather than closed issues.

Updates #2603
Updates #3955
Updates #25628

Change-Id: I3491c69b2ef5bad0fb12001fe8f7e06b424883ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/201718
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agosyscall: remove use of IN_KUBERNETES in test, add a TODO to improve further
Brad Fitzpatrick [Thu, 17 Oct 2019 16:30:49 +0000 (16:30 +0000)]
syscall: remove use of IN_KUBERNETES in test, add a TODO to improve further

Updates #34956

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

5 years agonet: skip some interface tests on Dragonfly for now
Brad Fitzpatrick [Wed, 16 Oct 2019 21:55:40 +0000 (21:55 +0000)]
net: skip some interface tests on Dragonfly for now

Skipping tests isn't great, but neither is a wall of red masking other
potential regressions.

Updates #34368

Change-Id: I5fdfa54846dd8d648001594c74f059af8af52247
Reviewed-on: https://go-review.googlesource.com/c/go/+/201482
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/asm: add missing x86 instructions
Artem Alekseev [Fri, 21 Jun 2019 08:15:21 +0000 (11:15 +0300)]
cmd/asm: add missing x86 instructions

Instructions added: CLDEMOTE, CLWB, TPAUSE, UMWAIT, UMONITOR.

Change-Id: I1ba550d4d5acc41a2fd97068ff5834e0412d3bcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/183225
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoos/exec: preserve the process environment when invoking TestHelperProcess
Bryan C. Mills [Thu, 17 Oct 2019 13:45:54 +0000 (09:45 -0400)]
os/exec: preserve the process environment when invoking TestHelperProcess

Also log errors from the lsof command on failure.
(That's how the missing environment was discovered.)

Updates #25628

Change-Id: I71594f60c15d0d254d5d4a86deec7431314c92ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/201717
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/asm/internal/arch: delete unused s390x functions
Michael Munday [Thu, 17 Oct 2019 12:54:39 +0000 (13:54 +0100)]
cmd/asm/internal/arch: delete unused s390x functions

These functions are not necessary and are not called anywhere.

Change-Id: I1c0d814ba3044c27e3626ac9e6052d8154140404
Reviewed-on: https://go-review.googlesource.com/c/go/+/201697
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[dev.link] cmd/link: remove unused slow paths from BytesAt/StringAt
Than McIntosh [Wed, 16 Oct 2019 14:39:58 +0000 (10:39 -0400)]
[dev.link] cmd/link: remove unused slow paths from BytesAt/StringAt

This change removes the NewReader function (no longer used by objdump)
and prunes away the now unused code paths from Reader.BytesAt and
Reader.StringAt, which helps with performance. At the moment the
reader operates by always ingesting the entire object file (either via
direct read or by mmap), meaning that there will always be a slice
available for us to index into.

Change-Id: I3af7396effe19e50ed594fe8d82fd2d15465687c
Reviewed-on: https://go-review.googlesource.com/c/go/+/201437
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>
5 years ago[dev.link] cmd/objdump: switch to using NewReaderFromBytes
Than McIntosh [Wed, 16 Oct 2019 16:31:33 +0000 (12:31 -0400)]
[dev.link] cmd/objdump: switch to using NewReaderFromBytes

Convert the object file dumper to use NewReaderFromBytes when
reading new object files, as opposed to NewReader.

Change-Id: I9f5e0356bd21c16f545cdd70262e983a2ed38bfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/201441
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years ago[dev.link] cmd/link: record go.itablink symbols during object file read
Than McIntosh [Wed, 16 Oct 2019 13:29:56 +0000 (09:29 -0400)]
[dev.link] cmd/link: record go.itablink symbols during object file read

Change the new loader to keep a note of the set of "go.itablink.*"
symbols (using a small map), and add a method that clients can use to
query whether a given global index corresponds to a "go.itablink.*"
sym. This eliminates one instance of raw symbol name reading/matching
during new deadcode, which should produce a minor speedup.

Change-Id: I5915773a3f33c16099ccd68592dbba783d909bc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/201400
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years ago[dev.link] cmd: add flag to mark gotype symbols
Than McIntosh [Wed, 16 Oct 2019 13:13:59 +0000 (09:13 -0400)]
[dev.link] cmd: add flag to mark gotype symbols

Add a flag bit to mark symbols in the new object file as containing Go
type information. The use of a flag eliminates the need to do symbol
name matching as part of the new dead code elimination pass, which
should produce a minor speedup.

Change-Id: Iec8700e1139e2c4e310644c0766379865d2d6f82
Reviewed-on: https://go-review.googlesource.com/c/go/+/201399
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>
5 years ago[dev.link] cmd: convert symbol "shared" flag to object file flag
Than McIntosh [Wed, 16 Oct 2019 12:54:58 +0000 (08:54 -0400)]
[dev.link] cmd: convert symbol "shared" flag to object file flag

For the new object file format, don't tag individual symbols with a
"shared" flag, since that characteristic is better off as an attribute
of the containing object file as opposed to the individual symbol. Add
a new flags field in the object file header and put a bit in the flags
if the shared flags is in effect during compilation.

Change-Id: I2cf6d33bf7bf2fd8a7614ae0cd6ef03914777498
Reviewed-on: https://go-review.googlesource.com/c/go/+/201398
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>
5 years agotime: change genzabbrs.go to fetch windowsZones.xml file from GitHub
Alex Brainman [Wed, 16 Oct 2019 07:09:27 +0000 (18:09 +1100)]
time: change genzabbrs.go to fetch windowsZones.xml file from GitHub

It seems that windowsZones.xml file has moved to Github. I opened

http://unicode.org/cldr/data/common/supplemental/windowsZones.xml

in my browser, and it redirected me to

https://github.com/unicode-org/cldr/blob/master/common/supplemental/windowsZones.xml

Very nice of them.

And we could see windowsZones.xml change history now. We could even
probably file issues against this file, if we find problems.

Anyway, this CL adjusts genzabbrs.go to use new GitHub location.

I also run 'go generate' command with updated genzabbrs.go to update
zoneinfo_abbrs_windows.go.

Fixes #34917

Change-Id: I69b71a4e02edd999435738ecb225a6f9793a66d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/201378
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/compile: add -d=checkptr to validate unsafe.Pointer rules
Matthew Dempsky [Wed, 13 Feb 2019 03:40:42 +0000 (19:40 -0800)]
cmd/compile: add -d=checkptr to validate unsafe.Pointer rules

This CL adds -d=checkptr as a compile-time option for adding
instrumentation to check that Go code is following unsafe.Pointer
safety rules dynamically. In particular, it currently checks two
things:

1. When converting unsafe.Pointer to *T, make sure the resulting
pointer is aligned appropriately for T.

2. When performing pointer arithmetic, if the result points to a Go
heap object, make sure we can find an unsafe.Pointer-typed operand
that pointed into the same object.

These checks are currently disabled for the runtime, and can also be
disabled through a new //go:nocheckptr annotation. The latter is
necessary for functions like strings.noescape, which intentionally
violate safety rules to workaround escape analysis limitations.

Fixes #22218.

Change-Id: If5a51273881d93048f74bcff10a3275c9c91da6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/162237
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/go/internal/module: fix inverted condition in MatchPathMajor
Jay Conrod [Wed, 16 Oct 2019 18:32:03 +0000 (14:32 -0400)]
cmd/go/internal/module: fix inverted condition in MatchPathMajor

This was spotted in CL 200767. This change just ensures internal
packages match their equivalents in x/mod.

Also pulled in test added in CL 201517.

Change-Id: I51d23d62697c256548f411930fcb6bccce51bf34
Reviewed-on: https://go-review.googlesource.com/c/go/+/201497
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agoencoding/json: correct caller's name in encoding errors
Eugene Kalinin [Fri, 28 Jun 2019 20:59:49 +0000 (23:59 +0300)]
encoding/json: correct caller's name in encoding errors

1. Change mapencode.encode to use fmt.Error rather than MarshalerError.
MarshalerError refer to MarshalJSON, but mapencode.encode does not use that.

2. Add sourceFunc field to MarshalerError to record the name of the function
that creates the error, so that the Error method can report it correctly.

Fixes #29753

Change-Id: I186c2fac8470ae2f9e300501de3730face642230
Reviewed-on: https://go-review.googlesource.com/c/go/+/184119
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years ago[dev.link] cmd/link: add basic shared library support in newobj mode
Cherry Zhang [Wed, 16 Oct 2019 19:44:04 +0000 (15:44 -0400)]
[dev.link] cmd/link: add basic shared library support in newobj mode

This CL adds basic shared library support in newobj mode. This is
not complete -- there are still tests in misc/cgo/testshared
failing. But at least a simple program works, and some tests
there pass.

Add the mechanism of loading external symbols with contents.
(Before, external symbols are always contentless.) This may
potentially be also used for other host objects.

Change-Id: I68dbf71e7949cc01ebf37ea159084e798ae16925
Reviewed-on: https://go-review.googlesource.com/c/go/+/201537
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
5 years agocrypto/ecdsa: remove s390x assembly
Michael Munday [Wed, 16 Oct 2019 20:49:09 +0000 (21:49 +0100)]
crypto/ecdsa: remove s390x assembly

This a revert of CL 174437 and follow up fix CL 201317.

The s390x assembly in this package makes use of an instruction
(specifically KDSA) which is not supported by the current build
machine. Remove this assembly for now, we can revisit this
functionality once we have a newer build machine and can ensure
that this assembly is well tested.

Updates #34927.

Change-Id: I779286fa7d9530a254b53a515ee76b1218821f2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/201360
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoRevert "cmd/compile, cmd/link, runtime: make defers low-cost through inline code...
Bryan C. Mills [Wed, 16 Oct 2019 20:41:53 +0000 (20:41 +0000)]
Revert "cmd/compile, cmd/link, runtime: make defers low-cost through inline code and extra funcdata"

This reverts CL 190098.

Reason for revert: broke several builders.

Change-Id: I69161352f9ded02537d8815f259c4d391edd9220
Reviewed-on: https://go-review.googlesource.com/c/go/+/201519
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
5 years agoio/ioutil: support predictable prefix,suffix for TempDir with *
Emmanuel T Odeke [Wed, 2 Oct 2019 20:36:27 +0000 (13:36 -0700)]
io/ioutil: support predictable prefix,suffix for TempDir with *

Allow TempDir to create directories with predictable
prefixes and suffixes, separated by the last "*", for example:
    "prefix*suffix"
will now expand to
    "prefix" + <RANDOM_VALUE> + "suffix"

RELNOTE=yes

Fixes #33805.

Change-Id: I85fa73ae6a684ce820d1810c82a60765eb9c4a42
Reviewed-on: https://go-review.googlesource.com/c/go/+/198488
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile, cmd/link, runtime: make defers low-cost through inline code and extra...
Dan Scales [Mon, 24 Jun 2019 19:59:22 +0000 (12:59 -0700)]
cmd/compile, cmd/link, runtime: make defers low-cost through inline code and extra funcdata

Generate inline code at defer time to save the args of defer calls to unique
(autotmp) stack slots, and generate inline code at exit time to check which defer
calls were made and make the associated function/method/interface calls. We
remember that a particular defer statement was reached by storing in the deferBits
variable (always stored on the stack). At exit time, we check the bits of the
deferBits variable to determine which defer function calls to make (in reverse
order). These low-cost defers are only used for functions where no defers
appear in loops. In addition, we don't do these low-cost defers if there are too
many defer statements or too many exits in a function (to limit code increase).

When a function uses open-coded defers, we produce extra
FUNCDATA_OpenCodedDeferInfo information that specifies the number of defers, and
for each defer, the stack slots where the closure and associated args have been
stored. The funcdata also includes the location of the deferBits variable.
Therefore, for panics, we can use this funcdata to determine exactly which defers
are active, and call the appropriate functions/methods/closures with the correct
arguments for each active defer.

In order to unwind the stack correctly after a recover(), we need to add an extra
code segment to functions with open-coded defers that simply calls deferreturn()
and returns. This segment is not reachable by the normal function, but is returned
to by the runtime during recovery. We set the liveness information of this
deferreturn() to be the same as the liveness at the first function call during the
last defer exit code (so all return values and all stack slots needed by the defer
calls will be live).

I needed to increase the stackguard constant from 880 to 896, because of a small
amount of new code in deferreturn().

The -N flag disables open-coded defers. '-d defer' prints out the kind of defer
being used at each defer statement (heap-allocated, stack-allocated, or
open-coded).

Cost of defer statement  [ go test -run NONE -bench BenchmarkDefer$ runtime ]
  With normal (stack-allocated) defers only:         35.4  ns/op
  With open-coded defers:                             5.6  ns/op
  Cost of function call alone (remove defer keyword): 4.4  ns/op

Text size increase (including funcdata) for go cmd without/with open-coded defers:  0.09%

The average size increase (including funcdata) for only the functions that use
open-coded defers is 1.1%.

The cost of a panic followed by a recover got noticeably slower, since panic
processing now requires a scan of the stack for open-coded defer frames. This scan
is required, even if no frames are using open-coded defers:

Cost of panic and recover [ go test -run NONE -bench BenchmarkPanicRecover runtime ]
  Without open-coded defers:        62.0 ns/op
  With open-coded defers:           255  ns/op

A CGO Go-to-C-to-Go benchmark got noticeably faster because of open-coded defers:

CGO Go-to-C-to-Go benchmark [cd misc/cgo/test; go test -run NONE -bench BenchmarkCGoCallback ]
  Without open-coded defers:        443 ns/op
  With open-coded defers:           347 ns/op

Updates #14939 (defer performance)
Updates #34481 (design doc)

Change-Id: I51a389860b9676cfa1b84722f5fb84d3c4ee9e28
Reviewed-on: https://go-review.googlesource.com/c/go/+/190098
Reviewed-by: Austin Clements <austin@google.com>
5 years agonet: fix multicast and IPv6 related issues on Plan 9
Fazlul Shahriar [Wed, 16 Oct 2019 02:58:40 +0000 (22:58 -0400)]
net: fix multicast and IPv6 related issues on Plan 9

Fix issues that make these tests pass:
- TestDialerLocalAddr: return error if local address is not IPv4 for
"tcp4" network.
- TestInterfaceAddrs, TestInterfaceUnicastAddrs: don't assume each
interface has only one address. It may have more than one or none.
- TestConcurrentPreferGoResolversDial: should be skipped on Plan 9.
- TestListenMulticastUDP: remove IP from `announce` command and don't
mix IPv4 address with IPv6 address in `addmulti` command.

Fixes #34931

Change-Id: Ie0fdfe19ea282e5d6d6c938bf3c9139f8f5b0308
Reviewed-on: https://go-review.googlesource.com/c/go/+/201397
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/internal/obj/arm: remove NaCl related DATABUNDLE
Ben Shi [Wed, 16 Oct 2019 05:57:08 +0000 (13:57 +0800)]
cmd/internal/obj/arm: remove NaCl related DATABUNDLE

Updates golang/go#30439

Change-Id: Ieaf18b7cfd22a768eb1b7ac549ebc03637258876
Reviewed-on: https://go-review.googlesource.com/c/go/+/201377
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years ago[dev.link] cmd: default to new object files
Cherry Zhang [Wed, 9 Oct 2019 14:22:20 +0000 (10:22 -0400)]
[dev.link] cmd: default to new object files

Switch the default to new object files.

Internal linking cgo is disabled for now, as it does not work yet
in newobj mode.

Shared libraries are also broken.

Disable some tests that are known broken for now.

Change-Id: I8ca74793423861d607a2aa7b0d89a4f4d4ca7671
Reviewed-on: https://go-review.googlesource.com/c/go/+/200161
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
5 years ago[dev.link] cmd/link/internal/objfile: relocate loader to new package
Than McIntosh [Mon, 14 Oct 2019 14:06:37 +0000 (10:06 -0400)]
[dev.link] cmd/link/internal/objfile: relocate loader to new package

Third change of several to update the loader API to reflect the final
consensus version of the loader API as described in Cherry's doc.
This piece:

   - move objfile.Loader into its own separate package, and update
     clients accordingly.

This includes a few minor cleanups, including converting a couple
of loader-related functions to methods, and privatizing some of the
loader methods such as ToGlobal/ToLocal.

Change-Id: Iae20585751a45491d8b19dcffc096aadae6bbfc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/200998
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/internal/obj/wasm,cmd/link/internal/wasm: add fast path for writeUleb128
Agniva De Sarker [Sat, 12 Oct 2019 15:43:28 +0000 (21:13 +0530)]
cmd/internal/obj/wasm,cmd/link/internal/wasm: add fast path for writeUleb128

While building a simple hello world binary, there are total 858277 calls
to writeUleb during the assembler phase out of which 836625 (97%) are less than 7 bits.

Using a simple micro-benchmark like this:

func BenchmarkUleb(b *testing.B) {
var buf bytes.Buffer
for i := 0; i < b.N; i++ {
writeUleb128(&buf, 42)
buf.Reset()
}
}

We get the following results with the fast path enabled.

name    old time/op  new time/op  delta
Uleb-4  8.45ns ± 2%  7.51ns ± 2%  -11.16%  (p=0.000 n=10+10)

Applying the time taken to the number of calls, we get roughly 6% improvement
in total time taken for writeUleb128.

We also apply the change to the function in linker to make it consistent.

Change-Id: I9fe8c41df1209f5f3aa7d8bd0181f1b0e536ceb5
Reviewed-on: https://go-review.googlesource.com/c/go/+/201177
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocrypto/ecdsa: fix buffer size on s390x for ecdsa
bill_ofarrell [Tue, 15 Oct 2019 23:30:54 +0000 (19:30 -0400)]
crypto/ecdsa: fix buffer size on s390x for ecdsa

I used too small a size for buffers, which can cause a panic in some testing.
The new buffer size is generous and sufficient for all purposes.

Fixes #34927
Fixes #34928

Change-Id: Icdbbfed5da87fe3757be40dfd23182b37ec62d58
Reviewed-on: https://go-review.googlesource.com/c/go/+/201317
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: on Wasm and AIX, let deferred nil function panic at invocation
Cherry Zhang [Tue, 15 Oct 2019 21:51:32 +0000 (17:51 -0400)]
cmd/compile: on Wasm and AIX, let deferred nil function panic at invocation

The Go spec requires

If a deferred function value evaluates to nil, execution
panics when the function is invoked, not when the "defer"
statement is executed.

On Wasm and AIX, currently we actually emit a nil check at the
point of defer statement, which will make it panic too early.
This CL fixes this.

Also, on Wasm, now the nil function will be passed through
deferreturn to jmpdefer, which does an explicit nil check and
calls sigpanic if it is nil. This sigpanic, being called from
assembly, is ABI0. So change the assembler backend to also
handle sigpanic in ABI0.

Fixes #34926.
Updates #8047.

Change-Id: I28489a571cee36d2aef041f917b8cfdc31d557d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/201297
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: add test for gccgo name mangling crash
Ian Lance Taylor [Fri, 11 Oct 2019 22:35:49 +0000 (15:35 -0700)]
cmd/go: add test for gccgo name mangling crash

Updates #33871

Change-Id: I73b1513a89ad89126159ce03ee72b922cd01916c
Reviewed-on: https://go-review.googlesource.com/c/go/+/200837
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agomath/big: make Rat accessors safe for concurrent use
Robert Griesemer [Tue, 15 Oct 2019 20:44:22 +0000 (13:44 -0700)]
math/big: make Rat accessors safe for concurrent use

Do not modify the underlying Rat denominator when calling
one of the accessors Float32, Float64; verify that we don't
modify the Rat denominator when calling Inv, Sign, IsInt, Num.

Fixes #34919.
Reopens #33792.

Change-Id: Ife6d1252373f493a597398ee51e7b5695b708df5
Reviewed-on: https://go-review.googlesource.com/c/go/+/201205
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoos: keep attr.Files alive when calling StartProcess
Ian Lance Taylor [Tue, 15 Oct 2019 14:52:23 +0000 (07:52 -0700)]
os: keep attr.Files alive when calling StartProcess

Updates #34810
Fixes #34858

Change-Id: Ie934861e51eeafe8a7fd6653c4223a5f5d45efe8
Reviewed-on: https://go-review.googlesource.com/c/go/+/201198
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agoruntime: change netpoll to take an amount of time to block
Ian Lance Taylor [Wed, 3 Apr 2019 03:27:35 +0000 (20:27 -0700)]
runtime: change netpoll to take an amount of time to block

This new facility will be used by future CLs in this series.

Change the only blocking call to netpoll to do the right thing when
netpoll returns an empty list.

Updates #6239
Updates #27707

Change-Id: I58b3c2903eda61a3698b1a4729ed0e81382bb1ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/171821
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years ago[dev.link] cmd/internal/goobj2: provide accessor methods for flags
Cherry Zhang [Mon, 14 Oct 2019 15:17:18 +0000 (11:17 -0400)]
[dev.link] cmd/internal/goobj2: provide accessor methods for flags

Per Jeremy's comment in CL 199643. This makes the code read
better.

Change-Id: If270aecd712a27fb52e3faf5a4339200327d9ffe
Reviewed-on: https://go-review.googlesource.com/c/go/+/201023
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
5 years ago[dev.link] cmd/link: let cgo import overwrite contentless data symbol
Cherry Zhang [Sat, 12 Oct 2019 05:05:03 +0000 (01:05 -0400)]
[dev.link] cmd/link: let cgo import overwrite contentless data symbol

A contentless data symbol may be a declaration of a cgo-imported
variable, e.g.

//go:cgo_import_dynamic xxx
var xxx uintptr

In this case, we want to mark the symbol imported, instead of
defined with zero value.

We used to load cgo directives before loading the object file, so
we'll mark the symbol SDYNIMPORT first. But in newobj mode,
currently we load cgo directives later. Letting SDYNIMPORT
overwrite contentless data symbol makes it work in both ordering.

Change-Id: I878f52086d6cdb5a347669bf8f848a49bce87b52
Reviewed-on: https://go-review.googlesource.com/c/go/+/201020
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
5 years ago[dev.link] cmd/link: add dupok symbols resolved to another package to textp
Cherry Zhang [Fri, 11 Oct 2019 21:43:32 +0000 (17:43 -0400)]
[dev.link] cmd/link: add dupok symbols resolved to another package to textp

When a dupok symbol is resolved to another package, we still need
to record its presence in the current package, as the trampoline
pass expects packages are laid out in dependency order. At the
point after deadcode where we populate symbol contents for
reachable symbols (add relocations and read symbol data), make a
note of the dupok text symbols for each package. Later in
addToTextp we will visit packages in dependency order, process
the dup text symbol list for each package and select a final lib
for each dup text symbol.

Change-Id: Ib885e0a7e2343229d853aa629e3e337111df6011
Reviewed-on: https://go-review.googlesource.com/c/go/+/200797
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/internal/obj, cmd/link: add InlTree in new object files
Cherry Zhang [Tue, 8 Oct 2019 21:22:20 +0000 (17:22 -0400)]
[dev.link] cmd/internal/obj, cmd/link: add InlTree in new object files

Add InlTree to the FuncInfo aux symbol in new object files.

In the linker, change InlinedCall.Func from a Symbol to a string,
as we only use its Name. (There was a use of Func.File, but that
use is not correct anyway.) So we don't need to create a Symbol
if not necessary.

Change-Id: I38ce568ae0934cd9cb6d0b30599f1c8d75444fc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/200098
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/link: implement symbol overwrite logic
Cherry Zhang [Tue, 8 Oct 2019 19:35:36 +0000 (15:35 -0400)]
[dev.link] cmd/link: implement symbol overwrite logic

If two defined symbols have the same name, one contentless and
one with content, the one with content "wins". This is mainly for
go:linkname on data symbols. Support this logic in newobj mode.

Introduce an "overwrite" mechanism, letting one symbol overwrite
another. This machanism could later be used for the linker
overwriting symbol contents (e.g. -X flag).

Change-Id: I32ee7d4b82df275f11b38c3abefc99b878ff12d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/200097
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/internal/obj, cmd/link: use aux symbol for DWARF symbols
Cherry Zhang [Tue, 8 Oct 2019 01:10:41 +0000 (21:10 -0400)]
[dev.link] cmd/internal/obj, cmd/link: use aux symbol for DWARF symbols

Use the auxiliary symbol mechanism to connect the text symbol and
its associated DWARF symbols. This way, the linker can track the
DWARF symbols from the text symbol, without looking up special
names.

Currently, in the linker this is only used in the deadcode pass
to track which DWARF symbols are used and need to load. Later
passes still use name lookup for now.

Change-Id: I2fe49f3b1f0ecc1472ae8aa93907cff740022d8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/199801
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/link: create sym.Symbols after deadcode in newobj mode
Cherry Zhang [Sat, 5 Oct 2019 02:05:41 +0000 (22:05 -0400)]
[dev.link] cmd/link: create sym.Symbols after deadcode in newobj mode

With the new object files, now we can run the deadcode pass on
indices instead of Symbol structs, so we can delay creating
Symbols after the deadcode pass. Then we only need to create
reachable symbols.

Not create Symbols in LoadNew and LoadRefs, and recombine
LoadReloc into LoadFull.

Split loadcgo into two parts: the first finds root symbols, the
second create Symbols and sets attributes. The first runs before
the deadcode pass, while the second runs after.

TODO: currently there are still symbols that are not marked
reachable but still used. This includes DWARF symbols, file
symbols, and type symbols that are referenced by DWARF symbols.
We still need to create them (conservatively).

Change-Id: I695779c9312be9d49ab1683957ac3e72e1f65a1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/199643
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years agonet/http: remove references to old NPN support
Brad Fitzpatrick [Tue, 15 Oct 2019 17:48:25 +0000 (17:48 +0000)]
net/http: remove references to old NPN support

We now only support ALPN.

Updates #28362

Change-Id: I8d9461c7a91315ee92e712448d0bf5c4070d09ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/201202
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go: omit new 'vendor/modules.txt' annotations if the go version is 1.13 or lower
Bryan C. Mills [Tue, 15 Oct 2019 17:39:13 +0000 (13:39 -0400)]
cmd/go: omit new 'vendor/modules.txt' annotations if the go version is 1.13 or lower

Updates #33848

Change-Id: I887d78179d467030f4177d1834ccefee28a55c8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/201257
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agotime: avoid or clarify CEST
Ian Lance Taylor [Tue, 15 Oct 2019 14:12:26 +0000 (07:12 -0700)]
time: avoid or clarify CEST

In the tzdata database CEST is not recognized as a timezone name.
It is used as the abbreviated name for daylight saving time in
Central Europe.  Avoid using CEST in documentation as it suggests
that programs can parse dates that use CEST, which will typically
fail on Unix systems.

Updates #34913

Change-Id: I4b22f7d06607eb5b066812a48af58edd95498286
Reviewed-on: https://go-review.googlesource.com/c/go/+/201197
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agoruntime: call goready in wakeScavenger instead of ready
Michael Anthony Knyszek [Mon, 14 Oct 2019 17:33:36 +0000 (17:33 +0000)]
runtime: call goready in wakeScavenger instead of ready

This changes fixes an oversight in wakeScavenger which would cause ready
to be called off of the system stack. This change makes it so that
wakeScavenger calls goready, which switches to the system stack before
calling ready.

Fixes #34773.

Change-Id: Icb13f180b4d8fdd47c921eac1b896e3dd49e43b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/200999
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
5 years ago[dev.link] cmd/internal/obj: convert "\" to "/" in file path
Cherry Zhang [Sat, 12 Oct 2019 18:01:57 +0000 (14:01 -0400)]
[dev.link] cmd/internal/obj: convert "\" to "/" in file path

The old code does this. Do the same.

Change-Id: Ibf32ac347d6425e19ad0bc664c6b43ab5eba9c5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/201022
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years agocmd/compile: remove some nacl SSA rules
Ben Shi [Mon, 14 Oct 2019 07:33:54 +0000 (07:33 +0000)]
cmd/compile: remove some nacl SSA rules

Updates golang/go#30439

Change-Id: I7ef5301fbd650d26a37a1241ddf7ca1ccd58b89d
Reviewed-on: https://go-review.googlesource.com/c/go/+/200941
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: preserve statements in late nilcheckelim optimization
David Chase [Wed, 9 Oct 2019 22:06:06 +0000 (18:06 -0400)]
cmd/compile: preserve statements in late nilcheckelim optimization

When a subsequent load/store of a ptr makes the nil check of that pointer
unnecessary, if their lines differ, change the line of the load/store
to that of the nilcheck, and attempt to rehome the load/store position
instead.

This fix makes profiling less accurate in order to make panics more
informative.

Fixes #33724

Change-Id: Ib9afaac12fe0d0320aea1bf493617facc34034b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/200197
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: fix fmt test
Keith Randall [Mon, 14 Oct 2019 23:34:28 +0000 (16:34 -0700)]
cmd/compile: fix fmt test

CL 196781 added map[int64]uint32 to the set of things printed with %v.

Fixes #34907

Change-Id: If4a13e86cfb4b691988f5fb70449ae23760f5789
Reviewed-on: https://go-review.googlesource.com/c/go/+/201079
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/internal/obj/riscv: implement MOV pseudo-instructions
Joel Sing [Thu, 3 Oct 2019 18:02:38 +0000 (04:02 +1000)]
cmd/internal/obj/riscv: implement MOV pseudo-instructions

Add support for rewriting MOV pseudo-instructions into appropriate
RISC-V instructions.

Based on the riscv-go port.

Updates #27532

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

5 years agocmd/go: refuse -w with an invalid GO111MODULE
Daniel Martí [Sun, 13 Oct 2019 21:33:18 +0000 (22:33 +0100)]
cmd/go: refuse -w with an invalid GO111MODULE

It was possible to get 'go env' to break itself:

$ go env -w GO111MODULE=bad
$ go env
go: unknown environment setting GO111MODULE=bad

We already check if the variable name is known. In some cases like
GO111MODULE, we also know what the variable's valid values are. Enforce
it when writing the variable, not just when fetching it.

Fixes #34880.

Change-Id: I10d682087c69f3445f314fd4473644f694e255f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/200867
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years ago[dev.link] cmd/internal/goobj2: separate Autolib from Pkglist in new object file
Cherry Zhang [Wed, 9 Oct 2019 14:22:02 +0000 (10:22 -0400)]
[dev.link] cmd/internal/goobj2: separate Autolib from Pkglist in new object file

In CL 196030 we decided to combine the imported package list
(Autolib) and referenced package list (PkgIdx, or Pkglist).
However, in some cases the Autolib list may contain file name,
instead of package path, e.g.
https://go.googlesource.com/go/+/refs/heads/dev.link/src/cmd/compile/internal/gc/main.go#1181
And the linker needs that to locate the file. This mostly happens
with direct invocation of the compiler and linker (i.e., not
through "go build").

Instead of letting the linker make guess of the file name based
on the package path, make Autolib a separate list.

Change-Id: If195a69462d04db515346ee67cdec925f5a69e2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/200157
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
5 years agocmd/compile: in poset, change the way inequality is recorded
Giovanni Bajo [Sat, 12 Oct 2019 23:30:51 +0000 (01:30 +0200)]
cmd/compile: in poset, change the way inequality is recorded

Before this CL, inequality was recorded in a bit matrix using
SSA IDs. This allowed to record inequality for SSA values that
we didn't know any relation in the partial order of. Unfortunately,
this also means that inequality is harder to use within the poset
itself as there is not fast way to map from internal poset indices
and SSA values.

Since we will need to check for inequality in following CLs within
code that lost track of SSA values, switch to use a bit matrix
of poset indices instead. This requires always allocate a poset
node (as a new root) for values that are first seen in a SetNonEqual
call, but it doesn't sound like a big problem. The other solution
(creating and maintaining a reverse map from poset indices to SSA
values) seem more complicated and memory hungry.

Change-Id: Ic917485abbe70aef7ad6fa98408e5430328b6cd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/196782
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
5 years agocmd/compile: in poset, improve panic strings and comments
Giovanni Bajo [Sat, 12 Oct 2019 23:26:22 +0000 (01:26 +0200)]
cmd/compile: in poset, improve panic strings and comments

No functional changes.

Change-Id: I6f5e811e141dd09dc5c47ff2d37fae4c640315e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/200862
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: in poset, make constant handling more flexible
Giovanni Bajo [Sat, 21 Sep 2019 23:26:50 +0000 (01:26 +0200)]
cmd/compile: in poset, make constant handling more flexible

Currently, constants in posets, in addition to being stored in
a DAG, are also stored as SSA values in a slice. This allows to
quickly go through all stored constants, but it's not easy to search
for a specific constant.

Following CLs will benefit from being able to quickly find
a constants by value in the poset, so change the constants
structure to a map. Since we're at it, don't store it as
*ssa.Value: poset always uses dense uint32 indices when
referring a node, so just switch to it.

Using a map also forces us to have a single node per
constant value: this is a good thing in the first place,
so this CL also make sure we never create two nodes for
the same constant value.

Change-Id: I099814578af35f935ebf14bc4767d607021f5f8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/196781
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
5 years agocmd/compile: add math/bits.Mul64 intrinsic on mips64x
Meng Zhuo [Sun, 13 Oct 2019 10:51:49 +0000 (18:51 +0800)]
cmd/compile: add math/bits.Mul64 intrinsic on mips64x

Benchmark:
name   old time/op  new time/op  delta
Mul    36.0ns ± 1%   2.8ns ± 0%  -92.31%  (p=0.000 n=10+10)
Mul32  4.37ns ± 0%  4.37ns ± 0%     ~     (p=0.429 n=6+10)
Mul64  36.4ns ± 0%   2.8ns ± 0%  -92.37%  (p=0.000 n=10+9)

Change-Id: Ic4f4e5958adbf24999abcee721d0180b5413fca7
Reviewed-on: https://go-review.googlesource.com/c/go/+/200582
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agonet/http: clean up checkIfModifiedSince and checkIfUnmodifiedSince
Anmol Sethi [Thu, 19 Oct 2017 01:27:48 +0000 (21:27 -0400)]
net/http: clean up checkIfModifiedSince and checkIfUnmodifiedSince

The comment in both functions referred to the wrong header and I made
the checks easier to read.

Change-Id: Ifb46729cee631a3305f557863818e3487b8eed71
Reviewed-on: https://go-review.googlesource.com/c/go/+/71753
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: add debugging mode for poset
Giovanni Bajo [Sat, 21 Sep 2019 23:34:13 +0000 (01:34 +0200)]
cmd/compile: add debugging mode for poset

Add an internal mode to simplify debugging of posets
by checking the integrity after every mutation. Turn
it on within SSA checked builds.

Change-Id: Idaa8277f58e5bce3753702e212cea4d698de30ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/196780
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
5 years agonet/http: fix and lock-in Client.Do docs on request cancelation
Emmanuel T Odeke [Sat, 12 Oct 2019 00:27:33 +0000 (20:27 -0400)]
net/http: fix and lock-in Client.Do docs on request cancelation

Fixes the docs to correctly match the implementation
and also adds a test locking-in the behavior to prevent
any accidental future regressions on the docs.

Fixes #33545

Change-Id: I6fdac6048cce8ac99beaa2db0dfc81d0dccc10f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/200798
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: remove period from "not allowed in runtime" errors
Matthew Dempsky [Mon, 14 Oct 2019 19:16:52 +0000 (12:16 -0700)]
cmd/compile: remove period from "not allowed in runtime" errors

We don't punctuate compiler diagnostics.

Change-Id: I19e1f30fbf04f0d1bfe6648fae26beaf3a06ee92
Reviewed-on: https://go-review.googlesource.com/c/go/+/201077
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: move some ONAME-specific flags from Node to Name
Matthew Dempsky [Sat, 12 Oct 2019 23:21:55 +0000 (16:21 -0700)]
cmd/compile: move some ONAME-specific flags from Node to Name

The IsClosureVar, IsOutputParamHeapAddr, Assigned, Addrtaken,
InlFormal, and InlLocal flags are only interesting for ONAME nodes, so
it's better to set these flags on Name.flags instead of Node.flags.

Two caveats though:

1. Previously, we would set Assigned and Addrtaken on the entire
expression tree involved in an assignment or addressing operation.
However, the rest of the compiler only actually cares about knowing
whether the underlying ONAME (if any) was assigned/addressed.

2. This actually requires bumping Name.flags from bitset8 to bitset16,
whereas it doesn't allow shrinking Node.flags any. However, Name has
some trailing padding bytes, so expanding Name.flags doesn't cost any
memory.

Passes toolstash-check.

Change-Id: I7775d713566a38d5b9723360b1659b79391744c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/200898
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agonet/http: fix Transport panic with nil Request.Header
Emmanuel T Odeke [Sun, 13 Oct 2019 22:07:06 +0000 (15:07 -0700)]
net/http: fix Transport panic with nil Request.Header

For Go 1.13 we introduced Header.Clone and it returns
nil if a nil Header is cloned. Unfortunately, though,
this exported Header.Clone nil behavior differed from
the old Go 1.12 and earlier internal header clone
behavior which always returned non-nil Headers.
This CL fixes the places where that distinction mattered.

Fixes #34878

Change-Id: Id19dea2272948c8dd10883b18ea7f7b8b33ea8eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/200977
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: consistenly use CTxxx for works relate to Ctype
Cuong Manh Le [Sun, 13 Oct 2019 16:37:14 +0000 (23:37 +0700)]
cmd/compile: consistenly use CTxxx for works relate to Ctype

Passes toolstash-check

Change-Id: Iaeaf2575b9f492e45619007438c0138f9d22006c
Reviewed-on: https://go-review.googlesource.com/c/go/+/200959
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years ago[dev.link] cmd/link: on AIX, use relocation to locate target symbol from TOC symbol
Cherry Zhang [Sat, 12 Oct 2019 01:51:01 +0000 (21:51 -0400)]
[dev.link] cmd/link: on AIX, use relocation to locate target symbol from TOC symbol

On AIX, a TOC symbol always has a relocation to its target symbol.
Instead of using name lookup to locate the target symbol, we can
just use the relocation.

Using name lookup, besides being less efficient, needs to provide
the right symbol version. In this particular case, we are looking
for a data symbol so it is almost always version 0. But in case
that it is a text symbol, we may get an ABIALIAS symbol, which
does not have its Sect set.

Change-Id: I1ecfd284b04a86bbbc450059ee89d99d40493e51
Reviewed-on: https://go-review.googlesource.com/c/go/+/201019
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years ago[dev.link] cmd/internal/obj: sort ctxt.Data on AIX
Cherry Zhang [Sat, 12 Oct 2019 05:07:31 +0000 (01:07 -0400)]
[dev.link] cmd/internal/obj: sort ctxt.Data on AIX

On AIX, TOC symbols may be created and added to ctxt.Data
concurrently. To ensure reproducible builds, sort ctxt.Data.
This implements the same logic as WriteObjFile does for old
object files.

Change-Id: I2e6e2d7755352848981544a4fb68b828a188c2ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/201021
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years agotest: revise testcase for new gccgo compiler bug
Than McIntosh [Mon, 14 Oct 2019 13:00:14 +0000 (09:00 -0400)]
test: revise testcase for new gccgo compiler bug

Add to the testcase originally created for issue 34577 so
as to also trigger the error condition for issue 34852 (the
two bugs are closely related).

Updates #34577.
Updates #34852.

Change-Id: I2347369652ce500184347606b2bb3e76d802b204
Reviewed-on: https://go-review.googlesource.com/c/go/+/201017
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years ago[dev.link] cmd/link: support reflect.Type.Method tracking in deadcode2
Cherry Zhang [Tue, 8 Oct 2019 22:21:22 +0000 (18:21 -0400)]
[dev.link] cmd/link: support reflect.Type.Method tracking in deadcode2

When reflect.Type.Method is called, all exported methods from a
reachable type need to be conservatively live. When such a
function is called, the compiler sets an attribute to the
function, and the linker needs to check that attribute. Implement
this in the index-based deadcode pass.

Unify symbol flags and FuncInfo flags to make things simpler. In
particular, the deadcode pass can check the reflectMethod
attribute without reading in and decoding FuncInfo.

Change-Id: Ibb21e172f2996e899c6efa5551a29d0eca62df67
Reviewed-on: https://go-review.googlesource.com/c/go/+/200099
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years agocmd/go/internal/work: fix error while passing custom vet tool
Agniva De Sarker [Sun, 13 Oct 2019 15:03:47 +0000 (20:33 +0530)]
cmd/go/internal/work: fix error while passing custom vet tool

For GOROOT packages, we were adding -unsafeptr=false to prevent unsafe.Pointer
checks. But the flag also got passed to invocations of go vet with a custom
vet tool. To prevent this from happening, we add this flag only when no
tools are passed.

Fixes #34053

Change-Id: I8bcd637fd8ec423d597fcdab2a0ceedd20786019
Reviewed-on: https://go-review.googlesource.com/c/go/+/200957
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years ago[dev.link] cmd/link: implement live method tracking in deadcode2
Cherry Zhang [Fri, 4 Oct 2019 19:08:58 +0000 (15:08 -0400)]
[dev.link] cmd/link: implement live method tracking in deadcode2

This essentially replicates the logic of live method tracking and
type symbol decoding, rewritten to operate on indices instead of
Symbols.

TODO: the special handling of reflect.Type.Method has not been
implemented.

TODO: the symbol name is used too much. It ought to be a better
way to do it.

Change-Id: I860ee7a506c00833902e4870d15aea698a705dd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/199078
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/link: move macho host files to new loader format
Jeremy Faller [Fri, 11 Oct 2019 17:58:43 +0000 (13:58 -0400)]
[dev.link] cmd/link: move macho host files to new loader format

Change-Id: I823b19c0742992dd760c6372428a1936bb7c7e70
Reviewed-on: https://go-review.googlesource.com/c/go/+/200768
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agointernal/syscall/unix: remove unused *Trap consts
Tobias Klauser [Sun, 13 Oct 2019 21:33:13 +0000 (23:33 +0200)]
internal/syscall/unix: remove unused *Trap consts

These are unused since the darwin port switched to libc calls in
CL 148457.

Change-Id: I309bb5b0a52c9069484e7a649d4a652efcb8e160
Reviewed-on: https://go-review.googlesource.com/c/go/+/200866
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: remove Addable flag
Matthew Dempsky [Sat, 12 Oct 2019 23:05:34 +0000 (16:05 -0700)]
cmd/compile: remove Addable flag

This flag is supposed to indicate whether the expression is
"addressable"; but in practice, we infer this from other
attributes about the expression (e.g., n.Op and n.Class()).

Passes toolstash-check.

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