aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2016-10-24 10:25:05 -0400
committerDavid Chase <drchase@google.com>2017-09-22 18:37:03 +0000
commit6cac100eefbe07ffd2c9bf64c9a782bf93d79081 (patch)
tree67dab0b4c4ab04efe4078d29c0b44f1f9eef4b80 /src/runtime
parent332719f7cee2abafb3963009d44ad7cc93474707 (diff)
downloadgo-6cac100eefbe07ffd2c9bf64c9a782bf93d79081.tar.xz
cmd/compile: add intrinsic for reading caller's pc
First step towards removing the mandatory argument for getcallerpc, which solves certain problems for the runtime. This might also slightly improve performance. Intrinsic enabled on 386, amd64, amd64p32, runtime asm implementation removed on those architectures. Now-superfluous argument remains in getcallerpc signature (for a future CL; non-386/amd64 asm funcs ignore it). Added getcallerpc to the "not a real function" test in dcl.go, that story is a little odd with respect to unexported functions but that is not this CL. Fixes #17327. Change-Id: I5df1ad91f27ee9ac1f0dd88fa48f1329d6306c3e Reviewed-on: https://go-review.googlesource.com/31851 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/asm_386.s6
-rw-r--r--src/runtime/asm_amd64.s6
-rw-r--r--src/runtime/asm_amd64p32.s6
-rw-r--r--src/runtime/stubs.go4
4 files changed, 3 insertions, 19 deletions
diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s
index 76758686e5..f3b927f0b7 100644
--- a/src/runtime/asm_386.s
+++ b/src/runtime/asm_386.s
@@ -849,12 +849,6 @@ TEXT runtime·stackcheck(SB), NOSPLIT, $0-0
INT $3
RET
-TEXT runtime·getcallerpc(SB),NOSPLIT,$4-8
- MOVL argp+0(FP),AX // addr of first arg
- MOVL -4(AX),AX // get calling pc
- MOVL AX, ret+4(FP)
- RET
-
// func cputicks() int64
TEXT runtime·cputicks(SB),NOSPLIT,$0-8
CMPB runtime·support_sse2(SB), $1
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s
index f992276794..d87f454e03 100644
--- a/src/runtime/asm_amd64.s
+++ b/src/runtime/asm_amd64.s
@@ -833,12 +833,6 @@ TEXT runtime·stackcheck(SB), NOSPLIT, $0-0
INT $3
RET
-TEXT runtime·getcallerpc(SB),NOSPLIT,$8-16
- MOVQ argp+0(FP),AX // addr of first arg
- MOVQ -8(AX),AX // get calling pc
- MOVQ AX, ret+8(FP)
- RET
-
// func cputicks() int64
TEXT runtime·cputicks(SB),NOSPLIT,$0-0
CMPB runtime·lfenceBeforeRdtsc(SB), $1
diff --git a/src/runtime/asm_amd64p32.s b/src/runtime/asm_amd64p32.s
index 6777ad03b9..c80a563bda 100644
--- a/src/runtime/asm_amd64p32.s
+++ b/src/runtime/asm_amd64p32.s
@@ -559,12 +559,6 @@ TEXT runtime·stackcheck(SB), NOSPLIT, $0-0
MOVL 0, AX
RET
-TEXT runtime·getcallerpc(SB),NOSPLIT,$8-12
- MOVL argp+0(FP),AX // addr of first arg
- MOVL -8(AX),AX // get calling pc
- MOVL AX, ret+8(FP)
- RET
-
// int64 runtime·cputicks(void)
TEXT runtime·cputicks(SB),NOSPLIT,$0-0
RDTSC
diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go
index 331fc0d518..65f1695ec4 100644
--- a/src/runtime/stubs.go
+++ b/src/runtime/stubs.go
@@ -200,7 +200,9 @@ func publicationBarrier()
// getcallersp returns the stack pointer (SP) of its caller's caller.
// For both, the argp must be a pointer to the caller's first function argument.
// The implementation may or may not use argp, depending on
-// the architecture.
+// the architecture. The implementation may be a compiler
+// intrinsic; there is not necessarily code implementing this
+// on every platform.
//
// For example:
//