aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/runtime/mgcmark_greenteagc.go7
-rw-r--r--src/runtime/mgcmark_nogreenteagc.go2
-rw-r--r--src/runtime/mgcsweep.go9
3 files changed, 8 insertions, 10 deletions
diff --git a/src/runtime/mgcmark_greenteagc.go b/src/runtime/mgcmark_greenteagc.go
index 3a368438d4..018f7df6ff 100644
--- a/src/runtime/mgcmark_greenteagc.go
+++ b/src/runtime/mgcmark_greenteagc.go
@@ -183,10 +183,10 @@ func (s *mspan) initInlineMarkBits() {
s.inlineMarkBits().init(s.spanclass)
}
-// mergeInlineMarks merges the span's inline mark bits into dst.
+// moveInlineMarks merges the span's inline mark bits into dst and clears them.
//
// gcUsesSpanInlineMarkBits(s.elemsize) must be true.
-func (s *mspan) mergeInlineMarks(dst *gcBits) {
+func (s *mspan) moveInlineMarks(dst *gcBits) {
if doubleCheckGreenTea && !gcUsesSpanInlineMarkBits(s.elemsize) {
throw("expected span with inline mark bits")
}
@@ -203,6 +203,9 @@ func (s *mspan) mergeInlineMarks(dst *gcBits) {
if doubleCheckGreenTea && !s.spanclass.noscan() && imb.marks != imb.scans {
throw("marks don't match scans for span with pointer")
}
+
+ // Reset the inline mark bits.
+ imb.init(s.spanclass)
}
// inlineMarkBits returns the inline mark bits for the span.
diff --git a/src/runtime/mgcmark_nogreenteagc.go b/src/runtime/mgcmark_nogreenteagc.go
index c0ca5c21ea..6e4f0c4f72 100644
--- a/src/runtime/mgcmark_nogreenteagc.go
+++ b/src/runtime/mgcmark_nogreenteagc.go
@@ -24,7 +24,7 @@ func tryDeferToSpanScan(p uintptr, gcw *gcWork) bool {
func (s *mspan) initInlineMarkBits() {
}
-func (s *mspan) mergeInlineMarks(to *gcBits) {
+func (s *mspan) moveInlineMarks(to *gcBits) {
throw("unimplemented")
}
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 {