mirror of
https://github.com/golang/go.git
synced 2024-09-22 02:48:50 +00:00
cmd/compile: add -d=inlstaticinit debug flag
This CL adds -d=inlstaticinit to control whether static initialization of inlined function calls (added in CL 450136) is allowed. We've needed to fix it once already (CL 451555) and Google-internal testing is hitting additional failure cases, so putting this optimization behind a feature flag seems appropriate regardless. Also, while we diagnose and fix the remaining cases, this CL also disables the optimization to avoid miscompilations. Updates #56894. Change-Id: If52a358ad1e9d6aad1c74fac5a81ff9cfa5a3793 Reviewed-on: https://go-review.googlesource.com/c/go/+/452676 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
1c9eba19d5
commit
152119990f
@ -31,6 +31,7 @@ type DebugFlags struct {
|
||||
GCProg int `help:"print dump of GC programs"`
|
||||
Gossahash string `help:"hash value for use in debugging the compiler"`
|
||||
InlFuncsWithClosures int `help:"allow functions with closures to be inlined" concurrent:"ok"`
|
||||
InlStaticInit int `help:"allow static initialization of inlined calls"`
|
||||
InterfaceCycles int `help:"allow anonymous interface cycles"`
|
||||
Libfuzzer int `help:"enable coverage instrumentation for libfuzzer"`
|
||||
LocationLists int `help:"print information about DWARF location list creation"`
|
||||
|
@ -167,6 +167,7 @@ func ParseFlags() {
|
||||
|
||||
Debug.ConcurrentOk = true
|
||||
Debug.InlFuncsWithClosures = 1
|
||||
Debug.InlStaticInit = 0
|
||||
if buildcfg.Experiment.Unified {
|
||||
Debug.Unified = 1
|
||||
}
|
||||
|
@ -451,6 +451,10 @@ func (s *Schedule) addvalue(p *Plan, xoffset int64, n ir.Node) {
|
||||
}
|
||||
|
||||
func (s *Schedule) staticAssignInlinedCall(l *ir.Name, loff int64, call *ir.InlinedCallExpr, typ *types.Type) bool {
|
||||
if base.Debug.InlStaticInit == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
// Handle the special case of an inlined call of
|
||||
// a function body with a single return statement,
|
||||
// which turns into a single assignment plus a goto.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// compiledir
|
||||
// compiledir -d=inlstaticinit=1
|
||||
|
||||
// Copyright 2022 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
|
@ -1,4 +1,4 @@
|
||||
// errorcheckwithauto -0 -m -d=inlfuncswithclosures=1
|
||||
// errorcheckwithauto -0 -m -d=inlfuncswithclosures=1 -d=inlstaticinit=1
|
||||
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
|
@ -1,4 +1,4 @@
|
||||
// run
|
||||
// run -gcflags=-d=inlstaticinit=1
|
||||
//go:build !gcflags_noopt
|
||||
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
|
Loading…
Reference in New Issue
Block a user