]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove -wrapglobalmapinit flag
authorThan McIntosh <thanm@google.com>
Thu, 9 Mar 2023 18:20:01 +0000 (13:20 -0500)
committerThan McIntosh <thanm@google.com>
Thu, 9 Mar 2023 20:09:52 +0000 (20:09 +0000)
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>

src/cmd/compile/internal/base/debug.go
src/cmd/compile/internal/base/flag.go
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/ssagen/pgen.go
src/cmd/compile/internal/staticinit/sched.go

index 288c2d82ef79d09ca18104cf0ae46c8762c248ad..ec20b181349f7d1c0698484164120071be54d0cf 100644 (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
 }
index 4baff74917e87ef72bfaeb5748b2d83bfdba8525..ccd63f6368fcfd6aabedde41dd08aaa23e219b2e 100644 (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
index 686506758025fbd517990223add89baf3ff22f8a..6a9ec90aa891f98c87dcbd5e71ede6295fc04365 100644 (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()
        }
 
index 3320f746bbcc4b0543c9eea6645c5bb9d44a2f4e..a0378c755a4bf79674faf97e57d619ba88379196 100644 (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)
        }
 
index 9ad016b930764b05700e4dfecd4e335723f59020..c9b023946536992d5c1ed79e740626d4c4590f9f 100644 (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{}