aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mgcsweep.go
diff options
context:
space:
mode:
authorSven Anderson <sven@anderson.de>2023-05-05 00:15:07 +0200
committerMichael Knyszek <mknyszek@google.com>2023-05-19 23:21:57 +0000
commit697644070c6e335b9c3dffdd4e82feb8038c3f22 (patch)
tree786e5a6aac283e68c63c411e0cb005abca939e22 /src/runtime/mgcsweep.go
parent6891405bbefc005467bd334d4061b599129a18c9 (diff)
downloadgo-697644070c6e335b9c3dffdd4e82feb8038c3f22.tar.xz
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 <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Knyszek <mknyszek@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com>
Diffstat (limited to 'src/runtime/mgcsweep.go')
-rw-r--r--src/runtime/mgcsweep.go5
1 files changed, 5 insertions, 0 deletions
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)