aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/builtin
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2021-03-01 19:23:42 -0500
committerCherry Zhang <cherryyz@google.com>2021-03-05 22:42:10 +0000
commita22bd3dc73bfcc9bf37cbd651933c54c82799c2a (patch)
tree2267b7432854ef635c3a5855136dce03a9d3d18a /src/cmd/compile/internal/typecheck/builtin
parenta829114b21b5a4238dea13dc97b030d650935ed8 (diff)
downloadgo-a22bd3dc73bfcc9bf37cbd651933c54c82799c2a.tar.gz
go-a22bd3dc73bfcc9bf37cbd651933c54c82799c2a.zip
cmd/compile: use getcallerpc for racefuncentry
Currently, when instrumenting for the race detector, the compiler inserts racefuncentry/racefuncentryfp at the entry of instrumented functions. racefuncentry takes the caller's PC. On AMD64, we synthesize a node which points to -8(FP) which is where the return address is stored. Later this node turns to a special Arg in SSA that is not really an argument. This causes problems in the new ABI work so that special node has to be special-cased. This CL changes the special node to a call to getcallerpc, which lowers to an intrinsic in SSA. This also unifies AMD64 code path and LR machine code path, as getcallerpc works on all platforms. Change-Id: I1377e140b91e0473cfcadfda221f26870c1b124d Reviewed-on: https://go-review.googlesource.com/c/go/+/297929 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/builtin')
-rw-r--r--src/cmd/compile/internal/typecheck/builtin/runtime.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/typecheck/builtin/runtime.go b/src/cmd/compile/internal/typecheck/builtin/runtime.go
index d5e00afcf8..8575148b5b 100644
--- a/src/cmd/compile/internal/typecheck/builtin/runtime.go
+++ b/src/cmd/compile/internal/typecheck/builtin/runtime.go
@@ -6,6 +6,7 @@
// to update builtin.go. This is not done automatically
// to avoid depending on having a working compiler binary.
+//go:build ignore
// +build ignore
package runtime
@@ -224,9 +225,10 @@ func uint32tofloat64(uint32) float64
func complex128div(num complex128, den complex128) (quo complex128)
+func getcallerpc() uintptr
+
// race detection
func racefuncenter(uintptr)
-func racefuncenterfp()
func racefuncexit()
func raceread(uintptr)
func racewrite(uintptr)