]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.regabi] cmd/compile: adjustments to Copy and DeepCopy
authorRuss Cox <rsc@golang.org>
Thu, 3 Dec 2020 03:42:24 +0000 (22:42 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 4 Dec 2020 16:52:46 +0000 (16:52 +0000)
commit989a3f5041d2055e165e363d3fb2d27e75e2fa38
tree555ec84a83e551d7208d6b1e8b0b6272101eabb4
parent99ecfcae31e52a297195b2c1d1d9326e16d6c775
[dev.regabi] cmd/compile: adjustments to Copy and DeepCopy

DeepCopy is not called DeepSepCopy, so it should use Copy, not SepCopy.

Also, the old gc.treecopy, which became ir.DeepCopy, only copied
the Left, Right, and List fields - not Init, Rlist, Body - and I didn't
notice when I moved it over. A general utility function should of
course copy the whole node, so do that.

Finally, the semantics of Copy should not depend on whether a
particular child node is held directly in a field or in a slice,
so make Copy duplicate the slice backing arrays as well.
(Logically, those backing arrays are part of the node storage.)

Passes buildall w/ toolstash -cmp.

Change-Id: I18fbe3f2b40078f566ed6370684d5585052b36a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/275309
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/ir/copy.go