]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: don't mutate shared nodes in orderinit
authorJosh Bleecher Snyder <josharian@gmail.com>
Tue, 28 Mar 2017 14:12:57 +0000 (07:12 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 31 Mar 2017 22:38:01 +0000 (22:38 +0000)
commit8e36575ebe36aba9c42be4f965fa30ec0f2b41dc
treecee12e2e6590a92152ca0a45b5ac2035bef1c8ea
parenta8b2e4a630a5991e91095d85c604dc1fa23c1e56
cmd/compile: don't mutate shared nodes in orderinit

A few gc.Node ops may be shared across functions.
The compiler is (mostly) already careful to avoid mutating them.
However, from a concurrency perspective, replacing (say)
an empty list with an empty list still counts as a mutation.
One place this occurs is orderinit. Avoid it.

This requires fixing one spot where shared nodes were mutated.
It doesn't result in any functional or performance changes.

Passes toolstash-check.

Updates #15756

Change-Id: I63c93b31baeeac62d7574804acb6b7f2bc9d14a9
Reviewed-on: https://go-review.googlesource.com/39196
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/order.go
src/cmd/compile/internal/gc/subr.go
src/cmd/compile/internal/gc/syntax.go
src/cmd/compile/internal/gc/walk.go