Skip to content

Commit 269bdcd

Browse files
committed
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 <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 2401714 commit 269bdcd

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

src/cmd/compile/internal/base/debug.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ type DebugFlags struct {
5050
WB int `help:"print information about write barriers"`
5151
ABIWrap int `help:"print information about ABI wrapper generation"`
5252
MayMoreStack string `help:"call named function before all stack growth checks" concurrent:"ok"`
53-
PGOInlineCDFThreshold string `help:"cummulative threshold percentage for determining call sites as hot candidates for inlining" concurrent:"ok"`
53+
PGOInlineCDFThreshold string `help:"cumulative threshold percentage for determining call sites as hot candidates for inlining" concurrent:"ok"`
5454
PGOInlineBudget int `help:"inline budget for hot functions" concurrent:"ok"`
5555
PGOInline int `help:"debug profile-guided inlining"`
56-
WrapGlobalMapDbg int "help:\"debug trace output for global map init wrapping\""
57-
WrapGlobalMapStress int "help:\"run global map init wrap in stress mode (no size cutoff)\""
56+
WrapGlobalMapDbg int `help:"debug trace output for global map init wrapping"`
57+
WrapGlobalMapCtl int `help:"global map init wrap control (0 => default, 1 => off, 2 => stress mode, no size cutoff)"`
5858

5959
ConcurrentOk bool // true if only concurrentOk flags seen
6060
}

src/cmd/compile/internal/base/flag.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ type CmdFlags struct {
123123
TraceProfile string "help:\"write an execution trace to `file`\""
124124
TrimPath string "help:\"remove `prefix` from recorded source file paths\""
125125
WB bool "help:\"enable write barrier\"" // TODO: remove
126-
WrapGlobalMapInit bool "help:\"wrap global map large inits in their own functions (to permit deadcode)\""
127126
PgoProfile string "help:\"read profile from `file`\""
128127

129128
// Configuration derived from flags; not a flag itself.
@@ -164,7 +163,6 @@ func ParseFlags() {
164163
Flag.LinkShared = &Ctxt.Flag_linkshared
165164
Flag.Shared = &Ctxt.Flag_shared
166165
Flag.WB = true
167-
Flag.WrapGlobalMapInit = true
168166

169167
Debug.ConcurrentOk = true
170168
Debug.InlFuncsWithClosures = 1

src/cmd/compile/internal/gc/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ func Main(archInit func(*ssagen.ArchInfo)) {
374374
}
375375

376376
// Add keep relocations for global maps.
377-
if base.Flag.WrapGlobalMapInit {
377+
if base.Debug.WrapGlobalMapCtl != 1 {
378378
staticinit.AddKeepRelocations()
379379
}
380380

src/cmd/compile/internal/ssagen/pgen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ func Compile(fn *ir.Func, worker int) {
214214
// If we're compiling the package init function, search for any
215215
// relocations that target global map init outline functions and
216216
// turn them into weak relocs.
217-
if base.Flag.WrapGlobalMapInit && fn.IsPackageInit() {
217+
if fn.IsPackageInit() && base.Debug.WrapGlobalMapCtl != 1 {
218218
weakenGlobalMapInitRelocs(fn)
219219
}
220220

src/cmd/compile/internal/staticinit/sched.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ func tryWrapGlobalMapInit(n ir.Node) (mapvar *ir.Name, genfn *ir.Func, call ir.N
945945
}
946946

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

0 commit comments

Comments
 (0)