]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: make gc debug flags collector a struct
authorAlberto Donizetti <alb.donizetti@gmail.com>
Mon, 19 Oct 2020 09:31:10 +0000 (11:31 +0200)
committerAlberto Donizetti <alb.donizetti@gmail.com>
Thu, 22 Oct 2020 09:33:46 +0000 (09:33 +0000)
commit3bac5faa4af2f5c454b2cebaa8be5cde9b8e2add
tree98a8f42a1ba64fba2c406522629de2bb51b5078e
parent4c7a18d74ae4d574313c01e95de66be06e3a3e82
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>
17 files changed:
src/cmd/compile/internal/gc/alg.go
src/cmd/compile/internal/gc/closure.go
src/cmd/compile/internal/gc/esc.go
src/cmd/compile/internal/gc/escape.go
src/cmd/compile/internal/gc/export.go
src/cmd/compile/internal/gc/go.go
src/cmd/compile/internal/gc/gsubr.go
src/cmd/compile/internal/gc/iimport.go
src/cmd/compile/internal/gc/inl.go
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/order.go
src/cmd/compile/internal/gc/range.go
src/cmd/compile/internal/gc/sinit.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/gc/subr.go
src/cmd/compile/internal/gc/syntax.go
src/cmd/compile/internal/gc/walk.go