mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: make gc debug flags collector a struct
gc debug flags are currently stored in a 256-long array, that is then addressed using the ASCII numeric value of the flag itself (a quirk inherited from the old C compiler). It is also a little wasteful, since we only define 16 flags, and the other 240 array elements are always empty. This change makes Debug a struct, which also provides static checking that we're not referencing flags that does not exist. Change-Id: I2f0dfef2529325514b3398cf78635543cdf48fe0 Reviewed-on: https://go-review.googlesource.com/c/go/+/263539 Trust: Alberto Donizetti <alb.donizetti@gmail.com> Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
4c7a18d74a
commit
3bac5faa4a
17 changed files with 149 additions and 134 deletions
|
|
@ -247,7 +247,7 @@ func (n *Node) Val() Val {
|
|||
// SetVal sets the Val for the node, which must not have been used with SetOpt.
|
||||
func (n *Node) SetVal(v Val) {
|
||||
if n.HasOpt() {
|
||||
Debug['h'] = 1
|
||||
Debug.h = 1
|
||||
Dump("have Opt", n)
|
||||
Fatalf("have Opt")
|
||||
}
|
||||
|
|
@ -270,7 +270,7 @@ func (n *Node) SetOpt(x interface{}) {
|
|||
return
|
||||
}
|
||||
if n.HasVal() {
|
||||
Debug['h'] = 1
|
||||
Debug.h = 1
|
||||
Dump("have Val", n)
|
||||
Fatalf("have Val")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue