]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: mark arenaIdx.l1 and arenaIdx.l2 methods as nosplit
authorThan McIntosh <thanm@google.com>
Mon, 10 Oct 2022 17:49:54 +0000 (13:49 -0400)
committerThan McIntosh <thanm@google.com>
Mon, 10 Oct 2022 19:56:54 +0000 (19:56 +0000)
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 <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/runtime/mheap.go

index 995cb2ae9c2ccdd63336fe3a1d1ab9096211ef45..8d8a75a8f4a7b6fbbe4e552e81133e019438f95b 100644 (file)
@@ -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)