Skip to content

Commit 506e690

Browse files
committed
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 <[email protected]> Run-TryBot: Than McIntosh <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 4a459cb commit 506e690

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/runtime/mheap.go

+12
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,12 @@ func arenaBase(i arenaIdx) uintptr {
576576

577577
type arenaIdx uint
578578

579+
// l1 returns the "l1" portion of an arenaIdx.
580+
//
581+
// Marked nosplit because it's called by spanOf and other nosplit
582+
// functions.
583+
//
584+
//go:nosplit
579585
func (i arenaIdx) l1() uint {
580586
if arenaL1Bits == 0 {
581587
// Let the compiler optimize this away if there's no
@@ -586,6 +592,12 @@ func (i arenaIdx) l1() uint {
586592
}
587593
}
588594

595+
// l2 returns the "l2" portion of an arenaIdx.
596+
//
597+
// Marked nosplit because it's called by spanOf and other nosplit funcs.
598+
// functions.
599+
//
600+
//go:nosplit
589601
func (i arenaIdx) l2() uint {
590602
if arenaL1Bits == 0 {
591603
return uint(i)

0 commit comments

Comments
 (0)