Source File
mcentral.go
Belonging Package
runtime
package runtime
import
func ( *mcentral) ( spanClass) {
.spanclass =
lockInit(&.partial[0].spineLock, lockRankSpanSetSpine)
lockInit(&.partial[1].spineLock, lockRankSpanSetSpine)
lockInit(&.full[0].spineLock, lockRankSpanSetSpine)
lockInit(&.full[1].spineLock, lockRankSpanSetSpine)
}
:= uintptr(class_to_allocnpages[.spanclass.sizeclass()]) * _PageSize
deductSweepCredit(, 0)
:= mheap_.sweepgen
:= false
if trace.enabled {
traceGCSweepStart()
}
:= 100
var *mspan
if = .partialSwept().pop(); != nil {
goto
}
for ; >= 0; -- {
= .partialUnswept().pop()
if == nil {
break
}
for ; >= 0; -- {
= .fullUnswept().pop()
if == nil {
break
}
:= .nextFreeIndex()
if != .nelems {
.freeindex =
goto
}
if trace.enabled {
traceGCSweepDone()
= true
}
:
if trace.enabled && ! {
traceGCSweepDone()
}
:= int(.nelems) - int(.allocCount)
if == 0 || .freeindex == .nelems || uintptr(.allocCount) == .nelems {
throw("span has no free objects")
}
:= .freeindex &^ (64 - 1)
.allocCache >>= .freeindex % 64
return
}
.partialSwept().push()
:= ( << _PageShift) >> .divShift * uintptr(.divMul) >> .divShift2
.limit = .base() + *
heapBitsForAddr(.base()).initSpan()
return
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |