mirror of
https://github.com/golang/go
synced 2024-11-26 18:16:48 -07:00
cmd/compile: move racewalk comment to walk/race.go
This comment got left behind in some refactoring and now refers to code "below" that is no longer below. Move it to be with the code it's referring to. Change-Id: I7f7bf0cf8b22c1f6e05ff12b8be71d18fb3359d5 Reviewed-on: https://go-review.googlesource.com/c/go/+/521177 Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Austin Clements <austin@google.com> TryBot-Bypass: Austin Clements <austin@google.com>
This commit is contained in:
parent
01cad815a1
commit
e7a1eb066b
@ -232,26 +232,6 @@ func Compiling(pkgs []string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// The racewalk pass is currently handled in three parts.
|
||||
//
|
||||
// First, for flag_race, it inserts calls to racefuncenter and
|
||||
// racefuncexit at the start and end (respectively) of each
|
||||
// function. This is handled below.
|
||||
//
|
||||
// Second, during buildssa, it inserts appropriate instrumentation
|
||||
// calls immediately before each memory load or store. This is handled
|
||||
// by the (*state).instrument method in ssa.go, so here we just set
|
||||
// the Func.InstrumentBody flag as needed. For background on why this
|
||||
// is done during SSA construction rather than a separate SSA pass,
|
||||
// see issue #19054.
|
||||
//
|
||||
// Third, we remove calls to racefuncenter and racefuncexit, for leaf
|
||||
// functions without instrumented operations. This is done as part of
|
||||
// ssa opt pass via special rule.
|
||||
|
||||
// TODO(dvyukov): do not instrument initialization as writes:
|
||||
// a := make([]int, 10)
|
||||
|
||||
// Do not instrument the following packages at all,
|
||||
// at best instrumentation would cause infinite recursion.
|
||||
var NoInstrumentPkgs = []string{
|
||||
|
@ -11,6 +11,26 @@ import (
|
||||
"cmd/internal/src"
|
||||
)
|
||||
|
||||
// The racewalk pass is currently handled in three parts.
|
||||
//
|
||||
// First, for flag_race, it inserts calls to racefuncenter and
|
||||
// racefuncexit at the start and end (respectively) of each
|
||||
// function. This is handled below.
|
||||
//
|
||||
// Second, during buildssa, it inserts appropriate instrumentation
|
||||
// calls immediately before each memory load or store. This is handled
|
||||
// by the (*state).instrument method in ssa.go, so here we just set
|
||||
// the Func.InstrumentBody flag as needed. For background on why this
|
||||
// is done during SSA construction rather than a separate SSA pass,
|
||||
// see issue #19054.
|
||||
//
|
||||
// Third, we remove calls to racefuncenter and racefuncexit, for leaf
|
||||
// functions without instrumented operations. This is done as part of
|
||||
// ssa opt pass via special rule.
|
||||
|
||||
// TODO(dvyukov): do not instrument initialization as writes:
|
||||
// a := make([]int, 10)
|
||||
|
||||
func instrument(fn *ir.Func) {
|
||||
if fn.Pragma&ir.Norace != 0 || (fn.Linksym() != nil && fn.Linksym().ABIWrapper()) {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user