// GOCOMPILEDEBUG=loopvarhash=... -- search for failure cause
//
// (*) For debugging purposes, providing loopvar flag >= 11 will expand the hash-eligible set of loops to all.
- // (**) Currently this applies to all code in the compilation of some_package, including
- // inlines from other packages that may have been compiled w/o the change.
+ // (**) Loop semantics, changed or not, follow code from a package when it is inlined; that is, the behavior
+ // of an application compiled with partially modified loop semantics does not depend on inlining.
if Debug.LoopVarHash != "" {
// This first little bit controls the inputs for debug-hash-matching.
return hashDebug.DebugHashMatch(pkgAndName)
}
+func DebugHashMatchPos(pos src.XPos) bool {
+ return hashDebug.DebugHashMatchPos(pos)
+}
+
// HasDebugHash returns true if Flags.Gossahash is non-empty, which
// results in hashDebug being not-nil. I.e., if !HasDebugHash(),
// there is no need to create the string for hashing and testing.
// locking is also more frequent and more granular.
// Note that the default answer for no environment variable (d == nil)
// is "yes", do the thing.
-func (d *HashDebug) DebugHashMatchPos(ctxt *obj.Link, pos src.XPos) bool {
+func (d *HashDebug) DebugHashMatchPos(pos src.XPos) bool {
if d == nil {
return true
}
return false
}
// Written this way to make inlining likely.
- return d.debugHashMatchPos(ctxt, pos)
+ return d.debugHashMatchPos(Ctxt, pos)
}
func (d *HashDebug) debugHashMatchPos(ctxt *obj.Link, pos src.XPos) bool {
// 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(base.Ctxt, n.Pos()) {
+ if base.LoopVarHash.DebugHashMatchPos(n.Pos()) {
// Rename the loop key, prefix body with assignment from loop key
transformed = append(transformed, n)
tk := typecheck.Temp(n.Type())
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(base.Ctxt, n.Pos()) {
+ if base.LoopVarHash.DebugHashMatchPos(n.Pos()) {
leaked = append(leaked, n)
}
}
if base.FmaHash == nil {
return true
}
- ctxt := v.Block.Func.Config.Ctxt()
- return base.FmaHash.DebugHashMatchPos(ctxt, v.Pos)
+ return base.FmaHash.DebugHashMatchPos(v.Pos)
}