From 697644070c6e335b9c3dffdd4e82feb8038c3f22 Mon Sep 17 00:00:00 2001 From: Sven Anderson Date: Fri, 5 May 2023 00:15:07 +0200 Subject: runtime: improve Pinner with gcBits This change replaces the statically sized pinnerBits with gcBits based ones, that are copied in each GC cycle if they exist. The pinnerBits now include a second bit per object, that indicates if a pinner counter for multi-pins exists, in order to avoid unnecessary specials iterations. This is a follow-up to CL 367296. Change-Id: I82e38cecd535e18c3b3ae54b5cc67d3aeeaafcfd Reviewed-on: https://go-review.googlesource.com/c/go/+/493275 Reviewed-by: Michael Knyszek TryBot-Result: Gopher Robot Run-TryBot: Michael Knyszek Reviewed-by: Heschi Kreinick --- src/runtime/mgcsweep.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/runtime/mgcsweep.go') diff --git a/src/runtime/mgcsweep.go b/src/runtime/mgcsweep.go index 728a5bad7e..68f1aae600 100644 --- a/src/runtime/mgcsweep.go +++ b/src/runtime/mgcsweep.go @@ -668,6 +668,11 @@ func (sl *sweepLocked) sweep(preserve bool) bool { s.allocBits = s.gcmarkBits s.gcmarkBits = newMarkBits(s.nelems) + // refresh pinnerBits if they exists + if s.pinnerBits != nil { + s.refreshPinnerBits() + } + // Initialize alloc bits cache. s.refillAllocCache(0) -- cgit v1.3