Revert "cmd/compile: cleanup nodpc and nodfp"

This reverts commit dcac984b97.

Reason for revert: broke LR architectures (arm64, ppc64, s390x)

Change-Id: I531d311c9053e81503c8c78d6cf044b318fc828b
Reviewed-on: https://go-review.googlesource.com/99695
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Matthew Dempsky 2018-03-08 21:00:36 +00:00
parent 010579c237
commit b55eedd173
9 changed files with 270 additions and 261 deletions

View file

@ -64,11 +64,21 @@ func instrument(fn *Node) {
}
if flag_race {
lno := lineno
// nodpc is the PC of the caller as extracted by
// getcallerpc. We use -widthptr(FP) for x86.
// BUG: this will not work on arm.
nodpc := *nodfp
nodpc.Type = types.Types[TUINTPTR]
nodpc.Xoffset = int64(-Widthptr)
savedLineno := lineno
lineno = src.NoXPos
fn.Func.Enter.Prepend(mkcall("racefuncenter", nil, nil, callerPC))
fn.Func.Exit.Append(mkcall("racefuncexit", nil, nil))
lineno = lno
nd := mkcall("racefuncenter", nil, nil, &nodpc)
fn.Func.Enter.Prepend(nd)
nd = mkcall("racefuncexit", nil, nil)
fn.Func.Exit.Append(nd)
fn.Func.Dcl = append(fn.Func.Dcl, &nodpc)
lineno = savedLineno
}
if Debug['W'] != 0 {