]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: use getcallerpc for racefuncentry
authorCherry Zhang <cherryyz@google.com>
Tue, 2 Mar 2021 00:23:42 +0000 (19:23 -0500)
committerCherry Zhang <cherryyz@google.com>
Fri, 5 Mar 2021 22:42:10 +0000 (22:42 +0000)
commita22bd3dc73bfcc9bf37cbd651933c54c82799c2a
tree2267b7432854ef635c3a5855136dce03a9d3d18a
parenta829114b21b5a4238dea13dc97b030d650935ed8
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>
src/cmd/compile/internal/base/base.go
src/cmd/compile/internal/ssa/rewrite.go
src/cmd/compile/internal/ssagen/ssa.go
src/cmd/compile/internal/typecheck/builtin.go
src/cmd/compile/internal/typecheck/builtin/runtime.go
src/cmd/compile/internal/walk/race.go