mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
397d2117ec
commit
0c6296ab12
3 changed files with 8 additions and 10 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue