mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-15 08:52:57 +00:00
21 lines
646 B
Go
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
|