From e22bd2348c8e3bfdf12197d0b0e194b66bbf5a36 Mon Sep 17 00:00:00 2001 From: David Chase Date: Fri, 13 Jan 2023 16:12:47 -0500 Subject: internal/abi,runtime: refactor map constants into one place Previously TryBot-tested with bucket bits = 4. Also tested locally with bucket bits = 5. This makes it much easier to change the size of map buckets, and hopefully provides pointers to all the code that in some way depends on details of map layout. Change-Id: I9f6669d1eadd02f182d0bc3f959dc5f385fa1683 Reviewed-on: https://go-review.googlesource.com/c/go/+/462115 TryBot-Result: Gopher Robot Run-TryBot: David Chase Reviewed-by: Austin Clements --- test/codegen/maps.go | 91 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 69 insertions(+), 22 deletions(-) (limited to 'test/codegen') diff --git a/test/codegen/maps.go b/test/codegen/maps.go index ea3a70d1f0..25505799e9 100644 --- a/test/codegen/maps.go +++ b/test/codegen/maps.go @@ -124,31 +124,78 @@ func MapClearSideEffect(m map[int]int) int { } func MapLiteralSizing(x int) (map[int]int, map[int]int) { - // amd64:"MOVL\t[$]10," + // This is tested for internal/abi/maps.go:MapBucketCountBits={3,4,5} + // amd64:"MOVL\t[$]33," m := map[int]int{ - 0: 0, - 1: 1, - 2: 2, - 3: 3, - 4: 4, - 5: 5, - 6: 6, - 7: 7, - 8: 8, - 9: 9, + 0: 0, + 1: 1, + 2: 2, + 3: 3, + 4: 4, + 5: 5, + 6: 6, + 7: 7, + 8: 8, + 9: 9, + 10: 10, + 11: 11, + 12: 12, + 13: 13, + 14: 14, + 15: 15, + 16: 16, + 17: 17, + 18: 18, + 19: 19, + 20: 20, + 21: 21, + 22: 22, + 23: 23, + 24: 24, + 25: 25, + 26: 26, + 27: 27, + 28: 28, + 29: 29, + 30: 30, + 31: 32, + 32: 32, } - // amd64:"MOVL\t[$]10," + // amd64:"MOVL\t[$]33," n := map[int]int{ - 0: x, - 1: x, - 2: x, - 3: x, - 4: x, - 5: x, - 6: x, - 7: x, - 8: x, - 9: x, + 0: 0, + 1: 1, + 2: 2, + 3: 3, + 4: 4, + 5: 5, + 6: 6, + 7: 7, + 8: 8, + 9: 9, + 10: 10, + 11: 11, + 12: 12, + 13: 13, + 14: 14, + 15: 15, + 16: 16, + 17: 17, + 18: 18, + 19: 19, + 20: 20, + 21: 21, + 22: 22, + 23: 23, + 24: 24, + 25: 25, + 26: 26, + 27: 27, + 28: 28, + 29: 29, + 30: 30, + 31: 32, + 32: 32, } return m, n } -- cgit v1.3