1
0
mirror of https://github.com/golang/go synced 2024-11-17 06:54:48 -07:00
Commit Graph

51926 Commits

Author SHA1 Message Date
hopehook
f8e70fc9a6 strings: document the use of simple case-folding in EqualFold
Fixes #52022

Change-Id: I077fc062dfd02f79eb83713490efbe0bdc783d8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/396616
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2022-04-02 06:48:45 +00:00
hopehook
153c18a515 net/netip: improve documentation terminology for IPv4-mapped IPv6 addresses
Updates #51834

Change-Id: I07a43457e2e328b51fea8131f7d6d5a4f1de4dc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/394078
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2022-04-02 06:45:40 +00:00
Bryan C. Mills
67d6a51065 net: in TestNotTemporaryRead, reject io.EOF on platforms other than plan9
Updates #29685

Change-Id: Id8dca078213942666871ac8ded663326e98427fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/385754
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-01 21:28:32 +00:00
Russ Cox
690ac4071f all: remove trailing blank doc comment lines
A future change to gofmt will rewrite

	// Doc comment.
	//
	func f()

to

	// Doc comment.
	func f()

Apply that change preemptively to all doc comments.

For #51082.

Change-Id: I4023e16cfb0729b64a8590f071cd92f17343081d
Reviewed-on: https://go-review.googlesource.com/c/go/+/384259
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-01 18:18:07 +00:00
Russ Cox
89dff118ad all: fix TODO comment hanging indents
For whatever reason (perhaps some tool does this), a handful of comments,
including some doc comments, have TODOs formatted like:

	// TODO(name): Text here and
	//             more text aligned
	//             under first text.

In doc comments the second line turns into a <pre> block,
which is undesirable in this context.

Rewrite those to unindent, like this instead:

	// TODO(name): Text here and
	// more text aligned
	// at left column.

For #51082.

Change-Id: Ibf5145659a61ebf9496f016752a709a7656d2d4b
Reviewed-on: https://go-review.googlesource.com/c/go/+/384258
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-01 18:18:05 +00:00
Russ Cox
7d87ccc860 all: fix various doc comment formatting nits
A run of lines that are indented with any number of spaces or tabs
format as a <pre> block. This commit fixes various doc comments
that format badly according to that (standard) rule.

For example, consider:

	// - List item.
	//   Second line.
	// - Another item.

Because the - lines are unindented, this is actually two paragraphs
separated by a one-line <pre> block. This CL rewrites it to:

	//  - List item.
	//    Second line.
	//  - Another item.

Today, that will format as a single <pre> block.
In a future release, we hope to format it as a bulleted list.

Various other minor fixes as well, all in preparation for reformatting.

For #51082.

Change-Id: I95cf06040d4186830e571cd50148be3bf8daf189
Reviewed-on: https://go-review.googlesource.com/c/go/+/384257
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-01 18:18:01 +00:00
Bryan C. Mills
df89f2ba53 crypto/x509: skip WSATRY_AGAIN errors when dialing badssl.com subdomains
(Temporarily, until the root cause of the test failure can be
diagnosed and fixed properly.)

For #52094

Change-Id: Iec69e162159f3f0a93135f742aac97cf82c1d96c
Reviewed-on: https://go-review.googlesource.com/c/go/+/397478
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-01 17:19:22 +00:00
Cherry Mui
995a604591 runtime/race: update syso files to new TSAN runtime (v3)
Following CL 333529, update syso files for other architectures.

Windows/AMD64 is not updated, waiting for Than for C toolchain
updates.

OpenBSD/AMD64 is not updated as upstream LLVM TSAN removed OpenBSD
support (#52090).

Linux/PPC64LE is not updated due to a test failure. Will look into
it.

Change-Id: I46441fd3bb0f2c9e372d3e7fd43744ffafaf87a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/397494
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-04-01 15:45:30 +00:00
Than McIntosh
1fc3346275 debug/dwarf: better error handling in SeekPC
The dwarf.Reader "SeekPC" method was not properly handling the case
of a truncated/empty unit (something that has header information
but an empty abbrev table and no DIEs). Add some guards to handle
this case.

Fixes #52045.

Change-Id: I978163eca3b610f7528058693b840931e90d3f63
Reviewed-on: https://go-review.googlesource.com/c/go/+/397054
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-01 14:08:14 +00:00
Eli Bendersky
2e8dc8f472 cmd/pprof: point to -h in package documentation
Change-Id: I820c72e31fbb6471481f4483e7f13bb8b3d5d00c
Reviewed-on: https://go-review.googlesource.com/c/go/+/396881
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Eli Bendersky‎ <eliben@golang.org>
Run-TryBot: Eli Bendersky‎ <eliben@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-01 12:16:03 +00:00
erifan01
62d4c32b7e cmd/asm: add DC instruction on arm64
There was only a placeholder for DC instruction in the previous code.
gVisor needs this instruction. This CL completes its support.

This patch is a copy of CL 250858, contributed by Junchen Li(junchen.li@arm.com).
Co-authored-by: Junchen Li(junchen.li@arm.com)

CustomizedGitHooks: yes
Change-Id: I76098048a227fbd08aa42c4173b028f0ab4f66e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/302851
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Eric Fang <eric.fang@arm.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-01 07:18:42 +00:00
erifan01
26ab215969 cmd/asm: add TLBI instruction on arm64
There was only a placeholder for TLBI instruction in the previous code.
gVisor needs this instruction. This CL completes its support.

This patch is a copy of CL 250758, contributed by Junchen Li(junchen.li@arm.com).
Co-authored-by: Junchen Li(junchen.li@arm.com)

Change-Id: I69e893d2c1f75e227475de9e677548e14870f3cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/302850
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Eric Fang <eric.fang@arm.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-01 06:36:16 +00:00
Andrew Gerrand
029d2c4524 flag: recover panic when calling String on zero value in PrintDefaults
When printing the usage message, recover panics when calling String
methods on reflect-constructed flag.Value zero values. Collect the panic
messages and include them at the end of the PrintDefaults output so that
the programmer knows to fix the panic.

Fixes #28667

Change-Id: Ic4378a5813a2e26f063d5580d678add65ece8f97
Reviewed-on: https://go-review.googlesource.com/c/go/+/396574
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Trust: Andrew Gerrand <adg@golang.org>
2022-04-01 03:43:34 +00:00
Ian Lance Taylor
9d6c711e3c runtime: use correct parameter name in comment
Change-Id: If8713aca9d6b1f1c218e85f09c9ee016833b3faa
Reviewed-on: https://go-review.googlesource.com/c/go/+/396515
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2022-04-01 03:35:45 +00:00
erifan01
f5290ef947 cmd/asm: refactor some operands that are not special registers on arm64
The previous code treats some operands such as EQ, LT, etc. as special
registers. However, they are not. This CL adds a new AddrType TYPE_SPOPD
and a new class C_SPOPD to support this kind of special operands, and
refactors the relevant code.

This patch is a copy of CL 260861, contributed by Junchen Li(junchen.li@arm.com).

Co-authored-by: Junchen Li(junchen.li@arm.com)
Change-Id: I57b28da458ee3332f610602632e7eda03af435f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/302849
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Eric Fang <eric.fang@arm.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-01 03:16:26 +00:00
Meng Zhuo
bb2b16d15e reflect, runtime: add reflect support for regabi on riscv64
This CL adds regabi support needed for reflect and reimplement
of CL 360994, which is reverted.

Change-Id: I140673f09109dd9f72eff70aad64c0aa00d6857a
Reviewed-on: https://go-review.googlesource.com/c/go/+/396077
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: mzh <mzh@golangcn.org>
2022-04-01 01:41:42 +00:00
eric fang
ecee4a3291 cmd/internal/obj/arm64: fix encoding error for SYS instruction
Currently using the SYS instruction will report the "illegal combination"
error. This is because the assembler parser treats the register operand
as p.To, while optab defines it as p.Reg. This CL fixes this bug.

Change-Id: I57799a7c19934b0c62278948f4efaa41001593a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/396796
Run-TryBot: Eric Fang <eric.fang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Eric Fang <eric.fang@arm.com>
2022-04-01 01:23:42 +00:00
Meng Zhuo
be8ee5a58f cmd/dist: enable msan/asan
Supporting memory sanitizer and address sanitizer in toolchains

Change-Id: Ie292657b78954d65bd72e64e063b1c4f18d4f0d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/374974
Trust: mzh <mzh@golangcn.org>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-04-01 01:18:52 +00:00
Olivier Szika
c4efe7fb27 mime/multipart: allow nested boundary with outer boundary+dash prefix
Fixes #46042

Change-Id: Icd243eb12c6e260aeead04710f12340048a0e859
Reviewed-on: https://go-review.googlesource.com/c/go/+/338549
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2022-04-01 01:18:06 +00:00
Ben Shi
5dbfa6e61a cmd/internal/obj/riscv: fix illegal form of MOV instructions
The MOV like instructions should only have two operands.

Change-Id: Icbfb49e47a91ac305194c2f140d3d81c912f6d6d
GitHub-Last-Rev: 2b25aaa0ed
GitHub-Pull-Request: golang/go#52073
Reviewed-on: https://go-review.googlesource.com/c/go/+/397175
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: mzh <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-04-01 01:17:45 +00:00
Meng Zhuo
baf6df06c0 debug/elf: ajdust SectionOverlap test for proper fields
The current SectionOverlap tests Size (addr) with Offset (file)

This CL set this test for overlap of Size + Addr and
Offset + FileSize

Fixes #51939

Change-Id: Ied4c0b87f61c4d5e52139a8295c371f55abc776f
Reviewed-on: https://go-review.googlesource.com/c/go/+/395920
Trust: mzh <mzh@golangcn.org>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-04-01 01:06:18 +00:00
nimelehin
a4ffeb9edd cmd/compile: use opregreg for x86.AXOR* ops
Change-Id: Id087d86261744559685c687aa7bad6c55466f1b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/369020
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Alex Rakoczy <alex@golang.org>
2022-04-01 00:06:53 +00:00
vpachkov
6a40bdcbaf runtime: check GOAMD64 v4 compatibility on Darwin
Darwin requires a different approach to check AVX512 support.

Update #45453

Change-Id: Ia3dfecc04b47aab16f472000e92e46d4fc6d596d
Reviewed-on: https://go-review.googlesource.com/c/go/+/365395
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Heschi Kreinick <heschi@google.com>
2022-04-01 00:05:05 +00:00
Damien Neil
a41763539c net/http: handle 3xx responses with no Location
RFC 7231 does not require that a 3xx response contain a Location header.
When receiving such a response, just return it to the caller rather than
treating it as an error.

Fixes #49281.

Change-Id: I66c06d81b0922016384a0f4ff32bf52e3a3d5983
Reviewed-on: https://go-review.googlesource.com/c/go/+/375354
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
2022-03-31 23:30:43 +00:00
Wayne Zuo
fb2a9d27e3 mime/multipart: unified Part and Reader receiver name
Change-Id: Ic36dd232f3ea049403715fadec00a74efbf7dc9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/394075
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Damien Neil <dneil@google.com>
2022-03-31 22:21:57 +00:00
Roland Shoemaker
9a53b472b5 crypto/x509: properly handle issuerUniqueID and subjectUniqueID
Fixes #51754

Change-Id: I3bfa15db3497de9fb82d6391d87fca1ae9ba6543
Reviewed-on: https://go-review.googlesource.com/c/go/+/394297
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2022-03-31 21:39:51 +00:00
Bryan C. Mills
ff6b6c61d7 net: skip tests that use netsh on the windows-arm64-10 builder
These tests sometimes hang on Windows 10 on ARM64, due to what appears
to be a platform bug. Since we have not yet observed any such hangs on
the windows-arm64-11 builder, I am leaving the tests otherwise enabled
on the theory that the platform bug may have been fixed in Windows 11.

Fixes #52082 (at least for now).

Change-Id: I79161f485b1921f083ebcf01865d6e7b0178ef70
Reviewed-on: https://go-review.googlesource.com/c/go/+/397315
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-31 21:21:20 +00:00
Bryan C. Mills
434b2a5d0d syscall: relax output check in TestGroupCleanupUserNamespace
“If you have a procedure with ten parameters, you probably missed some.”
― attr. Alan J. Perlis

I argue that the same is true for hard-coded special cases.

In TestGroupCleanupUserNamespace, instead of a curated list of strings
observed in the wild we now check for a prefix, as was done for
TestGroupCleanup in CL 24670.

Updates #16224.
Updates #16303.
Updates #19938.
Updates #34547.
Updates #46752.
Fixes #52088.

Change-Id: I59c5b0c048113e306996c0f8247e09c714d2423a
Reviewed-on: https://go-review.googlesource.com/c/go/+/397316
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-03-31 21:17:08 +00:00
John Anthony
a84ef50021 cmd/go: prevent go work use panic when given a file
The current implementation fails to identify that an argument to go work
use is a file when expecting a directory, and panics when attempting to
access it as a directory. This change checks arguments are directories
and generates an error otherwise.

Fixes #51749

Change-Id: If8f69d233409e93fcf391a8774bace74c031c986
Reviewed-on: https://go-review.googlesource.com/c/go/+/393615
Reviewed-by: Bryan Mills <bcmills@google.com>
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
2022-03-31 21:10:26 +00:00
Ian Lance Taylor
31ee4bb28d strconv: quote rune 007F as \x7f, not \u007f
\u007f is not wrong but it's weird to use \u when we could use the
shorter \x.

Fixes #52062

Change-Id: Ica4bdc2463128051876f44e15297ed1e9edf1de8
Reviewed-on: https://go-review.googlesource.com/c/go/+/397255
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2022-03-31 20:37:15 +00:00
Bryan C. Mills
825309962f cmd/go: allow either test to complete first in TestScript/test_chatty_parallel_success_run
This fixes a failure mode observed in
https://build.golang.org/log/7b28a914b1914dabe94f7c4e36ad6466ebd4de5d,
in which the expected CONT lines are present but the test completions
are reported in a different (but valid) order.

CONT lines are only printed between interleaved output lines, so if
the ordering of the tests swaps after all output is already generated
the PASS lines can be in arbitrary order.

Fixes #51221 (again).

Change-Id: I051f8ec4331e2e3ab1bb00a7c188c322ad4e0a03
Reviewed-on: https://go-review.googlesource.com/c/go/+/397194
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-03-31 20:34:32 +00:00
Keith Randall
bdd0f0f780 cmd/compile: better propagation of desired registers
This fixes two independent problems:

We normally propagate desired registers backwards through opcodes that
are marked resultInArg0. Unfortunately for the desired register
computation, ADDQconst is not marked as resultInArg0. This is because
the amd64 backend can write it out as LEAQ instead if the input and
output registers don't match. For desired register purposes, we want
to treat ADDQconst as resultInArg0, so that we get an ADDQ instead of
a LEAQ if we can.

Desired registers don't currently work for tuple-generating opcodes.
Declare that the desired register applies to the first element of the
tuple, and propagate the desired register back through Select0.

Noticed when fixing #51964

Change-Id: I83346b988882cd58c2d7e7e5b419a2b9a244ab66
Reviewed-on: https://go-review.googlesource.com/c/go/+/396035
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-31 20:19:48 +00:00
Michael Anthony Knyszek
23756207fb runtime: rewrite stale comment about pacer
Change-Id: Ieb8015164526da59b042031234146def06f70a1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/393399
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-03-31 20:03:04 +00:00
Michael Anthony Knyszek
f990b0f1e8 runtime: add wrappers for sys* functions and consolidate docs
This change lifts all non-platform-specific code out of sys* functions
for each platform up into wrappers, and moves documentation about the OS
virtual memory abstraction layer from malloc.go to mem.go, which
contains those wrappers.

Change-Id: Ie803e4447403eaafc508b34b53a1a47d6cee9388
Reviewed-on: https://go-review.googlesource.com/c/go/+/393398
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
2022-03-31 20:02:55 +00:00
Michael Anthony Knyszek
4a56ba1c45 runtime: remove intermediate fields in memstats for ReadMemStats
Currently, the ReadMemStats (really this is all happening in
readmemstats_m, but that's just a direct call from ReadMemStats) call
chain first populates some fields in memstats, then copies those into
the final MemStats location. This used to make a lot of sense when
memstats' structure aligned with MemStats, and the values were just
copied from one to other. Sometime in the last few releases, we switched
to populating the MemStats manually because a lot of fields had diverged
from their internal representation. Now, we're left with a lot of fields
in memstats that pollute the structure: they only exist to be updated
for the sake of ReadMemStats. Since we're going to be adding more fields
to memstats in further CLs, this is a good opportunity to clean up.

As a result of this change, updatememstats, which used to just update
the aforementioned intermediate fields in memstats, is no longer
necessary, so it is removed.

Change-Id: Ifabfb3ac3002641105af62e9509a6351165dcd87
Reviewed-on: https://go-review.googlesource.com/c/go/+/393397
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-03-31 20:02:31 +00:00
Michael Anthony Knyszek
3334afd760 runtime: remove old pacer and the PacerRedesign goexperiment
Now that Go 1.18 has been released, remove the old pacer.

Change-Id: Ie7a7596d67f3fc25d3f375a08fc75eafac2eb834
Reviewed-on: https://go-review.googlesource.com/c/go/+/393396
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-03-31 20:02:10 +00:00
Michael Anthony Knyszek
f1b5c048d7 runtime/internal/atomic: add Bool
This change adds the Bool type, a convenient wrapper around Uint8 for
atomic bool values.

Change-Id: I86127d6f213b730d6999db5718ca1a5af0c5b538
Reviewed-on: https://go-review.googlesource.com/c/go/+/393395
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
2022-03-31 20:01:47 +00:00
vpachkov
12acf9b0f0 runtime: remove AVX2less code in memclrNoHeapPointers for GOAMD64 >= 3
Optimize memclr by removing simple case loop along with the
runtime check since AVX2 is guaranteed to be available when
compiling with GOAMD64 >= 3

name             old speed      new speed      delta
Memclr/5-12      2.70GB/s ± 1%  2.73GB/s ± 1%     ~     (p=0.056 n=5+5)
Memclr/16-12     7.00GB/s ± 2%  7.03GB/s ± 1%     ~     (p=1.000 n=5+5)
Memclr/64-12     25.5GB/s ± 1%  25.5GB/s ± 1%     ~     (p=0.548 n=5+5)
Memclr/256-12    53.4GB/s ± 1%  52.7GB/s ± 2%     ~     (p=0.222 n=5+5)
Memclr/4096-12    109GB/s ± 1%   129GB/s ± 0%  +18.57%  (p=0.008 n=5+5)
Memclr/65536-12  75.2GB/s ± 2%  78.3GB/s ± 3%   +4.14%  (p=0.008 n=5+5)
Memclr/1M-12     53.5GB/s ± 2%  54.1GB/s ± 2%     ~     (p=0.310 n=5+5)
Memclr/4M-12     53.1GB/s ± 3%  52.9GB/s ± 2%     ~     (p=1.000 n=5+5)
Memclr/8M-12     44.6GB/s ± 3%  45.1GB/s ± 3%     ~     (p=0.310 n=5+5)
Memclr/16M-12    24.8GB/s ± 2%  24.2GB/s ± 2%     ~     (p=0.056 n=5+5)
Memclr/64M-12    38.3GB/s ± 1%  37.8GB/s ± 1%     ~     (p=0.056 n=5+5)
[Geo mean]       31.0GB/s       31.5GB/s        +1.78%

Change-Id: I6f3014f6338cb3b5a1b94503faa205f043fe2de8
Reviewed-on: https://go-review.googlesource.com/c/go/+/367494
Trust: Cherry Mui <cherryyz@google.com>
Trust: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2022-03-31 19:46:55 +00:00
Than McIntosh
cc3a3519af cmd/link/internal/ld: revise recipe for ASLR enable on windows
When doing external linking on windows, the existing Go linker code
assumed that the external linker defaulted to "--no-dynamicbase" (if
no explicit option was given). This assumption doesn't hold for LLD,
which turns on "--dynamicbase" by default for 64-bit apps. Change the
linker to detect whether a more modern toolchain is in use and to
explicitly pass "--dynamicbase" either way , so as to take the
external linker default out of the equation. This also applies to the
"--high-entropy-va" option as well.

Updates #35006.

Change-Id: I3e12cf6d331c9d003e3d2bd566d45de5710588b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/384156
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-31 19:40:29 +00:00
Than McIntosh
f7670b9f94 cmd/go: update TestCgoHandlesWlORIGIN to avoid -rpath on windows
Tweak the cgo recipe for the TestCgoHandlesWlORIGIN testpoint to avoid
using "-rpath" on Windows, where it doesn't make sense to use it. This
change needed to avoid an "unknown flag -rpath" from clang/ldd on
windows.

Updates #35006.

Change-Id: I4fcd649df4687aa3aff5690e11a15fc0e0f42332
Reviewed-on: https://go-review.googlesource.com/c/go/+/384155
Reviewed-by: Bryan Mills <bcmills@google.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-31 19:40:16 +00:00
nimelehin
96081f8545 cmd/compile: remove a false dependency for TZCNT
LZCNT/TZCNT on some Intel CPUs suffer from a false dependency on
the destination register.

The problem was mentioned in the GCC Ticket: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62011#c7
and fixed with https://gcc.gnu.org/viewcvs?rev=214112&root=gcc&view=rev

Change-Id: I8109e84f03ac85f221b06d3b913612b58320d151
Reviewed-on: https://go-review.googlesource.com/c/go/+/369019
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Alex Rakoczy <alex@golang.org>
Run-TryBot: Alex Rakoczy <alex@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-31 19:39:37 +00:00
Ian Lance Taylor
9743fdd097 go/build: set allTags even when short-circuiting x_GOOS_GOARCH.go
Fixes #52053

Change-Id: I0e1f2737f97a4656913b34a731d8de2c77a15b4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/396918
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-31 19:36:46 +00:00
Wayne Zuo
40504892c1 cmd/compile: clean up arm64 32bit pointer in Reverse
Change-Id: I0751270c0f656a501b389f2e2bb0e959d6f5a0e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/396054
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
2022-03-31 19:27:54 +00:00
Jakub Ciolek
913ecf492d cmd/compile: fix clobberFlags for BSWAP
BSWAP does not affect EFLAGS on neither 386 nor x64. Set the clobberFlags value accordingly.

Change-Id: Ib9e88400607fea44bb51fe95dc4d77e7cb54bfec
Reviewed-on: https://go-review.googlesource.com/c/go/+/391494
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
2022-03-31 19:18:14 +00:00
Than McIntosh
c5c66d78b2 debug/pe: skip TestReadCOFFSymbolAuxInfo on big-endian systems
Disable the new TestReadCOFFSymbolAuxInfo testpoint on big endian
systems, pending resolution of issue 52079. The newly added interfaces
for reading symbol definition aux info is not working properly when
reading PE objects obj big-endian systems.

Updates #52079.

Change-Id: I8d55c7e4c03fc6444ef06a6a8154cb50596ca58a
Reviewed-on: https://go-review.googlesource.com/c/go/+/397294
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-03-31 19:13:25 +00:00
Cherry Mui
b1e83c0513 cmd/compile: simplify func value symbol generation
Currently, in most cases the compiler generates a func value
symbol when it is referenced, except when building a shared object
it generates the func value symbol when the function is declared.

The comment says this was necessary because we cannot deduplicate
DUPOK symbols across DSO boundaries. But the dynamic linker is
just fine to resolve symbols with the same name across DSO
boundaries.

Another problem may be that the address of the PLT stub may be
used. When such a func value is deferred, when the runtime needs
to scan its arguments, it cannot look up the PC to find the
function and therefore cannot find its stack map. This is not a
problem now as deferred functions always have no arguments.

Remove the special case for shared linkage.

Change-Id: Id7df0b0ada6d3d7f85741a9ab09581975509516c
Reviewed-on: https://go-review.googlesource.com/c/go/+/396534
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-31 18:59:23 +00:00
Robert Griesemer
b76f8df133 test: update comments in run.go (cleanup)
The -G compiler option doesn't exist anymore. Update some variable
names and comments to reflect the new reality.

Change-Id: I227e9c59a01615c3a40c3869102e8045cb012980
Reviewed-on: https://go-review.googlesource.com/c/go/+/397254
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-03-31 18:30:44 +00:00
Filippo Valsorda
37065847d8 crypto/elliptic: tolerate zero-padded scalars in generic P-256
Fixes #52075

Change-Id: I595a7514c9a0aa1b9c76aedfc2307e1124271f27
Reviewed-on: https://go-review.googlesource.com/c/go/+/397135
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2022-03-31 16:58:48 +00:00
Than McIntosh
5138401209 runtime: remove use of -mnop-fun-dllimport from cgotest win.go
This flag is not supported by clang, so remove it from the cgo cflags
when building for windows. It is clear that it was needed at some
point in the past, but it doesn't appear to be needed at the moment,
since all.bash passes on windows without it now.

Updates #35006.

Change-Id: Ib06c891f516654138e3363e06645cd187e46ce4e
Reviewed-on: https://go-review.googlesource.com/c/go/+/383838
Trust: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-31 15:59:22 +00:00
Than McIntosh
1edc2769ca cmd/link/internal/loadpe: add rudimentary COMDAT support
Add some rudimentary support to the PE file loader for handling
sections in COMDAT when reading host object files. This is needed
in order to link programs with support libraries that are of a more
modern vintage than GCC 5.X.

If a given section XYZ is in COMDAT, the symbol for that section will
be flagged, e.g. section 'Characteristics' field will have the
IMAGE_SCN_LNK_COMDAT bit set, and the symbol will be followed by an
"aux" symbol that includes the COMDAT handling strategy that the
linker needs to use.

This patch supports two COMDAT strategies (IMAGE_COMDAT_SELECT_ANY and
IMAGE_COMDAT_SELECT_SAME_SIZE); more work will have to be done in the
future to support other flavors if it turns out that they are needed.

Updates #35006.

Change-Id: I516e825c30ed3df94ba08323b8a24fb847e10c1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/383835
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-31 15:59:05 +00:00