aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types/sym.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2020-11-27 23:52:37 -0500
committerRuss Cox <rsc@golang.org>2020-11-30 18:33:47 +0000
commit65f4ec2faec54b7a3e70f2404132df9d83df11e0 (patch)
treeed1812824b1d385c28bc04b565f961c30fbcd9bc /src/cmd/compile/internal/types/sym.go
parent88e33f6ecb9ea44a464bd3863f8037bc081b2a6e (diff)
downloadgo-65f4ec2faec54b7a3e70f2404132df9d83df11e0.tar.gz
go-65f4ec2faec54b7a3e70f2404132df9d83df11e0.zip
[dev.regabi] cmd/compile: cleanup label handling
- The use of a label's Name.Defn to point at the named for/select/switch means that any rewrite of the for/select/switch must overwrite the original or else the pointer will dangle. Remove that pointer by adding the label name directly to the for/select/switch representation instead. - The only uses of a label's Sym.Label were ephemeral values during markbreak and escape analysis. Use a map for each. Although in general we are not going to replace all computed fields with maps (too slow), the one in markbreak is only for labeled for/select/switch, and the one in escape is for all labels, but even so, labels are fairly rare. In theory this cleanup should make it easy to allow labeled for/select/switch in inlined bodies, but this CL does not attempt that. It's only concerned with cleanup to enable a new Node representation. Passes buildall w/ toolstash -cmp. Change-Id: I7e36ee98d2ea40dbae94e6722d585f007b7afcfa Reviewed-on: https://go-review.googlesource.com/c/go/+/274086 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types/sym.go')
-rw-r--r--src/cmd/compile/internal/types/sym.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/types/sym.go b/src/cmd/compile/internal/types/sym.go
index 046104d0dc..7272f1f786 100644
--- a/src/cmd/compile/internal/types/sym.go
+++ b/src/cmd/compile/internal/types/sym.go
@@ -33,13 +33,12 @@ type Sym struct {
Name string // object name
// saved and restored by dcopy
- Def IRNode // definition: ONAME OTYPE OPACK or OLITERAL
+ Def IRNode // definition: ONAME OTYPE OPACK or OLITERAL
Block int32 // blocknumber to catch redeclaration
Lastlineno src.XPos // last declaration for diagnostic
flags bitset8
- Label IRNode // corresponding label (ephemeral)
- Origpkg *Pkg // original package for . import
+ Origpkg *Pkg // original package for . import
}
const (