mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: simplify getargp
Change-Id: I9ed62e8a6d8b9204c18748efd7845adabf3460b9 Reviewed-on: https://go-review.googlesource.com/28775 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
70fd814f53
commit
07bcc16547
1 changed files with 1 additions and 7 deletions
|
|
@ -504,15 +504,9 @@ func gopanic(e interface{}) {
|
||||||
// getargp returns the location where the caller
|
// getargp returns the location where the caller
|
||||||
// writes outgoing function call arguments.
|
// writes outgoing function call arguments.
|
||||||
//go:nosplit
|
//go:nosplit
|
||||||
|
//go:noinline
|
||||||
func getargp(x int) uintptr {
|
func getargp(x int) uintptr {
|
||||||
// x is an argument mainly so that we can return its address.
|
// x is an argument mainly so that we can return its address.
|
||||||
// However, we need to make the function complex enough
|
|
||||||
// that it won't be inlined. We always pass x = 0, so this code
|
|
||||||
// does nothing other than keep the compiler from thinking
|
|
||||||
// the function is simple enough to inline.
|
|
||||||
if x > 0 {
|
|
||||||
return getcallersp(unsafe.Pointer(&x)) * 0
|
|
||||||
}
|
|
||||||
return uintptr(noescape(unsafe.Pointer(&x)))
|
return uintptr(noescape(unsafe.Pointer(&x)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue