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
|
|
@ -39,7 +39,7 @@ func (s *InitSchedule) append(n *Node) {
|
|||
// staticInit adds an initialization statement n to the schedule.
|
||||
func (s *InitSchedule) staticInit(n *Node) {
|
||||
if !s.tryStaticInit(n) {
|
||||
if Debug['%'] != 0 {
|
||||
if Debug.P != 0 {
|
||||
Dump("nonstatic", n)
|
||||
}
|
||||
s.append(n)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue