]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: stop race instrumentation from clobbering frame pointer
authorKeith Randall <khr@golang.org>
Tue, 11 Aug 2020 20:19:57 +0000 (13:19 -0700)
committerKeith Randall <khr@golang.org>
Sun, 16 Aug 2020 17:05:44 +0000 (17:05 +0000)
commit8c39bbf9c93f773ab351bbddb4c3dd93e4fddc76
treec8e90d1f1a325d92fb6ca65ef2bddf686b9572d4
parent01f99b4e9540f34b44e13b25f6dd04b82ac952d9
cmd/compile: stop race instrumentation from clobbering frame pointer

There is an optimization rule that removes calls to racefuncenter and
racefuncexit, if there are no other race calls in the function. The
rule removes the call to racefuncenter, but it does *not* remove the
store of its argument to the outargs section of the frame. If the
outargs section is now size 0 (because the calls to racefuncenter/exit
were the only calls), then that argument store clobbers the frame
pointer instead.

The fix is to remove the argument store when removing the call to
racefuncenter.  (Racefuncexit doesn't have an argument.)

Change-Id: I183ec4d92bbb4920200e1be27b7b8f66b89a2a0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/248262
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/gc/racewalk.go
src/cmd/compile/internal/ssa/rewrite.go