]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
21 months agomisc/cgo/testcarchive: permit SIGQUIT for TestSignalForwardingExternal
Ian Lance Taylor [Fri, 19 Aug 2022 21:43:47 +0000 (14:43 -0700)]
misc/cgo/testcarchive: permit SIGQUIT for TestSignalForwardingExternal

Occasionally the signal will be sent to a Go thread, which will cause
the program to exit with SIGQUIT rather than SIGSEGV.

Add TestSignalForwardingGo to test the case where the signal is
expected to be delivered to a Go thread.

This is a roll forward of CL 419014 which was rolled back in CL 424954.
This CL differs from 419014 in that it skips TestSignalForwardingGo
on darwin-amd64.

Fixes #53907

Change-Id: I5df3fd610c068df3bd48d9b3d7a9379248b97999
Reviewed-on: https://go-review.googlesource.com/c/go/+/425002
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

21 months agodebug/pe: fetch section size directly in (*Section).Data
Ian Lance Taylor [Wed, 17 Aug 2022 03:45:59 +0000 (20:45 -0700)]
debug/pe: fetch section size directly in (*Section).Data

Change-Id: Idc1f8b3fb6b4b2fdcc6dade048cc14c53715319f
Reviewed-on: https://go-review.googlesource.com/c/go/+/424197
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
21 months agogo/internal/gcimporter: use saferio to read indexed data
Ian Lance Taylor [Tue, 12 Jul 2022 01:50:03 +0000 (18:50 -0700)]
go/internal/gcimporter: use saferio to read indexed data

Avoid allocating large amounts of memory for corrupt input.

No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.

Fixes #53787

Change-Id: I1b75a4c000b8d1112110309ec44b0ba9b4638d71
Reviewed-on: https://go-review.googlesource.com/c/go/+/416861
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dan Kortschak <dan@kortschak.io>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
21 months agodebug/plan9obj: use saferio to read section data
Ian Lance Taylor [Sat, 25 Jun 2022 22:28:15 +0000 (15:28 -0700)]
debug/plan9obj: use saferio to read section data

Avoid allocating large amounts of memory for corrupt input.

No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.

Fixes #52521

Change-Id: I6a046f2e28e1255cf773ce135c5bb2b967ef43e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/414234
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dan Kortschak <dan@kortschak.io>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
21 months agobytes, strings: s/after/before/ in CutSuffix
Michal Bohuslávek [Thu, 18 Aug 2022 09:02:38 +0000 (11:02 +0200)]
bytes, strings: s/after/before/ in CutSuffix

This follows on CL 407176 which added this function (in both
packages). This CL makes it consistent with the Cut function,
which uses “before” and “after” in return variable names.

Change-Id: Id4345d2fe0f50bf301a880803e87bf356986b518
Reviewed-on: https://go-review.googlesource.com/c/go/+/424922
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
21 months agoruntime/pprof: check Getrusage return value in addMaxRSS
Tobias Klauser [Thu, 18 Aug 2022 17:15:51 +0000 (19:15 +0200)]
runtime/pprof: check Getrusage return value in addMaxRSS

Depending on the implementation of the getrusage syscall/function, the
value of rusage.Maxrss may be undefined in case of an error. Thus, only
report MaxRSS in case of no error.

Change-Id: I7572ccc53c49eb460e53bded3eb41736eed8d2ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/424815
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
21 months agoruntime/pprof: report MaxRSS on windows
Tobias Klauser [Thu, 18 Aug 2022 17:15:20 +0000 (19:15 +0200)]
runtime/pprof: report MaxRSS on windows

Use GetProcessMemoryInfo to report MaxRSS in memory profiles on windows.

Change-Id: I4ac5fe58961b1d5da8a5c1caa8a6e3d0a3281837
Reviewed-on: https://go-review.googlesource.com/c/go/+/424414
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months agogo/types: match types2 errors for incorrect method receiver count
Robert Griesemer [Fri, 19 Aug 2022 03:16:15 +0000 (20:16 -0700)]
go/types: match types2 errors for incorrect method receiver count

Use "method has no receiver" and "method has multiple receivers"
in error messages for invalid receiver counts, matching the
corresponding types2 errors.

For #54511.

Change-Id: I96fc99440d6206c74e9416069db052234baa8248
Reviewed-on: https://go-review.googlesource.com/c/go/+/424934
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
21 months agogo/types: match types2 errors for missing index expressions
Robert Griesemer [Fri, 19 Aug 2022 00:25:58 +0000 (17:25 -0700)]
go/types: match types2 errors for missing index expressions

Use "middle" and "final" rather than "2nd" and "3rd" in error messages
for invalid slice expressions. This is the original compiler error
message and many tests check for this specific message.

For #54511.

Change-Id: I86eb739aa7218b7f393fab1ab402732cb9e9a1f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/424906
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
21 months agogo/types: match types2 error for invalid map key
Robert Griesemer [Thu, 18 Aug 2022 23:59:10 +0000 (16:59 -0700)]
go/types: match types2 error for invalid map key

Use "invalid" rather than "incomparable" in error message for map key
types that are not comparable. This is the original compiler error
message and many tests check for this specific message. The type
checker does provide an additional explanation if the reason for
the error is not obvious (e.g. for type parameters).

For #54511.

Change-Id: Idb76c48b4dfbfd66a7deac728a552e07f14e06d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/424905
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
21 months agogo/parser: match const/var decl parsing of syntax package
Robert Griesemer [Thu, 18 Aug 2022 23:42:28 +0000 (16:42 -0700)]
go/parser: match const/var decl parsing of syntax package

Use same approach to parsing const and var declarations
as the syntax package. Specifically, don't complain if
the first const specification in a const declaration
doesn't have a type and initialization expression. This
removes some duplicate errors when combined with the
type checker.

Adjust corresponding type checker tests accordingly.

For #54511.

Change-Id: I96702eba51dda6b581dad44577a7f93e4c02c857
Reviewed-on: https://go-review.googlesource.com/c/go/+/424904
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>

21 months agoRevert "misc/cgo/testcarchive: permit SIGQUIT for TestSignalForwardingExternal"
Cuong Manh Le [Fri, 19 Aug 2022 13:42:38 +0000 (13:42 +0000)]
Revert "misc/cgo/testcarchive: permit SIGQUIT for TestSignalForwardingExternal"

This reverts CL 419014.

Reason for revert: broke darwin-amd64 builders

Change-Id: I77838e696a55c415d322ebb9846503de25b546d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/424954
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joedian Reid <joedian@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
21 months agoruntime: fix a typo in comment of netpollblock()
Andy Pan [Fri, 19 Aug 2022 17:36:14 +0000 (01:36 +0800)]
runtime: fix a typo in comment of netpollblock()

Change-Id: Ia00acf248f3498d75e2451548f82d3c57cfed06f
Reviewed-on: https://go-review.googlesource.com/c/go/+/424995
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months agogo/parser: fix spelling in error message
Robert Griesemer [Thu, 18 Aug 2022 22:40:23 +0000 (15:40 -0700)]
go/parser: fix spelling in error message

Make spelling consistent with uses in other error messages.

Change-Id: I584cd22413842fb8bae1632ed34c8b0e7ef163cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/424902
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
21 months agogo/types: remove machinery to select parsing mode (cleanup)
Robert Griesemer [Thu, 18 Aug 2022 22:21:18 +0000 (15:21 -0700)]
go/types: remove machinery to select parsing mode (cleanup)

All code may be generic. Remove machinery to select parsing
mode (generic vs non-generic) since the parser doesn't support
this anymore. Adjust tests to more closely match corresponding
types2 code.

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

21 months agogo/parser: remove (internal) ability to disable generic code
Robert Griesemer [Thu, 18 Aug 2022 19:54:28 +0000 (12:54 -0700)]
go/parser: remove (internal) ability to disable generic code

Generics are part of the language now; there's no need anymore
to switch back to a syntax without generics. Remove the associated
machinery and adjust short tests accordingly.

Change-Id: I6b16c5c75fd9354ee87e3b9bee110f49f514565a
Reviewed-on: https://go-review.googlesource.com/c/go/+/424857
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
21 months agogo/parser: remove import path string syntax checking
Robert Griesemer [Thu, 18 Aug 2022 19:21:01 +0000 (12:21 -0700)]
go/parser: remove import path string syntax checking

The validity of an import path string is checked by the type checker
(and possibly other tools); it doesn't need to be done by the parser.
Remove the respective code and tests.

Also, adjust a corresponding go/types test which resolves a TODO.

For #54511.

Change-Id: Id1fc80df4e3e83be3ef123da3946ccb8f759779f
Reviewed-on: https://go-review.googlesource.com/c/go/+/424855
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
21 months agocmd/compile/internal/types2: match go/types for "..." related error msg
Robert Griesemer [Thu, 18 Aug 2022 17:40:31 +0000 (10:40 -0700)]
cmd/compile/internal/types2: match go/types for "..." related error msg

For #54511.

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

21 months agocmd/compile/internal/types2: use go/types/testdata/examples tests
Robert Griesemer [Thu, 18 Aug 2022 03:45:08 +0000 (20:45 -0700)]
cmd/compile/internal/types2: use go/types/testdata/examples tests

Since the examples tests are now identical between the two type checkers,
remove the local copy of the examples tests and (for now) use the tests
in go/types/testdata/examples instead. Eventually we may decide to move
all tests out of the type checker directories and place them in a
shared space (e.g. internal/types/testdata).

For #54511.

Change-Id: Ibd8599d09e781b2219a23114b4b2049757971181
Reviewed-on: https://go-review.googlesource.com/c/go/+/424695
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>

21 months agogo/types: remove TODO in testdata/examples/types.go
Robert Griesemer [Thu, 18 Aug 2022 03:38:39 +0000 (20:38 -0700)]
go/types: remove TODO in testdata/examples/types.go

Follow-up on CL 424674. With this change, the files in
testdata/examples are identical to the corresponding
files for types2.

For #54511.

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

21 months agogo/parser: disallow parenthesizing embedded types in structs
Robert Griesemer [Thu, 18 Aug 2022 03:11:57 +0000 (20:11 -0700)]
go/parser: disallow parenthesizing embedded types in structs

This was never permitted in Go but the flexibility to do so
was introduced through the generics prototype code where we
experimented with parentheses to enclose type parameters.
Restore original (pre-generics) behavior.

Fixes #51655.

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

21 months agoruntime/internal/atomic: remove double-check in kernelcas on linux/arm
Tobias Klauser [Thu, 18 Aug 2022 09:49:39 +0000 (11:49 +0200)]
runtime/internal/atomic: remove double-check in kernelcas on linux/arm

Older kernels which require the double check of the __kuser_cmpxchg
result are no longer supported as of Go 1.18 which requires at least
Linux 2.6.32.

For #45964

Change-Id: Ic3d6691bf006353ac51b9d43e742d970e3d4e961
Reviewed-on: https://go-review.googlesource.com/c/go/+/424556
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
21 months agoio: add OffsetWriter, NewOffsetWriter
hopehook [Tue, 17 May 2022 03:24:03 +0000 (11:24 +0800)]
io: add OffsetWriter, NewOffsetWriter

Offsetwriter refers to the design of SectionReader and removes
the section parameter n.

Since the size of the written data is determined by the user,
we cannot know where the end offset of the original data is.
The offset of SeekEnd is not valid in Seek method.

Fixes #45899.

Change-Id: I9d9445aecfa0dd4fc5168f2f65e1e3055c201b45
Reviewed-on: https://go-review.googlesource.com/c/go/+/406776
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>

21 months ago.github/ISSUE_TEMPLATE: add issue template for Go vulnerability management
Julie Qiu [Fri, 19 Aug 2022 16:08:15 +0000 (12:08 -0400)]
.github/ISSUE_TEMPLATE: add issue template for Go vulnerability management

Change-Id: Ia8bdd7909e94f3ab7248e88f0947db85ac744d79
Reviewed-on: https://go-review.googlesource.com/c/go/+/424928
Run-TryBot: Julie Qiu <julieqiu@google.com>
Auto-Submit: Julie Qiu <julieqiu@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
21 months agounicode/utf16: add AppendRune
qmuntal [Fri, 27 May 2022 13:44:55 +0000 (15:44 +0200)]
unicode/utf16: add AppendRune

AppendRune appends the UTF-16 encoding of a rune to a []uint16.

    BenchmarkEncodeValidASCII-12                24.61ns 16B 1allocs
    BenchmarkEncodeValidJapaneseChars-12        18.79ns 8B  1allocs
    BenchmarkAppendRuneValidASCII-12            6.826ns 0B  0allocs
    BenchmarkAppendRuneValidJapaneseChars-12    3.547ns 0B  0allocs

The ASCII case is written to be inlineable.

Fixes #51896

Change-Id: I593b1029f603297ef6e80e036f2fee2a0938d38d
Reviewed-on: https://go-review.googlesource.com/c/go/+/409054
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
21 months agogo/printer: rename printPos to setPos
Robert Griesemer [Thu, 18 Aug 2022 16:47:53 +0000 (09:47 -0700)]
go/printer: rename printPos to setPos

Follow-up on feedback in CL 412557.

Change-Id: I5a693efccade97a62ab880c6e1b9e50cb597c293
Reviewed-on: https://go-review.googlesource.com/c/go/+/424814
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
21 months agostrings: reduce allocation for byteReplacer
Cuong Manh Le [Tue, 16 Aug 2022 03:59:05 +0000 (10:59 +0700)]
strings: reduce allocation for byteReplacer

Though it increases the execution time, the function is already quite
fast for most users, the allocation is much more important.

name                       old time/op    new time/op    delta
ByteReplacerWriteString-8    1.23µs ± 0%    2.16µs ± 1%   +75.31%  (p=0.000 n=10+10)

name                       old alloc/op   new alloc/op   delta
ByteReplacerWriteString-8    2.69kB ± 0%    0.00kB       -100.00%  (p=0.000 n=10+10)

name                       old allocs/op  new allocs/op  delta
ByteReplacerWriteString-8      1.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)

Change-Id: I6a36df5fcb8e11ef27e6c7b252aa88e869592f3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/424136
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joedian Reid <joedian@golang.org>
21 months agosyscall: remove cloexecSocket fallback path
Tobias Klauser [Wed, 10 Aug 2022 09:37:22 +0000 (11:37 +0200)]
syscall: remove cloexecSocket fallback path

Support for Linux kernel versions requiring the fallback to CloseOnExec
was dropped from recent Go versions. The minimum Linux kernel version is
2.6.32 as of Go 1.18. The SOCK_CLOEXEC flag for the socket syscall is
supported since kernel version 2.6.27.

Follows a similar change for net.sysSocket in CL 403634.

For #45964

Change-Id: I8b6311f07c4ed7900a9af3ecb2e146c49db08665
Reviewed-on: https://go-review.googlesource.com/c/go/+/422374
Reviewed-by: Joedian Reid <joedian@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>

21 months agostrings: speed up ToUpper()/ToLower() by batch writing data with Builder
Andy Pan [Tue, 16 Aug 2022 08:06:23 +0000 (16:06 +0800)]
strings: speed up ToUpper()/ToLower() by batch writing data with Builder

Updates #52371
Updates CL 423874

name                                                                    old time/op    new time/op    delta
ToUpper/#00-10                                                            2.85ns ± 0%    2.81ns ± 0%   -1.31%  (p=0.000 n=10+10)
ToUpper/ONLYUPPER-10                                                      12.7ns ± 0%    12.5ns ± 0%   -1.35%  (p=0.000 n=10+10)
ToUpper/abc-10                                                            20.9ns ± 1%    20.1ns ± 1%   -3.92%  (p=0.000 n=8+10)
ToUpper/AbC123-10                                                         26.9ns ± 1%    28.5ns ± 0%   +5.78%  (p=0.000 n=9+9)
ToUpper/azAZ09_-10                                                        27.4ns ± 1%    24.5ns ± 0%  -10.82%  (p=0.000 n=9+9)
ToUpper/longStrinGwitHmixofsmaLLandcAps-10                                95.9ns ± 1%   100.3ns ± 0%   +4.52%  (p=0.000 n=9+10)
ToUpper/RENAN_BASTOS_93_AOSDAJDJAIDJAIDAJIaidsjjaidijadsjiadjiOOKKO-10     188ns ± 0%     121ns ± 0%  -35.52%  (p=0.000 n=9+10)
ToUpper/longɐstringɐwithɐnonasciiⱯchars-10                                 168ns ± 0%     164ns ± 0%   -2.02%  (p=0.000 n=8+10)
ToUpper/ɐɐɐɐɐ-10                                                           134ns ± 0%     132ns ± 0%   -1.59%  (p=0.000 n=9+10)
ToUpper/a\u0080\U0010ffff-10                                              67.6ns ± 0%    66.4ns ± 0%   -1.73%  (p=0.000 n=10+10)
ToLower/#00-10                                                            2.87ns ± 4%    2.83ns ± 0%   -1.46%  (p=0.004 n=9+9)
ToLower/abc-10                                                            6.35ns ± 0%    6.29ns ± 0%   -0.98%  (p=0.000 n=9+9)
ToLower/AbC123-10                                                         25.6ns ± 1%    28.1ns ± 1%   +9.81%  (p=0.000 n=10+10)
ToLower/azAZ09_-10                                                        29.9ns ± 1%    30.1ns ± 1%   +0.64%  (p=0.023 n=9+10)
ToLower/longStrinGwitHmixofsmaLLandcAps-10                                96.7ns ± 1%    73.0ns ± 0%  -24.50%  (p=0.000 n=10+10)
ToLower/renan_bastos_93_AOSDAJDJAIDJAIDAJIaidsjjaidijadsjiadjiOOKKO-10     177ns ± 0%     118ns ± 0%  -33.61%  (p=0.000 n=7+8)
ToLower/LONGⱯSTRINGⱯWITHⱯNONASCIIⱯCHARS-10                                 159ns ± 1%     158ns ± 0%   -0.97%  (p=0.000 n=8+10)
ToLower/ⱭⱭⱭⱭⱭ-10                                                           125ns ± 1%     123ns ± 1%   -1.67%  (p=0.000 n=9+9)
ToLower/A\u0080\U0010ffff-10                                              68.4ns ± 1%    67.1ns ± 0%   -1.95%  (p=0.000 n=9+9)

name                                                                    old alloc/op   new alloc/op   delta
ToUpper/#00-10                                                             0.00B          0.00B          ~     (all equal)
ToUpper/ONLYUPPER-10                                                       0.00B          0.00B          ~     (all equal)
ToUpper/abc-10                                                             3.00B ± 0%     3.00B ± 0%     ~     (all equal)
ToUpper/AbC123-10                                                          8.00B ± 0%     8.00B ± 0%     ~     (all equal)
ToUpper/azAZ09_-10                                                         8.00B ± 0%     8.00B ± 0%     ~     (all equal)
ToUpper/longStrinGwitHmixofsmaLLandcAps-10                                 32.0B ± 0%     32.0B ± 0%     ~     (all equal)
ToUpper/RENAN_BASTOS_93_AOSDAJDJAIDJAIDAJIaidsjjaidijadsjiadjiOOKKO-10     64.0B ± 0%     64.0B ± 0%     ~     (all equal)
ToUpper/longɐstringɐwithɐnonasciiⱯchars-10                                 48.0B ± 0%     48.0B ± 0%     ~     (all equal)
ToUpper/ɐɐɐɐɐ-10                                                           48.0B ± 0%     48.0B ± 0%     ~     (all equal)
ToUpper/a\u0080\U0010ffff-10                                               16.0B ± 0%     16.0B ± 0%     ~     (all equal)
ToLower/#00-10                                                             0.00B          0.00B          ~     (all equal)
ToLower/abc-10                                                             0.00B          0.00B          ~     (all equal)
ToLower/AbC123-10                                                          8.00B ± 0%     8.00B ± 0%     ~     (all equal)
ToLower/azAZ09_-10                                                         8.00B ± 0%     8.00B ± 0%     ~     (all equal)
ToLower/longStrinGwitHmixofsmaLLandcAps-10                                 32.0B ± 0%     32.0B ± 0%     ~     (all equal)
ToLower/renan_bastos_93_AOSDAJDJAIDJAIDAJIaidsjjaidijadsjiadjiOOKKO-10     64.0B ± 0%     64.0B ± 0%     ~     (all equal)
ToLower/LONGⱯSTRINGⱯWITHⱯNONASCIIⱯCHARS-10                                 48.0B ± 0%     48.0B ± 0%     ~     (all equal)
ToLower/ⱭⱭⱭⱭⱭ-10                                                           24.0B ± 0%     24.0B ± 0%     ~     (all equal)
ToLower/A\u0080\U0010ffff-10                                               16.0B ± 0%     16.0B ± 0%     ~     (all equal)

name                                                                    old allocs/op  new allocs/op  delta
ToUpper/#00-10                                                              0.00           0.00          ~     (all equal)
ToUpper/ONLYUPPER-10                                                        0.00           0.00          ~     (all equal)
ToUpper/abc-10                                                              1.00 ± 0%      1.00 ± 0%     ~     (all equal)
ToUpper/AbC123-10                                                           1.00 ± 0%      1.00 ± 0%     ~     (all equal)
ToUpper/azAZ09_-10                                                          1.00 ± 0%      1.00 ± 0%     ~     (all equal)
ToUpper/longStrinGwitHmixofsmaLLandcAps-10                                  1.00 ± 0%      1.00 ± 0%     ~     (all equal)
ToUpper/RENAN_BASTOS_93_AOSDAJDJAIDJAIDAJIaidsjjaidijadsjiadjiOOKKO-10      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
ToUpper/longɐstringɐwithɐnonasciiⱯchars-10                                  1.00 ± 0%      1.00 ± 0%     ~     (all equal)
ToUpper/ɐɐɐɐɐ-10                                                            2.00 ± 0%      2.00 ± 0%     ~     (all equal)
ToUpper/a\u0080\U0010ffff-10                                                1.00 ± 0%      1.00 ± 0%     ~     (all equal)
ToLower/#00-10                                                              0.00           0.00          ~     (all equal)
ToLower/abc-10                                                              0.00           0.00          ~     (all equal)
ToLower/AbC123-10                                                           1.00 ± 0%      1.00 ± 0%     ~     (all equal)
ToLower/azAZ09_-10                                                          1.00 ± 0%      1.00 ± 0%     ~     (all equal)
ToLower/longStrinGwitHmixofsmaLLandcAps-10                                  1.00 ± 0%      1.00 ± 0%     ~     (all equal)
ToLower/renan_bastos_93_AOSDAJDJAIDJAIDAJIaidsjjaidijadsjiadjiOOKKO-10      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
ToLower/LONGⱯSTRINGⱯWITHⱯNONASCIIⱯCHARS-10                                  1.00 ± 0%      1.00 ± 0%     ~     (all equal)
ToLower/ⱭⱭⱭⱭⱭ-10                                                            1.00 ± 0%      1.00 ± 0%     ~     (all equal)
ToLower/A\u0080\U0010ffff-10                                                1.00 ± 0%      1.00 ± 0%     ~     (all equal)

Change-Id: Id3998ac4bae054ba3e6cf30545a257d5992b48be
Reviewed-on: https://go-review.googlesource.com/c/go/+/424139
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
21 months agosyscall: add new CLONE_ flags for Linux
Kir Kolyshkin [Fri, 20 May 2022 05:25:42 +0000 (22:25 -0700)]
syscall: add new CLONE_ flags for Linux

The constants for these were auto-generated from the C includes
into zerrors_linux* files quite some time ago. The generator is
currently broken, but some new flags need to be added nevertheless.

As the flags won't change and the values are the same for all
architectures, we can just define them statically (as it's already
done in the runtime package):

 - remove the CLONE_* constants from zerrors_linux_*.go;
 - patch mkerrors.sh to not generate CLONE_ constants
   (in case it will be fixed and used in the future);
 - add the constants and some comments about them to exec_linux.go,
   using Linux v5.17 include/uapi/sched.h as the ultimate source.

This adds the following new flags:

 - CLONE_CLEAR_SIGHAND
 - CLONE_INTO_CGROUP
 - CLONE_NEWCGROUP
 - CLONE_NEWTIME
 - CLONE_PIDFD

For #51246.

Change-Id: I0c635723926218bd403d37e113ee4d62194463a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/407574
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joedian Reid <joedian@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>

21 months agocmd/compile: add intrinsic for MulUintptr on arm64
ruinan [Thu, 21 Jul 2022 05:16:11 +0000 (05:16 +0000)]
cmd/compile: add intrinsic for MulUintptr on arm64

This CL adds intrinsic for runtime/internal/math.MulUintptr on arm64

Benchmark         master     ThisCL(ns/op)   delta
MulUintptr/small  0.95ns     0.79ns          -16%
MulUintptr/large  1.31ns     0.95ns          -27.6%

Change-Id: Ic7b453ad502826beffe93ce5531b8ba752312a1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/419556
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Eric Fang <eric.fang@arm.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Joedian Reid <joedian@golang.org>
21 months agoruntime: fix formula for computing number of padding bytes
Ludi Rehak [Sat, 25 Jun 2022 20:27:11 +0000 (13:27 -0700)]
runtime: fix formula for computing number of padding bytes

In order to prevent false sharing of cache lines, structs are
padded with some number of bytes. These bytes are unused, serving
only to make the size of the struct a multiple of the size of the
cache line.

The current calculation of how much to pad is an overestimation,
when the struct size is already a multiple of the cache line size
without padding. For these cases, no padding is necessary, and
the size of the inner pad field should be 0. The bug is that the
pad field is sized to a whole 'nother cache line, wasting space.

Here is the current formula that can never return 0:
cpu.CacheLinePadSize - unsafe.Sizeof(myStruct{})%cpu.CacheLinePadSize

This change simply mods that calculation by cpu.CacheLinePadSize,
so that 0 will be returned instead of cpu.CacheLinePadSize.

Change-Id: I26a2b287171bf47a3b9121873b2722f728381b5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/414214
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months agoencoding/gob: use saferio to read large buffer
Ian Lance Taylor [Sat, 25 Jun 2022 00:00:24 +0000 (17:00 -0700)]
encoding/gob: use saferio to read large buffer

Avoid allocating large amounts of memory for corrupt input.

No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.

Fixes #53369

Change-Id: I67c5e75bf181ad84988d6d6da12507df0e6df8e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/413979
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months agoruntime: remove pageAlloc.scav padding for atomic field alignment
Cuong Manh Le [Fri, 19 Aug 2022 11:35:42 +0000 (18:35 +0700)]
runtime: remove pageAlloc.scav padding for atomic field alignment

CL 404096 makes atomic.Int64 8 bytes aligned everywhere.

Change-Id: I5a676f646260d6391bb071f9376cbdb1553e6e6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/424925
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
21 months agotest: add test that caused gccgo crash
Ian Lance Taylor [Sat, 16 Jul 2022 01:41:41 +0000 (18:41 -0700)]
test: add test that caused gccgo crash

For #23870

Change-Id: I3bbe0f751254d1354a59a88b45e6f944c7a2fb4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/417874
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
21 months agotest: add test that caused gccgo to crash
Ian Lance Taylor [Thu, 14 Jul 2022 01:31:30 +0000 (18:31 -0700)]
test: add test that caused gccgo to crash

For #23868

Change-Id: I07b001836e8d1411609ab84786398a5b575bf8d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/417481
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
21 months agomisc/cgo/testcarchive: permit SIGQUIT for TestSignalForwardingExternal
Ian Lance Taylor [Thu, 21 Jul 2022 23:49:48 +0000 (16:49 -0700)]
misc/cgo/testcarchive: permit SIGQUIT for TestSignalForwardingExternal

Occasionally the signal will be sent to a Go thread, which will cause
the program to exit with SIGQUIT rather than SIGSEGV.

Add TestSignalForwardingGo to test the case where the signal is
expected to be delivered to a Go thread.

Fixes #53907

Change-Id: Iaefb964c2be4a815c11c507fa89648f8a7740ba9
Reviewed-on: https://go-review.googlesource.com/c/go/+/419014
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

21 months agonet: allow single dot in resolv.conf search statement
Andy Pan [Mon, 15 Aug 2022 15:09:00 +0000 (23:09 +0800)]
net: allow single dot in resolv.conf search statement

A single dot in a search statement doesn't affect DNS lookup, so just ignore it and a syntax error.

Fixes #54124

Change-Id: Idd43bd34c5c16af50cba51f0b6e24f992eec6e57
Reviewed-on: https://go-review.googlesource.com/c/go/+/423875
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
21 months agosync: use atomic.Uint64 for WaitGroup state
Cuong Manh Le [Thu, 18 Aug 2022 17:31:07 +0000 (00:31 +0700)]
sync: use atomic.Uint64 for WaitGroup state

So it's guaranteed to have 64-bit alignment, simplify the code without
losing any performance:

name                     old time/op    new time/op    delta
WaitGroupUncontended-8     3.84ns ± 2%    3.82ns ± 1%   ~     (p=0.159 n=10+10)
WaitGroupAddDone-8         33.2ns ± 3%    33.0ns ± 3%   ~     (p=0.564 n=9+10)
WaitGroupAddDoneWork-8     39.3ns ± 1%    39.3ns ± 1%   ~     (p=1.000 n=8+9)
WaitGroupWait-8            0.70ns ± 3%    0.70ns ± 2%   ~     (p=0.720 n=9+10)
WaitGroupWaitWork-8        7.93ns ± 1%    7.99ns ± 3%   ~     (p=0.271 n=10+10)
WaitGroupActuallyWait-8     135ns ± 2%     135ns ± 1%   ~     (p=0.897 n=10+10)

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

21 months agoruntime: fast clock_gettime on FreeBSD, split getHPETTimecounter
Yuval Pavel Zholkover [Fri, 11 Mar 2022 17:54:08 +0000 (19:54 +0200)]
runtime: fast clock_gettime on FreeBSD, split getHPETTimecounter

Call only initHPETTimecounter on the system stack.
Use O_CLOEXEC flag when opening the HPET device.

FreeBSD 12.3-RELEASE-p2, AMD FX-8300
paulzhol@relic:~/go/src/time % ~/gocode/bin/benchcmp old_hpet.txt new_hpet.txt
benchcmp is deprecated in favor of benchstat: https://pkg.go.dev/golang.org/x/perf/cmd/benchstat
benchmark                   old ns/op     new ns/op     delta
BenchmarkNow-8              1420          1397          -1.62%
BenchmarkNowUnixNano-8      1421          1404          -1.20%
BenchmarkNowUnixMilli-8     1423          1405          -1.26%
BenchmarkNowUnixMicro-8     1423          1404          -1.34%

Update #50947

Change-Id: I553b5427fb0b86d7e070af4516b36326bc0aaf00
Reviewed-on: https://go-review.googlesource.com/c/go/+/391856
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
21 months agoruntime: add and use runtime/internal/sys.NotInHeap
Cuong Manh Le [Sun, 7 Aug 2022 10:43:57 +0000 (17:43 +0700)]
runtime: add and use runtime/internal/sys.NotInHeap

Updates #46731

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

21 months agointernal/buildcfg: enable unified IR by default
Matthew Dempsky [Tue, 9 Aug 2022 07:29:45 +0000 (00:29 -0700)]
internal/buildcfg: enable unified IR by default

Unified IR is now at feature parity with the non-unified frontend.

Change-Id: I2a8cd41267a66f5eb1f425b89d18c6d501676e07
Reviewed-on: https://go-review.googlesource.com/c/go/+/422235
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
21 months agocmd/compile/internal/types2: use go/types/testdata/spec tests
Robert Griesemer [Thu, 18 Aug 2022 01:30:21 +0000 (18:30 -0700)]
cmd/compile/internal/types2: use go/types/testdata/spec tests

Since the spec tests are now identical between the two type checkers,
remove the local copy of the spec tests and (for now) use the tests
in go/types/testdata/spec instead. Eventually we may decide to move
all tests out of the type checker directories and place them in a
shared space (e.g. internal/types/testdata).

For #54511.

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

21 months agogo/types, types2: consolidate testdata/spec test files
Robert Griesemer [Thu, 18 Aug 2022 01:23:04 +0000 (18:23 -0700)]
go/types, types2: consolidate testdata/spec test files

Besides applying gofmt (which doesn't damage the tests in this case),
this removes a TODO for a set of nil-related tests.

The test files are now identical.

For #54511.

Change-Id: I0a286ad607f317f43972c1f5ee741b4f5bc9576d
Reviewed-on: https://go-review.googlesource.com/c/go/+/424675
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
21 months agogo/types, types2: consolidate testdata/examples test files
Robert Griesemer [Thu, 18 Aug 2022 01:09:55 +0000 (18:09 -0700)]
go/types, types2: consolidate testdata/examples test files

Besides applying gofmt (which doesn't damage the tests in this case),
the ERROR comments in the types2 files now match the go/types files.
But because types2 still reports some errors are different positions,
the checking code now allows for some position discrepancy (similar
to what we do for other tests).

Except for an outstanding TODO in go/types/testdata/examples/types.go
the test files are now identical.

For #54511.

Change-Id: I5748e0f678d11c5c0bdf4fdf28bd04f0b11b5b23
Reviewed-on: https://go-review.googlesource.com/c/go/+/424674
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
21 months agocmd/compile/internal/syntax: handle missing index like in go/parser
Robert Griesemer [Wed, 17 Aug 2022 23:48:07 +0000 (16:48 -0700)]
cmd/compile/internal/syntax: handle missing index like in go/parser

Instead of simply reporting an error but otherwise dropping the
index expression from the parse tree when an index is missing
(as in: x[]), create an index expression with a "bad expression"
as index. This matches the behavior of go/parser and permits the
use of the same test case for both parsers.

(It would be simpler to adjust the go/parser to match the syntax
parser's behavior, but that would break backward-compatibility
of the go/parser.)

Adjust the affected test files.

For #54511.

Change-Id: If7668973794604593e869a24b560da92e100b812
Reviewed-on: https://go-review.googlesource.com/c/go/+/424654
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
21 months agocrypto/internal/boring: update to newer boringcrypto, add arm64
Russ Cox [Tue, 16 Aug 2022 14:38:02 +0000 (10:38 -0400)]
crypto/internal/boring: update to newer boringcrypto, add arm64

Update the version of BoringCrypto to boringssl tag
fips-20210429, for which FIPS approval is "in process".

Add GOARCH=arm64 BoringCrypto support.

Shuffle build to run as distinct steps in Docker so that
we can rerun later parts like build-goboring.sh without
rerunning all the setup.

Strip unnecessary parts of the syso using --strip-unneeded,
which cuts the amd64 syso from 10MB to 2.5MB.
The new arm64 syso is 2MB, so even though we added a new
architecture, we have half as much syso to distribute.

Change-Id: I0f7327389a3a485b82577abea9153d006418298f
Reviewed-on: https://go-review.googlesource.com/c/go/+/423362
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

21 months agogo/types: match types2 error msg formatting for conversion errors
Robert Griesemer [Wed, 17 Aug 2022 22:06:56 +0000 (15:06 -0700)]
go/types: match types2 error msg formatting for conversion errors

This resolves a TODO. Also, it allows go/types and types2 to use
identical test files in testdata/spec, a prerequisition for sharing
them eventually.

For #54511.

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

21 months agointernal/buildcfg: support GOPPC64=power10
Paul E. Murphy [Thu, 8 Jul 2021 21:30:41 +0000 (16:30 -0500)]
internal/buildcfg: support GOPPC64=power10

This does not enable any new functionality. It should
behave identically to GOPPC64=power9.

Updates #44549

Change-Id: I9a860544527fcfe97cbaf89686459d40dcf9593e
Reviewed-on: https://go-review.googlesource.com/c/go/+/352791
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
21 months agoruntime: remove p padding field for atomic fields alignment
Cuong Manh Le [Thu, 18 Aug 2022 15:53:19 +0000 (22:53 +0700)]
runtime: remove p padding field for atomic fields alignment

CL 424396 and CL 424397 changed timer0When/timerModifiedEarliest to
atomic.Uint64, just they're guaranted to have 64-bit alignment.

Change-Id: Idaff1059da2aac84520b9b0e34f9721a74dbba5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/424794
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
21 months agocmd/compile: remove OFORUNTIL
Keith Randall [Tue, 19 Jul 2022 20:15:05 +0000 (13:15 -0700)]
cmd/compile: remove OFORUNTIL

Not used any more.

Fixes #53860

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

21 months agocmd/compile: rip out support for OpVarKill from ssa backend
Keith Randall [Fri, 22 Jul 2022 22:08:07 +0000 (15:08 -0700)]
cmd/compile: rip out support for OpVarKill from ssa backend

Change-Id: I008479a7516d8379186ce630748e503d94d3b1e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/419235
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>

21 months agocmd/compile: stop using VARKILL
Keith Randall [Fri, 22 Jul 2022 21:58:40 +0000 (14:58 -0700)]
cmd/compile: stop using VARKILL

With the introduction of stack objects, VARKILL information is
no longer needed.

With stack objects, an object is dead when there are no more static
references to it, and the stack scanner can't find any live pointers
to it. VARKILL information isn't used to establish live ranges for
address-taken variables any more. In effect, the last static reference
*is* the VARKILL, and there's an additional dynamic liveness check
during stack scanning.

Next CL will actually rip out the VARKILL opcodes.

Change-Id: I030a2ab867445cf4e0e69397911f8a2e2f0ed07b
Reviewed-on: https://go-review.googlesource.com/c/go/+/419234
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>

21 months agocmd/compile: don't use OFORUNTIL when implementing range loops
Keith Randall [Mon, 27 Jun 2022 04:18:19 +0000 (21:18 -0700)]
cmd/compile: don't use OFORUNTIL when implementing range loops

We don't need this special loop construct anymore now that we do
conservative GC scanning of the top of stack. Rewrite instead to a simple
pointer increment on every iteration. This leads to having a potential
past-the-end pointer at the end of the last iteration, but that value
immediately goes dead after the loop condition fails, and the past-the-end
pointer is never live across any call.

This simplifies and speeds up loops.

R=go1.20

TODO: actually delete all support for OFORUNTIL. It is now never generated,
but code to handle it (e.g. in ssagen) is still around.

TODO: in "for _, x := range" loops, we could get rid of the index
altogether and use a "pointer to the last element" reference to determine
when the loop is complete.

Fixes #53409

Change-Id: Ifc141600ff898a8bc6a75f793e575f8862679ba1
Reviewed-on: https://go-review.googlesource.com/c/go/+/414876
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months agocmd/compile: enable more inlining for unified IR
Matthew Dempsky [Thu, 18 Aug 2022 12:20:16 +0000 (05:20 -0700)]
cmd/compile: enable more inlining for unified IR

The non-unified frontend had repeated issues with inlining and
generics (#49309, #51909, #52907), which led us to substantially
restrict inlining when shape types were present.

However, these issues are evidently not present in unified IR's
inliner, and the safety restrictions added for the non-unified
frontend can simply be disabled in unified mode.

Fixes #54497.

Change-Id: I8e6ac9f3393c588bfaf14c6452891b9640a9d1bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/424775
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
21 months agocmd/compile: fix devirtualization bug with unified IR
Matthew Dempsky [Thu, 18 Aug 2022 11:56:10 +0000 (04:56 -0700)]
cmd/compile: fix devirtualization bug with unified IR

As a consistency check in devirtualization, when we determine `i` (of
interface type `I`) always has dynamic type `T`, we insert a type
assertion `i.(T)`. This emits an itab check for `go:itab.T,I`, but
it's always true (and so SSA optimizes it away).

However, if `I` is instead the generic interface type `I[T]`, then
`go:itab.T,I[int]` and `go:itab.T,I[go.shape.int]` are equivalent but
distinct itabs. And notably, we'll have originally created the
interface value using the former; but the (non-dynamic) TypeAssertExpr
created by devirtualization would ultimately emit a comparison against
the latter. This comparison would then evaluate false, leading to a
spurious type assertion panic at runtime.

The comparison is just meant as an extra safety check, so it should be
safe to just disable. But for now, it's simpler/safer to just punt on
devirtualization in this case. (The non-unified frontend doesn't
devirtualize this either.)

Change-Id: I6a8809bcfebc9571f32e289fa4bc6a8b0d21ca46
Reviewed-on: https://go-review.googlesource.com/c/go/+/424774
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
21 months agocmd/compile/internal/noder: set ir.Name.DictIndex for unified IR
Matthew Dempsky [Thu, 18 Aug 2022 10:53:58 +0000 (03:53 -0700)]
cmd/compile/internal/noder: set ir.Name.DictIndex for unified IR

For local variables of derived type, Delve relies on ir.Name.DictIndex
being set to the type's rtype index within the function's dictionary.
This CL implements that functionality within unified IR.

Manually double checked that Delve behaves correctly, at least as far
as I can tell from casual use. Specifically, I confirmed that running
the test program from TestDictIndex, stepping into testfn, and then
running `print mapvar` prints `map[int]main.CustomInt []`, which
matches the behavior under GOEXPERIMENT=nounified. (Also compare that
when ir.Name.DictIndex is *not* set by unified IR, `print mapvar`
instead prints `map[int]go.shape.int []`.)

Fixes #54514.

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

21 months agocmd/compile/internal/noder: pointer shaping for unified IR
Matthew Dempsky [Thu, 18 Aug 2022 10:14:23 +0000 (03:14 -0700)]
cmd/compile/internal/noder: pointer shaping for unified IR

This CL implements pointer shaping in unified IR, corresponding to the
existing pointer shaping implemented in the non-unified frontend.

For example, if `func F[T any]` is instantiated as both `F[*int]` and
`F[*string]`, we'll now generate a single `F[go.shape.*uint8]` shaped
function that can be used by both.

Fixes #54513.

Change-Id: I2cef5ae411919e6dc5bcb3cac912abecb4cd5218
Reviewed-on: https://go-review.googlesource.com/c/go/+/424734
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
21 months agoruntime: remove dead code and unnecessary checks for amd64
vpachkov [Fri, 1 Apr 2022 17:37:30 +0000 (20:37 +0300)]
runtime: remove dead code and unnecessary checks for amd64

Use amd64 assembly header to remove unnecessary cpu flags checks
and dead code that is guaranteed to not be executed when compiling
for specific microarchitectures.

name                  old time/op  new time/op  delta
BytesCompare/1-12     3.88ns ± 1%  3.18ns ± 1%  -18.15%  (p=0.008 n=5+5)
BytesCompare/2-12     3.89ns ± 1%  3.21ns ± 2%  -17.66%  (p=0.008 n=5+5)
BytesCompare/4-12     3.89ns ± 0%  3.17ns ± 0%  -18.62%  (p=0.008 n=5+5)
BytesCompare/8-12     3.44ns ± 2%  3.39ns ± 1%   -1.36%  (p=0.008 n=5+5)
BytesCompare/16-12    3.40ns ± 1%  3.14ns ± 0%   -7.77%  (p=0.008 n=5+5)
BytesCompare/32-12    3.90ns ± 1%  3.65ns ± 0%   -6.19%  (p=0.008 n=5+5)
BytesCompare/64-12    4.96ns ± 1%  4.71ns ± 2%   -4.98%  (p=0.008 n=5+5)
BytesCompare/128-12   6.42ns ± 0%  5.99ns ± 4%   -6.75%  (p=0.008 n=5+5)
BytesCompare/256-12   9.36ns ± 0%  7.40ns ± 0%  -20.97%  (p=0.008 n=5+5)
BytesCompare/512-12   15.9ns ± 1%  11.4ns ± 1%  -28.36%  (p=0.008 n=5+5)
BytesCompare/1024-12  27.0ns ± 0%  19.3ns ± 0%  -28.36%  (p=0.008 n=5+5)
BytesCompare/2048-12  50.2ns ± 0%  43.3ns ± 0%  -13.71%  (p=0.008 n=5+5)
[Geo mean]            7.13ns       6.07ns       -14.86%

name                old speed      new speed      delta
Count/10-12          723MB/s ± 0%   704MB/s ± 1%  -2.73%  (p=0.008 n=5+5)
Count/32-12         2.21GB/s ± 0%  2.12GB/s ± 2%  -4.21%  (p=0.008 n=5+5)
Count/4K-12         1.03GB/s ± 0%  1.03GB/s ± 1%    ~     (p=1.000 n=5+5)
Count/4M-12         1.04GB/s ± 0%  1.02GB/s ± 2%    ~     (p=0.310 n=5+5)
Count/64M-12        1.02GB/s ± 0%  1.01GB/s ± 1%  -1.00%  (p=0.016 n=5+5)
CountEasy/10-12      779MB/s ± 0%   768MB/s ± 1%  -1.48%  (p=0.008 n=5+5)
CountEasy/32-12     2.15GB/s ± 0%  2.09GB/s ± 1%  -2.71%  (p=0.008 n=5+5)
CountEasy/4K-12     45.1GB/s ± 1%  45.2GB/s ± 1%    ~     (p=0.421 n=5+5)
CountEasy/4M-12     36.4GB/s ± 1%  36.5GB/s ± 1%    ~     (p=0.690 n=5+5)
CountEasy/64M-12    16.1GB/s ± 2%  16.4GB/s ± 1%    ~     (p=0.056 n=5+5)
CountSingle/10-12   2.15GB/s ± 2%  2.22GB/s ± 1%  +3.37%  (p=0.008 n=5+5)
CountSingle/32-12   5.86GB/s ± 1%  5.76GB/s ± 1%  -1.55%  (p=0.008 n=5+5)
CountSingle/4K-12   54.6GB/s ± 1%  55.0GB/s ± 1%    ~     (p=0.548 n=5+5)
CountSingle/4M-12   45.9GB/s ± 4%  46.4GB/s ± 2%    ~     (p=0.548 n=5+5)
CountSingle/64M-12  17.3GB/s ± 1%  17.2GB/s ± 2%    ~     (p=1.000 n=5+5)
[Geo mean]          5.11GB/s       5.08GB/s       -0.53%

name          old speed      new speed      delta
Equal/1-12     200MB/s ± 0%   188MB/s ± 1%   -6.11%  (p=0.008 n=5+5)
Equal/6-12    1.20GB/s ± 0%  1.13GB/s ± 1%   -6.38%  (p=0.008 n=5+5)
Equal/9-12    1.67GB/s ± 3%  1.74GB/s ± 1%   +3.83%  (p=0.008 n=5+5)
Equal/15-12   2.82GB/s ± 1%  2.89GB/s ± 1%   +2.63%  (p=0.008 n=5+5)
Equal/16-12   2.96GB/s ± 1%  3.08GB/s ± 1%   +3.95%  (p=0.008 n=5+5)
Equal/20-12   3.33GB/s ± 1%  3.54GB/s ± 1%   +6.36%  (p=0.008 n=5+5)
Equal/32-12   4.57GB/s ± 0%  5.26GB/s ± 1%  +15.09%  (p=0.008 n=5+5)
Equal/4K-12   62.0GB/s ± 1%  65.9GB/s ± 2%   +6.29%  (p=0.008 n=5+5)
Equal/4M-12   23.6GB/s ± 2%  24.8GB/s ± 4%   +5.43%  (p=0.008 n=5+5)
Equal/64M-12  11.1GB/s ± 2%  11.3GB/s ± 1%   +1.69%  (p=0.008 n=5+5)
[Geo mean]    3.91GB/s       4.03GB/s        +3.11%

name                              old speed      new speed      delta
IndexByte/10-12                   2.64GB/s ± 0%  2.69GB/s ± 0%   +1.67%  (p=0.008 n=5+5)
IndexByte/32-12                   6.79GB/s ± 0%  6.27GB/s ± 0%   -7.57%  (p=0.008 n=5+5)
IndexByte/4K-12                   56.2GB/s ± 0%  56.9GB/s ± 0%   +1.27%  (p=0.008 n=5+5)
IndexByte/4M-12                   40.1GB/s ± 1%  41.7GB/s ± 1%   +4.05%  (p=0.008 n=5+5)
IndexByte/64M-12                  17.5GB/s ± 0%  17.7GB/s ± 1%     ~     (p=0.095 n=5+5)
IndexBytePortable/10-12           2.06GB/s ± 1%  2.16GB/s ± 1%   +5.08%  (p=0.008 n=5+5)
IndexBytePortable/32-12           1.40GB/s ± 1%  1.54GB/s ± 1%  +10.05%  (p=0.008 n=5+5)
IndexBytePortable/4K-12           3.99GB/s ± 0%  4.08GB/s ± 0%   +2.16%  (p=0.008 n=5+5)
IndexBytePortable/4M-12           4.05GB/s ± 1%  4.08GB/s ± 2%     ~     (p=0.095 n=5+5)
IndexBytePortable/64M-12          3.80GB/s ± 1%  3.81GB/s ± 0%     ~     (p=0.421 n=5+5)
IndexRune/10-12                    746MB/s ± 1%   752MB/s ± 0%   +0.85%  (p=0.008 n=5+5)
IndexRune/32-12                   2.33GB/s ± 0%  2.42GB/s ± 0%   +3.66%  (p=0.008 n=5+5)
IndexRune/4K-12                   44.4GB/s ± 0%  44.2GB/s ± 0%     ~     (p=0.095 n=5+5)
IndexRune/4M-12                   36.2GB/s ± 1%  36.3GB/s ± 2%     ~     (p=0.841 n=5+5)
IndexRune/64M-12                  16.2GB/s ± 2%  16.3GB/s ± 2%     ~     (p=0.548 n=5+5)
IndexRuneASCII/10-12              2.57GB/s ± 0%  2.58GB/s ± 0%   +0.63%  (p=0.008 n=5+5)
IndexRuneASCII/32-12              6.00GB/s ± 0%  6.30GB/s ± 1%   +4.98%  (p=0.008 n=5+5)
IndexRuneASCII/4K-12              56.7GB/s ± 0%  56.8GB/s ± 1%     ~     (p=0.151 n=5+5)
IndexRuneASCII/4M-12              41.6GB/s ± 1%  41.7GB/s ± 2%     ~     (p=0.151 n=5+5)
IndexRuneASCII/64M-12             17.7GB/s ± 1%  17.6GB/s ± 1%     ~     (p=0.222 n=5+5)
Index/10-12                       1.06GB/s ± 1%  1.06GB/s ± 0%     ~     (p=0.310 n=5+5)
Index/32-12                       3.57GB/s ± 0%  3.56GB/s ± 1%     ~     (p=0.056 n=5+5)
Index/4K-12                       1.02GB/s ± 2%  1.03GB/s ± 0%     ~     (p=0.690 n=5+5)
Index/4M-12                       1.04GB/s ± 0%  1.03GB/s ± 1%     ~     (p=1.000 n=4+5)
Index/64M-12                      1.02GB/s ± 0%  1.02GB/s ± 0%     ~     (p=0.905 n=5+4)
IndexEasy/10-12                   1.12GB/s ± 2%  1.15GB/s ± 1%   +3.10%  (p=0.008 n=5+5)
IndexEasy/32-12                   3.14GB/s ± 2%  3.13GB/s ± 1%     ~     (p=0.310 n=5+5)
IndexEasy/4K-12                   47.6GB/s ± 1%  47.7GB/s ± 2%     ~     (p=0.310 n=5+5)
IndexEasy/4M-12                   36.4GB/s ± 1%  36.3GB/s ± 2%     ~     (p=0.690 n=5+5)
IndexEasy/64M-12                  16.1GB/s ± 1%  16.4GB/s ± 5%     ~     (p=0.151 n=5+5)
[Geo mean]                        6.39GB/s       6.46GB/s        +1.11%

Change-Id: Ic1ca62f5cc719d87e2c4aeff25ad73507facff82
Reviewed-on: https://go-review.googlesource.com/c/go/+/397576
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
21 months agoruntime: convert timer0When/timerModifiedEarliest to atomic.Int64
Cuong Manh Le [Wed, 17 Aug 2022 17:21:36 +0000 (00:21 +0700)]
runtime: convert timer0When/timerModifiedEarliest to atomic.Int64

So they match with when/nextwhen fields of timer struct.

Updates #53821

Change-Id: Iad0cceb129796745774facfbbfe5756df3a320b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/423117
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>

21 months agocmd/dist: enable testsanitizer test on ppc64le
Lynn Boger [Wed, 17 Aug 2022 15:04:57 +0000 (10:04 -0500)]
cmd/dist: enable testsanitizer test on ppc64le

Even though the -race option works for ppc64le, some of the
testsanitizer test have failed in the past on our builders. These
same failures can't be reproduced on other systems.

This is an experiment to re-enable this test on ppc64le to see if
it still fails on the builders.

Updates #45040

Change-Id: I0729bec5864e6c4cc752968485e89179df027063
Reviewed-on: https://go-review.googlesource.com/c/go/+/424534
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months agogo/printer: avoid allocating for every position printed
Daniel Martí [Wed, 15 Jun 2022 21:55:58 +0000 (22:55 +0100)]
go/printer: avoid allocating for every position printed

printer.print is an overloaded method for multiple purposes.
When fed a position, it updates the current position.
When fed a string, it prints the string.
When fed a token, it prints the token. And so on.

However, this overloading comes at a significant cost.
Because the parameters are a list of the `any` interface type,
any type which is not of pointer or interface kind will allocate when
passed as an argument, as interfaces can only contain pointers.

A large portion of the arguments passed to the print method are of type
token.Pos, whose underlying type is int - so it allocates.
Removing those allocations has a significant benefit,
at the cost of some verbosity in the code:

name      old time/op    new time/op    delta
Print-16    6.10ms ± 2%    5.39ms ± 2%  -11.72%  (p=0.000 n=10+10)

name      old speed      new speed      delta
Print-16  8.50MB/s ± 2%  9.63MB/s ± 2%  +13.28%  (p=0.000 n=10+10)

name      old alloc/op   new alloc/op   delta
Print-16     443kB ± 0%     332kB ± 0%  -25.10%  (p=0.000 n=10+9)

name      old allocs/op  new allocs/op  delta
Print-16     17.3k ± 0%      3.5k ± 0%  -80.10%  (p=0.000 n=10+10)

There should be more significant speed-ups left, particularly for the
token.Token, string, and whiteSpace types fed to the same method.
They are left for a future CL, in case this kind of optimization is not
a path we want to take.

Change-Id: I3ff8387242c5a935bb003e60e0813b7b9c65402e
Reviewed-on: https://go-review.googlesource.com/c/go/+/412557
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: hopehook <hopehook@qq.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months agohash/crc32: remove single-use {castagnoli,ieee}ArchImpl bools
Tobias Klauser [Mon, 15 Aug 2022 09:04:03 +0000 (11:04 +0200)]
hash/crc32: remove single-use {castagnoli,ieee}ArchImpl bools

These are only used once right after being set in castagnoliInit and
ieeeInit, respectively.

Change-Id: Ifc5df1fe3040b97b1d252cc6d6d28d8fbc132fa5
Reviewed-on: https://go-review.googlesource.com/c/go/+/423854
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>

21 months agocmd/internal/osinfo: use unix.ByteSliceToString
Tobias Klauser [Tue, 9 Aug 2022 08:15:27 +0000 (10:15 +0200)]
cmd/internal/osinfo: use unix.ByteSliceToString

The golang.org/x/sys/unix package is already imported for Utsname and
Uname. Use ByteSliceToString from that package as well to replace the
locally defined utsString helper which serves the same purpose and
matches ByteSliceToString's implementation.

Change-Id: I5d9de186a5aeb1feed1387beedefbcd260fe22ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/415654
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
21 months agodebug/pe: use saferio to set symbol slice capacity
Ian Lance Taylor [Fri, 24 Jun 2022 17:24:11 +0000 (10:24 -0700)]
debug/pe: use saferio to set symbol slice capacity

No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.

For #47653
Fixes #53530

Change-Id: If1cebbbcabb188fec8be30ef043c8c4c935a9564
Reviewed-on: https://go-review.googlesource.com/c/go/+/413995
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
21 months agotime: fix LoadLocation documentation formatting
Abhinav Gupta [Fri, 12 Aug 2022 16:20:40 +0000 (09:20 -0700)]
time: fix LoadLocation documentation formatting

The documentation for LoadLocation contains an enumerated list,
but does not render as such because it's missing leading spaces.

Output verified with the go doc command and godoc server.

Change-Id: I88b61d34048b7d01ee5cd77c32849af266e2f4c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/423297
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>

21 months agointernal/poll: remove fallback path in accept
Tobias Klauser [Tue, 9 Aug 2022 15:45:01 +0000 (17:45 +0200)]
internal/poll: remove fallback path in accept

Support for operating system versions requiring the fallback to
CloseOnExec/SetNonblock was dropped from recent Go versions. The minimum
Linux kernel version is 2.6.32 as of Go 1.18. FreeBSD 10 is no longer
supported as of Go 1.13.

Follows a similar change for net.sysSocket in CL 403634 and
syscall.Socket in CL 422374.

For #45964

Change-Id: I60848415742a1d8204e1fda585462ff35ad6722f
Reviewed-on: https://go-review.googlesource.com/c/go/+/422375
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
21 months agosyscall: implement EpollCreate using EpollCreate1 on all linux platforms
Tobias Klauser [Tue, 9 Aug 2022 08:20:22 +0000 (10:20 +0200)]
syscall: implement EpollCreate using EpollCreate1 on all linux platforms

Most newer architectures (e.g. arm64, riscv64, loong64) don't provide the
epoll_create syscall. Some systems (e.g. Android) block it even if it
were available. In the kernel, the epoll_create syscall is implemented
[1] the same way EpollCreate is implemented in this package for
platforms without the epoll_create syscall. The epoll_create1 syscall is
available since Linux kernel 2.6.27 and the minimum required kernel
version is 2.6.32 since Go 1.18 (see #45964). Thus, avoid the separate
wrapper and consistently implement EpollCreate using EpollCreate1.

[1] https://elixir.bootlin.com/linux/v5.15-rc1/source/fs/eventpoll.c#L2006

The same change was already done in CL 349809 for golang.org/x/sys/unix.

For #45964

Change-Id: I5463b208aa7ae236fa2c175d6d3ec6568f1840b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/411594
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>

21 months agocmd/go: avoid passing testing.T to isCaseSensitive and goVersion
Bryan C. Mills [Tue, 19 Jul 2022 19:55:01 +0000 (15:55 -0400)]
cmd/go: avoid passing testing.T to isCaseSensitive and goVersion

The previous implementation of isCaseSensitive called t.Fatalf in the
wrong place, causing tests after the first to proceed past an error
determining case-sensitivity. That could lead to confusing errors.

(Moreover, I would like to try to disentangle the script engine from
testing.T so that I can also use it to generate serving contents in
the replacement for vcs-test.golang.org.)

The implementation of goVersion called ts.fatalf, which is probably
fine but prevents the script environment from being computed outside
of a test, as we might want to do for debugging and other scripting.

For #27494.

Change-Id: Ibfee0704523fdcd6174b544ff84267216435025b
Reviewed-on: https://go-review.googlesource.com/c/go/+/419874
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>

21 months agocmd/go: run tests when cmd/go is cross-compiled
Bryan C. Mills [Fri, 15 Oct 2021 15:35:25 +0000 (11:35 -0400)]
cmd/go: run tests when cmd/go is cross-compiled

When the GOOS or GOARCH of the cmd/go test binary does not match the
GOOS or GOARCH of the installed 'go' binary itself, the test currently
attempts to trick 'go test' into thinking that there were no test
functions to run.

That makes it very difficult to discover how to actually run the
tests, which in turn makes it difficult to diagnose and fix
regressions in, say, the linux-386-longtest builders. (We have had a
few of those lately, and they shouldn't be as much of an ordeal to fix
as they currently are.)

There are three underlying problems:

1. cmd/go uses its own GOOS and GOARCH to figure out which variant of
   other tools to use, and the cache keys for all installed tools and
   libraries include the IDs of the tools used to build them. So when
   cmd/go's GOARCH changes, all installed tools and binaries appear
   stale *even if* they were just installed by invoking the native
   cmd/go with the appropriate GOARCH value set.

2. The "go/build" library used by cmd/go toggles its default
   CGO_ENABLED behavior depending on whether the GOOS and GOARCH being
   imported match runtime.GOOS and runtime.GOARCH.

3. A handful of cmd/go tests explicitly use gccgo, but the user's
   installed gccgo binary cannot necessarily cross-compile to the same
   platforms as cmd/go.

To address the cache-invalidation problem, we modify the test variant
of cmd/go to use the host's native toolchain (as indicated by the new
TESTGO_GOHOSTOS and TESTGO_GOHOSTARCH environment variables) instead
of the toolchain matching the test binary itself. That allows a test
cmd/go binary compiled with GOARCH=386 to use libraries and tools
cross-compiled by the native toolchain, so that

$ GOARCH=386 go install std cmd

suffices to make the packages in std and cmd non-stale in the
tests.

To address the CGO_ENABLED mismatch, we set CGO_ENABLED explicitly in
the test's environment whenever it may differ from the default. Since
script tests that use cgo are already expected to use a [cgo]
condition, setting the environment to match that condition fixes the
cgo-specific tests.

To address the gccgo-specific cross-compilation failures, we add a new
script condition, [cross], which evaluates to true whenever the
platform of the test binary differs from that of the native toolchain.
We can then use that condition to explicitly skip the handful of gccgo
tests that fail under cross-compilation.

Fixes #53936.

Change-Id: I8633944f674eb5941ccc95df928991660e7e8137
Reviewed-on: https://go-review.googlesource.com/c/go/+/356611
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
21 months agoall: remove duplicate "the" words in comments
Abirdcfly [Thu, 18 Aug 2022 05:18:11 +0000 (13:18 +0800)]
all: remove duplicate "the" words in comments

Following CL 424454, using command

   rg --multiline " the\s{1,}the " *
   rg --multiline " the\s{1,}//\s{1,}the " *

all the words "the" that are repeated in comments are found.

Change-Id: I60b769b98f04c927b4c228e10f37faf190964069
Reviewed-on: https://go-review.googlesource.com/c/go/+/423836
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
21 months agocmd/compile/internal/noder: shape-based stenciling for unified IR
Matthew Dempsky [Sat, 6 Aug 2022 23:40:56 +0000 (16:40 -0700)]
cmd/compile/internal/noder: shape-based stenciling for unified IR

This CL switches unified IR to use shape-based stenciling with runtime
dictionaries, like the existing non-unified frontend. Specifically,
when instantiating generic functions and types `X[T]`, we now also
instantiated shaped variants `X[shapify(T)]` that can be shared by
`T`'s with common underlying types.

For example, for generic function `F`, `F[int](args...)` will be
rewritten to `F[go.shape.int](&.dict.F[int], args...)`.

For generic type `T` with method `M` and value `t` of type `T[int]`,
`t.M(args...)` will be rewritten to `T[go.shape.int].M(t,
&.dict.T[int], args...)`.

Two notable distinctions from the non-unified frontend:

1. For simplicity, currently shaping is limited to simply converting
type arguments to their underlying type. Subsequent CLs will implement
more aggressive shaping.

2. For generic types, a single dictionary is generated to be shared by
all methods, rather than separate dictionaries for each method. I
originally went with this design because I have an idea of changing
interface calls to pass the itab pointer via the closure
register (which should have zero overhead), and then the interface
wrappers for generic methods could use the *runtime.itab to find the
runtime dictionary that corresponds to the dynamic type. This would
allow emitting fewer method wrappers.

However, this choice does have the consequence that currently even if
a method is unused and its code is pruned by the linker, it may have
produced runtime dictionary entries that need to be kept alive anyway.

I'm open to changing this to generate per-method dictionaries, though
this would require changing the unified IR export data format; so it
would be best to make this decision before Go 1.20.

The other option is making the linker smarter about pruning unneeded
dictionary entries, like how it already prunes itab entries. For
example, the runtime dictionary for `T[int]` could have a `R_DICTTYPE`
meta-relocation against symbol `.dicttype.T[go.shape.int]` that
declares it's a dictionary associated with that type; and then each
method on `T[go.shape.T]` could have `R_DICTUSE` meta-relocations
against `.dicttype.T[go.shape.T]+offset` indicating which fields
within dictionaries of that type need to be preserved.

Change-Id: I369580b1d93d19640a4b5ecada4f6231adcce3fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/421821
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months agointernal/poll: remove detection of buggy splice on old Linux versions
Tobias Klauser [Wed, 17 Aug 2022 20:21:23 +0000 (22:21 +0200)]
internal/poll: remove detection of buggy splice on old Linux versions

The splice syscall is buggy prior to Linux 2.6.29. CL 113999 added a
workaround to detect buggy versions and disable use of splice for these.
As of Go 1.18 the minumum Linux version is 2.6.32. Thus, a non-buggy
implementation of the splice syscall can be assumed.

For #45964
Fixes #54505

Change-Id: Ied3a3334da7a3f7fa1280b7c5b1dfb9030219336
Reviewed-on: https://go-review.googlesource.com/c/go/+/422979
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
21 months agoos: only add file descriptors which are set to non-blocking mode to the netpoller
Yuval Pavel Zholkover [Sat, 30 Jul 2022 17:41:58 +0000 (20:41 +0300)]
os: only add file descriptors which are set to non-blocking mode to the netpoller

Either ones where kind == kindNonBlock or those we've successfully called syscall.SetNonblock() on.
Restore blocking behavior if we detect an error registering with the netpoller and our flow was
successful in setting the inital syscall.SetNonblock().

Update #54100

Change-Id: I08934e4107c7fb36c15a7ca23ac880490b4df235
Reviewed-on: https://go-review.googlesource.com/c/go/+/420334
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Yuval Pavel Zholkover <paulzhol@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

21 months agodebug/buildinfo: implement for Plan 9 a.out
Ori Bernstein [Sun, 17 Jul 2022 16:02:30 +0000 (12:02 -0400)]
debug/buildinfo: implement for Plan 9 a.out

Plan 9 a.out was not implemented for debug/buildinfo, which
was causing test failures on Plan 9. This adds an implementation,
and causes the tests to pass.

Fixes #53949

Change-Id: I90a307ef9babf8cf381f8746d731cac2206b234a
Reviewed-on: https://go-review.googlesource.com/c/go/+/418014
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

21 months agoruntime: convert profbuf.eof to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 10:45:15 +0000 (17:45 +0700)]
runtime: convert profbuf.eof to atomic type

Updates #53821

Change-Id: I271faaedbf8b8efca5fc765496eaf45c94927edf
Reviewed-on: https://go-review.googlesource.com/c/go/+/423891
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
21 months agoruntime: convert profbuf.overflowTime to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 10:43:56 +0000 (17:43 +0700)]
runtime: convert profbuf.overflowTime to atomic type

Updates #53821

Change-Id: I916549d831f84d4f1439433aea6a61ff5301d80c
Reviewed-on: https://go-review.googlesource.com/c/go/+/423890
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
21 months agoruntime: convert profbuf.overflow to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 10:42:49 +0000 (17:42 +0700)]
runtime: convert profbuf.overflow to atomic type

Updates #53821

Change-Id: Ib9c3be3d25c836636a59fdfacc63ba75edd9e016
Reviewed-on: https://go-review.googlesource.com/c/go/+/423889
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
21 months agoruntime: convert m.cgoCallersUse to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 10:39:01 +0000 (17:39 +0700)]
runtime: convert m.cgoCallersUse to atomic type

Updates #53821

Change-Id: I99b01f8e91b798e73275635c8a63fcdc4a8df9f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/423888
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>

21 months agoruntime: delete repeated word
Dan Kortschak [Wed, 17 Aug 2022 12:27:59 +0000 (21:57 +0930)]
runtime: delete repeated word

Change-Id: I0d7005481fc61b4c7f3286674c022334c8c0cae0
Reviewed-on: https://go-review.googlesource.com/c/go/+/424494
Reviewed-by: hopehook <hopehook@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: hopehook <hopehook@qq.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

21 months agoruntime: convert p.timerModifiedEarliest to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 07:59:57 +0000 (14:59 +0700)]
runtime: convert p.timerModifiedEarliest to atomic type

Updates #53821

Change-Id: Iac0d7a3871d9e3ee0ba38ee7ab989faca9c89666
Reviewed-on: https://go-review.googlesource.com/c/go/+/424397
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
21 months agocrypto/internal/boring/bcache: make Cache type-safe using generics
Russ Cox [Tue, 16 Aug 2022 14:37:48 +0000 (10:37 -0400)]
crypto/internal/boring/bcache: make Cache type-safe using generics

Generics lets us write Cache[K, V] instead of using unsafe.Pointer,
which lets us remove all the uses of package unsafe around the
uses of the cache.

I tried to do Cache[*K, *V] instead of Cache[K, V] but that was not possible.

Change-Id: If3b54cf4c8d2a44879a5f343fd91ecff096537e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/423357
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>

21 months agoruntime: gofmt -w -s
hopehook [Wed, 17 Aug 2022 09:11:13 +0000 (17:11 +0800)]
runtime: gofmt -w -s

Change-Id: I1226ff66fd0c64984939793eb8ef96c08d030fa1
Reviewed-on: https://go-review.googlesource.com/c/go/+/424399
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: hopehook <hopehook@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months agocmd/compile: gofmt -w -s
hopehook [Wed, 17 Aug 2022 09:02:06 +0000 (17:02 +0800)]
cmd/compile: gofmt -w -s

Change-Id: I4dad103d23121a21b04800ec157487fdf79f89a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/424398
Run-TryBot: hopehook <hopehook@qq.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months agorun: set GOENV=off when running 'go tool dist env'
Bryan C. Mills [Thu, 28 Jul 2022 19:29:38 +0000 (15:29 -0400)]
run: set GOENV=off when running 'go tool dist env'

'go tool' sets environment variables, including the GOAMD64 value
from the user's go.env file.

'go tool dist test' then rebuilds and reinstalls the toolchain and
standard library based on those variables. It should not; instead, it
should test exactly the configuration installed by the make scripts.

Fixes #54084.

Change-Id: I7cc8a21cc1d8331e06d7b7c55b14d170f8e2faab
Reviewed-on: https://go-review.googlesource.com/c/go/+/420055
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
21 months agoruntime: refactor ARM VDSO call setup to helper
Michael Pratt [Thu, 4 Nov 2021 21:21:13 +0000 (17:21 -0400)]
runtime: refactor ARM VDSO call setup to helper

We have a very complex process to make VDSO calls on ARM. Create a
wrapper helper function which reduces duplication and allows for
additional calls from other packages.

vdsoCall has a few differences from the original code in
walltime/nanotime:

* It does not use R0-R3, as they are passed through as arguments to fn.
* It does not save g if g.m.gsignal.stack.lo is zero. This may occur if
it called at startup on g0 between assigning g0.m.gsignal and setting
its stack.

For #49182

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

21 months agocmd/go: skip test cases that depend on gopkg.in
Bryan C. Mills [Wed, 17 Aug 2022 16:51:10 +0000 (12:51 -0400)]
cmd/go: skip test cases that depend on gopkg.in

Updates #54503.

Change-Id: Ie13d028b09260d2d316c343b3ea812bb9cce4e6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/424594
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
21 months agocrypto/subtle: add XORBytes
Russ Cox [Fri, 5 Aug 2022 17:34:29 +0000 (13:34 -0400)]
crypto/subtle: add XORBytes

Export cipher.xorBytes as subtle.XORBytes, for proposal #53021,
to provide fast XOR to cryptography libraries outside crypto/cipher.

Along with the move, implement the alignment check TODO
in xor_generic.go, so that systems with neither unaligned
accesses nor custom assembly can still XOR a word at a time
in word-based algorithms like GCM. This removes the need
for the separate cipher.xorWords.

Fixes #53021.

Change-Id: I58f80a922f1cff671b5ebc6168eb046e702b5a4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/421435
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
21 months agocrypto/internal/subtle: rename to crypto/internal/alias
Russ Cox [Tue, 16 Aug 2022 14:50:35 +0000 (10:50 -0400)]
crypto/internal/subtle: rename to crypto/internal/alias

This avoids an import conflict with crypto/subtle.
CL 424175 does the same for x/crypto.

Change-Id: Id4a319b3283b8affaaf769062388325b31fe1715
Reviewed-on: https://go-review.googlesource.com/c/go/+/424194
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>

21 months agonet: revert "reenable TestLookupLongTXT"
Damien Neil [Wed, 17 Aug 2022 17:49:57 +0000 (10:49 -0700)]
net: revert "reenable TestLookupLongTXT"

Test is still flaky.

For #22857

Change-Id: Ic0d979778eb4c2d3779b18a983e7077789ae08a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/424535
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
21 months agoruntime: convert p.timer0When to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 07:56:18 +0000 (14:56 +0700)]
runtime: convert p.timer0When to atomic type

Updates #53821

Change-Id: I523ec61116d290ecf7b7e3eb96e468695766cb4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/424396
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

21 months agoruntime: convert m.preemptGen to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 10:36:12 +0000 (17:36 +0700)]
runtime: convert m.preemptGen to atomic type

Updates #53821

Change-Id: I134dac3b1eb35f2da00e5ef8f4c264f08d4f65b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/423887
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>

21 months agoruntime: convert freezing to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 10:28:58 +0000 (17:28 +0700)]
runtime: convert freezing to atomic type

Updates #53821

Change-Id: I77fcdb972b8920e1fb42248ce5bd2c3d2d0bd27e
Reviewed-on: https://go-review.googlesource.com/c/go/+/423885
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>

21 months agoruntime/trace: convert tracing.enabled to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 10:25:33 +0000 (17:25 +0700)]
runtime/trace: convert tracing.enabled to atomic type

Updates #53821

Change-Id: I8a063ae94568cd2ea65c2e891618069a96139891
Reviewed-on: https://go-review.googlesource.com/c/go/+/423884
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>

21 months agoruntime: convert netpoll netpollInited to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 09:27:01 +0000 (16:27 +0700)]
runtime: convert netpoll netpollInited to atomic type

Updates #53821

Change-Id: Ifa2e5f5d4047117b1887c1e56851355547bb4f33
Reviewed-on: https://go-review.googlesource.com/c/go/+/423881
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
21 months agoruntime: convert kqueue netpollWakeSig to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 09:22:13 +0000 (16:22 +0700)]
runtime: convert kqueue netpollWakeSig to atomic type

Updates #53821

Change-Id: I85d7444be36967e1e7e0ff2ce2f19b73581ecdde
Reviewed-on: https://go-review.googlesource.com/c/go/+/423880
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>

21 months agoruntime: convert windows netpollWakeSig to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 09:21:00 +0000 (16:21 +0700)]
runtime: convert windows netpollWakeSig to atomic type

Updates #53821

Change-Id: Ifc5bc551a4bcf82bf10d2e670ad2644eb9c6b334
Reviewed-on: https://go-review.googlesource.com/c/go/+/423879
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>

21 months agoruntime: convert solaris netpollWakeSig to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 09:19:55 +0000 (16:19 +0700)]
runtime: convert solaris netpollWakeSig to atomic type

Updates #53821

Change-Id: Ic2799c125267dc5b13b265db41fbe8bf7c08b8a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/423878
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
21 months agoruntime: convert aix netpollWakeSig to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 09:18:07 +0000 (16:18 +0700)]
runtime: convert aix netpollWakeSig to atomic type

Updates #53821

Change-Id: Ic073871ed2638ca22e6cb057dd8297f27582e78f
Reviewed-on: https://go-review.googlesource.com/c/go/+/423877
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
21 months agoruntime: convert linux netpollWakeSig to atomic type
Cuong Manh Le [Wed, 17 Aug 2022 09:13:09 +0000 (16:13 +0700)]
runtime: convert linux netpollWakeSig to atomic type

Updates #53821

Change-Id: If4090393a127c2f468c8ae5ba478a9f59d73b945
Reviewed-on: https://go-review.googlesource.com/c/go/+/423876
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>