From 506e690a26390d137b8bfc01d90121581c3d6f7a Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Mon, 10 Oct 2022 13:49:54 -0400 Subject: [PATCH] runtime: mark arenaIdx.l1 and arenaIdx.l2 methods as nosplit Mark the "l1" and "l2" methods on "arenaIdx" with //go:nosplit, since these methods are called from a nosplit context (for example, from "spanOf"). Fixes #56044. Updates #21314. Change-Id: I48c7aa756b59a13162c89ef21066f83371ae50f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/441859 Reviewed-by: Cherry Mui Run-TryBot: Than McIntosh TryBot-Result: Gopher Robot --- src/runtime/mheap.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go index 995cb2ae9c..8d8a75a8f4 100644 --- a/src/runtime/mheap.go +++ b/src/runtime/mheap.go @@ -576,6 +576,12 @@ func arenaBase(i arenaIdx) uintptr { type arenaIdx uint +// l1 returns the "l1" portion of an arenaIdx. +// +// Marked nosplit because it's called by spanOf and other nosplit +// functions. +// +//go:nosplit func (i arenaIdx) l1() uint { if arenaL1Bits == 0 { // Let the compiler optimize this away if there's no @@ -586,6 +592,12 @@ func (i arenaIdx) l1() uint { } } +// l2 returns the "l2" portion of an arenaIdx. +// +// Marked nosplit because it's called by spanOf and other nosplit funcs. +// functions. +// +//go:nosplit func (i arenaIdx) l2() uint { if arenaL1Bits == 0 { return uint(i) -- 2.50.0