From c39bc22c141bc6990e4e2abf604dcf56669ff779 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 3 May 2024 13:03:04 -0400 Subject: all: wire up swisstable maps Use the new SwissTable-based map in internal/runtime/maps as the basis for the runtime map when GOEXPERIMENT=swissmap. Integration is complete enough to pass all.bash. Notable missing features: * Race integration / concurrent write detection * Stack-allocated maps * Specialized "fast" map variants * Indirect key / elem For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-amd64-longtest-swissmap Change-Id: Ie97b656b6d8e05c0403311ae08fef9f51756a639 Reviewed-on: https://go-review.googlesource.com/c/go/+/594596 Reviewed-by: Keith Randall Reviewed-by: Keith Randall Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI --- src/internal/runtime/maps/map_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/internal/runtime/maps/map_test.go') diff --git a/src/internal/runtime/maps/map_test.go b/src/internal/runtime/maps/map_test.go index 53b4a62071..d11535657b 100644 --- a/src/internal/runtime/maps/map_test.go +++ b/src/internal/runtime/maps/map_test.go @@ -6,8 +6,8 @@ package maps_test import ( "fmt" + "internal/abi" "internal/runtime/maps" - "internal/runtime/maps/internal/abi" "math" "testing" "unsafe" @@ -444,4 +444,11 @@ func TestTableZeroSizeSlot(t *testing.T) { if gotElem != elem { t.Errorf("Get(%d) got elem %d want %d", key, gotElem, elem) } + + start := tab.GroupsStart() + length := tab.GroupsLength() + end := unsafe.Pointer(uintptr(start) + length*tab.Type().Group.Size() - 1) // inclusive to ensure we have a valid pointer + if uintptr(got) < uintptr(start) || uintptr(got) > uintptr(end) { + t.Errorf("elem address outside groups allocation; got %p want [%p, %p]", got, start, end) + } } -- cgit v1.3-5-g9baa