diff options
| author | Russ Cox <rsc@golang.org> | 2023-05-08 23:18:38 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2023-05-09 16:07:06 +0000 |
| commit | da5a3146ec903cdcb779d501be4ff88fd775820e (patch) | |
| tree | 12c4fce48a5d3d1ea05fb08a5cf7578e77bb268d /src/cmd/compile/internal/loopvar | |
| parent | ffc4cc05f596a38c19f0d7e1ee91f17527ac3b37 (diff) | |
| download | go-da5a3146ec903cdcb779d501be4ff88fd775820e.tar.xz | |
cmd/compile: use more of internal/bisect in HashDebug
Using more of internal/bisect gives us more that will be deleted
from base/hashdebug.go when we have updated the tools that
need the old protocol. It is also cheaper: there is no allocation to
make a decision about whether to enable, and no locking unless
printing is needed.
Change-Id: I43ec398461205a1a9e988512a134ed6b3a3b1587
Reviewed-on: https://go-review.googlesource.com/c/go/+/493736
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/cmd/compile/internal/loopvar')
| -rw-r--r-- | src/cmd/compile/internal/loopvar/loopvar.go | 4 | ||||
| -rw-r--r-- | src/cmd/compile/internal/loopvar/loopvar_test.go | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/loopvar/loopvar.go b/src/cmd/compile/internal/loopvar/loopvar.go index 0d8a6d2d6e..7752cac535 100644 --- a/src/cmd/compile/internal/loopvar/loopvar.go +++ b/src/cmd/compile/internal/loopvar/loopvar.go @@ -91,7 +91,7 @@ func ForCapture(fn *ir.Func) []VarAndLoop { // subject to hash-variable debugging. maybeReplaceVar := func(k ir.Node, x *ir.RangeStmt) ir.Node { if n, ok := k.(*ir.Name); ok && possiblyLeaked[n] { - if base.LoopVarHash.DebugHashMatchPos(n.Pos()) { + if base.LoopVarHash.MatchPos(n.Pos()) { // Rename the loop key, prefix body with assignment from loop key transformed = append(transformed, VarAndLoop{n, x, lastPos}) tk := typecheck.Temp(n.Type()) @@ -199,7 +199,7 @@ func ForCapture(fn *ir.Func) []VarAndLoop { forAllDefInInit(x, func(z ir.Node) { if n, ok := z.(*ir.Name); ok && possiblyLeaked[n] { // Hash on n.Pos() for most precise failure location. - if base.LoopVarHash.DebugHashMatchPos(n.Pos()) { + if base.LoopVarHash.MatchPos(n.Pos()) { leaked = append(leaked, n) } } diff --git a/src/cmd/compile/internal/loopvar/loopvar_test.go b/src/cmd/compile/internal/loopvar/loopvar_test.go index 1a13f0e30c..5c7e11ac69 100644 --- a/src/cmd/compile/internal/loopvar/loopvar_test.go +++ b/src/cmd/compile/internal/loopvar/loopvar_test.go @@ -190,7 +190,7 @@ func TestLoopVarHashes(t *testing.T) { return string(b) } - m := f("000100000010011111101100") + m := f("011011011110011110111101") t.Logf(m) mCount := strings.Count(m, "loopvarhash triggered main.go:27:6") |
