Skip to content

Commit e13f0c4

Browse files
committed
runtime: refactor GC mark phase into gcMarkReachable
This is a small refactor to prepare GC marking for multithreaded stop-the-world.
1 parent a8060d4 commit e13f0c4

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/runtime/gc_blocks.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,7 @@ func runGC() (freeBytes uintptr) {
422422
}
423423

424424
// Mark phase: mark all reachable objects, recursively.
425-
markStack()
426-
findGlobals(markRoots)
425+
gcMarkReachable()
427426

428427
if baremetal && hasScheduler {
429428
// Channel operations in interrupts may move task pointers around while we are marking.

src/runtime/gc_stack_portable.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import (
88
"unsafe"
99
)
1010

11+
func gcMarkReachable() {
12+
markStack()
13+
findGlobals(markRoots)
14+
}
15+
1116
//go:extern runtime.stackChainStart
1217
var stackChainStart *stackChainObject
1318

src/runtime/gc_stack_raw.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ package runtime
44

55
import "internal/task"
66

7+
func gcMarkReachable() {
8+
markStack()
9+
findGlobals(markRoots)
10+
}
11+
712
// markStack marks all root pointers found on the stack.
813
//
914
// This implementation is conservative and relies on the stack top (provided by

0 commit comments

Comments
 (0)