Commit 37515135 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

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: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent a1cedf08
...@@ -207,7 +207,6 @@ func (s *ssafn) AllocFrame(f *ssa.Func) { ...@@ -207,7 +207,6 @@ func (s *ssafn) AllocFrame(f *ssa.Func) {
if ls, ok := l.(ssa.LocalSlot); ok { if ls, ok := l.(ssa.LocalSlot); ok {
ls.N.(*Node).SetUsed(true) ls.N.(*Node).SetUsed(true)
} }
} }
scratchUsed := false scratchUsed := false
...@@ -215,7 +214,11 @@ func (s *ssafn) AllocFrame(f *ssa.Func) { ...@@ -215,7 +214,11 @@ func (s *ssafn) AllocFrame(f *ssa.Func) {
for _, v := range b.Values { for _, v := range b.Values {
switch a := v.Aux.(type) { switch a := v.Aux.(type) {
case *ssa.ArgSymbol: 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: case *ssa.AutoSymbol:
a.Node.(*Node).SetUsed(true) a.Node.(*Node).SetUsed(true)
} }
......
...@@ -463,4 +463,5 @@ func finishUniverse() { ...@@ -463,4 +463,5 @@ func finishUniverse() {
nodfp = newname(lookup(".fp")) nodfp = newname(lookup(".fp"))
nodfp.Type = Types[TINT32] nodfp.Type = Types[TINT32]
nodfp.Class = PPARAM nodfp.Class = PPARAM
nodfp.SetUsed(true)
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment