aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mgcsweep.go
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2025-07-14 19:23:12 +0000
committerGopher Robot <gobot@golang.org>2025-07-15 12:24:28 -0700
commit0c6296ab128eae1980eb81a51b982766a5d7b5fb (patch)
tree3a50f4328000e960b3f6e6fd4a9deb3f20a38bf1 /src/runtime/mgcsweep.go
parent397d2117ec5ca7a96324f02dcfc24d8f00b067a0 (diff)
downloadgo-0c6296ab128eae1980eb81a51b982766a5d7b5fb.tar.xz
runtime: have mergeInlineMarkBits also clear the inline mark bits
This is conceptually simpler, as the sweeper doesn't have to worry about clearing them separately. It also doesn't have a use for them. This will also be useful to avoiding unnecessary zeroing in initInlineMarkBits at allocation time. Currently, because it's used in both span allocation and at sweep time, we cannot blindly trust needzero. This change also renames mergeInlineMarkBits to moveInlineMarkBits to make this change in semantics clearer from the name. For #73581. Change-Id: Ib154738a945633b7ff5b2ae27235baa310400139 Reviewed-on: https://go-review.googlesource.com/c/go/+/687936 Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/mgcsweep.go')
-rw-r--r--src/runtime/mgcsweep.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/runtime/mgcsweep.go b/src/runtime/mgcsweep.go
index a3bf2989df..1605c21966 100644
--- a/src/runtime/mgcsweep.go
+++ b/src/runtime/mgcsweep.go
@@ -650,9 +650,9 @@ func (sl *sweepLocked) sweep(preserve bool) bool {
}
}
- // Copy over the inline mark bits if necessary.
+ // Copy over and clear the inline mark bits if necessary.
if gcUsesSpanInlineMarkBits(s.elemsize) {
- s.mergeInlineMarks(s.gcmarkBits)
+ s.moveInlineMarks(s.gcmarkBits)
}
// Check for zombie objects.
@@ -704,11 +704,6 @@ func (sl *sweepLocked) sweep(preserve bool) bool {
// Initialize alloc bits cache.
s.refillAllocCache(0)
- // Reset the object queue, if we have one.
- if gcUsesSpanInlineMarkBits(s.elemsize) {
- s.initInlineMarkBits()
- }
-
// The span must be in our exclusive ownership until we update sweepgen,
// check for potential races.
if state := s.state.get(); state != mSpanInUse || s.sweepgen != sweepgen-1 {