1
0
mirror of https://github.com/golang/go synced 2024-11-14 22:40:40 -07:00
go/test/internal/runtime/sys/inlinegcpc.go
Michael Pratt 4f881115d4 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>
2024-09-17 17:01:20 +00:00

30 lines
617 B
Go

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