From: Michael Anthony Knyszek Date: Fri, 25 Jul 2025 18:08:35 +0000 (+0000) Subject: runtime: rename scanobject to scanObject X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1aa154621d414c0d9886e581ae058187f5277e60;p=gostls13.git runtime: rename scanobject to scanObject This is long overdue. Change-Id: I891b114cb581e82b903c20d1c455bbbdad548fe8 Reviewed-on: https://go-review.googlesource.com/c/go/+/690535 LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Pratt Auto-Submit: Michael Knyszek --- diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go index 7331886af2..b2557275ec 100644 --- a/src/runtime/mbitmap.go +++ b/src/runtime/mbitmap.go @@ -692,7 +692,7 @@ func (span *mspan) writeHeapBitsSmall(x, dataSize uintptr, typ *_type) (scanSize // malloc does not call heapSetType* when there are no pointers. // // There can be read-write races between heapSetType* and things -// that read the heap metadata like scanobject. However, since +// that read the heap metadata like scanObject. However, since // heapSetType* is only used for objects that have not yet been // made reachable, readers will ignore bits being modified by this // function. This does mean this function cannot transiently modify diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go index b8a1d8fc14..a0087ab6e0 100644 --- a/src/runtime/mgcmark.go +++ b/src/runtime/mgcmark.go @@ -421,7 +421,7 @@ func gcScanFinalizer(spf *specialfinalizer, s *mspan, gcw *gcWork) { // the object (but *not* the object itself or // we'll never collect it). if !s.spanclass.noscan() { - scanobject(p, gcw) + scanObject(p, gcw) } // The special itself is also a root. @@ -1255,7 +1255,7 @@ func gcDrain(gcw *gcWork, flags gcDrainFlags) { } } if b != 0 { - scanobject(b, gcw) + scanObject(b, gcw) } else if s != 0 { scanSpan(s, gcw) } else { @@ -1359,7 +1359,7 @@ func gcDrainN(gcw *gcWork, scanWork int64) int64 { } } if b != 0 { - scanobject(b, gcw) + scanObject(b, gcw) } else if s != 0 { scanSpan(s, gcw) } else { @@ -1390,7 +1390,7 @@ func gcDrainN(gcw *gcWork, scanWork int64) int64 { return workFlushed + gcw.heapScanWork } -// scanblock scans b as scanobject would, but using an explicit +// scanblock scans b as scanObject would, but using an explicit // pointer bitmap instead of the heap bitmap. // // This is used to scan non-heap roots, so it does not update @@ -1415,7 +1415,7 @@ func scanblock(b0, n0 uintptr, ptrmask *uint8, gcw *gcWork, stk *stackScanState) } for j := 0; j < 8 && i < n; j++ { if bits&1 != 0 { - // Same work as in scanobject; see comments there. + // Same work as in scanObject; see comments there. p := *(*uintptr)(unsafe.Pointer(b + i)) if p != 0 { if stk != nil && p >= stk.stack.lo && p < stk.stack.hi { diff --git a/src/runtime/mgcmark_greenteagc.go b/src/runtime/mgcmark_greenteagc.go index 1f2db2e1bb..845857a817 100644 --- a/src/runtime/mgcmark_greenteagc.go +++ b/src/runtime/mgcmark_greenteagc.go @@ -852,16 +852,16 @@ func (w *gcWork) flushScanStats(dst *[gc.NumSizeClasses]sizeClassScanStats) { clear(w.stats[:]) } -// scanobject scans the object starting at b, adding pointers to gcw. +// scanObject scans the object starting at b, adding pointers to gcw. // b must point to the beginning of a heap object or an oblet. -// scanobject consults the GC bitmap for the pointer mask and the +// scanObject consults the GC bitmap for the pointer mask and the // spans for the size of the object. // // Used only for !gcUsesSpanInlineMarkBits spans, but supports all // object sizes and is safe to be called on all heap objects. // //go:nowritebarrier -func scanobject(b uintptr, gcw *gcWork) { +func scanObject(b uintptr, gcw *gcWork) { // Prefetch object before we scan it. // // This will overlap fetching the beginning of the object with initial @@ -876,12 +876,12 @@ func scanobject(b uintptr, gcw *gcWork) { s := spanOfUnchecked(b) n := s.elemsize if n == 0 { - throw("scanobject n == 0") + throw("scanObject n == 0") } if s.spanclass.noscan() { // Correctness-wise this is ok, but it's inefficient // if noscan objects reach here. - throw("scanobject of a noscan object") + throw("scanObject of a noscan object") } var tp typePointers diff --git a/src/runtime/mgcmark_nogreenteagc.go b/src/runtime/mgcmark_nogreenteagc.go index 3ae0802e6c..6375773123 100644 --- a/src/runtime/mgcmark_nogreenteagc.go +++ b/src/runtime/mgcmark_nogreenteagc.go @@ -116,13 +116,13 @@ func (w *gcWork) flushScanStats(dst *[gc.NumSizeClasses]sizeClassScanStats) { clear(w.stats[:]) } -// scanobject scans the object starting at b, adding pointers to gcw. +// scanObject scans the object starting at b, adding pointers to gcw. // b must point to the beginning of a heap object or an oblet. -// scanobject consults the GC bitmap for the pointer mask and the +// scanObject consults the GC bitmap for the pointer mask and the // spans for the size of the object. // //go:nowritebarrier -func scanobject(b uintptr, gcw *gcWork) { +func scanObject(b uintptr, gcw *gcWork) { // Prefetch object before we scan it. // // This will overlap fetching the beginning of the object with initial @@ -137,12 +137,12 @@ func scanobject(b uintptr, gcw *gcWork) { s := spanOfUnchecked(b) n := s.elemsize if n == 0 { - throw("scanobject n == 0") + throw("scanObject n == 0") } if s.spanclass.noscan() { // Correctness-wise this is ok, but it's inefficient // if noscan objects reach here. - throw("scanobject of a noscan object") + throw("scanObject of a noscan object") } var tp typePointers diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go index cc3116acb3..d8193ddb46 100644 --- a/src/runtime/mheap.go +++ b/src/runtime/mheap.go @@ -2199,7 +2199,7 @@ func addfinalizer(p unsafe.Pointer, f *funcval, nret uintptr, fint *_type, ot *p // Mark everything reachable from the object // so it's retained for the finalizer. if !span.spanclass.noscan() { - scanobject(base, gcw) + scanObject(base, gcw) } // Mark the finalizer itself, since the // special isn't part of the GC'd heap. diff --git a/src/runtime/mwbbuf.go b/src/runtime/mwbbuf.go index 537d558592..e8c6064905 100644 --- a/src/runtime/mwbbuf.go +++ b/src/runtime/mwbbuf.go @@ -215,7 +215,7 @@ func wbBufFlush1(pp *p) { // pointers we greyed. We use the buffer itself to temporarily // record greyed pointers. // - // TODO: Should scanobject/scanblock just stuff pointers into + // TODO: Should scanObject/scanblock just stuff pointers into // the wbBuf? Then this would become the sole greying path. // // TODO: We could avoid shading any of the "new" pointers in