From 96add980ad27faed627f26ef1ab09e8fe45d6bd1 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Thu, 11 May 2023 17:01:44 +0000 Subject: [PATCH] Revert "runtime: rename getcallerfp to getfp" This reverts CL 481617. Reason for revert: breaks test build on Windows Change-Id: Ifc1a323b0cc521e7a5a1f7de7b3da667f5fee375 Reviewed-on: https://go-review.googlesource.com/c/go/+/494377 Reviewed-by: Bryan Mills Reviewed-by: Michael Knyszek Auto-Submit: Michael Pratt Run-TryBot: Michael Pratt TryBot-Result: Gopher Robot --- src/runtime/asm_amd64.s | 2 +- src/runtime/asm_arm64.s | 2 +- src/runtime/export_test.go | 2 +- src/runtime/os_wasm.go | 5 ++--- src/runtime/stubs_386.go | 5 ++--- src/runtime/stubs_amd64.go | 4 ++-- src/runtime/stubs_arm.go | 5 ++--- src/runtime/stubs_arm64.go | 4 ++-- src/runtime/stubs_loong64.go | 5 ++--- src/runtime/stubs_mips64x.go | 5 ++--- src/runtime/stubs_mipsx.go | 5 ++--- src/runtime/stubs_ppc64x.go | 5 ++--- src/runtime/stubs_riscv64.go | 5 ++--- src/runtime/stubs_s390x.go | 5 ++--- src/runtime/trace.go | 2 +- 15 files changed, 26 insertions(+), 35 deletions(-) diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index 403ef3fc56..7fb1ae2cff 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -2060,6 +2060,6 @@ TEXT runtime·retpolineR13(SB),NOSPLIT|NOFRAME,$0; RETPOLINE(13) TEXT runtime·retpolineR14(SB),NOSPLIT|NOFRAME,$0; RETPOLINE(14) TEXT runtime·retpolineR15(SB),NOSPLIT|NOFRAME,$0; RETPOLINE(15) -TEXT ·getfp(SB),NOSPLIT|NOFRAME,$0 +TEXT ·getcallerfp(SB),NOSPLIT|NOFRAME,$0 MOVQ BP, AX RET diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s index 6c5105210b..6fe04a6445 100644 --- a/src/runtime/asm_arm64.s +++ b/src/runtime/asm_arm64.s @@ -1544,6 +1544,6 @@ TEXT runtime·panicSliceConvert(SB),NOSPLIT,$0-16 MOVD R3, R1 JMP runtime·goPanicSliceConvert(SB) -TEXT ·getfp(SB),NOSPLIT|NOFRAME,$0 +TEXT ·getcallerfp(SB),NOSPLIT|NOFRAME,$0 MOVD R29, R0 RET diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index bd230c0476..07d14591a6 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -1820,5 +1820,5 @@ func PersistentAlloc(n uintptr) unsafe.Pointer { // FPCallers works like Callers and uses frame pointer unwinding to populate // pcBuf with the return addresses of the physical frames on the stack. func FPCallers(skip int, pcBuf []uintptr) int { - return fpTracebackPCs(unsafe.Pointer(getfp()), skip, pcBuf) + return fpTracebackPCs(unsafe.Pointer(getcallerfp()), skip, pcBuf) } diff --git a/src/runtime/os_wasm.go b/src/runtime/os_wasm.go index bf78dfb5f9..1a6f7d802f 100644 --- a/src/runtime/os_wasm.go +++ b/src/runtime/os_wasm.go @@ -137,9 +137,8 @@ func preemptM(mp *m) { // No threads, so nothing to do. } -// getfp returns the frame pointer register of its caller or 0 if not implemented. -// TODO: Make this a compiler intrinsic -func getfp() uintptr { return 0 } +// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented. +func getcallerfp() uintptr { return 0 } func setProcessCPUProfiler(hz int32) {} func setThreadCPUProfiler(hz int32) {} diff --git a/src/runtime/stubs_386.go b/src/runtime/stubs_386.go index a1dd023974..ef531367c9 100644 --- a/src/runtime/stubs_386.go +++ b/src/runtime/stubs_386.go @@ -19,6 +19,5 @@ func emptyfunc() //go:noescape func asmcgocall_no_g(fn, arg unsafe.Pointer) -// getfp returns the frame pointer register of its caller or 0 if not implemented. -// TODO: Make this a compiler intrinsic -func getfp() uintptr { return 0 } +// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented. +func getcallerfp() uintptr { return 0 } diff --git a/src/runtime/stubs_amd64.go b/src/runtime/stubs_amd64.go index a86a496457..3e7cf4f383 100644 --- a/src/runtime/stubs_amd64.go +++ b/src/runtime/stubs_amd64.go @@ -48,6 +48,6 @@ func asmcgocall_no_g(fn, arg unsafe.Pointer) func spillArgs() func unspillArgs() -// getfp returns the frame pointer register of its caller or 0 if not implemented. +// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented. // TODO: Make this a compiler intrinsic -func getfp() uintptr +func getcallerfp() uintptr diff --git a/src/runtime/stubs_arm.go b/src/runtime/stubs_arm.go index e19f1a87b2..be40a2b06a 100644 --- a/src/runtime/stubs_arm.go +++ b/src/runtime/stubs_arm.go @@ -24,6 +24,5 @@ func read_tls_fallback() //go:noescape func asmcgocall_no_g(fn, arg unsafe.Pointer) -// getfp returns the frame pointer register of its caller or 0 if not implemented. -// TODO: Make this a compiler intrinsic -func getfp() uintptr { return 0 } +// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented. +func getcallerfp() uintptr { return 0 } diff --git a/src/runtime/stubs_arm64.go b/src/runtime/stubs_arm64.go index df04e64291..723337ce52 100644 --- a/src/runtime/stubs_arm64.go +++ b/src/runtime/stubs_arm64.go @@ -22,6 +22,6 @@ func emptyfunc() func spillArgs() func unspillArgs() -// getfp returns the frame pointer register of its caller or 0 if not implemented. +// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented. // TODO: Make this a compiler intrinsic -func getfp() uintptr +func getcallerfp() uintptr diff --git a/src/runtime/stubs_loong64.go b/src/runtime/stubs_loong64.go index 556983cad1..0575c3093d 100644 --- a/src/runtime/stubs_loong64.go +++ b/src/runtime/stubs_loong64.go @@ -10,6 +10,5 @@ package runtime func load_g() func save_g() -// getfp returns the frame pointer register of its caller or 0 if not implemented. -// TODO: Make this a compiler intrinsic -func getfp() uintptr { return 0 } +// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented. +func getcallerfp() uintptr { return 0 } diff --git a/src/runtime/stubs_mips64x.go b/src/runtime/stubs_mips64x.go index f0cf088620..dbc4424f6c 100644 --- a/src/runtime/stubs_mips64x.go +++ b/src/runtime/stubs_mips64x.go @@ -15,6 +15,5 @@ func save_g() //go:noescape func asmcgocall_no_g(fn, arg unsafe.Pointer) -// getfp returns the frame pointer register of its caller or 0 if not implemented. -// TODO: Make this a compiler intrinsic -func getfp() uintptr { return 0 } +// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented. +func getcallerfp() uintptr { return 0 } diff --git a/src/runtime/stubs_mipsx.go b/src/runtime/stubs_mipsx.go index 84ba147b85..abae8418a1 100644 --- a/src/runtime/stubs_mipsx.go +++ b/src/runtime/stubs_mipsx.go @@ -10,6 +10,5 @@ package runtime func load_g() func save_g() -// getfp returns the frame pointer register of its caller or 0 if not implemented. -// TODO: Make this a compiler intrinsic -func getfp() uintptr { return 0 } +// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented. +func getcallerfp() uintptr { return 0 } diff --git a/src/runtime/stubs_ppc64x.go b/src/runtime/stubs_ppc64x.go index 0b7771ef03..67035eb7e8 100644 --- a/src/runtime/stubs_ppc64x.go +++ b/src/runtime/stubs_ppc64x.go @@ -16,6 +16,5 @@ func reginit() func spillArgs() func unspillArgs() -// getfp returns the frame pointer register of its caller or 0 if not implemented. -// TODO: Make this a compiler intrinsic -func getfp() uintptr { return 0 } +// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented. +func getcallerfp() uintptr { return 0 } diff --git a/src/runtime/stubs_riscv64.go b/src/runtime/stubs_riscv64.go index b07d7f8746..0df1659c4a 100644 --- a/src/runtime/stubs_riscv64.go +++ b/src/runtime/stubs_riscv64.go @@ -15,6 +15,5 @@ func save_g() func spillArgs() func unspillArgs() -// getfp returns the frame pointer register of its caller or 0 if not implemented. -// TODO: Make this a compiler intrinsic -func getfp() uintptr { return 0 } +// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented. +func getcallerfp() uintptr { return 0 } diff --git a/src/runtime/stubs_s390x.go b/src/runtime/stubs_s390x.go index a2b07ff8aa..799f4e948f 100644 --- a/src/runtime/stubs_s390x.go +++ b/src/runtime/stubs_s390x.go @@ -8,6 +8,5 @@ package runtime func load_g() func save_g() -// getfp returns the frame pointer register of its caller or 0 if not implemented. -// TODO: Make this a compiler intrinsic -func getfp() uintptr { return 0 } +// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented. +func getcallerfp() uintptr { return 0 } diff --git a/src/runtime/trace.go b/src/runtime/trace.go index 327059dd50..5eb68271d1 100644 --- a/src/runtime/trace.go +++ b/src/runtime/trace.go @@ -906,7 +906,7 @@ func traceStackID(mp *m, pcBuf []uintptr, skip int) uint64 { // Fast path: Unwind using frame pointers. pcBuf[0] = uintptr(skip) if curgp == gp { - nstk += fpTracebackPCs(unsafe.Pointer(getfp()), skip, pcBuf[1:]) + nstk += fpTracebackPCs(unsafe.Pointer(getcallerfp()), skip, pcBuf[1:]) } else if curgp != nil { // We're called on the g0 stack through mcall(fn) or systemstack(fn). To // behave like gcallers above, we start unwinding from sched.bp, which -- 2.50.0