From 7e0fa38aad7bb402fcd08a66adc6492818c79dcf Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Sun, 17 Jan 2021 02:16:58 -0800 Subject: [PATCH] [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 Run-TryBot: Matthew Dempsky TryBot-Result: Go Bot Reviewed-by: Cuong Manh Le --- src/cmd/compile/internal/gc/main.go | 9 --------- src/cmd/compile/internal/ir/symtab.go | 15 ++++++--------- src/cmd/compile/internal/reflectdata/reflect.go | 5 +++-- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index e9ac243527..f758933d79 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -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 } diff --git a/src/cmd/compile/internal/ir/symtab.go b/src/cmd/compile/internal/ir/symtab.go index 80e4571764..0968efbf5c 100644 --- a/src/cmd/compile/internal/ir/symtab.go +++ b/src/cmd/compile/internal/ir/symtab.go @@ -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 } diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go index fd3e6beaa3..fe0bd26927 100644 --- a/src/cmd/compile/internal/reflectdata/reflect.go +++ b/src/cmd/compile/internal/reflectdata/reflect.go @@ -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", "")) } } -- 2.50.0