]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: remove unneeded packages from ir.Pkgs
authorMatthew Dempsky <mdempsky@google.com>
Sun, 17 Jan 2021 10:16:58 +0000 (02:16 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Sun, 17 Jan 2021 22:16:41 +0000 (22:16 +0000)
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>
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/ir/symtab.go
src/cmd/compile/internal/reflectdata/reflect.go

index e9ac24352779bf4f6fb09af9c79b6c61b4130eeb..f758933d79e396af3b70df040e548d6c9c6caf1e 100644 (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
        }
index 80e457176490ce1359dda7f202dde2aceb795af8..0968efbf5cb3ed62437e24268d11827a67ffddcd 100644 (file)
@@ -65,13 +65,10 @@ var Syms struct {
 
 // Pkgs holds known packages.
 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
+       Go      *types.Pkg
+       Itab    *types.Pkg
+       Map     *types.Pkg
+       Runtime *types.Pkg
+       Track   *types.Pkg
+       Unsafe  *types.Pkg
 }
index fd3e6beaa3bca25732ff36f8c980ebc6ea632c21..fe0bd269272b6e253bbdd4969030bf816a891627 100644 (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", ""))
        }
 }