Files

30 lines
617 B
Go
Raw Permalink Normal View History

2025-02-14 12:42:07 +07:00
// errorcheck -0 -+ -p=internal/runtime/sys -m
2024-09-21 23:49:08 +10:00
2025-02-14 12:42:07 +07:00
// Copyright 2024 The Go Authors. All rights reserved.
2024-09-21 23:49:08 +10:00
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
2025-02-14 12:42:07 +07:00
package sys
2024-09-21 23:49:08 +10:00
2025-02-14 12:42:07 +07:00
// A function that calls sys.GetCallerPC or sys.GetCallerSP
2024-09-21 23:49:08 +10:00
// cannot be inlined, no matter how small it is.
2025-02-14 12:42:07 +07:00
func GetCallerPC() uintptr
func GetCallerSP() uintptr
2024-09-21 23:49:08 +10:00
func pc() uintptr {
2025-02-14 12:42:07 +07:00
return GetCallerPC() + 1
2024-09-21 23:49:08 +10:00
}
func cpc() uintptr { // ERROR "can inline cpc"
return pc() + 2
}
func sp() uintptr {
2025-02-14 12:42:07 +07:00
return GetCallerSP() + 3
2024-09-21 23:49:08 +10:00
}
func csp() uintptr { // ERROR "can inline csp"
return sp() + 4
}