]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: don't modify nodfp in AllocFrame
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 31 Mar 2017 23:52:50 +0000 (16:52 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 3 Apr 2017 01:22:58 +0000 (01:22 +0000)
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>
src/cmd/compile/internal/gc/pgen.go
src/cmd/compile/internal/gc/universe.go

index 71d9b8f9e361ad4dc9d7c928989f8d18ec4790af..06b7e5a691de393de2ecf3dc73ea177a759d0b12 100644 (file)
@@ -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)
                        }
index fea0103b334a19db79802ff2f9090790ac8ca449..50f7335cd02683fa9fae1d14f3c457b9dbc9e26f 100644 (file)
@@ -463,4 +463,5 @@ func finishUniverse() {
        nodfp = newname(lookup(".fp"))
        nodfp.Type = Types[TINT32]
        nodfp.Class = PPARAM
+       nodfp.SetUsed(true)
 }