Commit 929597b9 authored by Russ Cox's avatar Russ Cox

runtime: unroll gc_m loop

The loop made more sense when gc_m was not its own function.

Change-Id: I71a7f21d777e69c1924e3b534c507476daa4dfdd
Reviewed-on: https://go-review.googlesource.com/5332Reviewed-by: default avatarAustin Clements <austin@google.com>
parent 2b655c0b
......@@ -362,20 +362,9 @@ func gc(mode int) {
// the root set down a bit (g0 stacks are not scanned, and
// we don't need to scan gc's internal state). We also
// need to switch to g0 so we can shrink the stack.
n := 1
if debug.gctrace > 1 {
n = 2
}
for i := 0; i < n; i++ {
if i > 0 {
// refresh start time if doing a second GC
startTime = nanotime()
}
// switch to g0, call gc, then switch back
systemstack(func() {
gc_m(startTime, mode == gcForceBlockMode)
})
}
systemstack(func() {
gc_m(startTime, mode == gcForceBlockMode)
})
systemstack(func() {
// Called from malloc.go using systemstack.
......@@ -397,6 +386,13 @@ func gc(mode int) {
gc_m(startTime, mode == gcForceBlockMode) // turns off checkmarkphase + calls clearcheckmarkbits
})
if debug.gctrace > 1 {
startTime = nanotime()
systemstack(func() {
gc_m(startTime, mode == gcForceBlockMode)
})
}
if trace.enabled {
traceGCDone()
traceGoStart()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment