aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj
AgeCommit message (Collapse)Author
2023-09-08cmd/internal/obj/riscv: clean up error checking for encodingJoel Sing
Replace a "fixme" with a more appropriate error. Also invert the condition so that the error returns early, which is more Go idiomatic. Change-Id: I03006572c4010fb47037bed3ee1fd7f92bfc20d3 Reviewed-on: https://go-review.googlesource.com/c/go/+/523457 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: M Zhuo <mzh@golangcn.org>
2023-09-08cmd/internal/obj/riscv: correct message in regVal panicJoel Sing
Change-Id: I68be4110216145ad1fb2e5095e1f2b143f9e69ac Reviewed-on: https://go-review.googlesource.com/c/go/+/523456 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Mark Ryan <markdryan@rivosinc.com> Reviewed-by: M Zhuo <mzh@golangcn.org> Run-TryBot: Joel Sing <joel@sing.id.au>
2023-09-08cmd/internal/obj/riscv: simplify instructionsForMOVJoel Sing
Rather than handling shift based scaling in two locations, rework logic so there is a single exit path. Change-Id: I832b4932d53183736050059a11019ced08281b3b Reviewed-on: https://go-review.googlesource.com/c/go/+/523455 Reviewed-by: M Zhuo <mzh@golangcn.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Mark Ryan <markdryan@rivosinc.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-09-07cmd/internal/obj/ppc64: do not assemble non-constant rotate RLWMIPaul E. Murphy
Unlike RLWNM, the ISA only supports an immediate rotate operand. Update optab and opirrr to avoid quietly assembling this insn. Change-Id: I1472a431cb8a870d55d5fff79ab905c4c459f630 Reviewed-on: https://go-review.googlesource.com/c/go/+/449835 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Paul Murphy <murp@ibm.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-05cmd/asm: add KMA and KMCTR instructions on s390x.root
This CL is to add assembly instruction mnemonics for the following instructions, mainly used in crypto packages. * KMA - cipher message with authentication * KMCTR - cipher message with counter Fixes #61163 Change-Id: Iff9a69911aeb4fab4bca8755b23a106eaebb2332 Reviewed-on: https://go-review.googlesource.com/c/go/+/515195 Reviewed-by: Carlos Amedee <carlos@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com>
2023-09-02cmd: fix some commentscui fliter
Change-Id: I8b3eb51e31139314d222d796b56ab7d42338797f Reviewed-on: https://go-review.googlesource.com/c/go/+/525315 Run-TryBot: shuang cui <imcusg@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Commit-Queue: Ian Lance Taylor <iant@google.com> Auto-Submit: Keith Randall <khr@golang.org>
2023-09-01cmd/internal/dwarf: replace Sym.Length with Context.SizeMatthew Dempsky
Preparatory refactoring before next CL. Change-Id: I06fb4670b933fddff1a2a70f3cf1eb124cbd86ee Reviewed-on: https://go-review.googlesource.com/c/go/+/524899 Auto-Submit: Matthew Dempsky <mdempsky@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-09-01cmd/internal/obj: simplify filename handlingMatthew Dempsky
The old Go object file format used linker symbols like "gofile..foo" to record references to the filename "foo". But the current object file format has a dedicated section for file names, so we don't need these useless prefixes anymore. Also, change DWARF generation to pass around the src.Pos directly, rather than the old file symbols, which it just turned back into a file index before writing out anyway. Finally, directly record the FileIndex into src.PosBase, so that we can skip the map lookups. Change-Id: Ia4a5ebfa95da271f2522e45befdb9f137c16d373 Reviewed-on: https://go-review.googlesource.com/c/go/+/523378 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com>
2023-08-29cmd/internal/obj: add Func type to replace "curfn any"Matthew Dempsky
This adds a modicum of type safety to these APIs, which are otherwise quite confusing to follow. Change-Id: I268a9a1a99a47dcfef6dc1e9e5be13673af3fb85 Reviewed-on: https://go-review.googlesource.com/c/go/+/523396 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com>
2023-08-29cmd/internal/{dwarf,obj}: stop substituting "" with pkgprefixMatthew Dempsky
cmd/asm and cmd/compile now always create symbols with the appropriate package prefixes, so cmd/internal/dwarf and cmd/internal/obj can stop worrying about qualifying names itself. Change-Id: I9aee5d759bf0d41a61722c777e7f66fce957e79e Reviewed-on: https://go-review.googlesource.com/c/go/+/523338 Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-29cmd/internal/obj: tweak implicit {ArgsPointerMaps,ArgInfo} behaviorMatthew Dempsky
This CL changes cmd/internal/obj to also implicitly set ArgsPointerMaps and ArgInfo for assembly functions that are explicitly package qualified (e.g., "pkg·name", not just "·name"). This is a prerequisite for changing cmd/asm to stop emitting `"".`-prefixed symbol names. Change-Id: I4e14bc24c87cf4d7114a7aed9beaf0c8d1f9c07f Reviewed-on: https://go-review.googlesource.com/c/go/+/523335 Auto-Submit: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com>
2023-08-29cmd: simplify some handling of package pathsMatthew Dempsky
We have obj.Link.Pkgpath, so we don't need to pass it redundantly in places where we already have an *obj.Link. Also, renaming the parser's "compilingRuntime" field to "allowABI", to match the "AllowAsmABI" name used by objabi.LookupPkgSpecial. Finally, push the handling of GOEXPERIMENT_* flags up to cmd/asm's main entry point, by simply appending them to flags.D. Change-Id: I6ada134522b0cbc90d35bcb145fbe045338fefb7 Reviewed-on: https://go-review.googlesource.com/c/go/+/523297 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-28cmd/internal/obj/arm64: avoid unnecessary pool literal usage for load/store ↵Joel Sing
pairs Implement better classification for load and store pair operations. This in turn allows us to avoid using pool literals when the offset fits in a 24 bit unsigned immediate. In this case, the offset can be calculated using two add immediate instructions, rather than loading the offset from the pool literal and then adding the offset to the base register. This requires the same number of instructions, however avoids a load from memory and does not require the offset to be stored in the literal pool. Updates #59615 Change-Id: I316ec3d54f1d06ae9d930e98d0c32471775fcb26 Reviewed-on: https://go-review.googlesource.com/c/go/+/515615 Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Joedian Reid <joedian@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-08-25cmd/internal/obj/arm64: load large constants into vector registers from rodataJoel Sing
Load large constants into vector registers from rodata, instead of placing them in the literal pool. This treats VMOVQ/VMOVD/VMOVS the same as FMOVD/FMOVS and makes use of the existing mechanism for storing values in rodata. Two additional instructions are required for a load, however these instructions are used infrequently and already have a high latency. Updates #59615 Change-Id: I54226730267689963d73321e548733ae2d66740e Reviewed-on: https://go-review.googlesource.com/c/go/+/515617 Reviewed-by: Eric Fang <eric.fang@arm.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-08-23cmd/internal/obj/riscv,cmd/link: add support for internal cgo linking on riscv64Joel Sing
Make it possible to internally link cgo on riscv64, which also adds support for SDYNIMPORT calls without external linking being required. This reduces the time of an ./all.bash run on a Sifive Hifive Unleashed by approximately 20% (~140 minutes down to ~110 minutes). Change-Id: I43f1348de31672718ae8676cc82f6fdc1dfee054 Reviewed-on: https://go-review.googlesource.com/c/go/+/431104 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Than McIntosh <thanm@google.com>
2023-08-22cmd/internal/obj/arm64: add test coverage for VMOVS and VMOVDJoel Sing
Change-Id: I31ba6696e124dccf37d674d090fdf04ba0a049a3 Reviewed-on: https://go-review.googlesource.com/c/go/+/515616 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Joel Sing <joel@sing.id.au>
2023-08-11cmd/asm: add KDSA instruction supportSrinivas Pokala
KDSA(Compute Digital Signature Authentication) instruction provides support for the signing and verification of elliptic curves Change-Id: I19996a307162dd4f476a1cfe4f8d1a74a609e6c1 Reviewed-on: https://go-review.googlesource.com/c/go/+/503215 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-08cmd/internal/obj/mips: add SEB/SEH instructionsJunxian Zhu
Add support for SEB/SEH instructions, which are introduced in mips32r2. SEB/SEH can be used to sign-extend byte/halfword in registers directly without passing through memory. Ref: The MIPS32 Instruction Set, Revision 5.04: https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00086-2B-MIPS32BIS-AFP-05.04.pdf Updates #60072 Change-Id: I33175ae9d943ead5983ac004bd2a158039046d65 Reviewed-on: https://go-review.googlesource.com/c/go/+/515475 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Joel Sing <joel@sing.id.au>
2023-08-07arm64: replace "PCALGIN with PCALIGN" in package documentationadetunjii
Change-Id: I476e2a75f39c876fa9c071cada36573740d546de GitHub-Last-Rev: dec3fb438f4dd0d8e0aff300356c8d92e8ee6749 GitHub-Pull-Request: golang/go#61783 Reviewed-on: https://go-review.googlesource.com/c/go/+/516395 Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-03cmd/internal/obj/arm64: move register encoding into opxrrrJoel Sing
Rather than having register encoding knowledge in each caller of opxrrr, pass the registers into opxrrr and let it handle the encoding. This reduces duplication and improves readability. Change-Id: I202c503465a0169277a0f64340598203c9dcf20c Reviewed-on: https://go-review.googlesource.com/c/go/+/461140 Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-08-03cmd/asm,cmd/internal/obj/riscv,cmd/link: improve TLS handling on riscv64Joel Sing
The existing Thread Local Storage (TLS) implementation for riscv64 uses initial-exec (IE) mode, however a MOV of a TLS symbol currently loads the thread pointer offset and not the actual address or memory location. Rework TLS on riscv64 to generate the full instruction sequence needed to load from or store to a TLS symbol. Additionally, provide support for both initial-exec (IE) and local-exec (LE) TLS - in many cases we can use LE, which is slightly more efficient and easier to support in the linker. Change-Id: I1b43f8888b3b6b10354bbb79d604771e64d92645 Reviewed-on: https://go-review.googlesource.com/c/go/+/431103 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: M Zhuo <mzh@golangcn.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Joel Sing <joel@sing.id.au>
2023-08-03cmd/internal/obj/mips: add WSBH/DSBH/DSHD instructionsJunxian Zhu
Add support for WSBH/DSBH/DSHD instructions, which are introduced in mips{32,64}r2. WSBH reverse bytes within halfwords for 32-bit word, DSBH reverse bytes within halfwords for 64-bit doubleword, and DSHD reverse halfwords within doublewords. These instructions can be used to optimize byte swaps. Ref: The MIPS64 Instruction Set, Revision 5.04: https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00087-2B-MIPS64BIS-AFP-05.04.pdf Updates #60072 Change-Id: I31c043150fe8ac03027f413ef4cb2f3e435775e1 Reviewed-on: https://go-review.googlesource.com/c/go/+/493816 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Joel Sing <joel@sing.id.au>
2023-08-02cmd/asm: add s390x crypto related instructionsSrinivas Pokala
This CL add's the following instructions,useful for cipher and message digest operations: * KM - cipher message * KMC - cipher message with chaining * KLMD - compute last message digest * KIMD - compute intermediate message digest Fixes #61163 Change-Id: Ib0636430c3e4888ed61b86c5acae45ee596463ff Reviewed-on: https://go-review.googlesource.com/c/go/+/509075 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2023-07-31cmd/internal/obj/mips: use more appropriate register types for OP_FRRR/OP_SRRJoel Sing
Rather than passing registers as uint32, use int16 and cast to uint32 in the OP_FRRR/OP_SRR implementation. This allows a large number of casts to be removed and code simplified at call sites. Change-Id: Ia4bf3bd022f79d65e45fca64db13db12739e5b23 Reviewed-on: https://go-review.googlesource.com/c/go/+/514099 Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Rong Zhang <rongrong@oss.cipunited.com> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2023-07-31cmd/internal/obj/mips: use more appropriate register types for OP_IRRJoel Sing
Rather than passing registers as uint32, use int16 and cast to uint32 in the OP_IRR implementation. This allows a large number of casts to be removed and code simplified at call sites. Also be more consistent with op, register and value ordering. Change-Id: I510347d97787ce80a338037b25470addf3a2939d Reviewed-on: https://go-review.googlesource.com/c/go/+/514098 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Rong Zhang <rongrong@oss.cipunited.com> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2023-07-31cmd/internal/obj/mips: use more appropriate register types for OP_RRRJoel Sing
Rather than passing registers as uint32, use int16 and cast to uint32 in the OP_RRR implementation. This allows a large number of casts to be removed and code simplified at call sites. Change-Id: I2194ea07a6f89861530cd88c4b60c993bb0fa0c1 Reviewed-on: https://go-review.googlesource.com/c/go/+/514097 Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rong Zhang <rongrong@oss.cipunited.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-31cmd/internal/obj/mips: use obj.REG_NONE rather than 0Joel Sing
Instead of comparing register values to 0, use obj.REG_NONE to improve readability. No functional change. Change-Id: I848f7ab7e27fe7e5e9fe2caf9cce47e372c6cd6c Reviewed-on: https://go-review.googlesource.com/c/go/+/514096 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Rong Zhang <rongrong@oss.cipunited.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Junxian Zhu <zhujunxian@oss.cipunited.com>
2023-07-31cmd/internal/obj/arm64: improve splitting of 24 bit unsigned scaled immediatesJoel Sing
The previous implementation would limit itself to 0xfff000 | 0xfff << shift, while the maximum possible value is 0xfff000 + 0xfff << shift. In practical terms, this means that an additional ((1 << shift) - 1) * 0x1000 of offset is reachable for operations that use this splitting format. In the case of an 8 byte load/store, this is an additional 0x7000 that can be reached without needing to use the literal pool. Updates #59615 Change-Id: Ice7023104042d31c115eafb9398c2b999bdd6583 Reviewed-on: https://go-review.googlesource.com/c/go/+/512540 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Joel Sing <joel@sing.id.au>
2023-07-31cmd/internal/obj/arm64: avoid unnecessary literal pool usage for movesJoel Sing
In a number of load and store cases, the use of the literal pool can be entirely avoided by simply adding or subtracting the offset from the register. This uses the same number of instructions, while avoiding a load from memory, along with the need for the value to be in the literal pool. Overall this reduces the size of binaries slightly and should have lower overhead. Updates #59615 Change-Id: I9cb6a403dc71e34a46af913f5db87dbf52f8688c Reviewed-on: https://go-review.googlesource.com/c/go/+/512539 Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Joel Sing <joel@sing.id.au>
2023-07-31cmd/internal/obj/arm64: improve classification of loads and storesJoel Sing
Currently, pool literals are added when they are not needed, namely in the case where the offset is a 24 bit unsigned scaled immediate. By improving the classification of loads and stores, we can avoid generating unused pool literals. However, more importantly this provides a basis for further improvement of the load and store code generation. Updates #59615 Change-Id: Ia3bad1709314565a05894a76c434cca2fa4533c4 Reviewed-on: https://go-review.googlesource.com/c/go/+/512538 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-28cmd/asm: add PCALIGN support on 386/amd64Mauri de Souza Meneguzzo
The PCALIGN asm directive was not supported on 386/amd64, causing a compile-time error when used. The same directive is currently supported on arm64, loong64 and ppc64 architectures. This has potential for noticeable performance improvements on amd64 across multiple packages, I did a quick test aligning a hot loop on bytes.IndexByte: ``` IndexByte/10-16 3.477n ± ∞ ¹ 3.462n ± ∞ ¹ ~ (p=0.198 n=5) IndexByte/32-16 4.675n ± ∞ ¹ 4.834n ± ∞ ¹ +3.40% (p=0.008 n=5) IndexByte/4K-16 67.47n ± ∞ ¹ 44.44n ± ∞ ¹ -34.13% (p=0.008 n=5) IndexByte/4M-16 61.98µ ± ∞ ¹ 45.07µ ± ∞ ¹ -27.28% (p=0.008 n=5) IndexByte/64M-16 1206.6µ ± ∞ ¹ 940.9µ ± ∞ ¹ -22.02% (p=0.008 n=5) IndexBytePortable/10-16 4.064n ± ∞ ¹ 4.044n ± ∞ ¹ ~ (p=0.325 n=5) IndexBytePortable/32-16 9.999n ± ∞ ¹ 9.934n ± ∞ ¹ ~ (p=0.151 n=5) IndexBytePortable/4K-16 975.8n ± ∞ ¹ 965.5n ± ∞ ¹ ~ (p=0.151 n=5) IndexBytePortable/4M-16 973.3µ ± ∞ ¹ 972.3µ ± ∞ ¹ ~ (p=0.222 n=5) IndexBytePortable/64M-16 15.68m ± ∞ ¹ 15.89m ± ∞ ¹ ~ (p=0.310 n=5) geomean 1.478µ 1.342µ -9.20% IndexByte/10-16 2.678Gi ± ∞ ¹ 2.690Gi ± ∞ ¹ ~ (p=0.151 n=5) IndexByte/32-16 6.375Gi ± ∞ ¹ 6.165Gi ± ∞ ¹ -3.30% (p=0.008 n=5) IndexByte/4K-16 56.54Gi ± ∞ ¹ 85.85Gi ± ∞ ¹ +51.83% (p=0.008 n=5) IndexByte/4M-16 63.03Gi ± ∞ ¹ 86.68Gi ± ∞ ¹ +37.52% (p=0.008 n=5) IndexByte/64M-16 51.80Gi ± ∞ ¹ 66.42Gi ± ∞ ¹ +28.23% (p=0.008 n=5) IndexBytePortable/10-16 2.291Gi ± ∞ ¹ 2.303Gi ± ∞ ¹ ~ (p=0.421 n=5) IndexBytePortable/32-16 2.980Gi ± ∞ ¹ 3.000Gi ± ∞ ¹ ~ (p=0.151 n=5) IndexBytePortable/4K-16 3.909Gi ± ∞ ¹ 3.951Gi ± ∞ ¹ ~ (p=0.151 n=5) IndexBytePortable/4M-16 4.013Gi ± ∞ ¹ 4.017Gi ± ∞ ¹ ~ (p=0.222 n=5) IndexBytePortable/64M-16 3.987Gi ± ∞ ¹ 3.933Gi ± ∞ ¹ ~ (p=0.310 n=5) geomean 8.183Gi 9.013Gi +10.14% ``` Fixes #56474 Change-Id: Idea022b1a16e6d4b8dd778723adb862c46602c4f GitHub-Last-Rev: 2eb7e31dc378a02fd83faa7d41239df0f2859677 GitHub-Pull-Request: golang/go#61516 Reviewed-on: https://go-review.googlesource.com/c/go/+/511662 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org>
2023-07-27cmd/asm: add the fifth argument of the instruction to Optab on arm64erifan01
Currently the Optab structure contains four arguments of an instruction, excludes the fifth argument p.RegTo2. It does not participate in instruction matching and is usually handled separately. Instructions with five operands are common in the newer arm instruction set, so this CL adds the fifth argument to Optab, so that instruction matching is easier. This caused the oplook function also needs to be updated synchronously, this CL also made some cleaning and modifications to this function. Change-Id: I1d95ad99e72a44dfad1e00db182cfc369a0e55c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/505975 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Eric Fang <eric.fang@arm.com>
2023-07-26cmd/internal/obj/arm64: factor out splitting of 24 bit unsigned scaled ↵Joel Sing
immediates Rather than duplicating this code, factor it out into a function and add test coverage. Change-Id: I37ce568ded4659d98a4ff1361520c5fb2207e947 Reviewed-on: https://go-review.googlesource.com/c/go/+/512537 Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-07-26cmd/internal/obj/arm64: simplify buildopJoel Sing
This code stems from the original 7l C code, where one way to determine the end of a table is to put a sentinel entry, then scan for it. This is now Go code and the length of an array is readily available. Remove the sentinel and sentinel scan, then adjust the remaining code to work accordingly. Change-Id: I8964c787f5149f3548fa78bf8923aa7a93f9482e Reviewed-on: https://go-review.googlesource.com/c/go/+/512536 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Joel Sing <joel@sing.id.au>
2023-07-24cmd/asm: Fix encoding error of register offset shifted by 0 on arm64eric fang
The following instruction is wrongly encoded on arm64: MOVD (R2)(R3<<0), R1 It's incorrectly encoded as MOVD (R2)(R3<<3), R1 The reason for the error is that we hard-coded the shift encoding to 6, which is correct for the MOVB and MOVBU instructions because it only allows a shift amount of 0, but it is wrong for the MOVD instruction because it also allows other shift values. For instructions MOVB, MOVBU and FMOVB, the extension amount must be 0, encoded in "S" as 0 if omitted, or as 1 if present. But in Go, we don't distinguish between Rn.<EXT> and Rn.<EXT><<0, so we encode it as that does not present. This makes no difference to the function of the instruction. Change-Id: I2afe3498392cc9b2ecd524c7744f28b9d6d107b8 Reviewed-on: https://go-review.googlesource.com/c/go/+/510995 Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Eric Fang <eric.fang@arm.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-20cmd/internal/obj: print relocation type by name in -S outputCherry Mui
The compiler/assembler's -S output prints relocation type numerically, which is hard to understand. Every time I need to count the relocation type constants to figure out which relocation it actually is. Print the symbolic name instead. Change-Id: I4866873bbae8b3dc0ee212609cb00280f9164243 Reviewed-on: https://go-review.googlesource.com/c/go/+/501856 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com>
2023-07-20cmd/asm, cmd/internal/obj: generate proper atomic ops for riscv64Meng Zhuo
Go's memory model closely follows the approach C++ concurrency memory model (https://go.dev/ref/mem) and Go atomic "has the same semantics as C++'s sequentially consistent atomics". Meanwhile according to RISCV manual A.6 "Mappings from C/C++ primitives to RISC-V primitives". C/C++ atomic operations (memory_order_acq_rel) should be map to "amo<op>.{w|d}.aqrl" LR/SC (memory_order_acq_rel) should map to "lr.{w|d}.aq; <op>; sc.{w|d}.rl" goos: linux goarch: riscv64 pkg: runtime/internal/atomic │ atomic.old.bench │ atomic.new.bench │ │ sec/op │ sec/op vs base │ AtomicLoad64-4 4.216n ± 1% 4.202n ± 0% ~ (p=0.127 n=10) AtomicStore64-4 5.040n ± 0% 6.718n ± 0% +33.30% (p=0.000 n=10) AtomicLoad-4 4.217n ± 0% 4.213n ± 0% ~ (p=0.145 n=10) AtomicStore-4 5.040n ± 0% 6.718n ± 0% +33.30% (p=0.000 n=10) And8-4 9.237n ± 0% 9.240n ± 0% ~ (p=0.582 n=10) And-4 5.878n ± 0% 6.719n ± 0% +14.31% (p=0.000 n=10) And8Parallel-4 28.44n ± 0% 28.46n ± 0% +0.07% (p=0.000 n=10) AndParallel-4 28.40n ± 0% 28.43n ± 0% +0.11% (p=0.000 n=10) Or8-4 8.399n ± 0% 8.398n ± 0% ~ (p=0.357 n=10) Or-4 5.879n ± 0% 6.718n ± 0% +14.27% (p=0.000 n=10) Or8Parallel-4 28.43n ± 0% 28.45n ± 0% +0.09% (p=0.000 n=10) OrParallel-4 28.40n ± 0% 28.43n ± 0% +0.11% (p=0.000 n=10) Xadd-4 30.05n ± 0% 30.10n ± 0% +0.18% (p=0.000 n=10) Xadd64-4 30.05n ± 0% 30.09n ± 0% +0.12% (p=0.000 n=10) Cas-4 60.48n ± 0% 61.13n ± 0% +1.08% (p=0.000 n=10) Cas64-4 62.28n ± 0% 62.34n ± 0% ~ (p=0.810 n=10) Xchg-4 30.05n ± 0% 30.09n ± 0% +0.15% (p=0.000 n=10) Xchg64-4 30.05n ± 0% 30.09n ± 0% +0.13% (p=0.000 n=10) geomean 15.42n 16.17n +4.89% Fixes #61295 Change-Id: I97b5325db50467eeec36fb079bded7b09a32330f Reviewed-on: https://go-review.googlesource.com/c/go/+/508715 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Joel Sing <joel@sing.id.au> Run-TryBot: M Zhuo <mzh@golangcn.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-18all: fix typosJes Cok
Change-Id: I510b0a4bf3472d937393800dd57472c30beef329 GitHub-Last-Rev: 8d289b73a37bd86080936423d981d21e152aaa33 GitHub-Pull-Request: golang/go#60960 Reviewed-on: https://go-review.googlesource.com/c/go/+/505398 Auto-Submit: Robert Findley <rfindley@google.com> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-06-15cmd/asm: fix encoding errors for FMOVD and FMOVS instructions on arm64eric fang
The encoding of instructions "FMOVD F1, ZR" and "FMOVS F1, ZR" is wrong, the assembler encodes them as "FMOVD F1, F31" and "FMOVS F1, F31". This CL fixes the bug. Change-Id: I2d31520b58f9950ce2534a04f4a3275bf103a673 Reviewed-on: https://go-review.googlesource.com/c/go/+/503135 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Eric Fang <eric.fang@arm.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-06-14all: fix spelling errorsAlexander Yastrebov
Fix spelling errors discovered using https://github.com/codespell-project/codespell. Errors in data files and vendored packages are ignored. Change-Id: I83c7818222f2eea69afbd270c15b7897678131dc GitHub-Last-Rev: 3491615b1b82832cc0064f535786546e89aa6184 GitHub-Pull-Request: golang/go#60758 Reviewed-on: https://go-review.googlesource.com/c/go/+/502576 Auto-Submit: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
2023-06-13cmd/internal/obj: make aix/ppc64 builds reproducibleRuss Cox
sort.Slice was being used to sort some newly added entries by name to make the ctxt.Data slice reproducible, but some existing entries have the same name, and the effect was to take the non-determinism of the tail entries and scatter it into the earlier, deterministic section when multiple entries had the same name. The specific entries with the same name are type SDWARFVAR, which all have an empty name but different relocations. If they are shuffled, then the relocation symbols are visited in a different order, which enters them into the string table in a different order, which results in different object files, different object file hashes, and different build IDs for the final executables. Use sort.SliceStable to avoid reordering entries we don't mean to reorder. Also add a simple test for scheduling-related non-determinism. I debugged this originally using 'go install -race cmd/compile', but that was slow and turned out not to be terribly reliable. Using a few different GOMAXPROCS settings turns out to be a much more effective (and faster) way to scramble scheduling decisions. Fixes #60759. Change-Id: Ia966b02b9fdaefa971f998a09319ca375bdf8604 Reviewed-on: https://go-review.googlesource.com/c/go/+/502755 Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Auto-Submit: Russ Cox <rsc@golang.org> TryBot-Bypass: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-06-01cmd/internal/obj/arm: handle HAUTO etc. in addpoolCherry Mui
HAUTO should be handled the same way as other stack offsets for adding to constant pool. Add the missing cases. Fixes #57955. Change-Id: If7fc82cafb2bbf0a6121e73e353b8825cb36b5bc Reviewed-on: https://go-review.googlesource.com/c/go/+/463138 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com>
2023-05-24cmd/asm: refine some APIs related to Prog.RestArgs[]ruinan
Before this CL, we use GetFrom3&SetFrom3 to get or set a source operand which not fit into Prog.Reg. Those APIs operate the first element in Prog.RestArgs without checking the type so they're fragile to break if we have more than one different type of operands in the slice, which will be a common case in Arm64. This CL deprecates & renames some APIs related to Prog.RestArgs to make those APIs more reasonable and robust than before. Change-Id: I70d56edc1f23ccfffbcd6df34844e2cef2288432 Reviewed-on: https://go-review.googlesource.com/c/go/+/493355 Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Eric Fang <eric.fang@arm.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Eric Fang <eric.fang@arm.com>
2023-05-22cmd/compile: incorporate inlined function names into closure namingMatthew Dempsky
In Go 1.17, cmd/compile gained the ability to inline calls to functions that contain function literals (aka "closures"). This was implemented by duplicating the function literal body and emitting a second LSym, because in general it might be optimized better than the original function literal. However, the second LSym was named simply as any other function literal appearing literally in the enclosing function would be named. E.g., if f has a closure "f.funcX", and f is inlined into g, we would create "g.funcY" (N.B., X and Y need not be the same.). Users then have no idea this function originally came from f. With this CL, the inlined call stack is incorporated into the clone LSym's name: instead of "g.funcY", it's named "g.f.funcY". In the future, it seems desirable to arrange for the clone's name to appear exactly as the original name, so stack traces remain the same as when -l or -d=inlfuncswithclosures are used. But it's unclear whether the linker supports that today, or whether any downstream tooling would be confused by this. Updates #60324. Change-Id: Ifad0ccef7e959e72005beeecdfffd872f63982f8 Reviewed-on: https://go-review.googlesource.com/c/go/+/497137 Reviewed-by: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com>
2023-05-22cmd/asm: encode instructions like SHA1SU0 with a separate case for arm64Ruinan
Before this CL, instructions such as SHA1SU0, AESD and AESE are encoded in case 1 together with FMOV/ADD, and some error checking is missing, for example: SHA1SU0 V1.B16, V2.B16, V3.B16 // wrong data arrangement SHA1SU0 V1.4S, V2.S4, V3.S4 // correct Both will be accepted by the assembler, but the first one is totally incorrect. This CL fixes these potential encoding issues by moving them into separate cases, adds some error tests, and also fixes a wrong encoding operand for ASHA1C. Change-Id: Ic778321a567735d48bc34a1247ee005c4ed9e11f Reviewed-on: https://go-review.googlesource.com/c/go/+/493195 Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-19all: generate NOTOC shared code on power10/PPC64/linuxPaul E. Murphy
An explicit TOC pointer is not needed when building with GOPPC64=power10 on linux/PPC64 as all addressing is PC relative. Apply changes to the compiler, assembler, and linker to remove R2/TOC maintenance in these build configurations. This results in noticeably smaller PIC binaries. For example the size (in bytes) of the k8s binaries before and with this patch: GOFLAGS="-buildmode=pie" \ FORCE_HOST_GO=y \ GOPPC64=power10 \ CGO_CFLAGS="-mcpu=power10 -O2 -g" \ make all apiextensions-apiserver 66060288 64487424 -1572864 -2.38% e2e_node.test 163520856 159850760 -3670096 -2.24% e2e.test 178167304 174890432 -3276872 -1.83% ginkgo 11010048 10747904 -262144 -2.38% go-runner 2162688 2162688 0 0% k8s-tests 170182216 166970880 -3211336 -1.88% kubeadm 52625408 51314688 -1310720 -2.49% kube-aggregator 62849024 61341696 -1507328 -2.39% kube-apiserver 147783680 144375808 -3407872 -2.30% kube-controller-manager 131137536 127991808 -3145728 -2.39% kubectl 53608448 52363264 -1245184 -2.32% kubectl-convert 52625408 51314688 -1310720 -2.49% kubelet 120913920 118095872 -2818048 -2.33% kube-log-runner 1900544 1835008 -65536 -3.44% kubemark 119078912 116326400 -2752512 -2.31% kube-proxy 58392576 56885248 -1507328 -2.58% kube-scheduler 60751872 59244544 -1507328 -2.48% mounter 1835008 1769472 -65536 -3.57% watch-termination 38076416 37158912 -917504 -2.40% And text size changes: apiextensions-apiserver 30243288 28654116 -1589172 -5.25% e2e_node.test 71132064 67520288 -3611776 -5.07% e2e.test 61843984 58635088 -3208896 -5.18% ginkgo 4975916 4769304 -206612 -4.15% go-runner 896532 858400 -38132 -4.25% k8s-tests 60925792 57752032 -3173760 -5.20% kubeadm 24643240 23404100 -1239140 -5.02% kube-aggregator 28688060 27160976 -1527084 -5.32% kube-apiserver 65627332 62259460 -3367872 -5.13% kube-controller-manager 56773844 53706532 -3067312 -5.40% kubectl 24344276 23080640 -1263636 -5.19% kubectl-convert 23733764 22521768 -1211996 -5.10% kubelet 52494580 49720340 -2774240 -5.28% kube-log-runner 787128 753232 -33896 -4.30% kubemark 51576580 48837380 -2739200 -5.31% kube-proxy 26541092 25124080 -1417012 -5.33% kube-scheduler 27448512 25976172 -1472340 -5.36% mounter 744100 712628 -31472 -4.22% watch-termination 18047276 17139912 -907364 -5.02% Change-Id: Ib4872823b06f93861e46a00679b5d4e5e30b538a Reviewed-on: https://go-review.googlesource.com/c/go/+/495416 Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Paul Murphy <murp@ibm.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
2023-05-19cmd/compile: constant-fold loads from constant dictionaries and typesKeith Randall
Retrying the original CL with a small modification. The original CL did not handle the case of reading an itab out of a dictionary correctly. When we read an itab out of a dictionary, we must treat the type inside that itab as maybe being put in an interface. Original CL: 486895 Revert CL: 490156 Change-Id: Id2dc1699d184cd8c63dac83986a70b60b4e6cbd7 Reviewed-on: https://go-review.googlesource.com/c/go/+/491495 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-18cmd/asm: remove unsupported opcodes MOVNP and STLP for arm64erifan01
ARM64 doesn't have MOVNP/MOVNPW and STLP/STLPW instructions, which are currently useless instructions as well. This CL deletes them. At the same time this CL sorts the opcodes by name, which looks cleaner. Change-Id: I25cfb636b23356ba0a50cba527a8c85b3f7e2ee4 Reviewed-on: https://go-review.googlesource.com/c/go/+/495695 Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Eric Fang <eric.fang@arm.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-10cmd/internal/obj/riscv: regenerate instruction encoding tableMeng Zhuo
This CL updates riscv instructions by https://github.com/riscv/riscv-opcodes which adds instruction: APAUSE And removes the following unused instructions: AFENCEI AFMVQX AFMVXQ AHFENCEGVMA AHFENCEVVMA ASLLIRV32 ASRAIRV32 ASRLIRV32 AURET Change-Id: I314570c643af3e6bbc9d2cd471b6b39985bcbdff Reviewed-on: https://go-review.googlesource.com/c/go/+/409415 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Joel Sing <joel@sing.id.au> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: M Zhuo <mzh@golangcn.org>
2023-05-09cmd/compile: standardize on outer-to-inner for pos listsRuss Cox
The call sites that cared all reversed inner-to-outer to outer-to-inner already. The ones that didn't care left it alone. No one explicitly wanted inner-to-outer. Also change to a callback-based interface, so that call sites aren't required to accumulate the results in a slice (the main reason for that before was to reverse the slice!). There were three places where these lists were printed: 1. -d=ssa/genssa/dump, explicitly reversing to outer-to-inner 2. node dumps like -W, leaving the default inner-to-outer 3. file positions for HashDebugs, explicitly reversing to outer-to-inner It makes no sense that (1) and (2) would differ. The reason they do is that the code for (2) was too lazy to bother to fix it to be the right way. Consider this program: package p func f() { g() } func g() { println() } Both before and after this change, the ssa dump for f looks like: # x.go:3 00000 (3) TEXT <unlinkable>.f(SB), ABIInternal 00001 (3) FUNCDATA $0, gclocals·g2BeySu+wFnoycgXfElmcg==(SB) 00002 (3) FUNCDATA $1, gclocals·g2BeySu+wFnoycgXfElmcg==(SB) v4 00003 (-4) XCHGL AX, AX # x.go:4 # x.go:8 v5 00004 (+8) PCDATA $1, $0 v5 00005 (+8) CALL runtime.printlock(SB) v7 00006 (-8) CALL runtime.printnl(SB) v9 00007 (-8) CALL runtime.printunlock(SB) # x.go:5 b2 00008 (5) RET 00009 (?) END Note # x.go:4 (f) then # x.go:8 (g, called from f) between v4 and v5. The -W node dumps used the opposite order: before walk f . AS2 Def tc(1) # x.go:4:3 . INLMARK # +x.go:4:3 . PRINTN tc(1) # x.go:8:9,x.go:4:3 . LABEL p..i0 # x.go:4:3 Now they match the ssa dump order, and they use spaces as separators, to avoid potential problems with commas in some editors. before walk f . AS2 Def tc(1) # x.go:4:3 . INLMARK # +x.go:4:3 . PRINTN tc(1) # x.go:4:3 x.go:8:9 . LABEL p..i0 # x.go:4:3 I'm unaware of any argument for the old order other than it was easier to compute without allocation. The new code uses recursion to reverse the order without allocation. Now that the callers get the results outer-to-inner, most don't need any slices at all. This change is particularly important for HashDebug, which had been using a locked temporary slice to walk the inline stack without allocation. Now the temporary slice is gone. Change-Id: I5cb6d76b2f950db67b248acc928e47a0460569f9 Reviewed-on: https://go-review.googlesource.com/c/go/+/493735 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Russ Cox <rsc@golang.org>