]> Cypherpunks repositories - gostls13.git/commitdiff
internal/runtime/gc/scan: avoid -1 index when cache sizes unavailable
authorMichael Anthony Knyszek <mknyszek@google.com>
Tue, 12 Aug 2025 21:57:23 +0000 (21:57 +0000)
committerMichael Knyszek <mknyszek@google.com>
Wed, 13 Aug 2025 00:45:43 +0000 (17:45 -0700)
Fixes #74984.
Fixes #74983.

Change-Id: I011c66c2005bc4d92f1d17f1f8ce88158634f71f
Reviewed-on: https://go-review.googlesource.com/c/go/+/695476
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/internal/runtime/gc/scan/scan_test.go

index 9b577155ed76902e00446d535d8140e9b0a425a5..14a0f6f7f48a47af1ffcbff5ed3d3cdd5ef8a7a1 100644 (file)
@@ -100,6 +100,9 @@ func benchmarkCacheSizes(b *testing.B, fn func(b *testing.B, heapPages int)) {
                        fn(b, pages)
                })
        }
+       if len(cacheSizes) == 0 {
+               return
+       }
        ramPages := int(cacheSizes[len(cacheSizes)-1]*3/2) / gc.PageSize
        b.Run(fmt.Sprintf("cache=ram/pages=%d", ramPages), func(b *testing.B) {
                fn(b, ramPages)