mirror of
https://github.com/golang/go
synced 2024-11-26 05:37:57 -07:00
[dev.regabi] cmd/compile: clean up debug flag (-d) handling [generated]
The debug table is not as haphazard as flags, but there are still a few mismatches between command-line names and variable names. This CL moves them all into a consistent home (var Debug, like var Flag). Code updated automatically using the rf command below. A followup CL will make a few manual cleanups, leaving this CL completely automated and easier to regenerate during merge conflicts. [git-generate] cd src/cmd/compile/internal/gc rf ' add main.go var Debug struct{} mv Debug_append Debug.Append mv Debug_checkptr Debug.Checkptr mv Debug_closure Debug.Closure mv Debug_compilelater Debug.CompileLater mv disable_checknil Debug.DisableNil mv debug_dclstack Debug.DclStack mv Debug_gcprog Debug.GCProg mv Debug_libfuzzer Debug.Libfuzzer mv Debug_checknil Debug.Nil mv Debug_panic Debug.Panic mv Debug_slice Debug.Slice mv Debug_typeassert Debug.TypeAssert mv Debug_wb Debug.WB mv Debug_export Debug.Export mv Debug_pctab Debug.PCTab mv Debug_locationlist Debug.LocationLists mv Debug_typecheckinl Debug.TypecheckInl mv Debug_gendwarfinl Debug.DwarfInl mv Debug_softfloat Debug.SoftFloat mv Debug_defer Debug.Defer mv Debug_dumpptrs Debug.DumpPtrs mv flag.go:/parse.-d/-1,/unknown.debug/+2 parseDebug mv debugtab Debug parseDebug \ debugHelpHeader debugHelpFooter \ debug.go # Remove //go:generate line copied from main.go rm debug.go:/go:generate/-+ ' Change-Id: I625761ca5659be4052f7161a83baa00df75cca91 Reviewed-on: https://go-review.googlesource.com/c/go/+/272246 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
756661c82a
commit
3c240f5d17
@ -1164,7 +1164,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
|||||||
if logopt.Enabled() {
|
if logopt.Enabled() {
|
||||||
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
||||||
}
|
}
|
||||||
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
if gc.Debug.Nil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
||||||
gc.Warnl(v.Pos, "generated nil check")
|
gc.Warnl(v.Pos, "generated nil check")
|
||||||
}
|
}
|
||||||
case ssa.OpAMD64MOVBatomicload, ssa.OpAMD64MOVLatomicload, ssa.OpAMD64MOVQatomicload:
|
case ssa.OpAMD64MOVBatomicload, ssa.OpAMD64MOVLatomicload, ssa.OpAMD64MOVQatomicload:
|
||||||
|
@ -741,7 +741,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
|||||||
if logopt.Enabled() {
|
if logopt.Enabled() {
|
||||||
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
||||||
}
|
}
|
||||||
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
if gc.Debug.Nil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
||||||
gc.Warnl(v.Pos, "generated nil check")
|
gc.Warnl(v.Pos, "generated nil check")
|
||||||
}
|
}
|
||||||
case ssa.OpARMLoweredZero:
|
case ssa.OpARMLoweredZero:
|
||||||
|
@ -1038,7 +1038,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
|||||||
if logopt.Enabled() {
|
if logopt.Enabled() {
|
||||||
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
||||||
}
|
}
|
||||||
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Line==1 in generated wrappers
|
if gc.Debug.Nil != 0 && v.Pos.Line() > 1 { // v.Line==1 in generated wrappers
|
||||||
gc.Warnl(v.Pos, "generated nil check")
|
gc.Warnl(v.Pos, "generated nil check")
|
||||||
}
|
}
|
||||||
case ssa.OpARM64Equal,
|
case ssa.OpARM64Equal,
|
||||||
|
@ -387,7 +387,7 @@ func genhash(t *types.Type) *obj.LSym {
|
|||||||
typecheckslice(fn.Nbody.Slice(), ctxStmt)
|
typecheckslice(fn.Nbody.Slice(), ctxStmt)
|
||||||
Curfn = nil
|
Curfn = nil
|
||||||
|
|
||||||
if debug_dclstack != 0 {
|
if Debug.DclStack != 0 {
|
||||||
testdclstack()
|
testdclstack()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -766,7 +766,7 @@ func geneq(t *types.Type) *obj.LSym {
|
|||||||
typecheckslice(fn.Nbody.Slice(), ctxStmt)
|
typecheckslice(fn.Nbody.Slice(), ctxStmt)
|
||||||
Curfn = nil
|
Curfn = nil
|
||||||
|
|
||||||
if debug_dclstack != 0 {
|
if Debug.DclStack != 0 {
|
||||||
testdclstack()
|
testdclstack()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ func hasemptycvars(clo *Node) bool {
|
|||||||
// closuredebugruntimecheck applies boilerplate checks for debug flags
|
// closuredebugruntimecheck applies boilerplate checks for debug flags
|
||||||
// and compiling runtime
|
// and compiling runtime
|
||||||
func closuredebugruntimecheck(clo *Node) {
|
func closuredebugruntimecheck(clo *Node) {
|
||||||
if Debug_closure > 0 {
|
if Debug.Closure > 0 {
|
||||||
if clo.Esc == EscHeap {
|
if clo.Esc == EscHeap {
|
||||||
Warnl(clo.Pos, "heap closure, captured vars = %v", clo.Func.ClosureVars)
|
Warnl(clo.Pos, "heap closure, captured vars = %v", clo.Func.ClosureVars)
|
||||||
} else {
|
} else {
|
||||||
@ -386,7 +386,7 @@ func walkclosure(clo *Node, init *Nodes) *Node {
|
|||||||
|
|
||||||
// If no closure vars, don't bother wrapping.
|
// If no closure vars, don't bother wrapping.
|
||||||
if hasemptycvars(clo) {
|
if hasemptycvars(clo) {
|
||||||
if Debug_closure > 0 {
|
if Debug.Closure > 0 {
|
||||||
Warnl(clo.Pos, "closure converted to global")
|
Warnl(clo.Pos, "closure converted to global")
|
||||||
}
|
}
|
||||||
return fn.Nname
|
return fn.Nname
|
||||||
|
167
src/cmd/compile/internal/gc/debug.go
Normal file
167
src/cmd/compile/internal/gc/debug.go
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package gc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"cmd/compile/internal/ssa"
|
||||||
|
"cmd/internal/objabi"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Debug arguments.
|
||||||
|
// These can be specified with the -d flag, as in "-d nil"
|
||||||
|
// to set the debug_checknil variable.
|
||||||
|
// Multiple options can be comma-separated.
|
||||||
|
// Each option accepts an optional argument, as in "gcprog=2"
|
||||||
|
var debugtab = []struct {
|
||||||
|
name string
|
||||||
|
help string
|
||||||
|
val interface{} // must be *int or *string
|
||||||
|
}{
|
||||||
|
{"append", "print information about append compilation", &Debug.Append},
|
||||||
|
{"checkptr", "instrument unsafe pointer conversions", &Debug.Checkptr},
|
||||||
|
{"closure", "print information about closure compilation", &Debug.Closure},
|
||||||
|
{"compilelater", "compile functions as late as possible", &Debug.CompileLater},
|
||||||
|
{"disablenil", "disable nil checks", &Debug.DisableNil},
|
||||||
|
{"dclstack", "run internal dclstack check", &Debug.DclStack},
|
||||||
|
{"dumpptrs", "show Node pointer values in Dump/dumplist output", &Debug.DumpPtrs},
|
||||||
|
{"gcprog", "print dump of GC programs", &Debug.GCProg},
|
||||||
|
{"libfuzzer", "coverage instrumentation for libfuzzer", &Debug.Libfuzzer},
|
||||||
|
{"nil", "print information about nil checks", &Debug.Nil},
|
||||||
|
{"panic", "do not hide any compiler panic", &Debug.Panic},
|
||||||
|
{"slice", "print information about slice compilation", &Debug.Slice},
|
||||||
|
{"typeassert", "print information about type assertion inlining", &Debug.TypeAssert},
|
||||||
|
{"wb", "print information about write barriers", &Debug.WB},
|
||||||
|
{"export", "print export data", &Debug.Export},
|
||||||
|
{"pctab", "print named pc-value table", &Debug.PCTab},
|
||||||
|
{"locationlists", "print information about DWARF location list creation", &Debug.LocationLists},
|
||||||
|
{"typecheckinl", "eager typechecking of inline function bodies", &Debug.TypecheckInl},
|
||||||
|
{"dwarfinl", "print information about DWARF inlined function creation", &Debug.DwarfInl},
|
||||||
|
{"softfloat", "force compiler to emit soft-float code", &Debug.SoftFloat},
|
||||||
|
{"defer", "print information about defer compilation", &Debug.Defer},
|
||||||
|
{"fieldtrack", "enable fieldtracking", &objabi.Fieldtrack_enabled},
|
||||||
|
}
|
||||||
|
|
||||||
|
var Debug struct {
|
||||||
|
Append int
|
||||||
|
Checkptr int
|
||||||
|
Closure int
|
||||||
|
CompileLater int
|
||||||
|
DisableNil int
|
||||||
|
DclStack int
|
||||||
|
GCProg int
|
||||||
|
Libfuzzer int
|
||||||
|
Nil int
|
||||||
|
Panic int
|
||||||
|
Slice int
|
||||||
|
TypeAssert int
|
||||||
|
WB int
|
||||||
|
Export int
|
||||||
|
PCTab string
|
||||||
|
LocationLists int
|
||||||
|
TypecheckInl int
|
||||||
|
DwarfInl int
|
||||||
|
SoftFloat int
|
||||||
|
Defer int
|
||||||
|
DumpPtrs int
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseDebug() {
|
||||||
|
// parse -d argument
|
||||||
|
if Flag.LowerD != "" {
|
||||||
|
Split:
|
||||||
|
for _, name := range strings.Split(Flag.LowerD, ",") {
|
||||||
|
if name == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// display help about the -d option itself and quit
|
||||||
|
if name == "help" {
|
||||||
|
fmt.Print(debugHelpHeader)
|
||||||
|
maxLen := len("ssa/help")
|
||||||
|
for _, t := range debugtab {
|
||||||
|
if len(t.name) > maxLen {
|
||||||
|
maxLen = len(t.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, t := range debugtab {
|
||||||
|
fmt.Printf("\t%-*s\t%s\n", maxLen, t.name, t.help)
|
||||||
|
}
|
||||||
|
// ssa options have their own help
|
||||||
|
fmt.Printf("\t%-*s\t%s\n", maxLen, "ssa/help", "print help about SSA debugging")
|
||||||
|
fmt.Print(debugHelpFooter)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
val, valstring, haveInt := 1, "", true
|
||||||
|
if i := strings.IndexAny(name, "=:"); i >= 0 {
|
||||||
|
var err error
|
||||||
|
name, valstring = name[:i], name[i+1:]
|
||||||
|
val, err = strconv.Atoi(valstring)
|
||||||
|
if err != nil {
|
||||||
|
val, haveInt = 1, false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, t := range debugtab {
|
||||||
|
if t.name != name {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
switch vp := t.val.(type) {
|
||||||
|
case nil:
|
||||||
|
// Ignore
|
||||||
|
case *string:
|
||||||
|
*vp = valstring
|
||||||
|
case *int:
|
||||||
|
if !haveInt {
|
||||||
|
log.Fatalf("invalid debug value %v", name)
|
||||||
|
}
|
||||||
|
*vp = val
|
||||||
|
default:
|
||||||
|
panic("bad debugtab type")
|
||||||
|
}
|
||||||
|
continue Split
|
||||||
|
}
|
||||||
|
// special case for ssa for now
|
||||||
|
if strings.HasPrefix(name, "ssa/") {
|
||||||
|
// expect form ssa/phase/flag
|
||||||
|
// e.g. -d=ssa/generic_cse/time
|
||||||
|
// _ in phase name also matches space
|
||||||
|
phase := name[4:]
|
||||||
|
flag := "debug" // default flag is debug
|
||||||
|
if i := strings.Index(phase, "/"); i >= 0 {
|
||||||
|
flag = phase[i+1:]
|
||||||
|
phase = phase[:i]
|
||||||
|
}
|
||||||
|
err := ssa.PhaseOption(phase, flag, val, valstring)
|
||||||
|
if err != "" {
|
||||||
|
log.Fatalf(err)
|
||||||
|
}
|
||||||
|
continue Split
|
||||||
|
}
|
||||||
|
log.Fatalf("unknown debug key -d %s\n", name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const debugHelpHeader = `usage: -d arg[,arg]* and arg is <key>[=<value>]
|
||||||
|
|
||||||
|
<key> is one of:
|
||||||
|
|
||||||
|
`
|
||||||
|
|
||||||
|
const debugHelpFooter = `
|
||||||
|
<value> is key-specific.
|
||||||
|
|
||||||
|
Key "checkptr" supports values:
|
||||||
|
"0": instrumentation disabled
|
||||||
|
"1": conversions involving unsafe.Pointer are instrumented
|
||||||
|
"2": conversions to unsafe.Pointer force heap allocation
|
||||||
|
|
||||||
|
Key "pctab" supports values:
|
||||||
|
"pctospadj", "pctofile", "pctoline", "pctoinline", "pctopcdata"
|
||||||
|
`
|
@ -26,7 +26,7 @@ type varPos struct {
|
|||||||
func assembleInlines(fnsym *obj.LSym, dwVars []*dwarf.Var) dwarf.InlCalls {
|
func assembleInlines(fnsym *obj.LSym, dwVars []*dwarf.Var) dwarf.InlCalls {
|
||||||
var inlcalls dwarf.InlCalls
|
var inlcalls dwarf.InlCalls
|
||||||
|
|
||||||
if Debug_gendwarfinl != 0 {
|
if Debug.DwarfInl != 0 {
|
||||||
Ctxt.Logf("assembling DWARF inlined routine info for %v\n", fnsym.Name)
|
Ctxt.Logf("assembling DWARF inlined routine info for %v\n", fnsym.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ func assembleInlines(fnsym *obj.LSym, dwVars []*dwarf.Var) dwarf.InlCalls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Debugging
|
// Debugging
|
||||||
if Debug_gendwarfinl != 0 {
|
if Debug.DwarfInl != 0 {
|
||||||
dumpInlCalls(inlcalls)
|
dumpInlCalls(inlcalls)
|
||||||
dumpInlVars(dwVars)
|
dumpInlVars(dwVars)
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ func genAbstractFunc(fn *obj.LSym) {
|
|||||||
Ctxt.Diag("failed to locate precursor fn for %v", fn)
|
Ctxt.Diag("failed to locate precursor fn for %v", fn)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if Debug_gendwarfinl != 0 {
|
if Debug.DwarfInl != 0 {
|
||||||
Ctxt.Logf("DwarfAbstractFunc(%v)\n", fn.Name)
|
Ctxt.Logf("DwarfAbstractFunc(%v)\n", fn.Name)
|
||||||
}
|
}
|
||||||
Ctxt.DwarfAbstractFunc(ifn, fn, Ctxt.Pkgpath)
|
Ctxt.DwarfAbstractFunc(ifn, fn, Ctxt.Pkgpath)
|
||||||
|
@ -12,13 +12,9 @@ import (
|
|||||||
"go/constant"
|
"go/constant"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
Debug_export int // if set, print debugging information about export data
|
|
||||||
)
|
|
||||||
|
|
||||||
func exportf(bout *bio.Writer, format string, args ...interface{}) {
|
func exportf(bout *bio.Writer, format string, args ...interface{}) {
|
||||||
fmt.Fprintf(bout, format, args...)
|
fmt.Fprintf(bout, format, args...)
|
||||||
if Debug_export != 0 {
|
if Debug.Export != 0 {
|
||||||
fmt.Printf(format, args...)
|
fmt.Printf(format, args...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,7 +67,7 @@ func dumpexport(bout *bio.Writer) {
|
|||||||
size := bout.Offset() - off
|
size := bout.Offset() - off
|
||||||
exportf(bout, "\n$$\n")
|
exportf(bout, "\n$$\n")
|
||||||
|
|
||||||
if Debug_export != 0 {
|
if Debug.Export != 0 {
|
||||||
fmt.Printf("BenchmarkExportSize:%s 1 %d bytes\n", Ctxt.Pkgpath, size)
|
fmt.Printf("BenchmarkExportSize:%s 1 %d bytes\n", Ctxt.Pkgpath, size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,9 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"cmd/compile/internal/ssa"
|
|
||||||
"cmd/internal/objabi"
|
"cmd/internal/objabi"
|
||||||
"cmd/internal/sys"
|
"cmd/internal/sys"
|
||||||
)
|
)
|
||||||
@ -209,7 +208,7 @@ func ParseFlags() {
|
|||||||
}
|
}
|
||||||
if Flag.Race || Flag.MSan {
|
if Flag.Race || Flag.MSan {
|
||||||
// -race and -msan imply -d=checkptr for now.
|
// -race and -msan imply -d=checkptr for now.
|
||||||
Debug_checkptr = 1
|
Debug.Checkptr = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if Flag.CompilingRuntime && Flag.N != 0 {
|
if Flag.CompilingRuntime && Flag.N != 0 {
|
||||||
@ -222,89 +221,18 @@ func ParseFlags() {
|
|||||||
log.Fatalf("cannot use concurrent backend compilation with provided flags; invoked as %v", os.Args)
|
log.Fatalf("cannot use concurrent backend compilation with provided flags; invoked as %v", os.Args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse -d argument
|
parseDebug()
|
||||||
if Flag.LowerD != "" {
|
|
||||||
Split:
|
|
||||||
for _, name := range strings.Split(Flag.LowerD, ",") {
|
|
||||||
if name == "" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// display help about the -d option itself and quit
|
|
||||||
if name == "help" {
|
|
||||||
fmt.Print(debugHelpHeader)
|
|
||||||
maxLen := len("ssa/help")
|
|
||||||
for _, t := range debugtab {
|
|
||||||
if len(t.name) > maxLen {
|
|
||||||
maxLen = len(t.name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, t := range debugtab {
|
|
||||||
fmt.Printf("\t%-*s\t%s\n", maxLen, t.name, t.help)
|
|
||||||
}
|
|
||||||
// ssa options have their own help
|
|
||||||
fmt.Printf("\t%-*s\t%s\n", maxLen, "ssa/help", "print help about SSA debugging")
|
|
||||||
fmt.Print(debugHelpFooter)
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
val, valstring, haveInt := 1, "", true
|
|
||||||
if i := strings.IndexAny(name, "=:"); i >= 0 {
|
|
||||||
var err error
|
|
||||||
name, valstring = name[:i], name[i+1:]
|
|
||||||
val, err = strconv.Atoi(valstring)
|
|
||||||
if err != nil {
|
|
||||||
val, haveInt = 1, false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, t := range debugtab {
|
|
||||||
if t.name != name {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
switch vp := t.val.(type) {
|
|
||||||
case nil:
|
|
||||||
// Ignore
|
|
||||||
case *string:
|
|
||||||
*vp = valstring
|
|
||||||
case *int:
|
|
||||||
if !haveInt {
|
|
||||||
log.Fatalf("invalid debug value %v", name)
|
|
||||||
}
|
|
||||||
*vp = val
|
|
||||||
default:
|
|
||||||
panic("bad debugtab type")
|
|
||||||
}
|
|
||||||
continue Split
|
|
||||||
}
|
|
||||||
// special case for ssa for now
|
|
||||||
if strings.HasPrefix(name, "ssa/") {
|
|
||||||
// expect form ssa/phase/flag
|
|
||||||
// e.g. -d=ssa/generic_cse/time
|
|
||||||
// _ in phase name also matches space
|
|
||||||
phase := name[4:]
|
|
||||||
flag := "debug" // default flag is debug
|
|
||||||
if i := strings.Index(phase, "/"); i >= 0 {
|
|
||||||
flag = phase[i+1:]
|
|
||||||
phase = phase[:i]
|
|
||||||
}
|
|
||||||
err := ssa.PhaseOption(phase, flag, val, valstring)
|
|
||||||
if err != "" {
|
|
||||||
log.Fatalf(err)
|
|
||||||
}
|
|
||||||
continue Split
|
|
||||||
}
|
|
||||||
log.Fatalf("unknown debug key -d %s\n", name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if Flag.CompilingRuntime {
|
if Flag.CompilingRuntime {
|
||||||
// Runtime can't use -d=checkptr, at least not yet.
|
// Runtime can't use -d=checkptr, at least not yet.
|
||||||
Debug_checkptr = 0
|
Debug.Checkptr = 0
|
||||||
|
|
||||||
// Fuzzing the runtime isn't interesting either.
|
// Fuzzing the runtime isn't interesting either.
|
||||||
Debug_libfuzzer = 0
|
Debug.Libfuzzer = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// set via a -d flag
|
// set via a -d flag
|
||||||
Ctxt.Debugpcln = Debug_pctab
|
Ctxt.Debugpcln = Debug.PCTab
|
||||||
}
|
}
|
||||||
|
|
||||||
// registerFlags adds flag registrations for all the fields in Flag.
|
// registerFlags adds flag registrations for all the fields in Flag.
|
||||||
|
@ -339,14 +339,14 @@ func (n *Node) jconv(s fmt.State, flag FmtFlag) {
|
|||||||
short := flag&FmtShort != 0
|
short := flag&FmtShort != 0
|
||||||
|
|
||||||
// Useful to see which nodes in an AST printout are actually identical
|
// Useful to see which nodes in an AST printout are actually identical
|
||||||
if Debug_dumpptrs != 0 {
|
if Debug.DumpPtrs != 0 {
|
||||||
fmt.Fprintf(s, " p(%p)", n)
|
fmt.Fprintf(s, " p(%p)", n)
|
||||||
}
|
}
|
||||||
if !short && n.Name != nil && n.Name.Vargen != 0 {
|
if !short && n.Name != nil && n.Name.Vargen != 0 {
|
||||||
fmt.Fprintf(s, " g(%d)", n.Name.Vargen)
|
fmt.Fprintf(s, " g(%d)", n.Name.Vargen)
|
||||||
}
|
}
|
||||||
|
|
||||||
if Debug_dumpptrs != 0 && !short && n.Name != nil && n.Name.Defn != nil {
|
if Debug.DumpPtrs != 0 && !short && n.Name != nil && n.Name.Defn != nil {
|
||||||
// Useful to see where Defn is set and what node it points to
|
// Useful to see where Defn is set and what node it points to
|
||||||
fmt.Fprintf(s, " defn(%p)", n.Name.Defn)
|
fmt.Fprintf(s, " defn(%p)", n.Name.Defn)
|
||||||
}
|
}
|
||||||
|
@ -101,9 +101,6 @@ var pragcgobuf [][]string
|
|||||||
|
|
||||||
var decldepth int32
|
var decldepth int32
|
||||||
|
|
||||||
var Debug_checknil int
|
|
||||||
var Debug_typeassert int
|
|
||||||
|
|
||||||
var localpkg *types.Pkg // package being compiled
|
var localpkg *types.Pkg // package being compiled
|
||||||
|
|
||||||
var inimport bool // set during import
|
var inimport bool // set during import
|
||||||
@ -189,8 +186,6 @@ var Ctxt *obj.Link
|
|||||||
|
|
||||||
var nodfp *Node
|
var nodfp *Node
|
||||||
|
|
||||||
var disable_checknil int
|
|
||||||
|
|
||||||
var autogeneratedPos src.XPos
|
var autogeneratedPos src.XPos
|
||||||
|
|
||||||
// interface to back end
|
// interface to back end
|
||||||
|
@ -86,7 +86,7 @@ func typecheckinl(fn *Node) {
|
|||||||
return // typecheckinl on local function
|
return // typecheckinl on local function
|
||||||
}
|
}
|
||||||
|
|
||||||
if Flag.LowerM > 2 || Debug_export != 0 {
|
if Flag.LowerM > 2 || Debug.Export != 0 {
|
||||||
fmt.Printf("typecheck import [%v] %L { %#v }\n", fn.Sym, fn, asNodes(fn.Func.Inl.Body))
|
fmt.Printf("typecheck import [%v] %L { %#v }\n", fn.Sym, fn, asNodes(fn.Func.Inl.Body))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ func caninl(fn *Node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If marked "go:nocheckptr" and -d checkptr compilation, don't inline.
|
// If marked "go:nocheckptr" and -d checkptr compilation, don't inline.
|
||||||
if Debug_checkptr != 0 && fn.Func.Pragma&NoCheckPtr != 0 {
|
if Debug.Checkptr != 0 && fn.Func.Pragma&NoCheckPtr != 0 {
|
||||||
reason = "marked go:nocheckptr"
|
reason = "marked go:nocheckptr"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -595,7 +595,7 @@ func inlnode(n *Node, maxCost int32, inlMap map[*Node]bool) *Node {
|
|||||||
case OCALLMETH:
|
case OCALLMETH:
|
||||||
// Prevent inlining some reflect.Value methods when using checkptr,
|
// Prevent inlining some reflect.Value methods when using checkptr,
|
||||||
// even when package reflect was compiled without it (#35073).
|
// even when package reflect was compiled without it (#35073).
|
||||||
if s := n.Left.Sym; Debug_checkptr != 0 && isReflectPkg(s.Pkg) && (s.Name == "Value.UnsafeAddr" || s.Name == "Value.Pointer") {
|
if s := n.Left.Sym; Debug.Checkptr != 0 && isReflectPkg(s.Pkg) && (s.Name == "Value.UnsafeAddr" || s.Name == "Value.Pointer") {
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -931,7 +931,7 @@ func mkinlcall(n, fn *Node, maxCost int32, inlMap map[*Node]bool) *Node {
|
|||||||
defer func() {
|
defer func() {
|
||||||
inlMap[fn] = false
|
inlMap[fn] = false
|
||||||
}()
|
}()
|
||||||
if Debug_typecheckinl == 0 {
|
if Debug.TypecheckInl == 0 {
|
||||||
typecheckinl(fn)
|
typecheckinl(fn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,79 +34,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
Debug_append int
|
|
||||||
Debug_checkptr int
|
|
||||||
Debug_closure int
|
|
||||||
Debug_compilelater int
|
|
||||||
debug_dclstack int
|
|
||||||
Debug_dumpptrs int
|
|
||||||
Debug_libfuzzer int
|
|
||||||
Debug_panic int
|
|
||||||
Debug_slice int
|
|
||||||
Debug_wb int
|
|
||||||
Debug_pctab string
|
|
||||||
Debug_locationlist int
|
|
||||||
Debug_typecheckinl int
|
|
||||||
Debug_gendwarfinl int
|
|
||||||
Debug_softfloat int
|
|
||||||
Debug_defer int
|
|
||||||
)
|
|
||||||
|
|
||||||
// Debug arguments.
|
|
||||||
// These can be specified with the -d flag, as in "-d nil"
|
|
||||||
// to set the debug_checknil variable.
|
|
||||||
// Multiple options can be comma-separated.
|
|
||||||
// Each option accepts an optional argument, as in "gcprog=2"
|
|
||||||
var debugtab = []struct {
|
|
||||||
name string
|
|
||||||
help string
|
|
||||||
val interface{} // must be *int or *string
|
|
||||||
}{
|
|
||||||
{"append", "print information about append compilation", &Debug_append},
|
|
||||||
{"checkptr", "instrument unsafe pointer conversions", &Debug_checkptr},
|
|
||||||
{"closure", "print information about closure compilation", &Debug_closure},
|
|
||||||
{"compilelater", "compile functions as late as possible", &Debug_compilelater},
|
|
||||||
{"disablenil", "disable nil checks", &disable_checknil},
|
|
||||||
{"dclstack", "run internal dclstack check", &debug_dclstack},
|
|
||||||
{"dumpptrs", "show Node pointer values in Dump/dumplist output", &Debug_dumpptrs},
|
|
||||||
{"gcprog", "print dump of GC programs", &Debug_gcprog},
|
|
||||||
{"libfuzzer", "coverage instrumentation for libfuzzer", &Debug_libfuzzer},
|
|
||||||
{"nil", "print information about nil checks", &Debug_checknil},
|
|
||||||
{"panic", "do not hide any compiler panic", &Debug_panic},
|
|
||||||
{"slice", "print information about slice compilation", &Debug_slice},
|
|
||||||
{"typeassert", "print information about type assertion inlining", &Debug_typeassert},
|
|
||||||
{"wb", "print information about write barriers", &Debug_wb},
|
|
||||||
{"export", "print export data", &Debug_export},
|
|
||||||
{"pctab", "print named pc-value table", &Debug_pctab},
|
|
||||||
{"locationlists", "print information about DWARF location list creation", &Debug_locationlist},
|
|
||||||
{"typecheckinl", "eager typechecking of inline function bodies", &Debug_typecheckinl},
|
|
||||||
{"dwarfinl", "print information about DWARF inlined function creation", &Debug_gendwarfinl},
|
|
||||||
{"softfloat", "force compiler to emit soft-float code", &Debug_softfloat},
|
|
||||||
{"defer", "print information about defer compilation", &Debug_defer},
|
|
||||||
{"fieldtrack", "enable fieldtracking", &objabi.Fieldtrack_enabled},
|
|
||||||
}
|
|
||||||
|
|
||||||
const debugHelpHeader = `usage: -d arg[,arg]* and arg is <key>[=<value>]
|
|
||||||
|
|
||||||
<key> is one of:
|
|
||||||
|
|
||||||
`
|
|
||||||
|
|
||||||
const debugHelpFooter = `
|
|
||||||
<value> is key-specific.
|
|
||||||
|
|
||||||
Key "checkptr" supports values:
|
|
||||||
"0": instrumentation disabled
|
|
||||||
"1": conversions involving unsafe.Pointer are instrumented
|
|
||||||
"2": conversions to unsafe.Pointer force heap allocation
|
|
||||||
|
|
||||||
Key "pctab" supports values:
|
|
||||||
"pctospadj", "pctofile", "pctoline", "pctoinline", "pctopcdata"
|
|
||||||
`
|
|
||||||
|
|
||||||
func hidePanic() {
|
func hidePanic() {
|
||||||
if Debug_panic == 0 && Errors() > 0 {
|
if Debug.Panic == 0 && Errors() > 0 {
|
||||||
// If we've already complained about things
|
// If we've already complained about things
|
||||||
// in the program, don't bother complaining
|
// in the program, don't bother complaining
|
||||||
// about a panic too; let the user clean up
|
// about a panic too; let the user clean up
|
||||||
@ -243,9 +172,9 @@ func Main(archInit func(*Arch)) {
|
|||||||
instrumenting = true
|
instrumenting = true
|
||||||
}
|
}
|
||||||
if Flag.Dwarf {
|
if Flag.Dwarf {
|
||||||
dwarf.EnableLogging(Debug_gendwarfinl != 0)
|
dwarf.EnableLogging(Debug.DwarfInl != 0)
|
||||||
}
|
}
|
||||||
if Debug_softfloat != 0 {
|
if Debug.SoftFloat != 0 {
|
||||||
thearch.SoftFloat = true
|
thearch.SoftFloat = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +325,7 @@ func Main(archInit func(*Arch)) {
|
|||||||
|
|
||||||
// Phase 5: Inlining
|
// Phase 5: Inlining
|
||||||
timings.Start("fe", "inlining")
|
timings.Start("fe", "inlining")
|
||||||
if Debug_typecheckinl != 0 {
|
if Debug.TypecheckInl != 0 {
|
||||||
// Typecheck imported function bodies if Debug.l > 1,
|
// Typecheck imported function bodies if Debug.l > 1,
|
||||||
// otherwise lazily when used or re-exported.
|
// otherwise lazily when used or re-exported.
|
||||||
for _, n := range importlist {
|
for _, n := range importlist {
|
||||||
@ -501,7 +430,7 @@ func Main(archInit func(*Arch)) {
|
|||||||
// DWARF inlining gen so as to avoid problems with generated
|
// DWARF inlining gen so as to avoid problems with generated
|
||||||
// method wrappers.
|
// method wrappers.
|
||||||
if Ctxt.DwFixups != nil {
|
if Ctxt.DwFixups != nil {
|
||||||
Ctxt.DwFixups.Finalize(Ctxt.Pkgpath, Debug_gendwarfinl != 0)
|
Ctxt.DwFixups.Finalize(Ctxt.Pkgpath, Debug.DwarfInl != 0)
|
||||||
Ctxt.DwFixups = nil
|
Ctxt.DwFixups = nil
|
||||||
Flag.GenDwarfInl = 0
|
Flag.GenDwarfInl = 0
|
||||||
}
|
}
|
||||||
@ -944,7 +873,7 @@ func importfile(f constant.Value) *types.Pkg {
|
|||||||
return nil
|
return nil
|
||||||
|
|
||||||
case 'B':
|
case 'B':
|
||||||
if Debug_export != 0 {
|
if Debug.Export != 0 {
|
||||||
fmt.Printf("importing %s (%s)\n", path_, file)
|
fmt.Printf("importing %s (%s)\n", path_, file)
|
||||||
}
|
}
|
||||||
imp.ReadByte() // skip \n after $$B
|
imp.ReadByte() // skip \n after $$B
|
||||||
|
@ -384,7 +384,7 @@ func orderMakeSliceCopy(s []*Node) {
|
|||||||
|
|
||||||
// edge inserts coverage instrumentation for libfuzzer.
|
// edge inserts coverage instrumentation for libfuzzer.
|
||||||
func (o *Order) edge() {
|
func (o *Order) edge() {
|
||||||
if Debug_libfuzzer == 0 {
|
if Debug.Libfuzzer == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -998,7 +998,7 @@ func (o *Order) stmt(n *Node) {
|
|||||||
// For now just clean all the temporaries at the end.
|
// For now just clean all the temporaries at the end.
|
||||||
// In practice that's fine.
|
// In practice that's fine.
|
||||||
case OSWITCH:
|
case OSWITCH:
|
||||||
if Debug_libfuzzer != 0 && !hasDefaultCase(n) {
|
if Debug.Libfuzzer != 0 && !hasDefaultCase(n) {
|
||||||
// Add empty "default:" case for instrumentation.
|
// Add empty "default:" case for instrumentation.
|
||||||
n.List.Append(nod(OCASE, nil, nil))
|
n.List.Append(nod(OCASE, nil, nil))
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,7 @@ func compilenow(fn *Node) bool {
|
|||||||
if fn.IsMethod() && isInlinableButNotInlined(fn) {
|
if fn.IsMethod() && isInlinableButNotInlined(fn) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return Flag.LowerC == 1 && Debug_compilelater == 0
|
return Flag.LowerC == 1 && Debug.CompileLater == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// isInlinableButNotInlined returns true if 'fn' was marked as an
|
// isInlinableButNotInlined returns true if 'fn' was marked as an
|
||||||
|
@ -208,7 +208,7 @@ func Fatalf(format string, args ...interface{}) {
|
|||||||
func FatalfAt(pos src.XPos, format string, args ...interface{}) {
|
func FatalfAt(pos src.XPos, format string, args ...interface{}) {
|
||||||
flusherrors()
|
flusherrors()
|
||||||
|
|
||||||
if Debug_panic != 0 || numErrors == 0 {
|
if Debug.Panic != 0 || numErrors == 0 {
|
||||||
fmt.Printf("%v: internal compiler error: ", linestr(pos))
|
fmt.Printf("%v: internal compiler error: ", linestr(pos))
|
||||||
fmt.Printf(format, args...)
|
fmt.Printf(format, args...)
|
||||||
fmt.Printf("\n")
|
fmt.Printf("\n")
|
||||||
|
@ -1787,13 +1787,11 @@ type GCProg struct {
|
|||||||
w gcprog.Writer
|
w gcprog.Writer
|
||||||
}
|
}
|
||||||
|
|
||||||
var Debug_gcprog int // set by -d gcprog
|
|
||||||
|
|
||||||
func (p *GCProg) init(lsym *obj.LSym) {
|
func (p *GCProg) init(lsym *obj.LSym) {
|
||||||
p.lsym = lsym
|
p.lsym = lsym
|
||||||
p.symoff = 4 // first 4 bytes hold program length
|
p.symoff = 4 // first 4 bytes hold program length
|
||||||
p.w.Init(p.writeByte)
|
p.w.Init(p.writeByte)
|
||||||
if Debug_gcprog > 0 {
|
if Debug.GCProg > 0 {
|
||||||
fmt.Fprintf(os.Stderr, "compile: start GCProg for %v\n", lsym)
|
fmt.Fprintf(os.Stderr, "compile: start GCProg for %v\n", lsym)
|
||||||
p.w.Debug(os.Stderr)
|
p.w.Debug(os.Stderr)
|
||||||
}
|
}
|
||||||
@ -1807,7 +1805,7 @@ func (p *GCProg) end() {
|
|||||||
p.w.End()
|
p.w.End()
|
||||||
duint32(p.lsym, 0, uint32(p.symoff-4))
|
duint32(p.lsym, 0, uint32(p.symoff-4))
|
||||||
ggloblsym(p.lsym, int32(p.symoff), obj.DUPOK|obj.RODATA|obj.LOCAL)
|
ggloblsym(p.lsym, int32(p.symoff), obj.DUPOK|obj.RODATA|obj.LOCAL)
|
||||||
if Debug_gcprog > 0 {
|
if Debug.GCProg > 0 {
|
||||||
fmt.Fprintf(os.Stderr, "compile: end GCProg for %v\n", p.lsym)
|
fmt.Fprintf(os.Stderr, "compile: end GCProg for %v\n", p.lsym)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ func (s *InitSchedule) staticassign(l *Node, r *Node) bool {
|
|||||||
|
|
||||||
case OCLOSURE:
|
case OCLOSURE:
|
||||||
if hasemptycvars(r) {
|
if hasemptycvars(r) {
|
||||||
if Debug_closure > 0 {
|
if Debug.Closure > 0 {
|
||||||
Warnl(r.Pos, "closure converted to global")
|
Warnl(r.Pos, "closure converted to global")
|
||||||
}
|
}
|
||||||
// Closures with no captured variables are globals,
|
// Closures with no captured variables are globals,
|
||||||
|
@ -1102,7 +1102,7 @@ func (s *state) stmt(n *Node) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ODEFER:
|
case ODEFER:
|
||||||
if Debug_defer > 0 {
|
if Debug.Defer > 0 {
|
||||||
var defertype string
|
var defertype string
|
||||||
if s.hasOpenDefers {
|
if s.hasOpenDefers {
|
||||||
defertype = "open-coded"
|
defertype = "open-coded"
|
||||||
@ -1232,12 +1232,12 @@ func (s *state) stmt(n *Node) {
|
|||||||
// so there will be no write barriers,
|
// so there will be no write barriers,
|
||||||
// so there's no need to attempt to prevent them.
|
// so there's no need to attempt to prevent them.
|
||||||
if s.canSSA(n.Left) {
|
if s.canSSA(n.Left) {
|
||||||
if Debug_append > 0 { // replicating old diagnostic message
|
if Debug.Append > 0 { // replicating old diagnostic message
|
||||||
Warnl(n.Pos, "append: len-only update (in local slice)")
|
Warnl(n.Pos, "append: len-only update (in local slice)")
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if Debug_append > 0 {
|
if Debug.Append > 0 {
|
||||||
Warnl(n.Pos, "append: len-only update")
|
Warnl(n.Pos, "append: len-only update")
|
||||||
}
|
}
|
||||||
s.append(rhs, true)
|
s.append(rhs, true)
|
||||||
@ -5026,7 +5026,7 @@ func (s *state) exprPtr(n *Node, bounded bool, lineno src.XPos) *ssa.Value {
|
|||||||
// Used only for automatically inserted nil checks,
|
// Used only for automatically inserted nil checks,
|
||||||
// not for user code like 'x != nil'.
|
// not for user code like 'x != nil'.
|
||||||
func (s *state) nilCheck(ptr *ssa.Value) {
|
func (s *state) nilCheck(ptr *ssa.Value) {
|
||||||
if disable_checknil != 0 || s.curfn.Func.NilCheckDisabled() {
|
if Debug.DisableNil != 0 || s.curfn.Func.NilCheckDisabled() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.newValue2(ssa.OpNilCheck, types.TypeVoid, ptr, s.mem())
|
s.newValue2(ssa.OpNilCheck, types.TypeVoid, ptr, s.mem())
|
||||||
@ -5837,7 +5837,7 @@ func (s *state) dottype(n *Node, commaok bool) (res, resok *ssa.Value) {
|
|||||||
if n.Type.IsEmptyInterface() {
|
if n.Type.IsEmptyInterface() {
|
||||||
// Converting to an empty interface.
|
// Converting to an empty interface.
|
||||||
// Input could be an empty or nonempty interface.
|
// Input could be an empty or nonempty interface.
|
||||||
if Debug_typeassert > 0 {
|
if Debug.TypeAssert > 0 {
|
||||||
Warnl(n.Pos, "type assertion inlined")
|
Warnl(n.Pos, "type assertion inlined")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5904,7 +5904,7 @@ func (s *state) dottype(n *Node, commaok bool) (res, resok *ssa.Value) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// converting to a nonempty interface needs a runtime call.
|
// converting to a nonempty interface needs a runtime call.
|
||||||
if Debug_typeassert > 0 {
|
if Debug.TypeAssert > 0 {
|
||||||
Warnl(n.Pos, "type assertion not inlined")
|
Warnl(n.Pos, "type assertion not inlined")
|
||||||
}
|
}
|
||||||
if n.Left.Type.IsEmptyInterface() {
|
if n.Left.Type.IsEmptyInterface() {
|
||||||
@ -5921,14 +5921,14 @@ func (s *state) dottype(n *Node, commaok bool) (res, resok *ssa.Value) {
|
|||||||
return s.rtcall(assertI2I, true, []*types.Type{n.Type}, target, iface)[0], nil
|
return s.rtcall(assertI2I, true, []*types.Type{n.Type}, target, iface)[0], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if Debug_typeassert > 0 {
|
if Debug.TypeAssert > 0 {
|
||||||
Warnl(n.Pos, "type assertion inlined")
|
Warnl(n.Pos, "type assertion inlined")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converting to a concrete type.
|
// Converting to a concrete type.
|
||||||
direct := isdirectiface(n.Type)
|
direct := isdirectiface(n.Type)
|
||||||
itab := s.newValue1(ssa.OpITab, byteptr, iface) // type word of interface
|
itab := s.newValue1(ssa.OpITab, byteptr, iface) // type word of interface
|
||||||
if Debug_typeassert > 0 {
|
if Debug.TypeAssert > 0 {
|
||||||
Warnl(n.Pos, "type assertion inlined")
|
Warnl(n.Pos, "type assertion inlined")
|
||||||
}
|
}
|
||||||
var targetITab *ssa.Value
|
var targetITab *ssa.Value
|
||||||
@ -6474,7 +6474,7 @@ func genssa(f *ssa.Func, pp *Progs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if Ctxt.Flag_locationlists {
|
if Ctxt.Flag_locationlists {
|
||||||
e.curfn.Func.DebugInfo = ssa.BuildFuncDebug(Ctxt, f, Debug_locationlist > 1, stackOffset)
|
e.curfn.Func.DebugInfo = ssa.BuildFuncDebug(Ctxt, f, Debug.LocationLists > 1, stackOffset)
|
||||||
bstart := s.bstart
|
bstart := s.bstart
|
||||||
// Note that at this moment, Prog.Pc is a sequence number; it's
|
// Note that at this moment, Prog.Pc is a sequence number; it's
|
||||||
// not a real PC until after assembly, so this mapping has to
|
// not a real PC until after assembly, so this mapping has to
|
||||||
@ -7113,7 +7113,7 @@ func (e *ssafn) Warnl(pos src.XPos, fmt_ string, args ...interface{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *ssafn) Debug_checknil() bool {
|
func (e *ssafn) Debug_checknil() bool {
|
||||||
return Debug_checknil != 0
|
return Debug.Nil != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *ssafn) UseWriteBarrier() bool {
|
func (e *ssafn) UseWriteBarrier() bool {
|
||||||
|
@ -1412,7 +1412,7 @@ func genwrapper(rcvr *types.Type, method *types.Field, newnam *types.Sym) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
funcbody()
|
funcbody()
|
||||||
if debug_dclstack != 0 {
|
if Debug.DclStack != 0 {
|
||||||
testdclstack()
|
testdclstack()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -764,7 +764,7 @@ func (f *Func) SetInstrumentBody(b bool) { f.flags.set(funcInstrumentB
|
|||||||
func (f *Func) SetOpenCodedDeferDisallowed(b bool) { f.flags.set(funcOpenCodedDeferDisallowed, b) }
|
func (f *Func) SetOpenCodedDeferDisallowed(b bool) { f.flags.set(funcOpenCodedDeferDisallowed, b) }
|
||||||
|
|
||||||
func (f *Func) setWBPos(pos src.XPos) {
|
func (f *Func) setWBPos(pos src.XPos) {
|
||||||
if Debug_wb != 0 {
|
if Debug.WB != 0 {
|
||||||
Warnl(pos, "write barrier")
|
Warnl(pos, "write barrier")
|
||||||
}
|
}
|
||||||
if !f.WBPos.IsKnown() {
|
if !f.WBPos.IsKnown() {
|
||||||
|
@ -1685,7 +1685,7 @@ func reduceSlice(n *Node) *Node {
|
|||||||
n.SetSliceBounds(low, high, max)
|
n.SetSliceBounds(low, high, max)
|
||||||
if (n.Op == OSLICE || n.Op == OSLICESTR) && low == nil && high == nil {
|
if (n.Op == OSLICE || n.Op == OSLICESTR) && low == nil && high == nil {
|
||||||
// Reduce x[:] to x.
|
// Reduce x[:] to x.
|
||||||
if Debug_slice > 0 {
|
if Debug.Slice > 0 {
|
||||||
Warn("slice: omit slice operation")
|
Warn("slice: omit slice operation")
|
||||||
}
|
}
|
||||||
return n.Left
|
return n.Left
|
||||||
@ -3262,7 +3262,7 @@ func walkcompare(n *Node, init *Nodes) *Node {
|
|||||||
|
|
||||||
switch t.Etype {
|
switch t.Etype {
|
||||||
default:
|
default:
|
||||||
if Debug_libfuzzer != 0 && t.IsInteger() {
|
if Debug.Libfuzzer != 0 && t.IsInteger() {
|
||||||
n.Left = cheapexpr(n.Left, init)
|
n.Left = cheapexpr(n.Left, init)
|
||||||
n.Right = cheapexpr(n.Right, init)
|
n.Right = cheapexpr(n.Right, init)
|
||||||
|
|
||||||
@ -4087,5 +4087,5 @@ func walkCheckPtrArithmetic(n *Node, init *Nodes) *Node {
|
|||||||
// function fn at a given level. See debugHelpFooter for defined
|
// function fn at a given level. See debugHelpFooter for defined
|
||||||
// levels.
|
// levels.
|
||||||
func checkPtr(fn *Node, level int) bool {
|
func checkPtr(fn *Node, level int) bool {
|
||||||
return Debug_checkptr >= level && fn.Func.Pragma&NoCheckPtr == 0
|
return Debug.Checkptr >= level && fn.Func.Pragma&NoCheckPtr == 0
|
||||||
}
|
}
|
||||||
|
@ -766,7 +766,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
|||||||
if logopt.Enabled() {
|
if logopt.Enabled() {
|
||||||
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
||||||
}
|
}
|
||||||
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
if gc.Debug.Nil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
||||||
gc.Warnl(v.Pos, "generated nil check")
|
gc.Warnl(v.Pos, "generated nil check")
|
||||||
}
|
}
|
||||||
case ssa.OpMIPSFPFlagTrue,
|
case ssa.OpMIPSFPFlagTrue,
|
||||||
|
@ -724,7 +724,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
|||||||
if logopt.Enabled() {
|
if logopt.Enabled() {
|
||||||
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
||||||
}
|
}
|
||||||
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
if gc.Debug.Nil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
||||||
gc.Warnl(v.Pos, "generated nil check")
|
gc.Warnl(v.Pos, "generated nil check")
|
||||||
}
|
}
|
||||||
case ssa.OpMIPS64FPFlagTrue,
|
case ssa.OpMIPS64FPFlagTrue,
|
||||||
|
@ -1852,7 +1852,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
|||||||
if logopt.Enabled() {
|
if logopt.Enabled() {
|
||||||
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
||||||
}
|
}
|
||||||
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
if gc.Debug.Nil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
||||||
gc.Warnl(v.Pos, "generated nil check")
|
gc.Warnl(v.Pos, "generated nil check")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,7 +586,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
|||||||
gc.AddAux(&p.From, v)
|
gc.AddAux(&p.From, v)
|
||||||
p.To.Type = obj.TYPE_REG
|
p.To.Type = obj.TYPE_REG
|
||||||
p.To.Reg = riscv.REG_ZERO
|
p.To.Reg = riscv.REG_ZERO
|
||||||
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos == 1 in generated wrappers
|
if gc.Debug.Nil != 0 && v.Pos.Line() > 1 { // v.Pos == 1 in generated wrappers
|
||||||
gc.Warnl(v.Pos, "generated nil check")
|
gc.Warnl(v.Pos, "generated nil check")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,7 +642,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
|||||||
if logopt.Enabled() {
|
if logopt.Enabled() {
|
||||||
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
||||||
}
|
}
|
||||||
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
if gc.Debug.Nil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
||||||
gc.Warnl(v.Pos, "generated nil check")
|
gc.Warnl(v.Pos, "generated nil check")
|
||||||
}
|
}
|
||||||
case ssa.OpS390XMVC:
|
case ssa.OpS390XMVC:
|
||||||
|
@ -165,7 +165,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
|||||||
if logopt.Enabled() {
|
if logopt.Enabled() {
|
||||||
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
||||||
}
|
}
|
||||||
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
if gc.Debug.Nil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
||||||
gc.Warnl(v.Pos, "generated nil check")
|
gc.Warnl(v.Pos, "generated nil check")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -850,7 +850,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
|
|||||||
if logopt.Enabled() {
|
if logopt.Enabled() {
|
||||||
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
logopt.LogOpt(v.Pos, "nilcheck", "genssa", v.Block.Func.Name)
|
||||||
}
|
}
|
||||||
if gc.Debug_checknil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
if gc.Debug.Nil != 0 && v.Pos.Line() > 1 { // v.Pos.Line()==1 in generated wrappers
|
||||||
gc.Warnl(v.Pos, "generated nil check")
|
gc.Warnl(v.Pos, "generated nil check")
|
||||||
}
|
}
|
||||||
case ssa.OpClobber:
|
case ssa.OpClobber:
|
||||||
|
Loading…
Reference in New Issue
Block a user