mirror of
https://github.com/golang/go
synced 2024-10-06 08:00:07 +00:00
cmd/compile: disable inlining functions with closures for now
Added a flag '-d=inlfuncswithclosures=1' to allow inlining functions with closures, and change the default to off for now, until #44370 is fixed. Updates #44370. Change-Id: Ic17723aa5c091d91f5f5004d8b63ec7125257acf Reviewed-on: https://go-review.googlesource.com/c/go/+/296049 Run-TryBot: Dan Scales <danscales@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Dan Scales <danscales@google.com>
This commit is contained in:
parent
6c3f8a2f47
commit
8027343b63
|
@ -29,28 +29,29 @@ var Debug = DebugFlags{
|
||||||
// The -d option takes a comma-separated list of settings.
|
// The -d option takes a comma-separated list of settings.
|
||||||
// Each setting is name=value; for ints, name is short for name=1.
|
// Each setting is name=value; for ints, name is short for name=1.
|
||||||
type DebugFlags struct {
|
type DebugFlags struct {
|
||||||
Append int `help:"print information about append compilation"`
|
Append int `help:"print information about append compilation"`
|
||||||
Checkptr int `help:"instrument unsafe pointer conversions"`
|
Checkptr int `help:"instrument unsafe pointer conversions"`
|
||||||
Closure int `help:"print information about closure compilation"`
|
Closure int `help:"print information about closure compilation"`
|
||||||
DclStack int `help:"run internal dclstack check"`
|
DclStack int `help:"run internal dclstack check"`
|
||||||
Defer int `help:"print information about defer compilation"`
|
Defer int `help:"print information about defer compilation"`
|
||||||
DisableNil int `help:"disable nil checks"`
|
DisableNil int `help:"disable nil checks"`
|
||||||
DumpPtrs int `help:"show Node pointers values in dump output"`
|
DumpPtrs int `help:"show Node pointers values in dump output"`
|
||||||
DwarfInl int `help:"print information about DWARF inlined function creation"`
|
DwarfInl int `help:"print information about DWARF inlined function creation"`
|
||||||
Export int `help:"print export data"`
|
Export int `help:"print export data"`
|
||||||
Fieldtrack *int `help:"enable field tracking"`
|
Fieldtrack *int `help:"enable field tracking"`
|
||||||
GCProg int `help:"print dump of GC programs"`
|
GCProg int `help:"print dump of GC programs"`
|
||||||
Libfuzzer int `help:"enable coverage instrumentation for libfuzzer"`
|
InlFuncsWithClosures int `help:"allow functions with closures to be inlined"`
|
||||||
LocationLists int `help:"print information about DWARF location list creation"`
|
Libfuzzer int `help:"enable coverage instrumentation for libfuzzer"`
|
||||||
Nil int `help:"print information about nil checks"`
|
LocationLists int `help:"print information about DWARF location list creation"`
|
||||||
PCTab string `help:"print named pc-value table"`
|
Nil int `help:"print information about nil checks"`
|
||||||
Panic int `help:"show all compiler panics"`
|
PCTab string `help:"print named pc-value table"`
|
||||||
Slice int `help:"print information about slice compilation"`
|
Panic int `help:"show all compiler panics"`
|
||||||
SoftFloat int `help:"force compiler to emit soft-float code"`
|
Slice int `help:"print information about slice compilation"`
|
||||||
TypeAssert int `help:"print information about type assertion inlining"`
|
SoftFloat int `help:"force compiler to emit soft-float code"`
|
||||||
TypecheckInl int `help:"eager typechecking of inline function bodies"`
|
TypeAssert int `help:"print information about type assertion inlining"`
|
||||||
WB int `help:"print information about write barriers"`
|
TypecheckInl int `help:"eager typechecking of inline function bodies"`
|
||||||
ABIWrap int `help:"print information about ABI wrapper generation"`
|
WB int `help:"print information about write barriers"`
|
||||||
|
ABIWrap int `help:"print information about ABI wrapper generation"`
|
||||||
|
|
||||||
any bool // set when any of the values have been set
|
any bool // set when any of the values have been set
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,15 +354,15 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
|
||||||
return true
|
return true
|
||||||
|
|
||||||
case ir.OCLOSURE:
|
case ir.OCLOSURE:
|
||||||
// TODO(danscales,mdempsky): Get working with -G.
|
if base.Debug.InlFuncsWithClosures == 0 {
|
||||||
// Probably after #43818 is fixed.
|
// TODO(danscales): change default of InlFuncsWithClosures
|
||||||
if base.Flag.G > 0 {
|
// to 1 when #44370 is fixed
|
||||||
v.reason = "inlining closures not yet working with -G"
|
v.reason = "not inlining functions with closures"
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(danscales) - fix some bugs when budget is lowered below 15
|
// TODO(danscales): Maybe make budget proportional to number of closure
|
||||||
// Maybe make budget proportional to number of closure variables, e.g.:
|
// variables, e.g.:
|
||||||
//v.budget -= int32(len(n.(*ir.ClosureExpr).Func.ClosureVars) * 3)
|
//v.budget -= int32(len(n.(*ir.ClosureExpr).Func.ClosureVars) * 3)
|
||||||
v.budget -= 15
|
v.budget -= 15
|
||||||
// Scan body of closure (which DoChildren doesn't automatically
|
// Scan body of closure (which DoChildren doesn't automatically
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// errorcheckandrundir -0 -m
|
// errorcheckandrundir -0 -m -d=inlfuncswithclosures=1
|
||||||
|
|
||||||
// Copyright 2017 The Go Authors. All rights reserved.
|
// Copyright 2017 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// errorcheck -0 -m
|
// errorcheck -0 -m -d=inlfuncswithclosures=1
|
||||||
|
|
||||||
// Copyright 2015 The Go Authors. All rights reserved.
|
// Copyright 2015 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
|
|
Loading…
Reference in a new issue