internal/gclayout: make gclayout values constants

The previous versions calculated at init() prevented `interp` from running
in many cases, increasing compile times due to the increased need to revert
the partially interpreted results and also increasing binary runtime because
fewer optimizations had happened during interp.
This commit is contained in:
Damian Gryski
2025-07-08 15:20:49 -07:00
committed by Ron Evans
parent 3bb092d4d4
commit 8c5886060f
5 changed files with 25 additions and 34 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ func alloc(size uintptr, layout unsafe.Pointer) unsafe.Pointer {
gcLock.Lock()
needsResumeWorld = false
var ptr unsafe.Pointer
if layout == gclayout.NoPtrs {
if layout == gclayout.NoPtrs.AsPtr() {
// This object is entirely pointer free, for example make([]int, ...).
// Make sure the GC knows this so it doesn't scan the object
// unnecessarily to improve performance.