mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
ffc4cc05f5
commit
da5a3146ec
5 changed files with 132 additions and 187 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue