aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
AgeCommit message (Collapse)Author
8 daysall: update to x/tools@b36d1d12a1a724eb9be6609c9789aec3d99e6030Mark Freeman
Change-Id: If1c8d07aa53c5444b815b922ff4e0c18649ab83c Reviewed-on: https://go-review.googlesource.com/c/go/+/763181 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
8 dayscmd/go: invalidate test cache when -coverpkg dependencies changeRyan Currah
When running tests with -cover and -coverpkg, the resulting coverage profile includes data from all packages specified in -coverpkg, not just the test package. Previously, the test cache key did not account for changes in these out-of-band covered packages, causing stale coverage profiles to be reused even when source files in covered packages were modified. Fix this by hashing the BuildActionIDs of the writeCoverMetaAct's dependencies (the compile actions for all covered packages) and incorporating that hash into the coverage profile cache key via cache.Subkey. The covMeta hash is now computed directly in tryCacheWithID by locating the "write coverage meta-data file" action among the run action's dependencies, keeping all cache logic in one place. When -coverpkg is used without -coverprofile, a sentinel cache entry is written so the cache can still detect when covered packages change. Fixes #74873 Change-Id: Ice84557789e325330759442689d0e28f871858bb GitHub-Last-Rev: 84aa5376f471704b0ee7be79ab33a1d5bba71c5a GitHub-Pull-Request: golang/go#74773 Reviewed-on: https://go-review.googlesource.com/c/go/+/690775 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
8 dayscmd/go/internal/modload: minor modernization fixesIan Alexander
* Add package comment. * Make octal literal explicit. * Simplify single var declaration. Change-Id: I3841ca538034c75098502b35b1a713a98e936efc Reviewed-on: https://go-review.googlesource.com/c/go/+/763360 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Michael Matloob <matloob@google.com>
8 dayscmd/compile: ensure result selects are in the block of a callkhr@golang.org
Without this CL, when compiling test/range4.go:func9, we get: b1: v1 = StaticLECall <runtime.deferrangefunc> mem = SelectN [1] v1 Defer v1 -> b2 b3 b2: v2 = SelectN [0] v1 That select in b2 should really live in b1. This doesn't cause a bug as far as I can tell, but it makes a check fail when when checkEnabled is set in the compiler. Change-Id: I8fe928fa8c376b81131ec712fc69d5fd39a1d4bb Reviewed-on: https://go-review.googlesource.com/c/go/+/747740 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
8 dayscmd/compile/testdata/script/issue77033.txt: make test panicAlex Brainman
The issue77033.txt script is executed by cmd/internal/script/scripttest/run.go program, that uses 60 seconds interrupt timeout. The timeout is implemented by calling os/exec.Cmd.Process.Signal(os.Interrupt) but that call is not implemented on Windows, and we get run.go:259: FAIL: testdata\script\issue77033.txt:2: go test -bench=Foo -pgo=default.pgo: exec: canceling Cmd: not supported by windows useless output when the test fails on Windows. This CL adds -timeout=30s to go test command, that will make test panic. Hopefully panic will provide more details about the failure. For #77485 Change-Id: I69839c59a28f48fea5d504a5038145ffd651aed2 Reviewed-on: https://go-review.googlesource.com/c/go/+/762980 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: David Chase <drchase@google.com>
8 dayscmd/compile: report error instead of ICE for oversized map elementgulmix
When a map element or key type is 2GB or larger, the compiler crashed with "internal compiler error: map elem too big" in reflectdata.ZeroAddr. Add a size check in types.CalcSize for TMAP, similar to the existing check for channel element types, so that oversized map elements are reported as a normal error before reaching ZeroAddr. Fixes #78355 Change-Id: I281a5f0ec7dda6dac084787859156d4409dc860c Reviewed-on: https://go-review.googlesource.com/c/go/+/760600 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
8 dayscmd/compile: optimize CondSelect to math on arm64 with inline register shiftsJorropo
Change-Id: I27696b1a5fa0593d9f36743efa3559a36d23ec4b Reviewed-on: https://go-review.googlesource.com/c/go/+/760844 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@google.com>
8 dayscmd/compile: improve Mul to Left Shift rulesJorropo
- fix a bug where it wouldn't recognize 1<<63 as a power of two - remove the IsSigned check; there is no such thing as a signed Mul If the rule works for signed numbers it works for unsigned ones too. Even if the intermediary steps makes no sense, it ends up wrapping the right way around in the end. Change-Id: I86182762aec5eff784e2d9bc49ee028825fb9ea0 Reviewed-on: https://go-review.googlesource.com/c/go/+/760843 Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
9 dayscmd/compile: add loop invariant code motionIlya Tocar
(I copied Ilya Tocar's CL 27656 and heavily modified it.) This adds an optimization that moves loop invariant computations out of the loop. For example: a:= ... for ... { b:= a + 15 // uses of b } Turns into a:= ... b:= a + 15 for ... { // uses of b } Change-Id: I36c8c7e2b3bc1c5e6b4b293bed3a76dc20d6c825 Reviewed-on: https://go-review.googlesource.com/c/go/+/697235 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
9 dayscmd/compile/internal/importer: consume generic methods in importerMark Freeman
Change-Id: Iac9428fe8d2fb3e6fde30940470bf5d3ac9751cb Reviewed-on: https://go-review.googlesource.com/c/go/+/763141 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <markfreeman@google.com>
9 dayscmd/compile: cleanup rules by canonicalizing sext(int(bool)) → zext(int(bool))Jorropo
Change-Id: Ic97f661c68180ff7adb9976fcc61279e1e1f04a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/760842 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
9 dayscmd/compile: extend condselect into math code to handle other constants than 1Jorropo
On amd64 along: if b { x += 1 } => x += b We can also implement constants 2 4 and 8: if b { x += 2 } => x += b * 2 This compiles to a displacement LEA. Change-Id: Ib00fcc5059acb0ebb346e056c4a656f164cc63df Reviewed-on: https://go-review.googlesource.com/c/go/+/760841 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
9 dayscmd/go/internal/workcmd: correct go.work file nameSean Liao
Fixes #51714 Change-Id: I0619b1ca6715bed85ccc066a83a449f66a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/762660 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
9 dayscmd/go/internal/script: add fuzz test for quoteArgsAbhinav Gupta
Adds a fuzz test for quoteArgs and fixes the bugs it found: handling of empty strings and strings containing "&" or "$". This is a copy of a similar change submitted to rsc.io/script: https://github.com/rsc/script/pull/10 Change-Id: I76e7fc89475e1c4e415f45f2c7ac4a87a7a659e6 Reviewed-on: https://go-review.googlesource.com/c/go/+/566316 Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
9 dayscmd/compile: unify DWARF variable generation and remove encodingDerek Parker
Refactor the DWARF variable generation in the compiler: 1. Replace the intermediate []byte location list encoding with a structured LocListEntry type. The old code packed SSA block/value IDs into pointer-sized integers, wrote them alongside DWARF4-format length-prefixed expressions, then re-read and decoded everything during final encoding. The new approach stores entries as {StartBlock, StartValue, EndBlock, EndValue, Expr} structs that PutLocationListDwarf4/5 directly encode into the appropriate format. This eliminates encodeValue, decodeValue, appendPtr, writePtr, readPtr, and SetupLocList, and removes the DWARF4 re-encoding in PutLocationListDwarf5. 2. Unify createDwarfVars into a single processing loop. The old code had three mutually exclusive paths (createSimpleVars, createABIVars, createComplexVars) selected by build mode, followed by a separate conservative-var loop. The new code uses one loop that tries createComplexVar first (when SSA debug info is available), then falls back to createSimpleVar. This removes createSimpleVars, createABIVars, and createComplexVars. 3. Extract createConservativeVar and shouldEmitDwarfVar as named functions, consolidating inline code and scattered filtering logic. 4. Fix createHeapDerefLocationList to return []LocListEntry instead of raw bytes, consistent with the new representation. Change-Id: If6fb755c22e398d7615dccaf33b1367828e6c47e Reviewed-on: https://go-review.googlesource.com/c/go/+/750920 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
9 dayscmd/compile: improve uint8/uint16 logical immediates on PPC64Jayanth Krishnamurthy jayanth.krishnamurthy@ibm.com
Logical ops on uint8/uint16 (AND/OR/XOR) with constants sometimes materialized the mask via MOVD (often as a negative immediate), even when the value fit in the UI-immediate range. This prevented the backend from selecting andi. / ori / xori forms. This CL makes: UI-immediate truncation is performed only at the use-site of logical-immediate ops, and only when the constant does not fit in the 8- or 16-bit unsigned domain (m != uint8(m) / m != uint16(m)). This avoids negative-mask materialization and enables correct emission of UI-form logical instructions. Arithmetic SI-immediate instructions (addi, subfic, etc.) and other use-patterns are unchanged. Codegen tests are added to ensure the expected andi./ori/xori patterns appear and that MOVD is not emitted for valid 8/16-bit masks. Change-Id: I9fcdf4498c4e984c7587814fb9019a75865c4a0d Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9,gotip-linux-ppc64le_power10 Reviewed-on: https://go-review.googlesource.com/c/go/+/704015 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Paul Murphy <paumurph@redhat.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
11 dayscmd/internal/obj/riscv: add assembly support for Zihintpause extensionsQiu Weihong
Add support for the PAUSE instruction provided by the Zihintpause extension. Change-Id: If06cce4ca57137275f567b5fe29ef85517f381ef Reviewed-on: https://go-review.googlesource.com/c/go/+/710495 Reviewed-by: Joel Sing <joel@sing.id.au> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
12 dayscmd/compile: optimize switch statements using lookup tablesqmuntal
Switch statement containing integer constant cases and case bodies just returning a constant should be optimizable to a simpler and faster table lookup instead of a jump table. That is, a switch like this: switch x { case 0: return 10 case 1: return 20 case 2: return 30 case 3: return 40 default: return -1 } Could be optimized to this: var table = [4]int{10, 20, 30, 40} if uint(x) < 4 { return table[x] } return -1 The resulting code is smaller and faster, especially on platforms where jump tables are not supported. goos: windows goarch: arm64 pkg: cmd/compile/internal/test │ .\old.txt │ .\new.txt │ │ sec/op │ sec/op vs base │ SwitchLookup8Predictable-12 2.708n ± 6% 2.249n ± 5% -16.97% (p=0.000 n=10) SwitchLookup8Unpredictable-12 8.758n ± 7% 3.272n ± 4% -62.65% (p=0.000 n=10) SwitchLookup32Predictable-12 2.672n ± 5% 2.373n ± 6% -11.21% (p=0.000 n=10) SwitchLookup32Unpredictable-12 9.372n ± 7% 3.385n ± 6% -63.89% (p=0.000 n=10) geomean 4.937n 2.772n -43.84% Fixes #78203 Change-Id: I74fa3d77ef618412951b2e5c3cb6ebc760ce4ff1 Reviewed-on: https://go-review.googlesource.com/c/go/+/756340 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
12 dayscmd/compile/internal/noder: recognize generic method instantiationMark Freeman
This change slightly extends expression traversal to recognize explicit instantiation of generic methods. The relevant MethodVal and MethodExpr snippets are extracted into helper functions, since they are needed in two places. Change-Id: I85d49d89f2422fa4c2d09de28fb6552f171a2a1f Reviewed-on: https://go-review.googlesource.com/c/go/+/762560 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
12 dayscmd/internal/obj/loong64: run go generateKeith Randall
"go generate" on this package seems to generate a diff. I have no idea whether this diff is reasonable or not. It looks kinda weird, but maybe? Or perhaps something is wrong with ../mkcnames.go. Change-Id: I3474bab3f6880ffc24c1cf6ec11958a1c9467909 Reviewed-on: https://go-review.googlesource.com/c/go/+/761680 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Meidan Li <limeidan@loongson.cn> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
12 dayscmd/compile: extend all the cmov into math generic rules with their contraryJorropo
If the bool comes from a local operation this is foldable into the comparison. if a == b { } else { x++ } becomes: x += !(a == b) becomes: x += a != b If the bool is passed in or loaded rather than being locally computed this adds an extra XOR ^1 to invert it. But at worst it should make the math equal to the compute + CMP + CMOV which is a tie on modern CPUs which can execute CMOV on all int ALUs and a win on the cheaper or older ones which can't. Change-Id: Idd2566c7a3826ec432ebfbba7b3898aa0db4b812 Reviewed-on: https://go-review.googlesource.com/c/go/+/760922 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Junyang Shao <shaojunyang@google.com>
12 dayscmd/compile/internal/noder: omit wrapper functions for generic methodsMark Freeman
Emitting wrapper functions for generic methods is tricky for 2 reasons: 1. Existing downstream machinery expects that it can make certain assumptions about a method if it sees a wrapper function. We may violate those assumptions with generic method wrappers. 2. Signatures for generic methods are generic and hence cannot be encoded using w.typ. This has the slight downside of not using a statically computed wrapper for generic methods and instead dynamically computing the dictionary pointer. Thus, we miss out on a performance optimization for generic methods for now. Code that does not use generic methods is unaffected. Change-Id: I72c626ef0f807c0cb54d8cf040250de8177303cc Reviewed-on: https://go-review.googlesource.com/c/go/+/762382 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Mark Freeman <markfreeman@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
12 dayscmd/compile/internal/noder: set dict.receivers in writerMark Freeman
Change-Id: I9846b8086bacbc69e438a8e39e3e26c46316fb08 Reviewed-on: https://go-review.googlesource.com/c/go/+/762022 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <markfreeman@google.com>
12 dayscmd/compile/internal/noder: offset type parameter indicesMark Freeman
When a writer goes to encode use of a type parameter, it only records an index because the writer knows all of the type parameters in scope for that object. The writer orders the type parameteres as implicits first, then receivers, then explicits actually on the object. Note that receivers *are* explicit type arguments, they're just inherited from the type. For instance, given: func (T[P]) m[Q, R any]() This has: - 0 implicits - 1 receiver - 2 explicits With this ordering, P is at 0, Q is at 1, and R is at 2. In contrast, inspecting TypeParam.index for Q yields 0, and for R yields 1; hence the offset is needed. Change-Id: If12f342e109fbc5935ba278f574ac2809c889335 Reviewed-on: https://go-review.googlesource.com/c/go/+/762021 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
12 dayscmd/compile/internal/noder: decode generic methods and pipe receiversMark Freeman
Change-Id: I7a66fba400a743f4ef2fb989cd8e74e955e22b0f Reviewed-on: https://go-review.googlesource.com/c/go/+/762020 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Mark Freeman <markfreeman@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
13 dayscmd/asm, cmd/go: pass -std to assembler for standard library packagesCherry Mui
For the compiler, we already pass -std when compiling the standard library. Do the same for the assembler. So the assembler and the linker can tell which objects are in the standard library. Change-Id: I35d28a4c72d32c344eda37a3ff407ea525ee5cea Reviewed-on: https://go-review.googlesource.com/c/go/+/761200 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Michael Matloob <matloob@google.com>
13 dayshash/maphash: revert purego implementationAlan Donovan
This CL reverts the purego implementation added in CL 468795 and folds the runtime variant back into the main file. Purego means "no assembly"; it does not mean "no linkname". Henceforth this package will once again call runtime.memhash unconditionally. This was not a clean revert as there were a number of CLs since. The motivation for this change is to avoid the maphash -> crypto/rand dependency; see discussion on CL 657297. Change-Id: I54ce223c5b484710ce303cdec20049146df3f8bc Reviewed-on: https://go-review.googlesource.com/c/go/+/761260 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
13 dayscmd/compile/internal/noder: add encoding for generic methodsMark Freeman
We have not yet added the decoding on the reader side. Change-Id: Ic7f8dc51b6b9a2c214b402b1314ee84c0085c16a Reviewed-on: https://go-review.googlesource.com/c/go/+/761983 Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Mark Freeman <markfreeman@google.com>
13 dayscmd/compile/internal/noder: split up objTypeParamsMark Freeman
This splits objTypeParams into objTypeParams and objRecvTypeParams. The type parameters on a generic method and its receiver need to be reported separately to the reader. Change-Id: If9eb93ca66a5a5e4bdce71364627ff4bee110311 Reviewed-on: https://go-review.googlesource.com/c/go/+/761981 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Mark Freeman <markfreeman@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
14 daysgo/types, types2: in range-over-func, the yield function cannot be variadicRobert Griesemer
Fixes #78483. For #78314. Change-Id: If83983c0bf79840aa02dc0d2fa8945f5e8b4e969 Reviewed-on: https://go-review.googlesource.com/c/go/+/761682 Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
14 dayscmd/compile/internal/importer: update commentMark Freeman
Change-Id: I1f2fc247cdf979a40cbd48b4feab449c0ff6182e Reviewed-on: https://go-review.googlesource.com/c/go/+/761860 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Mark Freeman <markfreeman@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
14 dayscmd/internal/goobj: regenerate builtin list, add retpoline and tls_g symbolsCherry Mui
Add retpoline and tls_g symbols as the assembler generates direct reference to them. Change-Id: I569eab6d81798866263da9240d702139d3567d57 Reviewed-on: https://go-review.googlesource.com/c/go/+/761464 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
14 dayscmd/link: make dupok symbol handling path clearerCherry Mui
When the linker sees two symbols with the same name, if both are dupok, pick the one with larger size. If one is dupok, one is not, pick the one that is not dupok, as "dupok" is sort of like weak symbol in C terms. Change-Id: I0a95d1ddfdd70ffb5ecc06645fb345591039af49 Reviewed-on: https://go-review.googlesource.com/c/go/+/749943 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
14 dayscmd/compile, cmd/link: add linknamestd directive for std-only linknamesCherry Mui
In the standard library, there are a number of linknames, for sharing symbols within the standard library. They are not supposed to be accessed externally. But currently there is no good mechanism to prevent that. In the linker we have a blocklist of linknames, which forbids linkname references other than explicitly allowed packages. The blocklist is manually maintained, requiring periodic manual update. To move away from that manually maintained blocklist, this CL introduces a new directive, linknamestd, that marks a linkname for use within the standard library only. The linker will allow references within the standard library and forbid others. For a proof of concept, runtime.coroswitch is removed from the blocklist, and replaced with linknamestd. An external reference to it is still disallowed by the linker, as tested with cmd/link.TestCheckLinkname with testdata/linkname/coro.go. Change-Id: I0d0f8746b8835d8cdcfc3ff835d22a551da5f038 Reviewed-on: https://go-review.googlesource.com/c/go/+/749942 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
14 dayscmd/cgo/internal/testcarchive: unskip a test on darwin/arm64Cherry Mui
The test was skipped when darwin/arm64 meant iOS, and our LLDB runner could not handle signals. Now darwin/arm64 is macOS, it works just fine. Change-Id: I04b2b60046c6a0df01a5d5c23d7203d469af20de Reviewed-on: https://go-review.googlesource.com/c/go/+/749941 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
14 dayscmd/compile/internal/noder: separate generic methods in type encodingMark Freeman
This doesn't need a version guard here because we will bump the version in Go 1.27. It will be impossible to witness a generic method at the UIR layer without being at an appropriate bitstream version. Change-Id: Ie6c89fb98d55a3dccbd53e87860d6103582a921e Reviewed-on: https://go-review.googlesource.com/c/go/+/761582 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-04-01cmd/link: remove SITABLINKIan Lance Taylor
As of CL 729201 it's no longer used. Change-Id: Idc3104208d160e657f6dbef99c8124cd760c3c77 Reviewed-on: https://go-review.googlesource.com/c/go/+/745960 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2026-03-31cmd/go/internal/doc: follow up to CL 733200Michael Matloob
I submitted a rebased variant of the CL that dropped changes in response to Sean Liao and Ian Alexander's comments. Add the bug updates below and re-implement Ian's suggestion. Fixes #34750 For #53446 For #60645 Change-Id: Ie132ac65efd27e811edabfbbb083b6946a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/761580 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Matloob <matloob@golang.org> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Ian Alexander <jitsu@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2026-03-31cmd/internal/obj/riscv: add support for FENCE operands and FENCE.TSOwangboyao
Add support for fine-grained memory ordering flags in the RISC-V FENCE instruction to the assembler. This implements instruction validation and encoding for predecessor and successor flags (I, O, R, W) rather than always falling back to a full memory barrier. This allows more precise memory barriers like FENCE R, RW or FENCE W, W. Additionally, this adds assembly support for the FENCE.TSO, which is encoded as FENCE RW, RW with the fm field set to 1000. Change-Id: Ie9c6c8cd24b38b08013032972bd54515eaedd637 Reviewed-on: https://go-review.googlesource.com/c/go/+/758000 Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Joel Sing <joel@sing.id.au> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-31cmd/link/internal/loong64: remove the handling of R_CONST and R_GOTOFF from ↵limeidan
linker These two relocations are general relocations and do not require special architectural handling. Change-Id: Ibd5e71f6337e8dbb68e84759a46a46d9843b0382 Reviewed-on: https://go-review.googlesource.com/c/go/+/760080 Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-31cmd/compile/internal/noder: encode dictionaries for generic methodsMark Freeman
Generic methods have 2 sources of explicit type arguments-the receiver and the method itself. We simply concatenate these lists when constructing the dictionary. Change-Id: I8ba99fa7274b594941867e9bf6c2a22356c03e46 Reviewed-on: https://go-review.googlesource.com/c/go/+/761341 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-31cmd/compile/internal/noder: mangle method namesMark Freeman
Mangling produces shaped qualified identifiers using a dictionary. It's important for determining the stenciled type to use for a given instantiation. Since generic methods have qualified identifiers, they need mangling. Suppose a generic method like T[P].m[Q] and a shaped dictionary like: { implicits: 0 receivers: 1 targs: [go.shape.int, go.shape.int] } This would be shaped to T[go.shape.int].m[go.shape.int]. Change-Id: Idc4c825f77a4e9209da65b5b0acb74b9f845bde7 Reviewed-on: https://go-review.googlesource.com/c/go/+/761340 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Mark Freeman <markfreeman@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-03-31cmd/go: add more go tool documentation and show tool aliases in go toolMichael Matloob
This change adds pointers in the documentation for go tool to point to go get -tool, and vice versa, and documents the rules for when aliases can be used for tools and what those aliases are. It also modifies go tool with no arguments so that it prints the alias for any tools for which aliases can be provided, such as: $ go tool asm cgo [...] bar (foo.com/full/package/path/bar) For #71663 Change-Id: Id008cffbb02863692a18d4e1c1458b5b6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/761100 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Michael Matloob <matloob@golang.org> Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-31cmd/compile/internal/noder: qualify identifiers for generic methodsMark Freeman
Generic methods will be hoisted to objects so that they can get their own dictionaries. We need to avoid name collisions, so within a package, we qualify generic methods using their defining type. We don't differentiate method identifiers by whether they have a pointer or value receiver for simplicity. Change-Id: Ied06c5e4a4c5a6f8de8027358ddbe38fc40ae452 Reviewed-on: https://go-review.googlesource.com/c/go/+/761263 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-31cmd/compile/internal/noder: method expressions have nil implicitsMark Freeman
Change-Id: Ia7ba5484ef5258cc8edc19b7d500e334c0e0365d Reviewed-on: https://go-review.googlesource.com/c/go/+/761261 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-31cmd/compile/internal/noder: method expressions for generic methodsMark Freeman
This change permits shaping method expressions for generic methods. The API is slightly different for generic and non-generic methods, as explained in code comments. Using OMETHEXPR minimizes the necessary changes, but forces us to split / rejoin the linker symbol for generic methods. While a bit odd, it seems sound. Change-Id: Iff28b9b11b9e83f450225aba0873644633f20633 Reviewed-on: https://go-review.googlesource.com/c/go/+/761220 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-31runtime/cgo: remove SIGSEGV emulation on iOSqmuntal
The misc/ios exec wrapper doesn't support lldb since https://go.dev/cl/573175. This means that the SIGSEGV emulation code in the cgo signal handling on iOS is no longer needed, and can be removed. Cq-Include-Trybots: luci.golang.try:gotip-darwin-arm64_26 Change-Id: I39827cb20756e4730352d87cb3514bb6a3f1cee8 Reviewed-on: https://go-review.googlesource.com/c/go/+/756800 Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-03-31cmd/go/internal/doc: use internal go command logic to load packagesmatloob
We've been using go/build to load packages, and that doesn't always do the right thing, because it doesn't have the same context and settings that the go command uses to load packages. Use the go command's loader to load packages. This CL doesn't remove the logic for searching for matching packages in dirs.go. A next step would be to remove that so all the matching is also done with the go command's logic. Fixes #75976 Change-Id: I3c76d9a54dc88648bb7c76a17afad8cb6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/733200 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Michael Matloob <matloob@google.com>
2026-03-31test/codegen: forbid commas as separatorsKeith Randall
We need to leave the comma in the regexp so we get the entire comment for processing, but report an error if commas are actually used. Change-Id: Ia19a329deda2524cea292d866a84d1bf3b4518c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/760780 Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Paul Murphy <paumurph@redhat.com> Auto-Submit: Keith Randall <khr@google.com>
2026-03-31test/codegen: fix some unbalanced quotesKeith Randall
Change-Id: I081da8c79f0264118e079af21ff58c511ae37e6c Reviewed-on: https://go-review.googlesource.com/c/go/+/760682 Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Joel Sing <joel@sing.id.au> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@google.com>