1
0
mirror of https://github.com/golang/go synced 2024-11-11 20:20:23 -07:00

[dev.regabi] cmd/compile: remove unneeded packages from ir.Pkgs

ir.Pkgs.Itablink isn't used anymore. (I don't recall what it was ever
used for.)

ir.Pkgs.Race and ir.Pkgs.Msan are only needed in exactly only place,
so just create them on demand there, the same way that we create
"main" on demand.

Change-Id: I3474bb949f71cd40c7a462b9f4a369adeacde0d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/284230
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
Matthew Dempsky 2021-01-17 02:16:58 -08:00
parent 99a5db11ac
commit 7e0fa38aad
3 changed files with 9 additions and 20 deletions

View File

@ -96,9 +96,6 @@ func Main(archInit func(*ssagen.ArchInfo)) {
ir.Pkgs.Itab = types.NewPkg("go.itab", "go.itab")
ir.Pkgs.Itab.Prefix = "go.itab" // not go%2eitab
ir.Pkgs.Itablink = types.NewPkg("go.itablink", "go.itablink")
ir.Pkgs.Itablink.Prefix = "go.itablink" // not go%2eitablink
ir.Pkgs.Track = types.NewPkg("go.track", "go.track")
ir.Pkgs.Track.Prefix = "go.track" // not go%2etrack
@ -160,12 +157,6 @@ func Main(archInit func(*ssagen.ArchInfo)) {
ssagen.Arch.LinkArch.Init(base.Ctxt)
startProfile()
if base.Flag.Race {
ir.Pkgs.Race = types.NewPkg("runtime/race", "")
}
if base.Flag.MSan {
ir.Pkgs.Msan = types.NewPkg("runtime/msan", "")
}
if base.Flag.Race || base.Flag.MSan {
base.Flag.Cfg.Instrumenting = true
}

View File

@ -67,10 +67,7 @@ var Syms struct {
var Pkgs struct {
Go *types.Pkg
Itab *types.Pkg
Itablink *types.Pkg
Map *types.Pkg
Msan *types.Pkg
Race *types.Pkg
Runtime *types.Pkg
Track *types.Pkg
Unsafe *types.Pkg

View File

@ -1426,11 +1426,12 @@ func WriteBasicTypes() {
dimportpath(ir.Pkgs.Runtime)
if base.Flag.Race {
dimportpath(ir.Pkgs.Race)
dimportpath(types.NewPkg("runtime/race", ""))
}
if base.Flag.MSan {
dimportpath(ir.Pkgs.Msan)
dimportpath(types.NewPkg("runtime/msan", ""))
}
dimportpath(types.NewPkg("main", ""))
}
}