1
0
mirror of https://github.com/golang/go synced 2024-11-23 15:30:05 -07:00

cmd/compile: remove -wrapglobalmapinit flag

Remove the compiler's "-wrapglobalmapinit" flag; it is potentially
confusing for users and isn't appropriate as a top level flag. Move
the enable/disable control to the "wrapglobalmapctl" debug flag
(values: 0 on by default, 1 disabled, 2 stress mode). No other changes
to compiler functionality.

Change-Id: I0d120eaf90ee34e29d5032889e673d42fe99e5dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/475035
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Than McIntosh 2023-03-09 13:20:01 -05:00
parent 24017148ca
commit 269bdcd568
5 changed files with 7 additions and 9 deletions

View File

@ -50,11 +50,11 @@ type DebugFlags struct {
WB int `help:"print information about write barriers"`
ABIWrap int `help:"print information about ABI wrapper generation"`
MayMoreStack string `help:"call named function before all stack growth checks" concurrent:"ok"`
PGOInlineCDFThreshold string `help:"cummulative threshold percentage for determining call sites as hot candidates for inlining" concurrent:"ok"`
PGOInlineCDFThreshold string `help:"cumulative threshold percentage for determining call sites as hot candidates for inlining" concurrent:"ok"`
PGOInlineBudget int `help:"inline budget for hot functions" concurrent:"ok"`
PGOInline int `help:"debug profile-guided inlining"`
WrapGlobalMapDbg int "help:\"debug trace output for global map init wrapping\""
WrapGlobalMapStress int "help:\"run global map init wrap in stress mode (no size cutoff)\""
WrapGlobalMapDbg int `help:"debug trace output for global map init wrapping"`
WrapGlobalMapCtl int `help:"global map init wrap control (0 => default, 1 => off, 2 => stress mode, no size cutoff)"`
ConcurrentOk bool // true if only concurrentOk flags seen
}

View File

@ -123,7 +123,6 @@ type CmdFlags struct {
TraceProfile string "help:\"write an execution trace to `file`\""
TrimPath string "help:\"remove `prefix` from recorded source file paths\""
WB bool "help:\"enable write barrier\"" // TODO: remove
WrapGlobalMapInit bool "help:\"wrap global map large inits in their own functions (to permit deadcode)\""
PgoProfile string "help:\"read profile from `file`\""
// Configuration derived from flags; not a flag itself.
@ -164,7 +163,6 @@ func ParseFlags() {
Flag.LinkShared = &Ctxt.Flag_linkshared
Flag.Shared = &Ctxt.Flag_shared
Flag.WB = true
Flag.WrapGlobalMapInit = true
Debug.ConcurrentOk = true
Debug.InlFuncsWithClosures = 1

View File

@ -374,7 +374,7 @@ func Main(archInit func(*ssagen.ArchInfo)) {
}
// Add keep relocations for global maps.
if base.Flag.WrapGlobalMapInit {
if base.Debug.WrapGlobalMapCtl != 1 {
staticinit.AddKeepRelocations()
}

View File

@ -214,7 +214,7 @@ func Compile(fn *ir.Func, worker int) {
// If we're compiling the package init function, search for any
// relocations that target global map init outline functions and
// turn them into weak relocs.
if base.Flag.WrapGlobalMapInit && fn.IsPackageInit() {
if fn.IsPackageInit() && base.Debug.WrapGlobalMapCtl != 1 {
weakenGlobalMapInitRelocs(fn)
}

View File

@ -945,7 +945,7 @@ func tryWrapGlobalMapInit(n ir.Node) (mapvar *ir.Name, genfn *ir.Func, call ir.N
}
// Reject smaller candidates if not in stress mode.
if rsiz < wrapGlobalMapInitSizeThreshold && base.Debug.WrapGlobalMapStress == 0 {
if rsiz < wrapGlobalMapInitSizeThreshold && base.Debug.WrapGlobalMapCtl != 2 {
if base.Debug.WrapGlobalMapDbg > 1 {
fmt.Fprintf(os.Stderr, "=-= skipping %v size too small at %d\n",
nm, rsiz)
@ -1046,7 +1046,7 @@ func AddKeepRelocations() {
// functions (if legal/profitable). Return value is an updated list
// and a list of any newly generated "map init" functions.
func OutlineMapInits(stmts []ir.Node) ([]ir.Node, []*ir.Func) {
if !base.Flag.WrapGlobalMapInit {
if base.Debug.WrapGlobalMapCtl == 1 {
return stmts, nil
}
newfuncs := []*ir.Func{}