]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
2 years ago[dev.boringcrypto] all: merge master into dev.boringcrypto
Nicolas Hillegeer [Tue, 29 Mar 2022 00:40:23 +0000 (17:40 -0700)]
[dev.boringcrypto] all: merge master into dev.boringcrypto

Change-Id: I04d511ed8e3e7ca4a3267f226a0c3e248c0f84a9

2 years agogo/build: recognize "unix" build tag
Ian Lance Taylor [Fri, 4 Mar 2022 02:21:37 +0000 (18:21 -0800)]
go/build: recognize "unix" build tag

The new "unix" build tag matches any Unix or Unix-like system.
This is only recognized on go:build lines, not in file names.

For #20322
Fixes #51572

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

2 years agobytes: restore old Trim/TrimLeft behavior for nil
Ian Lance Taylor [Fri, 18 Mar 2022 19:14:20 +0000 (12:14 -0700)]
bytes: restore old Trim/TrimLeft behavior for nil

Keep returning nil for the cases where we historically returned nil,
even though this is slightly different for TrimLeft and TrimRight.

Fixes #51793

Change-Id: Ifbdfc6b09d52b8e063cfe6341019f9b2eb8b70e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/393876
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agoio/fs, path/filepath: honor SkipDir on second WalkDirFunc error call
Ian Lance Taylor [Sun, 13 Mar 2022 00:18:23 +0000 (16:18 -0800)]
io/fs, path/filepath: honor SkipDir on second WalkDirFunc error call

Fixes #51617

Change-Id: I03e9e575d9bad1481e7e4f051b50a077ba5f2fe0
Reviewed-on: https://go-review.googlesource.com/c/go/+/392154
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2 years agonet/mail: accept UT as a timezone
Ian Lance Taylor [Mon, 28 Mar 2022 17:18:03 +0000 (10:18 -0700)]
net/mail: accept UT as a timezone

Fixes #39906

Change-Id: I8fcaf4c1ccc4131d770cff08d9c80f520885a6b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/396214
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2 years agointernal/pkgbits: add fingerprints to unified IR export format
Matthew Dempsky [Wed, 23 Mar 2022 19:10:02 +0000 (12:10 -0700)]
internal/pkgbits: add fingerprints to unified IR export format

So far unified IR has been relying on the backwards-compat iexport
data to supply package fingerprints for imports. To be able to drop
the iexport data and natively use unified IR everywhere.

This CL applies basically the same idea that iexport used: simply
hash all of the export data as it's being written out, and then tack
on an 8-byte hash at the end.

Change-Id: Iaca5fbfd7443088bc7f422a1c58be3e762c29014
Reviewed-on: https://go-review.googlesource.com/c/go/+/396196
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agocmd/internal/obj: sort relocations
Cherry Mui [Mon, 28 Mar 2022 16:46:46 +0000 (12:46 -0400)]
cmd/internal/obj: sort relocations

At least on some platforms (e.g. PE dynamic loader) relocations
need to be sorted in address order. Currently we don't always emit
relocations in address order: e.g. for array literal with out-of-
order element initializers, or out-of-order DATA instructions in
assembly code. Sort them.

No test for now as I can't reproduce the failure for #51923.

Fixes #51923.

Change-Id: Ifec5d3476e027bb927bcefd6e45c40ebeccee4ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/396195
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2 years agocmd/compile: reallocate FPR31 to XER for PPC64 regalloc
Paul E. Murphy [Fri, 25 Mar 2022 15:37:11 +0000 (10:37 -0500)]
cmd/compile: reallocate FPR31 to XER for PPC64 regalloc

We are limited to 64 registers in the allocator today, and PPC64
has not been allocating F0,F26-F31 for quite some time without
performance impact.

Change-Id: If9d60be5037c94991fdd90a44461c3a6b96315cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/395835
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: make F0,F27-F31 allocatable on PPC64
Paul E. Murphy [Fri, 25 Mar 2022 15:29:27 +0000 (10:29 -0500)]
cmd/compile: make F0,F27-F31 allocatable on PPC64

These FP registers on PPC64 have no restrictions, they can
be used like the others. F27-F31 were sequested long ago for
scratch storage which has long since been reverted, but they
weren't added back to the allocator pool.

Change-Id: I9074660e2fc91a2044c9768f700a8215802cba51
Reviewed-on: https://go-review.googlesource.com/c/go/+/395834
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>

2 years agoall: delete PPC64 non-register ABI fallback path
Cherry Mui [Fri, 18 Mar 2022 22:49:39 +0000 (18:49 -0400)]
all: delete PPC64 non-register ABI fallback path

Change-Id: Ie058c0549167b256ad943a0134907df3aca4a69f
Reviewed-on: https://go-review.googlesource.com/c/go/+/394215
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile/internal/syntax: fix scanner.{op,prec} docs
Matthew Dempsky [Sat, 26 Mar 2022 02:03:37 +0000 (19:03 -0700)]
cmd/compile/internal/syntax: fix scanner.{op,prec} docs

These fields are also valid for _Star.

Change-Id: I2582000ac1737c41416e69f91404f7cac279d718
Reviewed-on: https://go-review.googlesource.com/c/go/+/395916
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agosyscall: optimize Byte{Ptr,Slice}FromString
Kir Kolyshkin [Thu, 2 Dec 2021 03:48:58 +0000 (19:48 -0800)]
syscall: optimize Byte{Ptr,Slice}FromString

Use bytealg.IndexByteString(str, 0) instead of looping through the
string to check for a zero byte. A quick and dirty benchmark shows 10x
performance improvement (on amd64 machine, using go 1.17.3).

BytePtrFromString is used by many functions with string arguments.
This change should make many functions in os package, such as those
accepting a filename (os.Open, os.Stat, etc.), a tad faster.

PS I am aware that syscall package is deprecated and frozen, but this
change is mainly for the os package and the likes. The alternative
would be for os to switch to x/sys, which is a much bigger change.

Change-Id: I18fdd50f9fbfe0a23a4a71bc4bd0a5f5b0eaa475
Reviewed-on: https://go-review.googlesource.com/c/go/+/368457
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agoruntime/race: update runtime (v3)
Dmitry Vyukov [Mon, 21 Feb 2022 08:52:14 +0000 (09:52 +0100)]
runtime/race: update runtime (v3)

New tsan runtime (v3) built on llvm commit 1784fe0532a6.

The new runtime features:
 - 2x smaller shadow memory (2x of app memory)
 - faster fully vectorized (on x86) race detection
 - small fixed-size vector clocks (512b)
 - fast vectorized vector clock operations
 - unlimited number of alive threads/goroutines

Some random subset of benchmarks:

encoding/json:
CodeEncoder-72           20.3ms ± 6%     11.7ms ± 4%   -42.02%  (p=0.000 n=10+8)
CodeMarshal-72           22.3ms ±11%     12.7ms ±11%   -43.28%  (p=0.000 n=10+10)
CodeDecoder-72           46.1ms ±42%     20.2ms ± 7%   -56.18%  (p=0.000 n=10+10)
CodeUnmarshal-72         16.7ms ±14%     13.2ms ± 9%   -20.93%  (p=0.000 n=10+10)
CodeUnmarshalReuse-72    17.7ms ±17%     12.8ms ± 8%   -27.58%  (p=0.000 n=10+10)

net/http:
ClientServerParallel4-72         914µs ±18%      72µs ± 5%  -92.16%  (p=0.000 n=20+18)
ClientServerParallel64-72       1.77ms ±16%    0.12ms ±29%  -93.43%  (p=0.000 n=20+17)
ClientServerParallelTLS4-72     1.99ms ±33%    0.20ms ± 5%  -89.83%  (p=0.000 n=19+17)
ClientServerParallelTLS64-72    2.72ms ±26%    0.25ms ±16%  -90.96%  (p=0.000 n=20+16)

compress/flate:
Decode/Digits/Huffman/1e4-72        2.53ms ± 3%     1.47ms ± 4%   -41.72%  (p=0.000 n=9+10)
Decode/Digits/Speed/1e4-72          2.59ms ± 5%     1.52ms ± 3%   -41.44%  (p=0.000 n=8+9)
Decode/Digits/Default/1e4-72        2.56ms ± 6%     1.51ms ± 4%   -40.96%  (p=0.000 n=10+10)
Decode/Digits/Compression/1e4-72    2.54ms ± 6%     1.52ms ± 2%   -40.14%  (p=0.000 n=10+9)
Decode/Newton/Huffman/1e4-72        2.65ms ± 3%     1.58ms ± 4%   -40.45%  (p=0.000 n=10+10)
Decode/Newton/Speed/1e4-72          2.16ms ± 9%     1.28ms ± 5%   -40.59%  (p=0.000 n=10+10)
Decode/Newton/Default/1e4-72        2.01ms ± 8%     1.16ms ± 6%   -42.11%  (p=0.000 n=10+10)
Decode/Newton/Compression/1e4-72    1.99ms ± 6%     1.17ms ± 3%   -41.05%  (p=0.000 n=9+10)
Encode/Digits/Huffman/1e4-72        2.05ms ± 2%     0.75ms ± 5%   -63.32%  (p=0.000 n=10+10)
Encode/Digits/Speed/1e4-72          2.89ms ± 2%     1.37ms ± 2%   -52.56%  (p=0.000 n=9+10)
Encode/Digits/Default/1e4-72        7.55ms ± 2%     3.86ms ± 4%   -48.93%  (p=0.000 n=8+10)
Encode/Digits/Compression/1e4-72    7.46ms ± 4%     3.88ms ± 4%   -48.07%  (p=0.000 n=9+9)
Encode/Newton/Huffman/1e4-72        2.20ms ± 4%     0.90ms ± 6%   -59.01%  (p=0.000 n=10+10)
Encode/Newton/Speed/1e4-72          2.62ms ± 2%     1.30ms ± 4%   -50.52%  (p=0.000 n=9+10)
Encode/Newton/Default/1e4-72        7.40ms ± 5%     3.72ms ± 2%   -49.65%  (p=0.000 n=10+9)
Encode/Newton/Compression/1e4-72    7.67ms ± 9%     3.85ms ± 4%   -49.87%  (p=0.000 n=10+10)

encoding/json short tests:
Time     2.34sec ± 6%   1.67sec ±11%  -28.85%  (p=0.000 n=10+10)
Memory     266MB ± 1%     190MB ± 9%  -28.78%  (p=0.000 n=10+10)

compress/flate short tests:
Time      4.69sec ± 4%   2.78sec ± 3%  -40.61%  (p=0.000 n=10+10)
Memory      284MB ± 5%     181MB ± 4%  -36.04%  (p=0.000 n=10+9)

sync short tests:
Time     4.87sec ± 4%  0.87sec ± 6%  -82.21%  (p=0.000 n=10+10)
Memory     147MB ± 3%     99MB ± 8%  -32.47%  (p=0.000 n=10+9)

Fixes #47056
Fixes #38184

Change-Id: I0cf228f2e4cac7778d34d33e46df7c081645f5d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/333529
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Trust: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agoio/ioutil: add deprecation markers to ioutil
Jeff Widman [Mon, 28 Mar 2022 04:13:24 +0000 (04:13 +0000)]
io/ioutil: add deprecation markers to ioutil

All the code in ioutil just forwards functionality to code
in either the io or os packages, per issue 42026.

This change adds the "Deprecated" marker to all the
functions in this package.

For #42026

Fixes #51927

Change-Id: Ia807bc5c0edb06cc80ec7e35917dcfe2ad50f0ea
GitHub-Last-Rev: 3c3603f368e2be517cdd946ae6a666d4e1eda67a
GitHub-Pull-Request: golang/go#51961
Reviewed-on: https://go-review.googlesource.com/c/go/+/395918
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agocmd/compile/internal/ir: remove un-used code for const
Cuong Manh Le [Mon, 28 Mar 2022 14:41:19 +0000 (21:41 +0700)]
cmd/compile/internal/ir: remove un-used code for const

CL 390474 removed last usages of ConstValue, it can now be removed, and
also Float64Val, since when it's only used by ConstValue.

CanInt64 is un-used for a long time, its original form last usage was
removed in CL 221802.

Change-Id: Id142b0da49c319faca73ef1b2090325f81431321
Reviewed-on: https://go-review.googlesource.com/c/go/+/396078
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2 years agoos: use syscall.Timespec.Unix
Ian Lance Taylor [Tue, 28 Dec 2021 18:54:55 +0000 (10:54 -0800)]
os: use syscall.Timespec.Unix

Use the syscall method instead of repeating the type conversions for each OS.

Change-Id: I1db975b3aaa189cf724d7b1b7c5c41bc64dd964d
Reviewed-on: https://go-review.googlesource.com/c/go/+/374574
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2 years agoRevert "reflect, runtime: add reflect support for regabi on riscv64"
mzh [Sun, 27 Mar 2022 23:08:32 +0000 (23:08 +0000)]
Revert "reflect, runtime: add reflect support for regabi on riscv64"

This reverts commit 56400fc70675cc2f404f33e3ed13386967cfe4da.

Reason for revert: this CL requires CL360296 be merged

Change-Id: I4c48c4d23b73b6e892cf86cbbc864698ebc5c992
Reviewed-on: https://go-review.googlesource.com/c/go/+/396076
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: mzh <mzh@golangcn.org>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agoencoding/xml: expose decoder line and column
Patrick Gundlach [Mon, 19 Apr 2021 10:51:04 +0000 (12:51 +0200)]
encoding/xml: expose decoder line and column

The existing implementation of the xml decoder uses the line number
only for reporting syntax errors. The line number of the last read
token and the column within the line is useful for the users even
in non-error conditions.

Fixes #45628

Change-Id: I37b5033ff5ff8411793d8f5180f96aa4537e83f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/311270
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>

2 years agogo/build: remove unused code in TestDependencies
zhangjian [Tue, 22 Mar 2022 16:35:21 +0000 (16:35 +0000)]
go/build: remove unused code in TestDependencies

Change-Id: I7ccffbf96bd30f33bb42b6a2592962e2d4dda9fc
GitHub-Last-Rev: 2d6e214ac50bf505f8edf5ad8bf1c7f02e7b1194
GitHub-Pull-Request: golang/go#51231
Reviewed-on: https://go-review.googlesource.com/c/go/+/386374
Reviewed-by: mzh <mzh@golangcn.org>
Trust: mzh <mzh@golangcn.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2 years agotime: add Duration.Abs
Carl Johnson [Sat, 26 Mar 2022 02:10:29 +0000 (02:10 +0000)]
time: add Duration.Abs

Fixes #51414

Change-Id: Ia3b1674f2a902c8396fe029397536643a3bc1784
GitHub-Last-Rev: 67159648af09e7a8ac2825a1fe71b2de3fb9d748
GitHub-Pull-Request: golang/go#51739
Reviewed-on: https://go-review.googlesource.com/c/go/+/393515
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2 years agoregexp: use input.step() to advance one rune in Regexp.allMatches()
Andy Pan [Thu, 28 Oct 2021 07:39:11 +0000 (15:39 +0800)]
regexp: use input.step() to advance one rune in Regexp.allMatches()

Change-Id: I32944f4ed519419e168e62f9ed6df63961839259
Reviewed-on: https://go-review.googlesource.com/c/go/+/359197
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agotest: fix inline test on noopt builder
Keith Randall [Sat, 26 Mar 2022 19:21:36 +0000 (12:21 -0700)]
test: fix inline test on noopt builder

CL 394074 broke the noopt builder. Something about time.After's inlining
depends on the build flags to make.bash, not the build flags that run.go
passes.

Change-Id: Ib284c66ea2008a4d32829c055d57c54a34ec3fb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/396037
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2 years agocmd/compile: upgrade prove pass to know results of math/bits ops are nonnegative
Keith Randall [Sat, 26 Mar 2022 17:36:10 +0000 (10:36 -0700)]
cmd/compile: upgrade prove pass to know results of math/bits ops are nonnegative

Fixes #51963

Change-Id: Ib9e0521222e6fc41e787f3150b254e058a19addc
Reviewed-on: https://go-review.googlesource.com/c/go/+/396036
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jakub Ciolek <jakub@ciolek.dev>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Eric Fang <eric.fang@arm.com>
2 years agocmd/compile: optimize BSRQ with nonzero input
Keith Randall [Sat, 26 Mar 2022 17:03:06 +0000 (10:03 -0700)]
cmd/compile: optimize BSRQ with nonzero input

Same as BSFQ, if the input is known to be nonzero we don't need a CMOV
to correct for the weird all-zero behavior of the BSRQ instruction.

Fixes #51964

Change-Id: Ic1d14fdf3e7e698ff2f47efecfd761d8a036012a
Reviewed-on: https://go-review.googlesource.com/c/go/+/396034
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2 years agoreflect, runtime: add reflect support for regabi on riscv64
Meng Zhuo [Wed, 3 Nov 2021 10:01:09 +0000 (18:01 +0800)]
reflect, runtime: add reflect support for regabi on riscv64

This CL adds regabi support needed for reflect.

Change-Id: Ib78f8c7765f03e3a7b46e8b115bf8870b8076e6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/360994
Trust: mzh <mzh@golangcn.org>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agocmd/go/internal/modfetch: remove unused FileRev struct
Baokun Lee [Mon, 20 Dec 2021 06:12:02 +0000 (14:12 +0800)]
cmd/go/internal/modfetch: remove unused FileRev struct

In CL 367756 we remove ReadFileRevs function, We simplified
the implementation of the interface Repo. and the type FileRev
is no longer used.

Change-Id: Iec9e2f0d6bb227f4d0d0f565e897137dcf392a3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/373375
Trust: Lee Baokun <bk@golangcn.org>
Run-TryBot: Lee Baokun <bk@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2 years agoos: document DirFS implements fs.StatFS
hopehook [Tue, 22 Mar 2022 15:33:48 +0000 (23:33 +0800)]
os: document DirFS implements fs.StatFS

Fixes #51856

Change-Id: I8328d73bbb7bc166d58281180b64785a634e9bab
Reviewed-on: https://go-review.googlesource.com/c/go/+/394555
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agoRevert "cmd/compile: stop interface conversions for generic method calls from allocating"
Keith Randall [Thu, 24 Mar 2022 17:50:06 +0000 (17:50 +0000)]
Revert "cmd/compile: stop interface conversions for generic method calls from allocating"

This reverts commit e550c3054586a224d949cc8fa030bac0887bee51.

Reason for revert: Method bound calls are no longer implemented using interface calls, so it is no longer necessary. Leaving the test, though.

Change-Id: I80f1e4cd921063cd27ca8f07998316ca282e075b
Reviewed-on: https://go-review.googlesource.com/c/go/+/395594
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: use method expression closures to implement bound method calls
Keith Randall [Fri, 11 Feb 2022 20:58:37 +0000 (12:58 -0800)]
cmd/compile: use method expression closures to implement bound method calls

When we have x.M(args) where x is a value of type parameter type, we
currently cast x to the bound of that type parameter (which is an interface)
and then invoke the method on that interface. That's pretty inefficient
because:
 1) We need to convert x to an interface, which often requires allocation.
    With CL 378178 it is at least stack allocation, but allocation nontheless.
 2) We need to call through wrapper functions to unpack the interface
    into the right argument locations for the callee.

Instead, let's just call the target directly. The previous CL to this one
added method expression closures to the dictionary, which is a simple
captureless closure that implements T.M for type parameter T and method M.
So to implement x.M(args) for x of type T, we use methodexpr(T,M)(x, args).
We just need to move x from the receiver slot to the first argument, and
use the dictionary entry to implement the polymorphism. This works because
we stencil by shape, so we know how to marshal x for the call even though
we don't know its exact type.

We should be able to revert CL 378178 after this one, as that optimization
will no longer be necssary as we're not converting values to interfaces
to implement this language construct anymore.

Update #50182

Change-Id: I813de4510e41ab63626e58bd1167f9ae93016202
Reviewed-on: https://go-review.googlesource.com/c/go/+/385274
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: implement generic method expressions with closures in dictionary
Keith Randall [Fri, 11 Feb 2022 00:40:18 +0000 (16:40 -0800)]
cmd/compile: implement generic method expressions with closures in dictionary

Currently we do quite a dance for method expressions on generic
types. We write a new closure, and in that closure convert the
receiver to an interface with the required method, then call the
target using an interface call.

Instead in this CL, we just allocate a (captureless) closure in the
dictionary which implements that method expression.

This CL makes method expressions faster and simpler. But the real win
is some followon CLs, where we can use the same closure to implement
bound method calls using the same closure, instead of converting to
interface and having wrappers convert back. Much faster and simpler.

Still thinking about how to do method values. The receiver still
needs to be captured, so there must be some closure involved, I think.

Update #50182

Change-Id: I1fbd57e7105663f8b049955b8f4111649a5f4aa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/385254
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agointernal/abi: define riscv64 register ABI constants
Meng Zhuo [Wed, 3 Nov 2021 08:17:45 +0000 (16:17 +0800)]
internal/abi: define riscv64 register ABI constants

Add the riscv64 register ABI constants and allow regabi
value to be set for riscv64

Change-Id: I3ce98bf9a29d2acc00f92650b27bc59884ed62ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/359336
Trust: mzh <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: enable inlining SELECT
Wayne Zuo [Sun, 20 Mar 2022 13:28:46 +0000 (21:28 +0800)]
cmd/compile: enable inlining SELECT

Change-Id: I90c8e12a0be05d82bf6e147b5249859518f35c14
Reviewed-on: https://go-review.googlesource.com/c/go/+/394074
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Keith Randall <khr@golang.org>

2 years agocmd/compile: simplify fingerprint logic
Matthew Dempsky [Wed, 23 Mar 2022 19:22:50 +0000 (12:22 -0700)]
cmd/compile: simplify fingerprint logic

Historically, we sometimes recorded imports based on either package
path ("net/http") or object file path ("net/http.a"). But modern Go
build systems always use package path, and the extra ".a" suffix
doesn't mean anything anyway.

Change-Id: I6060ef8bafa324168710d152a353f4d8db062133
Reviewed-on: https://go-review.googlesource.com/c/go/+/395254
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agonet/netip: fix uses of "IPv4-mapped IPv6" in doc comments
Adam Pritchard [Fri, 25 Mar 2022 19:08:19 +0000 (19:08 +0000)]
net/netip: fix uses of "IPv4-mapped IPv6" in doc comments

The correct (or at least mostly commonly used) name for addresses of the
form ::ffff:192.0.2.128 is "IPv4-mapped IPv6". Some of the comments in
the netip package used that name, but others used "IPv6-mapped IPv4" or
"v6-mapped". This change makes the usage of the term consistent.

Change-Id: Ic01309ddf9252705a2387322d940b777e88800a5
GitHub-Last-Rev: 56044dcb97aeae1aa09bde635118ad46c979bbaf
GitHub-Pull-Request: golang/go#51950
Reviewed-on: https://go-review.googlesource.com/c/go/+/395914
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>

2 years agonet/mail: improve detection of charset errors
Russ Cox [Wed, 13 Jan 2021 15:53:48 +0000 (10:53 -0500)]
net/mail: improve detection of charset errors

The detection of the "unknown charset" case was too tailored
to one specific address parser. Make it generalize, so that custom
address parsers behave the same way as the default one
for character sets they do not handle.

Fixes #41625.

Change-Id: I347d4bb6844d0a1f23e908b776d21e8be5af3874
Reviewed-on: https://go-review.googlesource.com/c/go/+/283632
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile/internal/ir: remove NewClosureExpr
Cuong Manh Le [Fri, 25 Mar 2022 17:46:17 +0000 (00:46 +0700)]
cmd/compile/internal/ir: remove NewClosureExpr

The only usage of NewClosureExpr is inside NewClosureFunc, which is its
alternative version. So just remove NewClosureExpr and inline it there.

Change-Id: I1900f4fbb48d7b4f6e6a857f7f7760cd27302671
Reviewed-on: https://go-review.googlesource.com/c/go/+/395855
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2 years agonet/http/httptest: fix race in Server.Close
Maisem Ali [Mon, 21 Mar 2022 17:43:45 +0000 (17:43 +0000)]
net/http/httptest: fix race in Server.Close

When run with race detector the test fails without the fix.

Fixes #51799

Change-Id: I273adb6d3a2b1e0d606b9c27ab4c6a9aa4aa8064
GitHub-Last-Rev: a5ddd146a2a65f2e817eed5133449c79b3af2562
GitHub-Pull-Request: golang/go#51805
Reviewed-on: https://go-review.googlesource.com/c/go/+/393974
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

2 years agocmd/compile: handle sole component for 1-byte type interface conversion
Cuong Manh Le [Tue, 30 Nov 2021 17:28:25 +0000 (00:28 +0700)]
cmd/compile: handle sole component for 1-byte type interface conversion

For 1-byte type, we have a special case for converting to interface
type. But we missed an optimization for sole component-ed types, this CL
add that one.

goos: linux
goarch: amd64
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
Benchmark_BoolField-8     1000000000          0.6473 ns/op
Benchmark_ByteField-8     1000000000          0.6094 ns/op
Benchmark_Uint8Field-8    1000000000          0.6385 ns/op
Benchmark_Int16Field-8    785179434          1.481 ns/op
Benchmark_Int32Field-8    796127782          1.539 ns/op
Benchmark_Int64Field-8    718815478          1.657 ns/op

Fixes #49879

Change-Id: Idc0e9d3ff738c8c8081b8e8d65093dacf2bcf392
Reviewed-on: https://go-review.googlesource.com/c/go/+/367755
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: merge ANDconst and UBFX into UBFX on arm64
fanzha02 [Tue, 3 Nov 2020 09:31:04 +0000 (17:31 +0800)]
cmd/compile: merge ANDconst and UBFX into UBFX on arm64

Add a new rewrite rule to merge ANDconst and UBFX into
UBFX.

Add test cases.

Change-Id: I24d6442d0c956d7ce092c3a3858d4a3a41771670
Reviewed-on: https://go-review.googlesource.com/c/go/+/377054
Trust: Fannie Zhang <Fannie.Zhang@arm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agonet/http/httputil: ignore CloseNotify when a non-background context is present
Damien Neil [Fri, 7 Jan 2022 18:11:08 +0000 (10:11 -0800)]
net/http/httputil: ignore CloseNotify when a non-background context is present

If the http.Request passed to ReverseProxy.ServeHTTP has a context
with a non-nil Done channel, don't watch the ResponseWriter's
CloseNotify channel.

Avoids starting an extra background goroutine in the common case.

Change-Id: I1328f3e02d3025caa0f446a2f20dfc14ef604c64
Reviewed-on: https://go-review.googlesource.com/c/go/+/376415
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Damien Neil <dneil@google.com>

2 years agogo/types, types2: clean up a few typos, and an unused const
Robert Findley [Fri, 25 Feb 2022 23:51:48 +0000 (18:51 -0500)]
go/types, types2: clean up a few typos, and an unused const

Change-Id: I01717cc52c9728b4eaaf2c996707f59a113bff9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/395434
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agotest: compile source files as if from "test" module
Matthew Dempsky [Wed, 23 Mar 2022 21:24:26 +0000 (14:24 -0700)]
test: compile source files as if from "test" module

This CL updates test/run.go to compile xxx.dir/x.go with a package
path of "test/x" instead of just "x". This prevents collisions with
standard library packages.

It also requires updating a handful of tests to account for the
updated package paths.

Fixes #25693.

Change-Id: I49208c56ab3cb229ed667d547cd6e004d2175fcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/395258
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agoruntime: update framepointer_enabled doc
Romanos Skiadas [Wed, 23 Mar 2022 11:47:08 +0000 (13:47 +0200)]
runtime: update framepointer_enabled doc

Change-Id: I69e64ebf8c11145ce32aa4c11178e3a47d22fb84
Reviewed-on: https://go-review.googlesource.com/c/go/+/394915
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>

2 years agocmd/link: do not add label symbols for DWARF on Windows/ARM64
Cherry Mui [Wed, 23 Mar 2022 22:57:16 +0000 (18:57 -0400)]
cmd/link: do not add label symbols for DWARF on Windows/ARM64

Label symbols are only useful for relocations from text. No need
to do it for DWARF. And the PE symbol table doesn't like them.

May fix #51903.

Change-Id: Ibe6ea880d8533ba1dcc017030072c7dffee0e9e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/395215
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2 years agocmd/gofmt: return a proper error for empty Go files
Daniel Martí [Fri, 18 Mar 2022 10:57:02 +0000 (10:57 +0000)]
cmd/gofmt: return a proper error for empty Go files

I was testing edge cases in gofumpt, a fork of gofmt,
and noticed that gofmt will return a bare io error on empty files,
as demonstrated by the added test case without a fix:

        > ! exec $GOROOT/bin/gofmt empty.go nopackage.go
        [stderr]
        EOF
        nopackage.go:1:1: expected 'package', found not

The problem is the code that detects concurrent modifications.
It relies on ReadFull and correctly deals with io.ErrUnexpectedEOF,
but it did not pay attention to io.EOF, which can happen when size==0.

Change-Id: I6092391721edad4584fb5922d3e3a8fb3da86493
Reviewed-on: https://go-review.googlesource.com/c/go/+/393757
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Trust: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: clarify help message for -L flag
Robert Griesemer [Wed, 23 Mar 2022 20:29:43 +0000 (13:29 -0700)]
cmd/compile: clarify help message for -L flag

The file names reported in error messages by the compiler are
printed unchanged from the file names provided to the compiler;
the -L flag has no impact on the file names themselves, contrary
to what the old flag description suggested.

If an error is reported on a line that is affected by a //line
directive, an error message reports the file name and line as
controlled by the directive (i.e., the actual source position
is not known).

If the -L flag is provided, the actual source position is also
reported in square brackets.

This change documents this with an updated help string for the
flag.

For #36988.

Change-Id: I39ee35e6ff6cd5cfa44d87dabb05b8d78575d631
Reviewed-on: https://go-review.googlesource.com/c/go/+/395115
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2 years agocmd/compile: refactor walkIndexMap
Cuong Manh Le [Mon, 24 May 2021 05:15:17 +0000 (12:15 +0700)]
cmd/compile: refactor walkIndexMap

So all runtime map functions will use the same code path, make it easier
for future CL to handle stack object for map key.

Passes toolstash -cmp.

For #43753

Change-Id: I374fa4e351c1eba079e2ccb637b1ef5adad1488f
Reviewed-on: https://go-review.googlesource.com/c/go/+/321713
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agotest: remove unused oldescape_linkname.dir directory
Matthew Dempsky [Wed, 23 Mar 2022 23:06:19 +0000 (16:06 -0700)]
test: remove unused oldescape_linkname.dir directory

CL 187617 removed oldescape_linkname.go, but forgot to remove this
directory too.

Change-Id: I6d208c4d96d636b3df93adec1ee22fe1d4f5f61d
Reviewed-on: https://go-review.googlesource.com/c/go/+/395259
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agotest: remove obsolete test case that misuses -p
Matthew Dempsky [Fri, 18 Mar 2022 19:37:56 +0000 (12:37 -0700)]
test: remove obsolete test case that misuses -p

bug302 compiles p.go with -p=p, and then manually creates a pp.a
archive, and imports it as both "p" and "pp". This is a misuse of
cmd/compile's -p flag, and it isn't representative of how any actual
Go build systems work anyway.

This test made sense back when cmd/compile still wrote out bare object
files, which was then split into separate __.PKGDEF and _go_.o archive
entries when added to a pack archive. But since CL 102236, cmd/compile
always writes out pack files.

Updates #51734.

Change-Id: I4b5de22d348ecc0a72c98b512351c2d267c77736
Reviewed-on: https://go-review.googlesource.com/c/go/+/393896
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agotest: use dot-relative imports where appropriate
Matthew Dempsky [Wed, 23 Mar 2022 22:09:31 +0000 (15:09 -0700)]
test: use dot-relative imports where appropriate

Currently, run.go's *dir tests allow "x.go" to be imported
interchangeably as either "x" or "./x". This is generally fine, but
can cause problems when "x" is the name of a standard library
package (e.g., "fixedbugs/bug345.dir/io.go").

This CL is an automated rewrite to change all `import "x"` directives
to use `import "./x"` instead. It has no effect today, but will allow
subsequent CLs to update test/run.go to resolve "./x" to "test/x" to
avoid stdlib collisions.

Change-Id: Ic76cd7140e83b47e764f8a499e59936be2b3c876
Reviewed-on: https://go-review.googlesource.com/c/go/+/395116
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agocmd/compile: update riscv64 CALL* ops
Meng Zhuo [Sun, 31 Oct 2021 13:16:15 +0000 (21:16 +0800)]
cmd/compile: update riscv64 CALL* ops

This CL allow the CALL ops to take variable number of arguments.

Change-Id: If84bb306c2f23a0a934e31dfeabbca7bed0c1796
Reviewed-on: https://go-review.googlesource.com/c/go/+/360216
Trust: mzh <mzh@golangcn.org>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agocmd/compile/internal/types: simplify AllowsGoVersion
Cuong Manh Le [Wed, 23 Mar 2022 10:13:38 +0000 (17:13 +0700)]
cmd/compile/internal/types: simplify AllowsGoVersion

After CL 394556, only LocalPkg is passed to AllowsGoVersion, so simplify
the code to not depend on Pkg anymore.

Change-Id: I8f9bfd4090100eec60cf3959c0d8fa92a26fc32a
Reviewed-on: https://go-review.googlesource.com/c/go/+/394954
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2 years agocmd/compile: remove types.Field.{Broken,SetBroken}
Cuong Manh Le [Tue, 22 Mar 2022 18:27:11 +0000 (01:27 +0700)]
cmd/compile: remove types.Field.{Broken,SetBroken}

SetBroken is never called and Broken always returns false.

Updates #51691

Change-Id: I7e3fd3f2121268596d2e93a28c69e895bcf802ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/394558
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile/internal/types: remove anyBroke
Cuong Manh Le [Tue, 22 Mar 2022 18:25:45 +0000 (01:25 +0700)]
cmd/compile/internal/types: remove anyBroke

anyBroke now always return false, we can get rid of it.

Updates #51691

Change-Id: Idab5bc9f9f222cc63e50bdde2b23b9404a4bd74e
Reviewed-on: https://go-review.googlesource.com/c/go/+/394557
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: remove AllowsGoVersion checks in old typechecker
Cuong Manh Le [Tue, 22 Mar 2022 18:20:11 +0000 (01:20 +0700)]
cmd/compile: remove AllowsGoVersion checks in old typechecker

types2 handles those checks instead.

The only exception is noder.checkEmbed, since when types2
have not known about "//go:embed" pragma yet.

Updates #51691

Change-Id: I74ded03536023fe838f23fa7421e04513f904f66
Reviewed-on: https://go-review.googlesource.com/c/go/+/394556
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2 years agocmd/compile: remove typecheck.FuncBody
Cuong Manh Le [Tue, 22 Mar 2022 13:57:19 +0000 (20:57 +0700)]
cmd/compile: remove typecheck.FuncBody

CL 388535 removed the only usage of this function.

Change-Id: Ie5a61cce75b03d83162f62989fe52388b069c9bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/394576
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: remove ir.Node.SetDiag
Cuong Manh Le [Tue, 22 Mar 2022 13:55:38 +0000 (20:55 +0700)]
cmd/compile: remove ir.Node.SetDiag

And use base.Fatalf in code that use n.SetDiag(true) instead.

Updates #51691

Change-Id: Ib3c0b9c89b8d95717391cbe7d424240e288ada1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/394575
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: remove types.Type.SetBroken
Cuong Manh Le [Tue, 22 Mar 2022 13:43:43 +0000 (20:43 +0700)]
cmd/compile: remove types.Type.SetBroken

And use base.Fatalf in code that use t.SetBroke(true) instead.

Updates #51691

Change-Id: I9f3613379dd82d0dd069cdf7b61cbb281810e2e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/394574
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: remove reportTypeLoop
Cuong Manh Le [Tue, 22 Mar 2022 13:25:37 +0000 (20:25 +0700)]
cmd/compile: remove reportTypeLoop

reportTypeLoop used to be used to report invalid recursive types in old
typechecker.

However, types2 now reports this error, so this can be removed.

Updates #51691

Change-Id: I5e73369dadafb0cc56e682668b32cbd1e1210f2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/394554
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agogo/types, types2: report struct type for literals with too few/many elements
Robert Griesemer [Wed, 23 Mar 2022 04:28:32 +0000 (21:28 -0700)]
go/types, types2: report struct type for literals with too few/many elements

This change essentially matches the 1.17 compiler error message for
this error.

Fixes #51877.

Change-Id: I24ec2f9cc93d8cd2283d097332a39bc1a0eed3a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/394914
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agodebug/gosym: skip non-real functions in LineToPC lookup
Cherry Mui [Wed, 23 Mar 2022 16:02:36 +0000 (12:02 -0400)]
debug/gosym: skip non-real functions in LineToPC lookup

The code iterates through the func table to find a function with
a given file and line number. The code panics if it sees a non-
real function (e.g. go.buildid), because its CU offset is -1,
which causes an index-out-of-bounds error. The debug/gosym package
recovers the panic and returns "not found", without looping
through the rest of the entries.

Skip the non-real functions. They cannot be looked up by line
number anyway.

Fixes #51890.

Change-Id: I96f64c17b4a53ffdce047c8244b35a402a0d39ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/395074
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2 years agocmd/compile: don't mark non-generic defined type symbol dupok
Cherry Mui [Tue, 22 Mar 2022 00:07:06 +0000 (20:07 -0400)]
cmd/compile: don't mark non-generic defined type symbol dupok

For a non-generic defined type, we generate its type descriptor
symbol only in the defining package. So there is no duplicate and
it doesn't need to be dupok.

For unnamed types and instantiated types, the type descriptor can
be generated in multiple packages and so still need to be dupok.

Change-Id: I92ed68c998ad68c5917b77b1dfd62eac4ced6bcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/394636
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2 years agocmd/compile: default to -p=main for main package
Cherry Mui [Tue, 22 Mar 2022 21:08:56 +0000 (17:08 -0400)]
cmd/compile: default to -p=main for main package

With the previous CL the compiler emits an unlinkable object if
the -p flag is not specified. It is actually okay (and convenient)
to omit the -p flag for (just) the main package. This CL makes it
so.

Change-Id: I978d54d14c45b3bb9ed7471e40a2c47f269b56f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/394834
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2 years agogo/types, types2: remove uses of "type list" and "operational type" (cleanup)
Robert Griesemer [Tue, 22 Mar 2022 19:49:09 +0000 (12:49 -0700)]
go/types, types2: remove uses of "type list" and "operational type" (cleanup)

Fixes #49193.

Change-Id: Ief31ea6b3dddf9452efb94763c89b8639aa3ce9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/394656
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile/internal/importer: key tparams by Package instead of pkgname
Robert Findley [Mon, 21 Mar 2022 20:08:38 +0000 (16:08 -0400)]
cmd/compile/internal/importer: key tparams by Package instead of pkgname

The importer type param index used package name type parameter key,
causing type parameters to be reused/overwritten if two packages in the
import graph had the same combination of (name, declaration name, type
parameter name).

Fix this by instead using the *Package in the key.

Fixes #51836

Change-Id: I881ceaf3cf7c1ab4e0835962350feb552e79b233
Reviewed-on: https://go-review.googlesource.com/c/go/+/394219
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agoruntime/pprof: rerun magnitude test on failure
Rhys Hiltner [Fri, 18 Mar 2022 18:36:39 +0000 (11:36 -0700)]
runtime/pprof: rerun magnitude test on failure

Restructure TestCPUProfileMultithreadMagnitude so it will run again with
a longer duration on failure. Log the split between the user vs system
CPU time that rusage reports.

For #50232

Change-Id: Ice5b38ee7594dbee1eaa5686d32b968c306e3e85
Reviewed-on: https://go-review.googlesource.com/c/go/+/393934
Run-TryBot: Rhys Hiltner <rhys@justin.tv>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>

2 years agocmd/link: write output in temp dir in TestUnlinkableObj
Cherry Mui [Tue, 22 Mar 2022 20:38:13 +0000 (16:38 -0400)]
cmd/link: write output in temp dir in TestUnlinkableObj

For unlinkable object the link will fail, but it opens the output
file in writable mode first then delete it on failure. This fails
if the current directory is not writable. Write to the temporary
directory instead.

Change-Id: Iefd73b5cc8efdc0f11b12edc0920169a8ad3f37c
Reviewed-on: https://go-review.googlesource.com/c/go/+/394755
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agoruntime: make static/dynamic startup detection work with musl on ppc64le
Paul E. Murphy [Tue, 22 Mar 2022 16:52:02 +0000 (11:52 -0500)]
runtime: make static/dynamic startup detection work with musl on ppc64le

The glibc loader explicitly sets the first doubleword on the stack (R1)
to $0 to indicate it was dynamically loaded.

An ELFv2 ABI compliant loader will set R3/R4 to argc/argv when starting
the process, and R13 to TLS. musl is not compliant. Instead it passes
argc/argv like the kernel, but R3/R4 are in an undefined state and R13
is valid.

With the knowledge above, the startup code can be modified to
dynamically handle all three cases when linked internally.

Fixes #51787

Change-Id: I5de33862c161900d9161817388bbc13a65fdc69c
Reviewed-on: https://go-review.googlesource.com/c/go/+/394654
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Paul Murphy <murp@ibm.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>

2 years agoruntime: delete useless TPIDR macro on arm64
eric fang [Fri, 17 Dec 2021 08:26:06 +0000 (08:26 +0000)]
runtime: delete useless TPIDR macro on arm64

The TPIDR macro in tls_arm64.h is not used anywhere, so remove it
to reduce confusion.

Change-Id: I04aa5e64ee30753f28f43bc67b44559d81d093c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/373357
Trust: Eric Fang <eric.fang@arm.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2 years agocmd/link: simplify content hashed symbol handling
Cherry Mui [Mon, 21 Mar 2022 19:46:32 +0000 (15:46 -0400)]
cmd/link: simplify content hashed symbol handling

Symbol's content hash used to depend on package path expansion in
symbol names, so we have special logic handling hashed symbols
when path expansion is needed. As we required -p in the compiler
the symbol names are now fully expanded. Remove that logic.

Change-Id: I888574f63ea3789455d96468a6abd500e0958230
Reviewed-on: https://go-review.googlesource.com/c/go/+/394218
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile, cmd/link: produce unlinkable object when compile without -p
Cherry Mui [Mon, 21 Mar 2022 17:45:50 +0000 (13:45 -0400)]
cmd/compile, cmd/link: produce unlinkable object when compile without -p

CL 391014 requires the compiler to be invoked with the -p flag, to
specify the package path. People are used to run "go tool compile"
from the command line with the -p flag. This is mostly for simple
testing, or debugging the compiler. The produced object file is
almost never intended to be linked.

This CL makes the compiler allow "go tool compile" without the -p
flag again. It will produce an unlinkable object. If the linker
sees such an object it will error out.

Change-Id: I7bdb162c3cad61dadd5c456d903b92493a3df20f
Reviewed-on: https://go-review.googlesource.com/c/go/+/394217
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: add short self-link to ABI spec
Austin Clements [Tue, 22 Mar 2022 16:44:01 +0000 (12:44 -0400)]
cmd/compile: add short self-link to ABI spec

This makes the short link discoverable.

Change-Id: I9a2f091652bc096feebbbd79a854aa68efe702bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/394634
Trust: Austin Clements <austin@google.com>
Reviewed-by: Eli Bendersky‎ <eliben@golang.org>
2 years agoA+C: change email of Ben Shi (individual CLA)
Ben Shi [Tue, 22 Mar 2022 14:29:39 +0000 (14:29 +0000)]
A+C: change email of Ben Shi (individual CLA)

Change-Id: Icff75d5fbbeae7aa5003a848ea49b79ddde9933a
GitHub-Last-Rev: 489a69fc6bb02a57689a43ae8fb718e5e0177ae6
GitHub-Pull-Request: golang/go#51869
Reviewed-on: https://go-review.googlesource.com/c/go/+/394595
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Mui <cherryyz@google.com>

2 years agonet/http: fix nil body causing ParseMultipartForm to panic
hopehook [Wed, 9 Feb 2022 12:20:06 +0000 (20:20 +0800)]
net/http: fix nil body causing ParseMultipartForm to panic

ParseMultipartForm relies on a valid multipartReader, if the request body is nil,
the multipartReader should return an error. This way ParseMultipartForm can return
an error instead of causing mr.ReadForm(maxMemory) to panic

Fixes #48206

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

2 years agoos: skip TestOpenFileLimit on openbsd/mips64
Ian Lance Taylor [Sun, 20 Mar 2022 16:32:00 +0000 (09:32 -0700)]
os: skip TestOpenFileLimit on openbsd/mips64

For #46279
For #51713

Change-Id: I444f309999bf5576449a46a9808b23cf6537e7dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/394094
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
2 years agocmd/link: delete oReader.flags
Cherry Mui [Mon, 21 Mar 2022 19:15:40 +0000 (15:15 -0400)]
cmd/link: delete oReader.flags

Same information is provided from the fields of the embedded
goobj.Reader, and are accessed through it. Delete the flags field.

Change-Id: I7a4f5dca054e567443d719b2931fceff231d6efc
Reviewed-on: https://go-review.googlesource.com/c/go/+/394216
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2 years agogo/types, types: add additional generic cases for the Selections API
Robert Findley [Tue, 8 Mar 2022 21:16:49 +0000 (16:16 -0500)]
go/types, types: add additional generic cases for the Selections API

Change-Id: Icc5240db7447846061d0d81f5e15f788758d4d64
Reviewed-on: https://go-review.googlesource.com/c/go/+/393372
Trust: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/link: add DT_NEEDED for all 64-bit ELF dynimplib
Byoungchan Lee [Thu, 25 Nov 2021 11:40:21 +0000 (20:40 +0900)]
cmd/link: add DT_NEEDED for all 64-bit ELF dynimplib

Also change the relevant test to be tested on the linux-arm64 platform
as well.

Fixes #49789

Change-Id: Id2eac7a45279f037957442862f8ed63838b8e929
Reviewed-on: https://go-review.googlesource.com/c/go/+/366855
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agoruntime: combine wbuf checks in tryGetFast and putFast
Jakub Ciolek [Fri, 18 Mar 2022 08:10:02 +0000 (09:10 +0100)]
runtime: combine wbuf checks in tryGetFast and putFast

Less text and improves codegen a bit.

compilecmp on ARM64:

runtime
(*gcWork).putFast 160 -> 144  (-10.00%)
(*gcWork).tryGetFast 144 -> 128  (-11.11%)
scanobject 784 -> 752  (-4.08%)
greyobject 800 -> 784  (-2.00%)

AMD64:

runtime
greyobject 765 -> 748  (-2.22%)
(*gcWork).tryGetFast 102 -> 85  (-16.67%)
scanobject 837 -> 820  (-2.03%)
(*gcWork).putFast 102 -> 89  (-12.75%)

Change-Id: I6bb508afe1ba416823775c0bfc08ea9dc21de8a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/393754
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>

2 years agocmd/gofmt: don't descend into /testdata directories in tests (fix long builders)
Robert Griesemer [Mon, 21 Mar 2022 21:37:38 +0000 (14:37 -0700)]
cmd/gofmt: don't descend into /testdata directories in tests (fix long builders)

Now that the go/types and types2 test files end in .go we must
avoid trying to format them as that won't work in general.

Change-Id: I05fdd95a0d26cbe746f6d618b22b48dc1f1ea749
Reviewed-on: https://go-review.googlesource.com/c/go/+/394295
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agogo/types, types2: add an assertion that named type origin is idempotent
Robert Findley [Wed, 16 Mar 2022 20:52:30 +0000 (16:52 -0400)]
go/types, types2: add an assertion that named type origin is idempotent

For #46794

Change-Id: I19edc19640a2dfa6bc7504dd8e1742a261ba29f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/393368
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: replace Type.OrigSym with Type.OrigType
Matthew Dempsky [Mon, 21 Mar 2022 17:06:48 +0000 (10:06 -0700)]
cmd/compile: replace Type.OrigSym with Type.OrigType

First law of cmd/compile frontend development: thou shalt not rely on
types.Sym.

This CL replaces Type.OrigSym with Type.OrigType, which semantically
matches what all of the uses within the frontend actually care about,
and avoids using types.Sym, which invariably leads to mistakes because
symbol scoping in the frontend doesn't work how anyone intuitively
expects it to.

Fixes #51765.

Change-Id: I4affe6ee0718103ce5006ab68aa7e1bb0cac6881
Reviewed-on: https://go-review.googlesource.com/c/go/+/394274
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agogo/types, types2: remove predecl. test functions from ordinary tests
Robert Griesemer [Fri, 18 Mar 2022 00:35:11 +0000 (17:35 -0700)]
go/types, types2: remove predecl. test functions from ordinary tests

The type checker implements additional built-in functions (assert
and trace) that are useful for debugging. Only permit them in
manual tests (go test -run Manual), not for other tests where they
are not needed.

Change-Id: Idc7723d9e3f6b2c27769b34743561e9d0339565c
Reviewed-on: https://go-review.googlesource.com/c/go/+/393659
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agogo/types, types2: rename testfile suffixes from .src to .go
Robert Griesemer [Fri, 18 Mar 2022 00:15:38 +0000 (17:15 -0700)]
go/types, types2: rename testfile suffixes from .src to .go

Also, manually renamed some irregularly numbered files to
make their file names more regular.

With this rename, all test files now end uniformly in .go.

go fmt doesn't descend into testdata directories, so this
is fine and makes all test files behave like regular .go
files in editors with Go language support.

Change-Id: I3abde32c35c494b94b17787788cd3d7e35662296
Reviewed-on: https://go-review.googlesource.com/c/go/+/393658
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agogo/types, types2: rename testfile suffixes from .go2 to .go
Robert Griesemer [Thu, 17 Mar 2022 23:46:18 +0000 (16:46 -0700)]
go/types, types2: rename testfile suffixes from .go2 to .go

We don't need the distinction anymore.
Also, made corresponding adjustments to check_test.go.

Change-Id: I3c9a768c16a251d76bc6b3ebabd37822773e4ef5
Reviewed-on: https://go-review.googlesource.com/c/go/+/393657
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agogo/types, types2: use new flag mechanims to handle importC test
Robert Griesemer [Thu, 17 Mar 2022 21:04:37 +0000 (14:04 -0700)]
go/types, types2: use new flag mechanims to handle importC test

Change-Id: I6f0cb850ee23184380c03a53c12425c350aa16e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/393714
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agogo/types, types2: implement flexible flag-setting mechanism for tests
Robert Griesemer [Thu, 17 Mar 2022 01:19:31 +0000 (18:19 -0700)]
go/types, types2: implement flexible flag-setting mechanism for tests

Use it so set the language version. Adjust relevant tests.

Fixes #49074.

Change-Id: Ida6d0002bdba65b5add6e8728a1700305de18351
Reviewed-on: https://go-review.googlesource.com/c/go/+/393514
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agogo/types, types2: remove mechanism to exclude tests for unified build
Robert Griesemer [Wed, 16 Mar 2022 22:17:36 +0000 (15:17 -0700)]
go/types, types2: remove mechanism to exclude tests for unified build

The unified build will become the norm and the excluded tests run now.

Change-Id: I0f0873eb73483a4f04736d167d2eb796ee8a857b
Reviewed-on: https://go-review.googlesource.com/c/go/+/393438
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2 years agogo/types, types2: improved tracing output throughout (debugging support)
Robert Griesemer [Thu, 24 Feb 2022 21:10:34 +0000 (13:10 -0800)]
go/types, types2: improved tracing output throughout (debugging support)

This change fine-tunes tracing output and adds additional
descriptions for delayed actions that were missing tracing.

Change-Id: Ib5e70e8f40ef564194cdb0e8d12c38e15388b987
Reviewed-on: https://go-review.googlesource.com/c/go/+/387919
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agogo/types, types2: ensure we have a fully resolved type in validType
Robert Griesemer [Wed, 16 Mar 2022 21:09:56 +0000 (14:09 -0700)]
go/types, types2: ensure we have a fully resolved type in validType

This addresses a situation where Named.fromRHS is nil which
is causing validType to panic when the debug flag is set.

Change-Id: Ie1af3f4d412efc2ce2ee7707af5375ed130a1f2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/393436
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agogo/types, types2: better error msg when using fallthrough in type switch
Robert Griesemer [Mon, 14 Mar 2022 21:05:53 +0000 (14:05 -0700)]
go/types, types2: better error msg when using fallthrough in type switch

Fixes #51533.

Change-Id: Ia41a2e96d1ef94f740887e3167e6396e4f52035c
Reviewed-on: https://go-review.googlesource.com/c/go/+/392759
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agogo/types, types2: re-enable panic if unification stack-overflows
Robert Griesemer [Mon, 14 Mar 2022 20:26:42 +0000 (13:26 -0700)]
go/types, types2: re-enable panic if unification stack-overflows

With all the unification/type-inference fixes in place now, we
should not see stack overflows anymore. Re-enable the panic if
we do overflow, so we can address those issues should they arise.

Fixes #51377.

Change-Id: Ied64435ea5936811504cb30bda1126c7d85980f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/392755
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agogo/types, types2: alias type declarations may refer to constraint types
Robert Griesemer [Mon, 14 Mar 2022 19:10:11 +0000 (12:10 -0700)]
go/types, types2: alias type declarations may refer to constraint types

Fixes #51616.

Change-Id: I388a6d91d9bfe5410b5eb32e1606257ec668d618
Reviewed-on: https://go-review.googlesource.com/c/go/+/392715
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agogo/types, types2: factor out isInterface(x) && !isTypeParam(x) (cleanup)
Robert Griesemer [Fri, 11 Mar 2022 05:50:54 +0000 (21:50 -0800)]
go/types, types2: factor out isInterface(x) && !isTypeParam(x) (cleanup)

Fixes #51581.

Change-Id: I3232428edd7dd86f2930af950fb5841f7394c4e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/391834
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agocmd/compile/internal/types: remove Sym.Block and Sym.Lastlineno
Matthew Dempsky [Mon, 21 Mar 2022 18:24:24 +0000 (11:24 -0700)]
cmd/compile/internal/types: remove Sym.Block and Sym.Lastlineno

These fields were used for tracking the last scope/position that an
identifier was declared, so that we could report redeclaration
errors. However, redeclaration errors are now diagnosed by types2 (and
typecheck.Redeclared was removed in CL 388537), so these fields can be
safely pruned.

Updates #51691.

Change-Id: Ifd5ea3f6795fadb420913298d59287c95e4669a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/394276
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2 years agobuild: force GOWORK=off in make.{bash,bat,rc}
Dmitri Shuralyov [Fri, 18 Mar 2022 23:57:43 +0000 (19:57 -0400)]
build: force GOWORK=off in make.{bash,bat,rc}

While building Go from source, workspace mode should be disabled,
even if the external environment tries to configure it otherwise.

Fixes #51558.

Change-Id: Icd7577860271f59a8f94406214b111280e4b65b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/393879
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

2 years agocmd/link: set alignment of compressed section based on arch
Meng Zhuo [Fri, 18 Mar 2022 09:36:52 +0000 (17:36 +0800)]
cmd/link: set alignment of compressed section based on arch

The ELF compression header(Chdr) has Addralign field that is set to the
alignment of the uncompressed section which makes section able to have
a different alignment than the decompressed section. However `file` and
other tools require both Chdr.Addralign and Addralign to be equal.

Ref https://sourceware.org/bugzilla/show_bug.cgi?id=23919
Related #42136

Fixes #51769

Change-Id: I3cf99dbd2359932576420a3c0d342c7e91b99227
Reviewed-on: https://go-review.googlesource.com/c/go/+/393916
Trust: mzh <mzh@golangcn.org>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Fangrui Song <maskray@google.com>
2 years agointernal/abi, internal/buildcfg: always enable register ABI on PPC64
Cherry Mui [Fri, 18 Mar 2022 22:23:44 +0000 (18:23 -0400)]
internal/abi, internal/buildcfg: always enable register ABI on PPC64

In last cycle we developed register ABI for ARM64, enabled by
default as a GOEXPERIMENT. This cycle we turn it on all the time.
Later CLs will clean up fallback code.

Change-Id: Idac4dcff634791cbc3d30988052ecd742b55ab8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/394214
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2 years agocmd/vendor: update golang.org/x/tools to c717623e3197
Cherry Mui [Mon, 21 Mar 2022 17:44:17 +0000 (13:44 -0400)]
cmd/vendor: update golang.org/x/tools to c717623e3197

To pick up CL 394234.

Done by
go get -d golang.org/x/tools@c717623e3197
go mod tidy
go mod vendor

Change-Id: Ic67a7deb9a22b2679eec895210168f698d8d05eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/394275
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2 years agocmd/compile: fix panic with nested dead hidden closures
Cuong Manh Le [Mon, 21 Mar 2022 11:49:37 +0000 (18:49 +0700)]
cmd/compile: fix panic with nested dead hidden closures

CL 342350 fixed deadcode panic with dead hidden closures. However, a
closure may contains nested dead hidden closures, so we need to mark
them dead as well.

Fixes #51839

Change-Id: Ib54581adfc1bdea60e74d733cd30fd8e783da983
Reviewed-on: https://go-review.googlesource.com/c/go/+/394079
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>