Files
tinygo/src/runtime/gc_globals_boehm.go
T
2026-09-10 08:49:07 +02:00

21 lines
646 B
Go

//go:build gc.boehm
package runtime
import "unsafe"
func markGlobals() {
for i := uintptr(0); i < gcGlobalRootCount(); i++ {
addr := gcGlobalRoot(uintptr(i))
// GC_push_all queues one range per call and overflows Boehm's mark
// stack for programs with thousands of roots. Scan each range now.
libgc_push_all_eager(uintptr(addr), uintptr(addr)+gcGlobalRootSize(i))
}
}
// These functions are generated by the compiler from the pointer layouts of
// mutable globals. Each range contains only pointer slots.
func gcGlobalRootCount() uintptr
func gcGlobalRoot(index uintptr) unsafe.Pointer
func gcGlobalRootSize(index uintptr) uintptr