mirror of
https://github.com/golang/go
synced 2024-11-17 23:54:51 -07:00
cmd/compile: don't modify nodfp in AllocFrame
nodfp is a global, so modifying it is unsafe in a concurrent backend. It is also not necessary, since the Used marks are only relevant for nodes in fn.Dcl. For good measure, mark nodfp as always used. Passes toolstash-check. Updates #15756 Change-Id: I5320459f5eced2898615a17b395a10c1064bcaf5 Reviewed-on: https://go-review.googlesource.com/39200 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
a1cedf0842
commit
3751513562
@ -207,7 +207,6 @@ func (s *ssafn) AllocFrame(f *ssa.Func) {
|
||||
if ls, ok := l.(ssa.LocalSlot); ok {
|
||||
ls.N.(*Node).SetUsed(true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
scratchUsed := false
|
||||
@ -215,7 +214,11 @@ func (s *ssafn) AllocFrame(f *ssa.Func) {
|
||||
for _, v := range b.Values {
|
||||
switch a := v.Aux.(type) {
|
||||
case *ssa.ArgSymbol:
|
||||
a.Node.(*Node).SetUsed(true)
|
||||
n := a.Node.(*Node)
|
||||
// Don't modify nodfp; it is a global.
|
||||
if n != nodfp {
|
||||
n.SetUsed(true)
|
||||
}
|
||||
case *ssa.AutoSymbol:
|
||||
a.Node.(*Node).SetUsed(true)
|
||||
}
|
||||
|
@ -463,4 +463,5 @@ func finishUniverse() {
|
||||
nodfp = newname(lookup(".fp"))
|
||||
nodfp.Type = Types[TINT32]
|
||||
nodfp.Class = PPARAM
|
||||
nodfp.SetUsed(true)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user