mirror of
https://github.com/golang/go
synced 2024-09-29 03:24:29 -06:00
runtime: rename getcallerfp to getfp
The previous name was wrong due to the mistaken assumption that calling f->g->getcallerpc and f->g->getcallersp would respectively return the pc/sp at g. However, they are actually referring to their caller's caller, i.e. f. Rename getcallerfp to getfp in order to stay consistent with this naming convention. Also see discussion on CL 463835. For #16638 This is a redo of CL 481617 that became necessary because CL 461738 added another call site for getcallerfp(). Change-Id: If0b536e85a6c26061b65e7b5c2859fc31385d025 Reviewed-on: https://go-review.googlesource.com/c/go/+/494857 Reviewed-by: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
This commit is contained in:
parent
d75cc4b9c6
commit
3afbca5c5f
@ -2088,6 +2088,6 @@ TEXT runtime·retpolineR13(SB),NOSPLIT|NOFRAME,$0; RETPOLINE(13)
|
|||||||
TEXT runtime·retpolineR14(SB),NOSPLIT|NOFRAME,$0; RETPOLINE(14)
|
TEXT runtime·retpolineR14(SB),NOSPLIT|NOFRAME,$0; RETPOLINE(14)
|
||||||
TEXT runtime·retpolineR15(SB),NOSPLIT|NOFRAME,$0; RETPOLINE(15)
|
TEXT runtime·retpolineR15(SB),NOSPLIT|NOFRAME,$0; RETPOLINE(15)
|
||||||
|
|
||||||
TEXT ·getcallerfp<ABIInternal>(SB),NOSPLIT|NOFRAME,$0
|
TEXT ·getfp<ABIInternal>(SB),NOSPLIT|NOFRAME,$0
|
||||||
MOVQ BP, AX
|
MOVQ BP, AX
|
||||||
RET
|
RET
|
||||||
|
@ -1568,6 +1568,6 @@ TEXT runtime·panicSliceConvert<ABIInternal>(SB),NOSPLIT,$0-16
|
|||||||
MOVD R3, R1
|
MOVD R3, R1
|
||||||
JMP runtime·goPanicSliceConvert<ABIInternal>(SB)
|
JMP runtime·goPanicSliceConvert<ABIInternal>(SB)
|
||||||
|
|
||||||
TEXT ·getcallerfp<ABIInternal>(SB),NOSPLIT|NOFRAME,$0
|
TEXT ·getfp<ABIInternal>(SB),NOSPLIT|NOFRAME,$0
|
||||||
MOVD R29, R0
|
MOVD R29, R0
|
||||||
RET
|
RET
|
||||||
|
@ -1826,7 +1826,7 @@ func PersistentAlloc(n uintptr) unsafe.Pointer {
|
|||||||
// FPCallers works like Callers and uses frame pointer unwinding to populate
|
// FPCallers works like Callers and uses frame pointer unwinding to populate
|
||||||
// pcBuf with the return addresses of the physical frames on the stack.
|
// pcBuf with the return addresses of the physical frames on the stack.
|
||||||
func FPCallers(pcBuf []uintptr) int {
|
func FPCallers(pcBuf []uintptr) int {
|
||||||
return fpTracebackPCs(unsafe.Pointer(getcallerfp()), pcBuf)
|
return fpTracebackPCs(unsafe.Pointer(getfp()), pcBuf)
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -33,6 +33,6 @@ func NewContextStub() ContextStub {
|
|||||||
var ctx context
|
var ctx context
|
||||||
ctx.set_ip(getcallerpc())
|
ctx.set_ip(getcallerpc())
|
||||||
ctx.set_sp(getcallersp())
|
ctx.set_sp(getcallersp())
|
||||||
ctx.set_fp(getcallerfp())
|
ctx.set_fp(getfp())
|
||||||
return ContextStub{ctx}
|
return ContextStub{ctx}
|
||||||
}
|
}
|
||||||
|
@ -137,8 +137,9 @@ func preemptM(mp *m) {
|
|||||||
// No threads, so nothing to do.
|
// No threads, so nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented.
|
// getfp returns the frame pointer register of its caller or 0 if not implemented.
|
||||||
func getcallerfp() uintptr { return 0 }
|
// TODO: Make this a compiler intrinsic
|
||||||
|
func getfp() uintptr { return 0 }
|
||||||
|
|
||||||
func setProcessCPUProfiler(hz int32) {}
|
func setProcessCPUProfiler(hz int32) {}
|
||||||
func setThreadCPUProfiler(hz int32) {}
|
func setThreadCPUProfiler(hz int32) {}
|
||||||
|
@ -19,5 +19,6 @@ func emptyfunc()
|
|||||||
//go:noescape
|
//go:noescape
|
||||||
func asmcgocall_no_g(fn, arg unsafe.Pointer)
|
func asmcgocall_no_g(fn, arg unsafe.Pointer)
|
||||||
|
|
||||||
// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented.
|
// getfp returns the frame pointer register of its caller or 0 if not implemented.
|
||||||
func getcallerfp() uintptr { return 0 }
|
// TODO: Make this a compiler intrinsic
|
||||||
|
func getfp() uintptr { return 0 }
|
||||||
|
@ -48,6 +48,6 @@ func asmcgocall_no_g(fn, arg unsafe.Pointer)
|
|||||||
func spillArgs()
|
func spillArgs()
|
||||||
func unspillArgs()
|
func unspillArgs()
|
||||||
|
|
||||||
// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented.
|
// getfp returns the frame pointer register of its caller or 0 if not implemented.
|
||||||
// TODO: Make this a compiler intrinsic
|
// TODO: Make this a compiler intrinsic
|
||||||
func getcallerfp() uintptr
|
func getfp() uintptr
|
||||||
|
@ -24,5 +24,6 @@ func read_tls_fallback()
|
|||||||
//go:noescape
|
//go:noescape
|
||||||
func asmcgocall_no_g(fn, arg unsafe.Pointer)
|
func asmcgocall_no_g(fn, arg unsafe.Pointer)
|
||||||
|
|
||||||
// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented.
|
// getfp returns the frame pointer register of its caller or 0 if not implemented.
|
||||||
func getcallerfp() uintptr { return 0 }
|
// TODO: Make this a compiler intrinsic
|
||||||
|
func getfp() uintptr { return 0 }
|
||||||
|
@ -22,6 +22,6 @@ func emptyfunc()
|
|||||||
func spillArgs()
|
func spillArgs()
|
||||||
func unspillArgs()
|
func unspillArgs()
|
||||||
|
|
||||||
// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented.
|
// getfp returns the frame pointer register of its caller or 0 if not implemented.
|
||||||
// TODO: Make this a compiler intrinsic
|
// TODO: Make this a compiler intrinsic
|
||||||
func getcallerfp() uintptr
|
func getfp() uintptr
|
||||||
|
@ -10,5 +10,6 @@ package runtime
|
|||||||
func load_g()
|
func load_g()
|
||||||
func save_g()
|
func save_g()
|
||||||
|
|
||||||
// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented.
|
// getfp returns the frame pointer register of its caller or 0 if not implemented.
|
||||||
func getcallerfp() uintptr { return 0 }
|
// TODO: Make this a compiler intrinsic
|
||||||
|
func getfp() uintptr { return 0 }
|
||||||
|
@ -15,5 +15,6 @@ func save_g()
|
|||||||
//go:noescape
|
//go:noescape
|
||||||
func asmcgocall_no_g(fn, arg unsafe.Pointer)
|
func asmcgocall_no_g(fn, arg unsafe.Pointer)
|
||||||
|
|
||||||
// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented.
|
// getfp returns the frame pointer register of its caller or 0 if not implemented.
|
||||||
func getcallerfp() uintptr { return 0 }
|
// TODO: Make this a compiler intrinsic
|
||||||
|
func getfp() uintptr { return 0 }
|
||||||
|
@ -10,5 +10,6 @@ package runtime
|
|||||||
func load_g()
|
func load_g()
|
||||||
func save_g()
|
func save_g()
|
||||||
|
|
||||||
// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented.
|
// getfp returns the frame pointer register of its caller or 0 if not implemented.
|
||||||
func getcallerfp() uintptr { return 0 }
|
// TODO: Make this a compiler intrinsic
|
||||||
|
func getfp() uintptr { return 0 }
|
||||||
|
@ -16,5 +16,6 @@ func reginit()
|
|||||||
func spillArgs()
|
func spillArgs()
|
||||||
func unspillArgs()
|
func unspillArgs()
|
||||||
|
|
||||||
// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented.
|
// getfp returns the frame pointer register of its caller or 0 if not implemented.
|
||||||
func getcallerfp() uintptr { return 0 }
|
// TODO: Make this a compiler intrinsic
|
||||||
|
func getfp() uintptr { return 0 }
|
||||||
|
@ -15,5 +15,6 @@ func save_g()
|
|||||||
func spillArgs()
|
func spillArgs()
|
||||||
func unspillArgs()
|
func unspillArgs()
|
||||||
|
|
||||||
// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented.
|
// getfp returns the frame pointer register of its caller or 0 if not implemented.
|
||||||
func getcallerfp() uintptr { return 0 }
|
// TODO: Make this a compiler intrinsic
|
||||||
|
func getfp() uintptr { return 0 }
|
||||||
|
@ -8,5 +8,6 @@ package runtime
|
|||||||
func load_g()
|
func load_g()
|
||||||
func save_g()
|
func save_g()
|
||||||
|
|
||||||
// getcallerfp returns the address of the frame pointer in the callers frame or 0 if not implemented.
|
// getfp returns the frame pointer register of its caller or 0 if not implemented.
|
||||||
func getcallerfp() uintptr { return 0 }
|
// TODO: Make this a compiler intrinsic
|
||||||
|
func getfp() uintptr { return 0 }
|
||||||
|
@ -970,7 +970,7 @@ func traceStackID(mp *m, pcBuf []uintptr, skip int) uint64 {
|
|||||||
// Fast path: Unwind using frame pointers.
|
// Fast path: Unwind using frame pointers.
|
||||||
pcBuf[0] = uintptr(skip)
|
pcBuf[0] = uintptr(skip)
|
||||||
if curgp == gp {
|
if curgp == gp {
|
||||||
nstk += fpTracebackPCs(unsafe.Pointer(getcallerfp()), pcBuf[1:])
|
nstk += fpTracebackPCs(unsafe.Pointer(getfp()), pcBuf[1:])
|
||||||
} else if curgp != nil {
|
} else if curgp != nil {
|
||||||
// We're called on the g0 stack through mcall(fn) or systemstack(fn). To
|
// 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
|
// behave like gcallers above, we start unwinding from sched.bp, which
|
||||||
|
Loading…
Reference in New Issue
Block a user