From 528bafa0498bb26a3b3961fa5bf50d02bd7101bb Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Tue, 4 Mar 2025 19:02:48 +0000 Subject: runtime: move sizeclass defs to new package internal/runtime/gc We will want to reference these definitions from new generator programs, and this is a good opportunity to cleanup all these old C-style names. Change-Id: Ifb06f0afc381e2697e7877f038eca786610c96de Reviewed-on: https://go-review.googlesource.com/c/go/+/655275 Auto-Submit: Michael Knyszek LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui Reviewed-by: Michael Pratt --- src/runtime/stack.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/runtime/stack.go') diff --git a/src/runtime/stack.go b/src/runtime/stack.go index a2866322a9..2fedaa9421 100644 --- a/src/runtime/stack.go +++ b/src/runtime/stack.go @@ -10,6 +10,7 @@ import ( "internal/goarch" "internal/goos" "internal/runtime/atomic" + "internal/runtime/gc" "internal/runtime/sys" "unsafe" ) @@ -161,11 +162,11 @@ type stackpoolItem struct { // Global pool of large stack spans. var stackLarge struct { lock mutex - free [heapAddrBits - pageShift]mSpanList // free lists by log_2(s.npages) + free [heapAddrBits - gc.PageShift]mSpanList // free lists by log_2(s.npages) } func stackinit() { - if _StackCacheSize&_PageMask != 0 { + if _StackCacheSize&pageMask != 0 { throw("cache size must be a multiple of page size") } for i := range stackpool { @@ -196,7 +197,7 @@ func stackpoolalloc(order uint8) gclinkptr { lockWithRankMayAcquire(&mheap_.lock, lockRankMheap) if s == nil { // no free stacks. Allocate another span worth. - s = mheap_.allocManual(_StackCacheSize>>_PageShift, spanAllocStack) + s = mheap_.allocManual(_StackCacheSize>>gc.PageShift, spanAllocStack) if s == nil { throw("out of memory") } @@ -390,7 +391,7 @@ func stackalloc(n uint32) stack { v = unsafe.Pointer(x) } else { var s *mspan - npage := uintptr(n) >> _PageShift + npage := uintptr(n) >> gc.PageShift log2npage := stacklog2(npage) // Try to get a stack from the large stack cache. -- cgit v1.3