aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/ld/deadcode.go
diff options
context:
space:
mode:
authorJake Bailey <jacob.b.bailey@gmail.com>2025-09-09 22:22:17 -0700
committerGopher Robot <gobot@golang.org>2026-03-24 11:17:57 -0700
commit55600733988b0d3bb708be22b5cbecd8edd83380 (patch)
tree8966b0c85e05e748308009ce52618eda3cf10025 /src/cmd/link/internal/ld/deadcode.go
parent3f057dcdbc86498e07a5744406fe92069221a92d (diff)
downloadgo-55600733988b0d3bb708be22b5cbecd8edd83380.tar.xz
internal/runtime/maps: add GOEXPERIMENT=mapsplitgroup for KKKKVVVV slot order
Map groups are currently: type group struct { ctrl uint64 slots [8]slot } type slot struct { key K elem E } If the element type is struct{}, the slot will be padded so that the address of the elem is unique rather than pointing outside the alloc. This has the effect of map[K]struct{} wasting space due to the extra byte and padding, making it no better than map[K]bool. This CL changes the group layout to instead place keys and elems together, as they used to be before swiss maps: type group struct { ctrl uint64 keys [8]K elems [8]V } This is an alternative to CL 701976, which I suspect will have better performance. Keys placed together should lead to better cache behavior, at the cost of more expensive elem lookups, since the elems are not a fixed offset from their keys. This change is locked behind GOEXPERIMENT=mapsplitgroup. Updates #70835 Updates #71368 Change-Id: Ide8d1406ae4ab636f86edc40e0640cc80653197c Reviewed-on: https://go-review.googlesource.com/c/go/+/711560 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/cmd/link/internal/ld/deadcode.go')
-rw-r--r--src/cmd/link/internal/ld/deadcode.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go
index 055b4efe5d..c2dead36bf 100644
--- a/src/cmd/link/internal/ld/deadcode.go
+++ b/src/cmd/link/internal/ld/deadcode.go
@@ -560,7 +560,7 @@ func (d *deadcodePass) decodetypeMethods(ldr *loader.Loader, arch *sys.Arch, sym
case abi.Chan: // reflect.chanType
off += 2 * arch.PtrSize
case abi.Map:
- off += 7*arch.PtrSize + 4 // internal/abi.MapType
+ off += 10*arch.PtrSize + 4 // internal/abi.MapType
if arch.PtrSize == 8 {
off += 4 // padding for final uint32 field (Flags).
}