]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: copy volatile values before emitting write barrier call
authorCherry Zhang <cherryyz@google.com>
Thu, 21 Mar 2019 17:40:28 +0000 (13:40 -0400)
committerCherry Zhang <cherryyz@google.com>
Thu, 21 Mar 2019 21:05:13 +0000 (21:05 +0000)
commitf23c601bf9f66ef4a0d9d2dcd003b95e78fb28f8
treed2a88b1639e1f1cb29555648fd9edcc8a1437b88
parent804a4024ec9b149410df6aeaa8b443e65e70ff28
cmd/compile: copy volatile values before emitting write barrier call

It is possible that a "volatile" value (one that can be clobbered
by preparing args of a call) to be used in multiple write barrier
calls. We used to copy the volatile value right before each call.
But this doesn't work if the value is used the second time, after
the first call where it is already clobbered. Copy it before
emitting any call.

Fixes #30977.

Change-Id: Iedcc91ad848d5ded547bf37a8359c125d32e994c
Reviewed-on: https://go-review.googlesource.com/c/go/+/168677
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/writebarrier.go
test/fixedbugs/issue30977.go [new file with mode: 0644]