]> Cypherpunks repositories - gostls13.git/log
gostls13.git
4 years ago[dev.typeparams] cmd/compile/internal/types2: add some more tests
Robert Griesemer [Tue, 20 Oct 2020 04:49:57 +0000 (21:49 -0700)]
[dev.typeparams] cmd/compile/internal/types2: add some more tests

Change-Id: I36fce5462d11dd2e8fc9a619118c6a63eed4980a
Reviewed-on: https://go-review.googlesource.com/c/go/+/263633
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years ago[dev.typeparams] cmd/compile/internal/types2: adjust tests, enable Testdata tests
Robert Griesemer [Tue, 20 Oct 2020 04:38:31 +0000 (21:38 -0700)]
[dev.typeparams] cmd/compile/internal/types2: adjust tests, enable Testdata tests

Types2 uses a different test runner and has fewer/better
errors in some cases (error messages match the compiler).
Adjust the tests and enable them.

Change-Id: I74877f54a81a3918a80774452cef5bcaad8a98e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/263631
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years ago[dev.typeparams] cmd/compile/internal/types2: add testdata directory
Robert Griesemer [Tue, 20 Oct 2020 04:10:37 +0000 (21:10 -0700)]
[dev.typeparams] cmd/compile/internal/types2: add testdata directory

Exact copy of src/go/types/testdata. Testdata tests still disabled.

Change-Id: Idff5fff7f1adcfd626f700b1f21f5a14ce1a74f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/263630
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years ago[dev.typeparams] cmd/compile/internal/importer, types2: initial check-in of types2...
Robert Griesemer [Mon, 19 Oct 2020 22:28:22 +0000 (15:28 -0700)]
[dev.typeparams] cmd/compile/internal/importer, types2: initial check-in of types2 and importer

This is a copy of the importer and types2 (unreviewed) prototype version
excluding the testdata directory containing tests (see below). Each file
is marked with the comment

// UNREVIEWED

on the first line. The plan is to check in this code wholesale (it runs and
passes all tests) and then review the code file-by-file via subsequent CLs
and remove the "// UNREVIEWED" comments as we review the files.

Since most tests are unchanged from the original go/types, the next CL will
commit those tests as they don't need to be reviewed again. (Eventually we
may want to factor them out and share them from a single place, e.g. the
test directory.)

The existing file fmtmap_test.go was updated.

Change-Id: I9bd0ad1a7e7188b501423483a44d18e623c0fe71
Reviewed-on: https://go-review.googlesource.com/c/go/+/263624
Trust: Robert Griesemer <gri@golang.org>
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years ago[dev.typeparams] cmd/compile/internal/syntax: add utility functions for testing
Robert Griesemer [Mon, 19 Oct 2020 22:47:40 +0000 (15:47 -0700)]
[dev.typeparams] cmd/compile/internal/syntax: add utility functions for testing

Preparation step for types2 package.

Change-Id: I8f9557b1a48ad570ba38aac7b720e639218dc6a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/263623
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years ago[dev.typeparams] cmd/compile/internal/syntax: add Pos method
Robert Griesemer [Mon, 19 Oct 2020 22:24:39 +0000 (15:24 -0700)]
[dev.typeparams] cmd/compile/internal/syntax: add Pos method

Allows syntax.Pos values to implement

interface {
Pos() Pos
}

Preparation step for types2 package.

Change-Id: Ib0f4d7695a3d066983567d680fc3b9256a31c31d
Reviewed-on: https://go-review.googlesource.com/c/go/+/263622
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years ago[dev.typeparams] cmd/compile/internal/syntax: fix printing of channel types
Robert Griesemer [Thu, 15 Oct 2020 05:09:47 +0000 (22:09 -0700)]
[dev.typeparams] cmd/compile/internal/syntax: fix printing of channel types

Change-Id: I80a3ca77d0642711913c9584e70059e4ed668860
Reviewed-on: https://go-review.googlesource.com/c/go/+/262444
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years ago[dev.typeparams] cmd/compile/internal/syntax: always use IndexExpr node for type...
Robert Griesemer [Wed, 14 Oct 2020 05:33:17 +0000 (22:33 -0700)]
[dev.typeparams] cmd/compile/internal/syntax: always use IndexExpr node for type instantiation

Per @mdempsky's suggestion: Instead of representing a type instantiation T[P]
by an IndexExpr node, and a type instantiation with multiple type arguments
T[P1, P2] by a CallExpr node with special Brackets flag, always use an IndexExpr.
Use a ListExpr as index in the (less common) case of multiple type arguments.

This removes the need for the CallExpr.Brackets field and cleans up the parser
code around type instantiations.

Backport of syntax package changes from https://golang.org/cl/262020.

Change-Id: I32e8bc4eafac5b3ef2e7eb40fa8c790a5a905b69
Reviewed-on: https://go-review.googlesource.com/c/go/+/262137
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years ago[dev.typeparams] cmd/compile: enable parsing of generic code with new -G flag
Robert Griesemer [Mon, 12 Oct 2020 23:19:49 +0000 (16:19 -0700)]
[dev.typeparams] cmd/compile: enable parsing of generic code with new -G flag

Providing the -G flag instructs the compiler to accept type parameters.
For now, the compiler only parses such files and then exits.

Added a new test directory (test/typeparam) and initial test case.

Port from dev.go2go branch.

Change-Id: Ic11e33a9d5f012f8def0bdae205043659562ac73
Reviewed-on: https://go-review.googlesource.com/c/go/+/261660
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years ago[dev.typeparams] cmd/compile/internal/syntax: add type parameter tests
Robert Griesemer [Sun, 11 Oct 2020 00:02:15 +0000 (17:02 -0700)]
[dev.typeparams] cmd/compile/internal/syntax: add type parameter tests

The file endings are not .go so that gofmt leaves these files alone.
They are also not .src to distinguish them from regular go source tests.

Change-Id: I741f5c037bad1ea9d6f7fda3673487d0be631350
Reviewed-on: https://go-review.googlesource.com/c/go/+/261219
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years ago[dev.typeparams] cmd/compile/internal/syntax: implement parsing of type parameters
Robert Griesemer [Mon, 12 Oct 2020 21:07:31 +0000 (14:07 -0700)]
[dev.typeparams] cmd/compile/internal/syntax: implement parsing of type parameters

Port from dev.go2go prototype branch. The compiler doesn't yet set the
syntax.AllowGenerics mode, so parsing of generic code remains disabled.

Known issue: The doc strings documenting the specific syntax accepted
by parser methods are not all up-to-date.

Change-Id: I13d134289fd9330fd0ed7f97c997cca6f23466fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/261658
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years ago[dev.typeparams] cmd/compile/internal/syntax: prepare syntax nodes for type parameters
Robert Griesemer [Mon, 12 Oct 2020 20:11:03 +0000 (13:11 -0700)]
[dev.typeparams] cmd/compile/internal/syntax: prepare syntax nodes for type parameters

- add TParamList fields to TypeDecl, FuncDecl
- also: change File.Lines to File.EOF so we have the actual file end position

Change-Id: Ia345f888080a884f7ac5cefd8bff3d80e4a59cdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/261657
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years ago[dev.typeparams] merge master into dev.typeparams
Rob Findley [Mon, 12 Oct 2020 19:41:05 +0000 (15:41 -0400)]
[dev.typeparams] merge master into dev.typeparams

Change-Id: Ib2a0f85e00a7366b784e3615366ca3bde4ec8c49

4 years agogo/build: clean up ctxt.shouldBuild, tests
Russ Cox [Fri, 22 May 2020 18:40:50 +0000 (14:40 -0400)]
go/build: clean up ctxt.shouldBuild, tests

Make ctxt.shouldBuild return multiple values
instead of modifying *sawBinaryOnly in place.
Also give it a table-driven test.

Cleanup in preparation for boolean expressions,
but nice even if those don't end up happening.

Change-Id: Ibb78b0080070deafac7299a6de87ab8bebeb702d
Reviewed-on: https://go-review.googlesource.com/c/go/+/240598
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
4 years agocmd/fix: print warning to stderr, show provenance
Russ Cox [Mon, 29 Jun 2020 18:20:04 +0000 (14:20 -0400)]
cmd/fix: print warning to stderr, show provenance

This cgo warning shows up when running "go test" in cmd/fix:

warning: no cgo types: exit status 1

(It may show up at other times too.)

Warnings belong on standard error, and while we're here,
make it say where it came from.

Change-Id: I3eaba592a219cc6abf2d584762374f9d6ec5135e
Reviewed-on: https://go-review.googlesource.com/c/go/+/240597
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
4 years agocmd/fix: rename confusing boolean
Russ Cox [Mon, 29 Jun 2020 18:10:24 +0000 (14:10 -0400)]
cmd/fix: rename confusing boolean

("truth" says nothing about what is true.
This boolean tracks whether the file was fixed.)

Change-Id: I29bb80c4fad3ca7f2ae96e50e16f6cde484b374f
Reviewed-on: https://go-review.googlesource.com/c/go/+/240556
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
4 years agocmd/fix: always format source file before fixing
Russ Cox [Mon, 29 Jun 2020 14:44:56 +0000 (10:44 -0400)]
cmd/fix: always format source file before fixing

This makes the changes to the file easier to explain.
Not all the changes may come from the fixers directly,
if the file is not gofmt-ed already.

Change-Id: I81776da446a34a1239a3130317d2aae1437d61a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/240555
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
4 years agocmd/go: add IgnoredOtherFiles to go list; pass IgnoredFiles to vet
Russ Cox [Mon, 29 Jun 2020 14:39:30 +0000 (10:39 -0400)]
cmd/go: add IgnoredOtherFiles to go list; pass IgnoredFiles to vet

Show constraint-ignored non-.go files in go list, as Package.IgnoredOtherFiles
(same as go/build's IgnoredOtherFiles).

Pass full list of ignored files to vet, to help buildtag checker.

For #41184.

Change-Id: I749868de9082cbbc1efbc59370783c8c82fe735f
Reviewed-on: https://go-review.googlesource.com/c/go/+/240553
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
4 years agocmd/go: remove Package.constraintIgnoredGoFiles
Russ Cox [Mon, 29 Jun 2020 14:38:06 +0000 (10:38 -0400)]
cmd/go: remove Package.constraintIgnoredGoFiles

Now all of IgnoredGoFiles is constraint-ignored Go files.

Change-Id: I03001796c290708ab835526250c619dd667a8607
Reviewed-on: https://go-review.googlesource.com/c/go/+/240552
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
4 years agogo/build: add Package.IgnoredOtherFiles
Russ Cox [Mon, 29 Jun 2020 14:31:03 +0000 (10:31 -0400)]
go/build: add Package.IgnoredOtherFiles

Just like it is useful to report ignored .go files,
it is also useful to report ignored non-.go files.

Also, remove _* and .* files from IgnoredGoFiles.
The fact that they were there at all was a mistake.
This list is for files being ignored due to build constraints.

Change-Id: Ie08252dde9f56bda08647e7ebeab7906e9271c54
Reviewed-on: https://go-review.googlesource.com/c/go/+/240551
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
4 years agocmd/compile/internal/syntax: provide BadExpr where needed, call correct error handler
Robert Griesemer [Sat, 10 Oct 2020 00:42:41 +0000 (17:42 -0700)]
cmd/compile/internal/syntax: provide BadExpr where needed, call correct error handler

- For "if" statements without a condition, provide a BadExpr rather than nil
  (clients expect IfStmt.Cond != nil since the parser is taking care of
  reporting a missing condition).

- For 3-index slice expressions, also provide BadExpr where an index is
  required but missing.

- Declare a parser-local error method to hide the embedded error method
  so we don't use it by mistake.

Accidentally found while adjusting prototype parser to work for generics.

Change-Id: Iacc211cc60869be05efe9ae630d65dff1dac00a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/261218
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years agocmd/go: disable automatic go vet -unreachable during go test of std
Russ Cox [Mon, 22 Jun 2020 18:45:35 +0000 (14:45 -0400)]
cmd/go: disable automatic go vet -unreachable during go test of std

go test runs a limited number of vet checks by default.
In the standard library, we run more, both to get additional checking
for the standard library and to get experience with whether to enable
any others by default.

One that experience has shown us should not be enabled by default
is go vet -unreachable. When you are testing, it is common to want to
put an early return or a panic into code to bypass a section of code.
That often causes unreachable code. It's incredibly frustrating if the
result is an "unreachable code" error that keeps your test from completing.

Change-Id: Ib194e87759eb65f5a193d771a9880b38d2fd3ba9
Reviewed-on: https://go-review.googlesource.com/c/go/+/240550
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
4 years agocmd/link: only dynamically export necessary symbols on darwin
Cherry Zhang [Sat, 10 Oct 2020 15:22:14 +0000 (11:22 -0400)]
cmd/link: only dynamically export necessary symbols on darwin

Currently on darwin, when a symbol needs to be exported, we
export it both statically and dynamically. The dynamic export is
unnecessary for some symbols. Only export the necessary ones.

For special runtime C symbols (e.g. crosscall2), they used to be
exported dynamically, and we had a special case for pclntab to
not include those symbols (otherwise, when the dynamic linker
dedup them, the pclntab entries end up pointing out of the
module's address space). This CL changes it to not export those
symbols, and remove the special case.

Change-Id: I2ab40630742d48a09b86ee150aa5f1f7002b134d
Reviewed-on: https://go-review.googlesource.com/c/go/+/261497
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agonet/http: deflake TestTransportPersistConnLeak on macOS
Russ Cox [Mon, 12 Oct 2020 15:56:15 +0000 (11:56 -0400)]
net/http: deflake TestTransportPersistConnLeak on macOS

On a loaded system, sometimes connections don't work out.
Ignore those in TestTransportPersistConnLeak to avoid flakes.

For #33585.

Change-Id: Ic07057532dc0ea5115d6ec49c3c29099a9382295
Reviewed-on: https://go-review.googlesource.com/c/go/+/261538
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Russ Cox <rsc@golang.org>

4 years agohash/maphash: adjust package comment
Russ Cox [Fri, 18 Sep 2020 16:30:10 +0000 (12:30 -0400)]
hash/maphash: adjust package comment

Add note about using per-use seeds.

Delete "collision-resistant but" in:
> The hash functions are collision-resistant but not cryptographically secure.

"Collision-resistant" has a precise cryptographic meaning that is
incompatible with "not cryptographically secure".
All that is really meant by it here here is "it's a good hash function",
which should be established already.

Also delete:
> The hash value of a given byte sequence is consistent within a
> single process, but will be different in different processes.

This was added for its final clause in response to #37040,
but "The hash value of a given byte sequence" is by design not a
concept in this package. Only "... of a given seed and byte sequence".
And seeds cannot be shared between processes, so again by design
you can't even set up the appropriate first half of the sentence
to say the second half.

Change-Id: I2c02bee0e804ef3b120cb4752bf89e60f3f5ff5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/255968
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agotext/template: allow newlines inside action delimiters
Russ Cox [Thu, 10 Sep 2020 22:53:26 +0000 (18:53 -0400)]
text/template: allow newlines inside action delimiters

This allows multiline constructs like:

{{"hello" |
  printf}}

Now that unclosed actions can span multiple lines,
track and report the start of the action when reporting errors.

Also clean up a few "unexpected <error message>" to be just "<error message>".

Fixes #29770.

Change-Id: I54c6c016029a8328b7902a4b6d85eab713ec3285
Reviewed-on: https://go-review.googlesource.com/c/go/+/254257
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
4 years agonet: remove dependency on math/rand
Russ Cox [Tue, 7 Jul 2020 13:07:16 +0000 (09:07 -0400)]
net: remove dependency on math/rand

Like we did for sync, let the runtime give net random numbers,
to avoid forcing an import of math/rand for DNS.

Change-Id: Iab3e64121d687d288a3961a8ccbcebe589047253
Reviewed-on: https://go-review.googlesource.com/c/go/+/241258
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocmd/compile: use Bool accessor in place of Val.U.(bool)
Alberto Donizetti [Mon, 12 Oct 2020 12:35:24 +0000 (14:35 +0200)]
cmd/compile: use Bool accessor in place of Val.U.(bool)

We have a Bool() accessor for the value in boolean nodes, that we use
elsewhere for n.Val().U.(bool), use it here too. Noticed while reading
the code.

Change-Id: Ie42e014970099a05fe9f02f378af77b63e7e6b13
Reviewed-on: https://go-review.googlesource.com/c/go/+/261360
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
4 years agossa: comment Sdom() with the form "Sdom..."
soolaugust [Mon, 12 Oct 2020 07:13:18 +0000 (07:13 +0000)]
ssa: comment Sdom() with the form "Sdom..."

Change-Id: I7ddb3d178e5437a7c3d8e94a089ac7a476a7dc85
GitHub-Last-Rev: bc27289128079f294ec149ccc4539ad29b859c9f
GitHub-Pull-Request: golang/go#41925
Reviewed-on: https://go-review.googlesource.com/c/go/+/261437
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
4 years agonet/http: deep copy Request.TransferEncoding
dqu123 [Sat, 10 Oct 2020 20:25:07 +0000 (16:25 -0400)]
net/http: deep copy Request.TransferEncoding

The existing implementation in Request.Clone() assigns the wrong
pointer to r2.TransferEncoding.

Fixes #41907

Change-Id: I7f220a41b1b46a55d1a1005e47c6dd69478cb025
Reviewed-on: https://go-review.googlesource.com/c/go/+/261258
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Trust: Emmanuel Odeke <emm.odeke@gmail.com>

4 years agoos: call f.Close before t.Fatal to avoid vet unreachable code warnings
gzdaijie [Mon, 12 Oct 2020 05:39:16 +0000 (05:39 +0000)]
os: call f.Close before t.Fatal to avoid vet unreachable code warnings

Change-Id: Ic3f756ecf9b4fad8fb8c259e7dad6df894863b0e
GitHub-Last-Rev: 303e524029289fb4c0cb114dad7cb03c4fce9637
GitHub-Pull-Request: golang/go#41900
Reviewed-on: https://go-review.googlesource.com/c/go/+/261217
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Trust: Emmanuel Odeke <emm.odeke@gmail.com>

4 years agocmd/compile/internal/gc: fix wrong function name in the comment
hk [Sun, 11 Oct 2020 03:44:09 +0000 (03:44 +0000)]
cmd/compile/internal/gc: fix wrong function name in the comment

Change-Id: I2fc5cff7495b5db4eb8f286a5335787241f1a850
GitHub-Last-Rev: 1d226f14c8edbcb189fd1a37b11a82b9642f19ab
GitHub-Pull-Request: golang/go#41917
Reviewed-on: https://go-review.googlesource.com/c/go/+/261317
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Robert Griesemer <gri@golang.org>

4 years agocmd/asm: Add SHA3 hardware instructions for ARM64
Meng Zhuo [Fri, 12 Jun 2020 16:06:49 +0000 (00:06 +0800)]
cmd/asm: Add SHA3 hardware instructions for ARM64

Armv8.2-SHA introduced four SHA3-related instructions

EOR3 <Vd>.16B, <Vn>.16B, <Vm>.16B, <Va>.16B
RAX1 <Vd>.2D, <Vn>.2D, <Vm>.2D
XAR <Vd>.2D, <Vn>.2D, <Vm>.2D, #<imm6>
BCAX <Vd>.16B, <Vn>.16B, <Vm>.16B, <Va>.16B

We convert them into Go asm style as:

VEOR3 <Va>.B16, <Vm>.B16, <Vn>.B16, <Vd>.B16
VRAX1 <Vm>.D2, <Vn>.D2, <Vd>.D2
VXAR $imm6, <Vm>.D2, <Vn>.D2, <Vd>.D2
VBCAX <Va>.B16, <Vm>.B16, <Vn>.B16, <Vd>.B16

Armv8 Reference Manual:
* EOR3 (Three-way Exclusive OR) on C7.2.42
* RAX1 (Rotate and Exclusive OR) on C7.2.217
* XAR (Exclusive OR and Rotate) on C7.2.401
* BCAX (Bit Clear and Exclusive OR) on C7.2.12

Change-Id: I9a5d1b5ad508ed8fd5289d535906c54d9a63ca5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/180757
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Emmanuel Odeke <emm.odeke@gmail.com>

4 years agocmd/compile: remove NewPtr/NewSlice calls with untyped string
Cuong Manh Le [Fri, 9 Oct 2020 16:26:30 +0000 (23:26 +0700)]
cmd/compile: remove NewPtr/NewSlice calls with untyped string

This is follow up of CL 260699, NewPtr/NewSlice should not be called
with untyped string.

No significal change in performance.

name          old time/op       new time/op       delta
Template            167ms ± 5%        168ms ± 6%    ~     (p=0.549 n=9+10)
Unicode            73.9ms ±21%       69.5ms ± 5%    ~     (p=0.182 n=10+9)
GoTypes             611ms ± 4%        603ms ± 2%    ~     (p=0.356 n=10+9)
Compiler            3.07s ± 4%        3.05s ± 2%    ~     (p=0.356 n=9+10)
SSA                 7.61s ± 3%        7.49s ± 1%  -1.67%  (p=0.017 n=10+9)
Flate               114ms ±10%        110ms ±12%    ~     (p=0.165 n=10+10)
GoParser            148ms ±23%        138ms ±13%    ~     (p=0.436 n=9+9)
Reflect             377ms ± 9%        364ms ± 8%    ~     (p=0.105 n=10+10)
Tar                 149ms ±12%        151ms ±12%    ~     (p=0.315 n=10+10)
XML                 201ms ± 3%        206ms ± 8%    ~     (p=0.237 n=8+10)
LinkCompiler        308ms ± 3%        325ms ± 9%  +5.38%  (p=0.017 n=9+10)
[Geo mean]          352ms             348ms       -1.19%

Passes toolstash-check.

Change-Id: I1ca8e9635f1926e53e457bc06648fa08a5473bf3
Reviewed-on: https://go-review.googlesource.com/c/go/+/260859
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years agocmd/go: ignore retracted versions when converting revisions to versions
Jay Conrod [Fri, 9 Oct 2020 19:16:13 +0000 (15:16 -0400)]
cmd/go: ignore retracted versions when converting revisions to versions

When a module author retracts a version, the go command should act as
if it doesn't exist unless it's specifically requested.

When converting a revision to a version, we should ignore tags for
retracted versions. For example, if the tag v1.0.0 is retracted, and
branch B points to the same revision, we should convert B to a
pseudo-version, not v1.0.0. Similarly, if B points to a commit after
v1.0.0, we should not use v1.0.0 as the base; we can use an earlier
non-retracted tag or no base.

Fixes #41700

Change-Id: Ia596b05b0780e5acfe6616a04e94d24bd342fbae
Reviewed-on: https://go-review.googlesource.com/c/go/+/261079
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>

4 years agocmd/compile: drop SSA atomics TODO
Michael Pratt [Fri, 9 Oct 2020 16:44:07 +0000 (12:44 -0400)]
cmd/compile: drop SSA atomics TODO

These ops have been used for sync/atomic since golang.org/cl/28076.

Change-Id: Ic1445c073273f6b191b97018e8eb6f7ad9c48922
Reviewed-on: https://go-review.googlesource.com/c/go/+/261077
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
4 years agocmd/compile: late call expansion for rtcall
David Chase [Wed, 12 Aug 2020 19:46:19 +0000 (15:46 -0400)]
cmd/compile: late call expansion for rtcall

Change-Id: I0708c9d649d8a579857330b68d9fbcbbeced29e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/248189
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocmd/compile: enable late expansion in openDeferExit
David Chase [Wed, 12 Aug 2020 16:58:07 +0000 (12:58 -0400)]
cmd/compile: enable late expansion in openDeferExit

Change-Id: I4ce9e914d22b519b00d7e19d93091f6ac0b60938
Reviewed-on: https://go-review.googlesource.com/c/go/+/248188
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocmd/compile: enable late call lowering for "callDeferStack"
David Chase [Tue, 11 Aug 2020 16:52:01 +0000 (12:52 -0400)]
cmd/compile: enable late call lowering for "callDeferStack"

Change-Id: I773fce43d43f6e19180531e7bd1cc50bd8f31f75
Reviewed-on: https://go-review.googlesource.com/c/go/+/248187
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocmd/compile: some minor cleanups
David Chase [Mon, 10 Aug 2020 17:33:15 +0000 (13:33 -0400)]
cmd/compile: some minor cleanups

Change-Id: Icdf3320814ad4a86a5ae532f4fcb899da3f46ae3
Reviewed-on: https://go-review.googlesource.com/c/go/+/248186
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agonet/http/pprof: remove html/template dependency
Egon Elbre [Wed, 23 Sep 2020 11:06:28 +0000 (14:06 +0300)]
net/http/pprof: remove html/template dependency

html/template indirectly uses reflect MethodByName, this causes linker
to use conservative mode resulting in larger binaries. The template here
is trivial and can be replaced by string manipulation.

This reduces a binary using only net/http/pprof by ~2.5MB.

Fixes #41569

Change-Id: I240e1daa6376182ff4961997ee3ec7b96cb07be8
Reviewed-on: https://go-review.googlesource.com/c/go/+/256900
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Brad Fitzpatrick <bradfitz@golang.org>

4 years agodoc: update install docs for 387->softfloat transition
Keith Randall [Thu, 8 Oct 2020 15:42:11 +0000 (08:42 -0700)]
doc: update install docs for 387->softfloat transition

Fixes #41861

Change-Id: I7aa9370c7762986ee07ba6ff7f6ebda067559f06
Reviewed-on: https://go-review.googlesource.com/c/go/+/260757
Trust: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocmd/compile: split exported/non-exported methods for interface type
Cuong Manh Le [Fri, 2 Oct 2020 18:23:47 +0000 (01:23 +0700)]
cmd/compile: split exported/non-exported methods for interface type

Currently, mhdr/methods is emitted with the same len/cap. There's no way
to distinguish between exported and non-exported methods statically.

This CL splits mhdr/methods into two parts, use "len" for number of
exported methods, and "cap" for all methods. This fixes the bug in
issue #22075, which intends to return the number of exported methods but
currently return all methods.

Note that with this encoding, we still can access either
all/exported-only/non-exported-only methods:

mhdr[:cap(mhdr)]          // all methods
mhdr                      // exported methods
mhdr[len(mhdr):cap(mhdr)] // non-exported methods

Thank to Matthew Dempsky (@mdempsky) for suggesting this encoding.

Fixes #22075

Change-Id: If662adb03ccff27407d55a5578a0ed05a15e7cdd
Reviewed-on: https://go-review.googlesource.com/c/go/+/259237
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years agoall: enable more tests on macOS/ARM64
Cherry Zhang [Wed, 7 Oct 2020 22:29:51 +0000 (18:29 -0400)]
all: enable more tests on macOS/ARM64

On macOS, we can do "go build", can exec, and have the source
tree available, so we can enable more tests.

Skip ones that don't work. Most of them are due to that it
requires external linking (for now) and some tests don't work
with external linking (e.g. runtime deadlock detection). For
them, helper functions CanInternalLink/MustInternalLink are
introduced. I still want to have internal linking implemented,
but it is still a good idea to identify which tests don't work
with external linking.

Updates #38485.

Change-Id: I6b14697573cf3f371daf54b9ddd792acf232f2f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/260719
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agosyscall: support ptrace on macOS/ARM64
Cherry Zhang [Wed, 7 Oct 2020 22:26:26 +0000 (18:26 -0400)]
syscall: support ptrace on macOS/ARM64

Updates #38485.

Change-Id: I853966d934a8ee05cf62c7321f3e6271811d47b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/260718
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agosyscall: restore EscapeArg behavior for empty string
Ian Lance Taylor [Wed, 7 Oct 2020 18:15:01 +0000 (11:15 -0700)]
syscall: restore EscapeArg behavior for empty string

Accidentally broken by CL 259978.

For #41825

Change-Id: Id663514e6eefa325faccdb66493d0bb2b3281046
Reviewed-on: https://go-review.googlesource.com/c/go/+/260397
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Alex Brainman <alex.brainman@gmail.com>
Trust: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
4 years agocmd/compile: fix incorrect comparison folding
Keith Randall [Thu, 8 Oct 2020 18:18:02 +0000 (11:18 -0700)]
cmd/compile: fix incorrect comparison folding

We lost a sign extension that was necessary. The nonnegative comparison
didn't have the correct extension on it. If the larger constant is
positive, but its shorter sign extension is negative, the rule breaks.

Fixes #41872

Change-Id: I6592ef103f840fbb786bf8cb94fd8804c760c976
Reviewed-on: https://go-review.googlesource.com/c/go/+/260701
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
4 years agocmd/compile: rename types.IdealFoo to types.UntypedFoo
Cuong Manh Le [Thu, 8 Oct 2020 13:33:36 +0000 (20:33 +0700)]
cmd/compile: rename types.IdealFoo to types.UntypedFoo

To be consistent with go/types.

Passes toolstash-check.

Change-Id: I5e02f529064a904310a164f8765082aa533cc799
Reviewed-on: https://go-review.googlesource.com/c/go/+/260699
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years agocmd/compile: use types.IdealFoo directly in predecl
Cuong Manh Le [Thu, 8 Oct 2020 12:51:57 +0000 (19:51 +0700)]
cmd/compile: use types.IdealFoo directly in predecl

Instead of using untype(Ctype) to get corresponding untyped type.

Passes toolstash-check.

Change-Id: I311fe6c94b1f8eb2e1615101a379cd06dcab835b
Reviewed-on: https://go-review.googlesource.com/c/go/+/260698
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years agonet/http: make SameSiteDefaultMode behavior match the specification
Roberto Clapis [Tue, 22 Sep 2020 15:57:06 +0000 (17:57 +0200)]
net/http: make SameSiteDefaultMode behavior match the specification

The current specification does not foresee a SameSite attribute without
a value. While the existing implementation would serialize SameSite in a
way that would likely be ignored by well-impelemented clients, it is
better to not rely on this kind of quirks.

Specification: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-05#section-4.1.1

Fixes #36990

Change-Id: Ie51152741d7e84bab64d3e4e4f780286932acbde
Reviewed-on: https://go-review.googlesource.com/c/go/+/256498
Trust: Roberto Clapis <roberto@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
4 years agocmd/cgo: add more architectures to size maps
Ian Lance Taylor [Wed, 7 Oct 2020 23:37:05 +0000 (16:37 -0700)]
cmd/cgo: add more architectures to size maps

This brings over the architectures that the gofrontend knows about.
This permits using the main cgo tool for those architectures,
as cgo can be used with -godefs without gc support.
This will help add golang.org/x/sys/unix support for other architectures.

For #37443

Change-Id: I63632b9c5139e71b9ccab8edcc7acdb464229b74
Reviewed-on: https://go-review.googlesource.com/c/go/+/260657
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agocmd/vendor,cmd/pprof: sync pprof@1a94d8640e99
Hana (Hyang-Ah) Kim [Fri, 14 Aug 2020 16:27:26 +0000 (12:27 -0400)]
cmd/vendor,cmd/pprof: sync pprof@1a94d8640e99

Updated cmd/pprof.objTool.Disasm to accept
an additional bool param introduced in
https://github.com/google/pprof/pull/520 to support
intel syntax in the assembly report.

Returns an error if the intelSyntax param is set. We use
src/cmd/internal/objfile to disassemble and print assembly
so I am not sure if it is relevant, and if so, how.

Fixes #38802
Updates #36905

Change-Id: Iae2b4322404f232196705f05210f00e2495588d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/248499
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
4 years agocmd/internal/obj/arm64: only emit R_CALLIND relocations on calls
Cherry Zhang [Wed, 7 Oct 2020 18:39:47 +0000 (14:39 -0400)]
cmd/internal/obj/arm64: only emit R_CALLIND relocations on calls

Don't emit it for jumps. In particular, not for the return
instruction, which is JMP (LR).

Reduce some binary size and linker resources.

Change-Id: Idb3242b86c5a137597fb8accb8aadfe0244c14cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/260341
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agocrypto/x509: use macOS/AMD64 implementation on macOS/ARM64
Cherry Zhang [Wed, 7 Oct 2020 01:13:16 +0000 (21:13 -0400)]
crypto/x509: use macOS/AMD64 implementation on macOS/ARM64

Updates #38485.

Change-Id: I0582a53171ce803ca1b0237cfa9bc022fc1da6f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/260340
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agotime: enable system zoneinfo on macOS/ARM64
Cherry Zhang [Wed, 7 Oct 2020 00:36:52 +0000 (20:36 -0400)]
time: enable system zoneinfo on macOS/ARM64

Updates #38485.

Change-Id: I4a8b509dc4ad03706235289fbe8c2a675453c871
Reviewed-on: https://go-review.googlesource.com/c/go/+/260339
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agodoc/go1.16: document GO386=387 and GO386=softfloat
Dmitri Shuralyov [Wed, 7 Oct 2020 17:42:49 +0000 (13:42 -0400)]
doc/go1.16: document GO386=387 and GO386=softfloat

Also add a few more TODOs as found by the relnote command.
It's an incomplete list due to #41849.

For #40700.

Change-Id: Id17a9be86d3338e1fcb281d26e7298ff26e92864
Reviewed-on: https://go-review.googlesource.com/c/go/+/260337
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

4 years agonet/http/pprof: use Request.Context, not the deprecated CloseNotifier
Ayan George [Tue, 6 Oct 2020 18:40:40 +0000 (18:40 +0000)]
net/http/pprof: use Request.Context, not the deprecated CloseNotifier

Prior to this commit, the profiling code had a sleep() function that
waits and unblocks on either time.After() or a channel provided by an
http.CloseNotifier derived from a supplied http.ResponseWriter.

According to the documentation, http.CloseNotifier is deprecated:

  Deprecated: the CloseNotifier interface predates Go's context package.
  New code should use Request.Context instead.

This patch does just that -- sleep() now takes an *http.Request and uses
http.Request.Context() to signal when a request has been cancelled.

Change-Id: I98702314addf494f5743a4f99172dc607389dbb8
GitHub-Last-Rev: c1e37a03ca28417ed5833618d3eeddb2eecccd09
GitHub-Pull-Request: golang/go#41756
Reviewed-on: https://go-review.googlesource.com/c/go/+/259157
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agosyscall: rewrite Windows makeCmdLine to use []byte
Ian Lance Taylor [Tue, 6 Oct 2020 23:31:00 +0000 (16:31 -0700)]
syscall: rewrite Windows makeCmdLine to use []byte

It's faster to append to a []byte and only convert to string at the
end then it is to build up a string by concatenating characters.

Fixes #41825

Change-Id: I45ddf77dcc62726c919f0533c95d483cee8ba366
Reviewed-on: https://go-review.googlesource.com/c/go/+/259978
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
4 years agocmd/compile: store call args in the call block
Cherry Zhang [Wed, 7 Oct 2020 15:32:43 +0000 (11:32 -0400)]
cmd/compile: store call args in the call block

We already do this for OpStore, but we didn't do this for OpMove.
Do the same, to ensure that no two memories are live at the same
time.

Fixes #41846.

Change-Id: Iad77ff031b3c4459d1217e0b04aeb0e692eb474d
Reviewed-on: https://go-review.googlesource.com/c/go/+/260237
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
4 years agocmd/go: env -w validates GOTMPDIR value
Eugene Kalinin [Mon, 24 Aug 2020 22:49:39 +0000 (01:49 +0300)]
cmd/go: env -w validates GOTMPDIR value

This change makes go env -w check if GOTMPDIR is an absolute path.

If GOTMPDIR is not an absolute and not existing path there will be an
error at every `work.Builder.Init()`. If `go env` has `-u/-w` as
argument `work.Builder.Init()` is not called.

`go env -w GOTMPDIR=` work in the same way as `go env -u GOTMPDIR`.

Fixes #40932

Change-Id: I6b0662302eeace7f20460b6d26c6e59af1111da2
Reviewed-on: https://go-review.googlesource.com/c/go/+/250198
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>

4 years agoruntime: restore SSE guard in asyncPreempt on 386
Cherry Zhang [Wed, 7 Oct 2020 02:07:15 +0000 (22:07 -0400)]
runtime: restore SSE guard in asyncPreempt on 386

So we don't use SSE instructions under GO386=softfloat.

Change-Id: I8ecc92340ee567f84a22501df2543ec041d25ef2
Reviewed-on: https://go-review.googlesource.com/c/go/+/260137
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
4 years agointernal/reflectlite: include Kind in ValueError message
Ori Rawlings [Fri, 29 May 2020 03:41:38 +0000 (22:41 -0500)]
internal/reflectlite: include Kind in ValueError message

The implementation has been ported from reflect, but to avoid
introducing a dependency on strconv, Kind.String() falls back to
"invalid" if the Kind is unknown rather than "kind" + strconv.Itoa(int(k))

Fixes #39286

Change-Id: I82277242a6c41d0146dabd9d20339fe72d562500
Reviewed-on: https://go-review.googlesource.com/c/go/+/235522
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

4 years agocmd/link: support C-shared buildmode on macOS/ARM64
Cherry Zhang [Sun, 4 Oct 2020 03:58:29 +0000 (23:58 -0400)]
cmd/link: support C-shared buildmode on macOS/ARM64

It just works, after the plugin work.

Updates #38485.

Change-Id: I55aa11b380a33a729fccb731b77f48bc7d0dea2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/259443
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agocmd/link: support PIE on macOS/ARM64
Cherry Zhang [Sun, 4 Oct 2020 03:36:58 +0000 (23:36 -0400)]
cmd/link: support PIE on macOS/ARM64

On macOS/ARM64 everything must be PIE, and we already build PIE
in exe buildmode. Support PIE buildmode as well.

Updates #38485.

Change-Id: I10b68c2f6eb77714e31c26116c61a0e28bf9a358
Reviewed-on: https://go-review.googlesource.com/c/go/+/259442
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agocmd/link: support plugin on macOS/ARM64
Cherry Zhang [Sat, 3 Oct 2020 20:26:37 +0000 (16:26 -0400)]
cmd/link: support plugin on macOS/ARM64

Updates #38485.

Change-Id: I8295f7fad55b1f9701162f9d2902b3499137c64d
Reviewed-on: https://go-review.googlesource.com/c/go/+/259441
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agoruntime/cgo: only build xx_cgo_panicmem on iOS
Cherry Zhang [Sat, 3 Oct 2020 20:18:43 +0000 (16:18 -0400)]
runtime/cgo: only build xx_cgo_panicmem on iOS

On iOS, when running under lldb, we install xx_cgo_panicmem as
EXC_BAD_ACCESS handler so we can get a proper Go panic for
SIGSEGV. Only build it on iOS.

Updates #38485.

Change-Id: I801c477439e05920a4bb8fdf5eae6f4923ab8274
Reviewed-on: https://go-review.googlesource.com/c/go/+/259440
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agoall: implement GO386=softfloat
Keith Randall [Tue, 6 Oct 2020 21:42:15 +0000 (14:42 -0700)]
all: implement GO386=softfloat

Backstop support for non-sse2 chips now that 387 is gone.

RELNOTE=yes

Change-Id: Ib10e69c4a3654c15a03568f93393437e1939e013
Reviewed-on: https://go-review.googlesource.com/c/go/+/260017
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agonet/http: add Transport.GetProxyConnectHeader
Brad Fitzpatrick [Tue, 6 Oct 2020 17:53:11 +0000 (10:53 -0700)]
net/http: add Transport.GetProxyConnectHeader

Fixes golang/go#41048

Change-Id: I38e01605bffb6f85100c098051b0c416dd77f261
Reviewed-on: https://go-review.googlesource.com/c/go/+/259917
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
4 years agoall: enable more tests on macOS/ARM64
Cherry Zhang [Thu, 17 Sep 2020 19:02:26 +0000 (15:02 -0400)]
all: enable more tests on macOS/ARM64

Updates #38485.

Change-Id: Iac96f5ffe88521fcb11eab306d0df6463bdce046
Reviewed-on: https://go-review.googlesource.com/c/go/+/256920
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocmd/dist: enable more tests on macOS/ARM64
Cherry Zhang [Thu, 17 Sep 2020 16:39:43 +0000 (12:39 -0400)]
cmd/dist: enable more tests on macOS/ARM64

Unlike iOS, macOS ARM64 is more of a fully featured OS. Enable
more tests.

Updates #38485.

Change-Id: I2e2240c848d21996db2b950a4a6856987f7a652c
Reviewed-on: https://go-review.googlesource.com/c/go/+/256919
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agoruntime: enable more address bits on macOS/ARM64
Cherry Zhang [Thu, 17 Sep 2020 14:53:10 +0000 (10:53 -0400)]
runtime: enable more address bits on macOS/ARM64

Apparently macOS/ARM64 has 47-bit addresses, instead of 33-bit as
on ios/ARM64. Enable more address bits.

Updates #38485.

Change-Id: I8aa64ba22a3933e3d9c4fffd17d902b5f31c30e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/256918
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 years agoruntime: use sigaltstack on macOS/ARM64
Cherry Zhang [Sat, 12 Sep 2020 16:33:24 +0000 (12:33 -0400)]
runtime: use sigaltstack on macOS/ARM64

Currently we don't use sigaltstack on darwin/arm64, as is not
supported on iOS. However, it is supported on macOS. Use it.
(iOS remains unchanged.)

Change-Id: Icc154c5e2edf2dbdc8ca68741ad9157fc15a72ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/256917
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocompress/flate: remove unneeded zeroing of bytes array in (*huffmanBitWriter).reset
Dan Scales [Wed, 30 Sep 2020 23:34:47 +0000 (16:34 -0700)]
compress/flate: remove unneeded zeroing of bytes array in (*huffmanBitWriter).reset

There is no correctness reason to zero out the w.bytes array in (w
*huffmanBitWriter).reset, since w.nbytes is correctly set to zero. The elements of
the bytes array are always written sequentially, with nbytes indicating how many
elements have been written, and are only read up to the current value of nybytes.

We have a pprof profile of a web server that compresses its request/responses, and
the zeroing in reset() is taking up 2.6% of the CPU time of the server (and could
be causing more slowdowns elsewhere due to its effects on the cache). This
overhead may be showing up especially because there are many request/responses
that are all fairly small.

I'm not sure if the zeroing of the bytes array was intended as extra protection of
data across reset uses in the same program, but no protection is needed as long as
the huffman_bit_writer code remains correct.

Change-Id: I67f2b2f56cff9dcc38d8fc0aea885bb010aeedbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/258577
Run-TryBot: Dan Scales <danscales@google.com>
Run-TryBot: Joe Tsai <joetsai@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Klaus Post <klauspost@gmail.com>
Reviewed-by: Joe Tsai <joetsai@google.com>
Trust: Joe Tsai <joetsai@google.com>
Trust: Dan Scales <danscales@google.com>

4 years agocmd/compile,cmd/internal/obj/ppc64: use mulli where possible
Lynn Boger [Fri, 2 Oct 2020 21:51:13 +0000 (17:51 -0400)]
cmd/compile,cmd/internal/obj/ppc64: use mulli where possible

This adds support to allow the use of mulli when one of the multiply
operands is a constant that fits in 16 bits.

This especially helps in the case where this instruction appears in
a loop since the load of the constant is not being moved out of the loop.

Some improvements seen in compress/flate on power9:

Decode/Digits/Huffman/1e4         259µs ± 0%     261µs ± 0%   +0.57%  (p=1.000 n=1+1)
Decode/Digits/Huffman/1e5        2.43ms ± 0%    2.45ms ± 0%   +0.79%  (p=1.000 n=1+1)
Decode/Digits/Huffman/1e6        23.9ms ± 0%    24.2ms ± 0%   +0.86%  (p=1.000 n=1+1)
Decode/Digits/Speed/1e4           278µs ± 0%     279µs ± 0%   +0.34%  (p=1.000 n=1+1)
Decode/Digits/Speed/1e5          2.80ms ± 0%    2.81ms ± 0%   +0.29%  (p=1.000 n=1+1)
Decode/Digits/Speed/1e6          28.0ms ± 0%    28.1ms ± 0%   +0.28%  (p=1.000 n=1+1)
Decode/Digits/Default/1e4         278µs ± 0%     278µs ± 0%   +0.28%  (p=1.000 n=1+1)
Decode/Digits/Default/1e5        2.68ms ± 0%    2.69ms ± 0%   +0.19%  (p=1.000 n=1+1)
Decode/Digits/Default/1e6        26.6ms ± 0%    26.6ms ± 0%   +0.21%  (p=1.000 n=1+1)
Decode/Digits/Compression/1e4     278µs ± 0%     278µs ± 0%   +0.00%  (p=1.000 n=1+1)
Decode/Digits/Compression/1e5    2.68ms ± 0%    2.69ms ± 0%   +0.21%  (p=1.000 n=1+1)
Decode/Digits/Compression/1e6    26.6ms ± 0%    26.6ms ± 0%   +0.07%  (p=1.000 n=1+1)
Decode/Newton/Huffman/1e4         322µs ± 0%     312µs ± 0%   -2.84%  (p=1.000 n=1+1)
Decode/Newton/Huffman/1e5        3.11ms ± 0%    2.91ms ± 0%   -6.41%  (p=1.000 n=1+1)
Decode/Newton/Huffman/1e6        31.4ms ± 0%    29.3ms ± 0%   -6.85%  (p=1.000 n=1+1)
Decode/Newton/Speed/1e4           282µs ± 0%     269µs ± 0%   -4.69%  (p=1.000 n=1+1)
Decode/Newton/Speed/1e5          2.29ms ± 0%    2.20ms ± 0%   -4.13%  (p=1.000 n=1+1)
Decode/Newton/Speed/1e6          22.7ms ± 0%    21.3ms ± 0%   -6.06%  (p=1.000 n=1+1)
Decode/Newton/Default/1e4         254µs ± 0%     237µs ± 0%   -6.60%  (p=1.000 n=1+1)
Decode/Newton/Default/1e5        1.86ms ± 0%    1.75ms ± 0%   -5.99%  (p=1.000 n=1+1)
Decode/Newton/Default/1e6        18.1ms ± 0%    17.4ms ± 0%   -4.10%  (p=1.000 n=1+1)
Decode/Newton/Compression/1e4     254µs ± 0%     244µs ± 0%   -3.91%  (p=1.000 n=1+1)
Decode/Newton/Compression/1e5    1.85ms ± 0%    1.79ms ± 0%   -3.10%  (p=1.000 n=1+1)
Decode/Newton/Compression/1e6    18.0ms ± 0%    17.3ms ± 0%   -3.88%  (p=1.000 n=1+1)

Change-Id: I840320fab1c4bf64c76b001c2651ab79f23df4eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/259444
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Paul Murphy <murp@ibm.com>
Reviewed-by: Carlos Eduardo Seo <carlos.seo@gmail.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>

4 years agocmd/go/internal/get: improve -insecure deprecation docs
witchard [Fri, 25 Sep 2020 14:09:42 +0000 (14:09 +0000)]
cmd/go/internal/get: improve -insecure deprecation docs

Updates #37519

Change-Id: I212607f1839b729d7da24b1258e56997b13ad830
GitHub-Last-Rev: db6d3c835bdf867a0b18f115276210e3a05902ed
GitHub-Pull-Request: golang/go#41613
Reviewed-on: https://go-review.googlesource.com/c/go/+/257157
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
4 years agocmd/go: add basic support for overlays
Michael Matloob [Tue, 11 Aug 2020 16:57:01 +0000 (12:57 -0400)]
cmd/go: add basic support for overlays

This CL adds basic support for listing packages with overlays.
The new cmd/go/internal/fs package adds an abstraction for communicating
with the file system that will open files according to their overlaid paths,
and provides functions to override those in the build context to open
overlaid files. There is also some support for executing builds on packages
with overlays. In cmd/go/internal/work.(*Builder).build, paths are mapped
to their overlaid paths before they are given as arguments to tools.

For #39958

Change-Id: I5ec0eb9ebbca303e2f1e7dbe22ec32613bc1fd17
Reviewed-on: https://go-review.googlesource.com/c/go/+/253747
Trust: Michael Matloob <matloob@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 years agocmd/compile: correct leaf type when "selecting" singleton register-sized struct
David Chase [Fri, 2 Oct 2020 18:53:48 +0000 (14:53 -0400)]
cmd/compile: correct leaf type when "selecting" singleton register-sized struct

Two part fix:
1) bring the type "correction" forward from a later CL in the expand calls series
2) when a leaf-selwect is rewritten in place, update the type (it might have been
   changed by the type correction in 1).

Fixes #41736.

Change-Id: Id097efd10481bf0ad92aaead81a7207221c144b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/259203
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocrypto/tls: fix typo in spelling of permanentError
Luca Spiller [Tue, 6 Oct 2020 08:12:45 +0000 (08:12 +0000)]
crypto/tls: fix typo in spelling of permanentError

Change-Id: I819c121ff388460ec348af773ef94b44416a2ea9
GitHub-Last-Rev: 98dd8fb25cecb73e88d107e0a35e3e63a53dfd09
GitHub-Pull-Request: golang/go#41785
Reviewed-on: https://go-review.googlesource.com/c/go/+/259517
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Trust: Emmanuel Odeke <emm.odeke@gmail.com>

4 years agodoc: fix typo in contribute.html
Alberto Donizetti [Thu, 1 Oct 2020 12:00:48 +0000 (14:00 +0200)]
doc: fix typo in contribute.html

Change-Id: Ica27c4a9e4c364d94250aebfc4c2b59cff7f4a8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/258679
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
4 years agocmd/compile: avoid applying ARM CMP->CMN rewrite in unsigned context
David Chase [Mon, 5 Oct 2020 16:07:00 +0000 (12:07 -0400)]
cmd/compile: avoid applying ARM CMP->CMN rewrite in unsigned context

Fixes #41780.

Change-Id: I1dc7c19a9f057650905da3a96214c2ff4abb51be
Reviewed-on: https://go-review.googlesource.com/c/go/+/259450
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agoreflect: support multiple keys in struct tags
Alexey Vilenskiy [Fri, 14 Aug 2020 08:37:31 +0000 (11:37 +0300)]
reflect: support multiple keys in struct tags

Fixes #40281

Change-Id: Ie624bce3a78a06d7ed71bba1f501e66802dffd13
Reviewed-on: https://go-review.googlesource.com/c/go/+/248341
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

4 years agosrc/buildall.bash: remove linux-386-387 target
Dmitri Shuralyov [Mon, 28 Sep 2020 18:17:37 +0000 (14:17 -0400)]
src/buildall.bash: remove linux-386-387 target

Support for GO386=387 is being dropped in Go 1.16. There
is no need for the target to be available for testing on
the master branch (where Go 1.16 development is ongoing).

For #40255.

Change-Id: I4a4ee80b0c0a535b6b0b246fe991f26964eb07ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/257963
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

4 years agosrc/buildall.bash: remove mobile filter
Dmitri Shuralyov [Fri, 25 Sep 2020 21:10:24 +0000 (17:10 -0400)]
src/buildall.bash: remove mobile filter

Mobile targets are not supported by misc-compile trybots, as tracked in
golang.org/issue/25963, and need to be filtered out. The buildall.bash
script was created in CL 9438, back when it was a single all-compile
builder, and it was easier to filter out mobile targets in the script
than to come up with a pattern that matches all non-mobile targets.

As of CL 254740, all mobile targets (Android and iOS) have unique GOOS
values. That makes it it easy to filter them out in x/build/dashboard.
This was done in CL 258057. As a result, it's now viable to simplify
this script and perform all misc-compile target selection in x/build,
rather than having it spread it across two places.

Also, as of CL 10750, the all-compile builder has turned into multiple
misc-compile builders, so update the script description accordingly.

Updates #41610.

Change-Id: I1e33260ac18cf0a70bb68cd8e3db5587100c7e87
Reviewed-on: https://go-review.googlesource.com/c/go/+/257962
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

4 years agocmd/compile: export notinheap annotation to object file
Keith Randall [Fri, 2 Oct 2020 22:48:50 +0000 (15:48 -0700)]
cmd/compile: export notinheap annotation to object file

In the rare case when a cgo type makes it into an object file, we need
the go:notinheap annotation to go with it.

Fixes #41761

Change-Id: I541500cb1a03de954881aef659f96fc0b7738848
Reviewed-on: https://go-review.googlesource.com/c/go/+/259297
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocmd/go: use cmd/internal/pkgpath for gccgo pkgpath symbol
Ian Lance Taylor [Fri, 2 Oct 2020 23:17:30 +0000 (16:17 -0700)]
cmd/go: use cmd/internal/pkgpath for gccgo pkgpath symbol

Fixes #37272

Change-Id: I6554fd5e5400acb20c5a7e96b1d6cb1a1afb9871
Reviewed-on: https://go-review.googlesource.com/c/go/+/259299
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agocmd/cgo: split gofrontend mangling checks into cmd/internal/pkgpath
Ian Lance Taylor [Fri, 2 Oct 2020 23:03:37 +0000 (16:03 -0700)]
cmd/cgo: split gofrontend mangling checks into cmd/internal/pkgpath

This is a step toward porting https://golang.org/cl/219817 from the
gofrontend repo to the main repo.

Note that this also corrects the implementation of the v2 mangling
scheme to use ..u and ..U where appropriate.

For #37272

Change-Id: I64a1e7ca1c84348efcbf1cf62049eeb05c830ed8
Reviewed-on: https://go-review.googlesource.com/c/go/+/259298
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agocmd/go: update go_windows_test to use test go binary
Michael Matloob [Thu, 24 Sep 2020 15:26:23 +0000 (11:26 -0400)]
cmd/go: update go_windows_test to use test go binary

Most of the cmd/go tests build the cmd/go binary and run that binary to
test it, but TestAbsolutePath used the GOROOT's cmd/go instead, which
makes debugging confusing and means that make.bash has to be run in each
iteration cycle. Update TestAbsolutePath to use the same go binary as
the rest of the cmd/go tests.

Change-Id: Ib4e8ae707b66f1f75ceb346b98358f5604fd28c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/256979
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 years agocmd/dist: test c-archive mode on ios/arm64
Cherry Zhang [Sun, 4 Oct 2020 04:25:17 +0000 (00:25 -0400)]
cmd/dist: test c-archive mode on ios/arm64

It is tested on darwin/arm64. Don't lose it when using GOOS=ios.

Updates #38485.

Change-Id: I7157d6b6f2850f2fd361e35ae310dd1ba9f31aa4
Reviewed-on: https://go-review.googlesource.com/c/go/+/259439
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agoruntime: clean up runtime.call* frame sizes on ARM64
Austin Clements [Mon, 5 Oct 2020 16:17:30 +0000 (12:17 -0400)]
runtime: clean up runtime.call* frame sizes on ARM64

ARM64 used to require that all assembly frame sizes were of the form
16*N+8 because ARM64 requires 16-byte SP alignment and the assembler
added an 8 byte LR slot. This made all of the runtime.call* frame
sizes wonky. The assembler now rounds up the frame size appropriately
after adding any additional slots it needs, so this is no longer
necessary.

This CL cleans up the frame sizes of these functions so they look the
way you'd expect and match all other architectures.

Change-Id: I47819092296b8983c43eadf2e66c7c1e0d518555
Reviewed-on: https://go-review.googlesource.com/c/go/+/259448
Trust: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agoruntime: define and use call16 everywhere
Austin Clements [Sun, 4 Oct 2020 00:40:49 +0000 (20:40 -0400)]
runtime: define and use call16 everywhere

Currently, runtime.call16 is defined and used only on 32-bit
architectures, while 64-bit architectures all start at call32 and go
up from there. This led to unnecessary complexity because call16's
prototype needed to be in a different file, separate from all of the
other call* prototypes, which in turn led to it getting out of sync
with the other call* prototypes. This CL adds call16 on 64-bit
architectures, bringing them all into sync, and moves the call16
prototype to live with the others.

Prior to CL 31655 (in 2016), call16 couldn't be implemented on 64-bit
architectures because it needed at least four words of argument space
to invoke "callwritebarrier" after copying back the results. CL 31655
changed the way call* invoked the write barrier in preparation for the
hybrid barrier; since the hybrid barrier had to be invoked prior to
copying back results, it needed a different solution that didn't reuse
call*'s stack space. At this point, call16 was no longer a problem on
64-bit, but we never added it. Until now.

Change-Id: Id10ade0e4f75c6ea76afa6229ddaee2b994c27dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/259339
Trust: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agoruntime: correct signature of call16
Austin Clements [Sat, 3 Oct 2020 20:44:22 +0000 (16:44 -0400)]
runtime: correct signature of call16

The signature of call16 is currently missing the "typ" parameter. This
CL fixes this. This wasn't caught by vet because call16 is defined by
macro expansion (see #17544), and we didn't notice the mismatch with
the other call* functions because call16 is defined only on 32-bit
architectures and lives alone in stubs32.go.

Unfortunately, this means its GC signature is also wrong: the "arg"
parameter is treated as a scalar rather than a pointer, so GC won't
trace it and stack copying won't adjust it. This turns out to matter
in exactly one case right now: on 32-bit architectures (which are the
only architectures where call16 is defined), a stack-allocated defer
of a function with a 16-byte or smaller argument frame including a
non-empty result area can corrupt memory if the deferred function
grows the stack and is invoked during a panic. Whew. All other current
uses of reflectcall pass a heap-allocated "arg" frame (which happens
to be reachable from other stack roots, so tracing isn't a problem).

Curiously, in 2016, the signatures of all call* functions were wrong
in exactly this way. CL 31654 fixed all of them in stubs.go, but
missed the one in stubs32.go.

Fixes #41795.

Change-Id: I31e3c0df201f79ee5707eeb8dc4ff0d13fc10ada
Reviewed-on: https://go-review.googlesource.com/c/go/+/259338
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agoencoding/asn1: clarify use of SET suffix
Roland Bracewell Shoemaker [Mon, 5 Oct 2020 15:46:23 +0000 (15:46 +0000)]
encoding/asn1: clarify use of SET suffix

This change clarifies the usage of the SET type name suffix. Previously
the documentation was somewhat confusing about where the suffix should
be used, and when used what it applied to. For instance the previous
language could be interpreted such that []exampleSET would be parsed as
a SEQUENCE OF SET, which is incorrect as the SET suffix only applies to
slice types, such as type exampleSET []struct{} which is parsed as a
SET OF SEQUENCE.

Change-Id: I74201d9969f931f69391c236559f66cb460569ec
GitHub-Last-Rev: d0d2ddc587df4564a265c800efb9d8e204002624
GitHub-Pull-Request: golang/go#38543
Reviewed-on: https://go-review.googlesource.com/c/go/+/229078
Trust: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
4 years agomisc/ios: fixup review comments from CL 255257
Elias Naur [Mon, 5 Oct 2020 15:51:54 +0000 (17:51 +0200)]
misc/ios: fixup review comments from CL 255257

Change-Id: I247fc9e0e26e706e6af07367f953eaa1b7e544c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/259577
Trust: Elias Naur <mail@eliasnaur.com>
Run-TryBot: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agocmd/dist: detect gohostarch on ios/arm64
Cherry Zhang [Sat, 3 Oct 2020 01:57:24 +0000 (21:57 -0400)]
cmd/dist: detect gohostarch on ios/arm64

Add a case for gohostos == "ios" along with "darwin".

Updates #38485.

Change-Id: Ic7310e6c97d405f78a5e5db1a639860455e61327
Reviewed-on: https://go-review.googlesource.com/c/go/+/259337
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
4 years agoiostest.bash: remove
Elias Naur [Sat, 3 Oct 2020 09:27:04 +0000 (11:27 +0200)]
iostest.bash: remove

There are no tethered iOS builders left, and should they appear in
the future, they should use all.bash.

Change-Id: I3217789514ffa725e4d2584e4991d899c5fda995
Reviewed-on: https://go-review.googlesource.com/c/go/+/259278
Trust: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
4 years agomisc/ios: add support for running programs on the iOS simulator
Elias Naur [Wed, 16 Sep 2020 13:23:58 +0000 (15:23 +0200)]
misc/ios: add support for running programs on the iOS simulator

Update the README to mention the emulator. Remove reference to gomobile
while here; there are multiple ways to develop for iOS today, including
using the c-archive buildmode directly.

Updates #38485

Change-Id: Iccef75e646ea8e1b9bc3fc37419cc2d6bf3dfdf4
Reviewed-on: https://go-review.googlesource.com/c/go/+/255257
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocmd/link: add support for openbsd/mips64
Joel Sing [Tue, 25 Aug 2020 10:19:55 +0000 (20:19 +1000)]
cmd/link: add support for openbsd/mips64

Update #40995

Change-Id: I2cf9b85a960f479eaa59bf58081d03a0467bc2b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/250582
Trust: Joel Sing <joel@sing.id.au>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agocmd/compile: change mustHeapAlloc to return a reason why
Alberto Donizetti [Thu, 1 Oct 2020 10:03:27 +0000 (12:03 +0200)]
cmd/compile: change mustHeapAlloc to return a reason why

This change renames mustHeapAlloc to heapAllocReason, and changes it
to return the reason why the argument must escape, so we don't have to
re-deduce it in its callers just to print the escape reason. It also
embeds isSmallMakeSlice body in heapAllocReason, since the former was
only used by the latter, and deletes isSmallMakeSlice.

An outdated TODO to remove smallintconst, which the TODO claimed was
only used in one place, was also removed, since grepping shows we
currently call smallintconst in 11 different places.

Change-Id: I0bd11bf29b92c4126f5bb455877ff73217d5a155
Reviewed-on: https://go-review.googlesource.com/c/go/+/258678
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years agoruntime: update and tidy cgo callback description
Austin Clements [Thu, 1 Oct 2020 14:58:47 +0000 (10:58 -0400)]
runtime: update and tidy cgo callback description

The documentation on how cgo callbacks (C -> Go calls) works
internally has gotten somewhat stale. This CL refreshes it.

Change-Id: I1ab66225c9da52d698d97ebeb4f3c7b9b5ee97db
Reviewed-on: https://go-review.googlesource.com/c/go/+/258937
Trust: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agodoc/go1.16: announce netbsd/arm64 support
Tobias Klauser [Fri, 2 Oct 2020 20:13:14 +0000 (22:13 +0200)]
doc/go1.16: announce netbsd/arm64 support

netbsd/arm64 now complies with all the requirements for a port as
specified on https://golang.org/wiki/PortingPolicy

Note that this was preliminarily announced in the Go 1.13 release notes
(CL 183637) but then removed again due to the port lacking a builder at
that time (CL 192997).

Updates #30824

Change-Id: I2f40fabc84fe9cb699282e6a9d13ed9b64478e36
Reviewed-on: https://go-review.googlesource.com/c/go/+/259277
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>