]> Cypherpunks repositories - gostls13.git/commit
[dev.regabi] cmd/compile: use ir.Copy instead of direct use of RawCopy
authorRuss Cox <rsc@golang.org>
Tue, 1 Dec 2020 02:18:48 +0000 (21:18 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 1 Dec 2020 12:34:46 +0000 (12:34 +0000)
commit4da41fb3f8aa2e81b6ed371b617643042ba5e170
tree360a8ca3fad10eb49d355aa306313cd345bbc5cd
parentdadfc80bc173ce4475bc76231de5259d797b0522
[dev.regabi] cmd/compile: use ir.Copy instead of direct use of RawCopy

The ONIL export bug happened because the logic about
maintaining an “implicit” orig pointer in the comments
around ir.Orig only applies to Copy and SepCopy, not to
direct use of RawCopy. I'd forgotten those could exist.

The sole direct use of RawCopy was for the OLITERAL/ONIL case.
The ONIL is now provably indistinguishable from Copy, since
NilExpr does not have an explicit Orig field, so for NilExpr
RawCopy and Copy are the same.
The OLITERAL is not, but we can reconstruct the effect
with Copy+SetOrig to be explicit that we need the orig link.

The next CL will unexport RawCopy.

Also fix a typo in MapType doc comment.

Passes buildall w/ toolstash -cmp.

Change-Id: I876a85ff188e6d1cd4c0dfa385be32482e0de0d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/274292
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
src/cmd/compile/internal/gc/const.go
src/cmd/compile/internal/ir/type.go