aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/panic.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2024-09-16 15:58:36 -0400
committerMichael Pratt <mpratt@google.com>2024-09-17 17:01:20 +0000
commit4f881115d4067bda8a236aabcae8c41cdd13b4d0 (patch)
tree2249bfaec1950819e5e22184e61e60dcd076ae40 /src/runtime/panic.go
parent41ca2637d4df8b8edf63436c6caab56821d2af38 (diff)
downloadgo-4f881115d4067bda8a236aabcae8c41cdd13b4d0.tar.xz
runtime: move getcallersp to internal/runtime/sys
Moving these intrinsics to a base package enables other internal/runtime packages to use them. For #54766. Change-Id: I45a530422207dd94b5ad4eee51216c9410a84040 Reviewed-on: https://go-review.googlesource.com/c/go/+/613261 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime/panic.go')
-rw-r--r--src/runtime/panic.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/runtime/panic.go b/src/runtime/panic.go
index e74a7feb05..5b62e019d9 100644
--- a/src/runtime/panic.go
+++ b/src/runtime/panic.go
@@ -281,10 +281,10 @@ func deferproc(fn func()) {
gp._defer = d
d.fn = fn
d.pc = sys.GetCallerPC()
- // We must not be preempted between calling getcallersp and
- // storing it to d.sp because getcallersp's result is a
+ // We must not be preempted between calling GetCallerSP and
+ // storing it to d.sp because GetCallerSP's result is a
// uintptr stack pointer.
- d.sp = getcallersp()
+ d.sp = sys.GetCallerSP()
// deferproc returns 0 normally.
// a deferred func that stops a panic
@@ -395,10 +395,10 @@ func deferrangefunc() any {
d.link = gp._defer
gp._defer = d
d.pc = sys.GetCallerPC()
- // We must not be preempted between calling getcallersp and
- // storing it to d.sp because getcallersp's result is a
+ // We must not be preempted between calling GetCallerSP and
+ // storing it to d.sp because GetCallerSP's result is a
// uintptr stack pointer.
- d.sp = getcallersp()
+ d.sp = sys.GetCallerSP()
d.rangefunc = true
d.head = new(atomic.Pointer[_defer])
@@ -484,7 +484,7 @@ func deferprocStack(d *_defer) {
// are initialized here.
d.heap = false
d.rangefunc = false
- d.sp = getcallersp()
+ d.sp = sys.GetCallerSP()
d.pc = sys.GetCallerPC()
// The lines below implement:
// d.panic = nil
@@ -596,7 +596,7 @@ func deferreturn() {
var p _panic
p.deferreturn = true
- p.start(sys.GetCallerPC(), unsafe.Pointer(getcallersp()))
+ p.start(sys.GetCallerPC(), unsafe.Pointer(sys.GetCallerSP()))
for {
fn, ok := p.nextDefer()
if !ok {
@@ -622,7 +622,7 @@ func Goexit() {
var p _panic
p.goexit = true
- p.start(sys.GetCallerPC(), unsafe.Pointer(getcallersp()))
+ p.start(sys.GetCallerPC(), unsafe.Pointer(sys.GetCallerSP()))
for {
fn, ok := p.nextDefer()
if !ok {
@@ -778,7 +778,7 @@ func gopanic(e any) {
runningPanicDefers.Add(1)
- p.start(sys.GetCallerPC(), unsafe.Pointer(getcallersp()))
+ p.start(sys.GetCallerPC(), unsafe.Pointer(sys.GetCallerSP()))
for {
fn, ok := p.nextDefer()
if !ok {
@@ -818,7 +818,7 @@ func (p *_panic) start(pc uintptr, sp unsafe.Pointer) {
// can restart its defer processing loop if a recovered panic tries
// to jump past it.
p.startPC = sys.GetCallerPC()
- p.startSP = unsafe.Pointer(getcallersp())
+ p.startSP = unsafe.Pointer(sys.GetCallerSP())
if p.deferreturn {
p.sp = sp
@@ -1228,7 +1228,7 @@ func recovery(gp *g) {
//go:nosplit
func fatalthrow(t throwType) {
pc := sys.GetCallerPC()
- sp := getcallersp()
+ sp := sys.GetCallerSP()
gp := getg()
if gp.m.throwing == throwTypeNone {
@@ -1264,7 +1264,7 @@ func fatalthrow(t throwType) {
//go:nosplit
func fatalpanic(msgs *_panic) {
pc := sys.GetCallerPC()
- sp := getcallersp()
+ sp := sys.GetCallerSP()
gp := getg()
var docrash bool
// Switch to the system stack to avoid any stack growth, which