mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: add newnamel, use in tempAt
newnamel is newname but with no dependency on lineno or Curfn. This makes it suitable for use in a concurrent back end. Use it now to make tempAt global-free. The decision to push the assignment to n.Name.Curfn to the caller of newnamel is based on mdempsky's comments in #19683 that he'd like to do that for callers of newname as well. Passes toolstash-check. No compiler performance impact. Updates #19683 Updates #15756 Change-Id: Idc461a1716916d268c9ff323129830d9a6e4a4d9 Reviewed-on: https://go-review.googlesource.com/39191 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
4927b9a9ff
commit
3d90378df5
2 changed files with 23 additions and 18 deletions
|
|
@ -365,8 +365,16 @@ func nodl(pos src.XPos, op Op, nleft, nright *Node) *Node {
|
|||
|
||||
// newname returns a new ONAME Node associated with symbol s.
|
||||
func newname(s *Sym) *Node {
|
||||
n := newnamel(lineno, s)
|
||||
n.Name.Curfn = Curfn
|
||||
return n
|
||||
}
|
||||
|
||||
// newname returns a new ONAME Node associated with symbol s at position pos.
|
||||
// The caller is responsible for setting n.Name.Curfn.
|
||||
func newnamel(pos src.XPos, s *Sym) *Node {
|
||||
if s == nil {
|
||||
Fatalf("newname nil")
|
||||
Fatalf("newnamel nil")
|
||||
}
|
||||
|
||||
var x struct {
|
||||
|
|
@ -379,8 +387,7 @@ func newname(s *Sym) *Node {
|
|||
n.Name.Param = &x.Param
|
||||
|
||||
n.Op = ONAME
|
||||
n.Pos = lineno
|
||||
n.Name.Curfn = Curfn
|
||||
n.Pos = pos
|
||||
n.Orig = n
|
||||
|
||||
n.Sym = s
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue