From 2220fd36368c96da3dd833bdc2bbd13be291216a Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 17 Sep 2024 16:30:04 -0400 Subject: runtime: add concurrent write checks to swissmap This is the same design as existing maps. For #54766. Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap Change-Id: I5f6ef5fea1e0f0616bcd90eaae7faee4cdac58c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/616460 Reviewed-by: Keith Randall LUCI-TryBot-Result: Go LUCI Auto-Submit: Michael Pratt Reviewed-by: Keith Randall --- src/cmd/compile/internal/reflectdata/map_swiss.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/cmd/compile/internal/reflectdata') diff --git a/src/cmd/compile/internal/reflectdata/map_swiss.go b/src/cmd/compile/internal/reflectdata/map_swiss.go index 2b79b22235..b531d785d3 100644 --- a/src/cmd/compile/internal/reflectdata/map_swiss.go +++ b/src/cmd/compile/internal/reflectdata/map_swiss.go @@ -144,6 +144,8 @@ func SwissMapType() *types.Type { // // globalDepth uint8 // globalShift uint8 + // + // writing uint8 // // N.B Padding // // clearSeq uint64 @@ -156,6 +158,7 @@ func SwissMapType() *types.Type { makefield("dirLen", types.Types[types.TINT]), makefield("globalDepth", types.Types[types.TUINT8]), makefield("globalShift", types.Types[types.TUINT8]), + makefield("writing", types.Types[types.TUINT8]), makefield("clearSeq", types.Types[types.TUINT64]), } @@ -169,7 +172,7 @@ func SwissMapType() *types.Type { // The size of Map should be 48 bytes on 64 bit // and 32 bytes on 32 bit platforms. - if size := int64(2*8 + 4*types.PtrSize /* one extra for globalDepth + padding */); m.Size() != size { + if size := int64(2*8 + 4*types.PtrSize /* one extra for globalDepth/globalShift/writing + padding */); m.Size() != size { base.Fatalf("internal/runtime/maps.Map size not correct: got %d, want %d", m.Size(), size) } -- cgit v1.3-6-g1900