We use an "autogenerated" position in several places.
Rather than recreate it each time, make one early on and reuse it.
This removes the creation of new positions during the backend,
which was not concurrency-safe.
Updates #15756
Change-Id: Ic116b2e60f0e99de1a2ea87fe763831b50b645f8
Reviewed-on: https://go-review.googlesource.com/38915
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
fmt.Printf("genhash %v %v\n", sym, t)
}
- lineno = makePos(nil, 1, 0) // less confusing than end of input
+ lineno = autogeneratedPos // less confusing than end of input
dclcontext = PEXTERN
markdcl()
fmt.Printf("geneq %v %v\n", sym, t)
}
- lineno = makePos(nil, 1, 0) // less confusing than end of input
+ lineno = autogeneratedPos // less confusing than end of input
dclcontext = PEXTERN
markdcl()
var disable_checknil int
+var autogeneratedPos src.XPos
+
// interface to back end
type Arch struct {
package gc
-import "cmd/internal/src"
-
// a function named init is a special case.
// it is called by the initialization before
// main is run. to make it unique within a
}
func fninit(n []*Node) {
- lineno = makePos(src.NewFileBase("<autogenerated>", "<autogenerated>"), 1, 0)
+ lineno = autogeneratedPos
nf := initfix(n)
if !anyinit(nf) {
return
dclcontext = PEXTERN
nerrors = 0
+ autogeneratedPos = makePos(src.NewFileBase("<autogenerated>", "<autogenerated>"), 1, 0)
+
timings.Start("fe", "loadsys")
loadsys()
fmt.Printf("genwrapper rcvrtype=%v method=%v newnam=%v\n", rcvr, method, newnam)
}
- lineno = makePos(src.NewFileBase("<autogenerated>", "<autogenerated>"), 1, 0)
+ lineno = autogeneratedPos
dclcontext = PEXTERN
markdcl()