1
0
mirror of https://github.com/golang/go synced 2024-11-26 06:27:58 -07:00

[dev.regabi] cmd/compile: directly create go.map and go.track symbols

These symbols are implementation details and don't correspond to Go
source symbols, so directly create them as linker symbols and get rid
of their pseudo packages.

Passes toolstash -cmp w/ -gcflags=all=-abiwrap.

Change-Id: I2e97374c21f3e909f6d350f15e7a5ed3574cadf4
Reviewed-on: https://go-review.googlesource.com/c/go/+/284372
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Matthew Dempsky 2021-01-17 02:53:18 -08:00
parent 4a4212c0e5
commit a2f825c542
4 changed files with 5 additions and 23 deletions

View File

@ -96,13 +96,6 @@ func Main(archInit func(*ssagen.ArchInfo)) {
ir.Pkgs.Itab = types.NewPkg("go.itab", "go.itab") ir.Pkgs.Itab = types.NewPkg("go.itab", "go.itab")
ir.Pkgs.Itab.Prefix = "go.itab" // not go%2eitab ir.Pkgs.Itab.Prefix = "go.itab" // not go%2eitab
ir.Pkgs.Track = types.NewPkg("go.track", "go.track")
ir.Pkgs.Track.Prefix = "go.track" // not go%2etrack
// pseudo-package used for map zero values
ir.Pkgs.Map = types.NewPkg("go.map", "go.map")
ir.Pkgs.Map.Prefix = "go.map"
// pseudo-package used for methods with anonymous receivers // pseudo-package used for methods with anonymous receivers
ir.Pkgs.Go = types.NewPkg("go", "") ir.Pkgs.Go = types.NewPkg("go", "")

View File

@ -146,7 +146,7 @@ func dumpdata() {
dumpglobls(typecheck.Target.Externs[numExterns:]) dumpglobls(typecheck.Target.Externs[numExterns:])
if reflectdata.ZeroSize > 0 { if reflectdata.ZeroSize > 0 {
zero := ir.Pkgs.Map.Lookup("zero").Linksym() zero := base.PkgLinksym("go.map", "zero", obj.ABI0)
objw.Global(zero, int32(reflectdata.ZeroSize), obj.DUPOK|obj.RODATA) objw.Global(zero, int32(reflectdata.ZeroSize), obj.DUPOK|obj.RODATA)
} }

View File

@ -67,8 +67,6 @@ var Syms struct {
var Pkgs struct { var Pkgs struct {
Go *types.Pkg Go *types.Pkg
Itab *types.Pkg Itab *types.Pkg
Map *types.Pkg
Runtime *types.Pkg Runtime *types.Pkg
Track *types.Pkg
Unsafe *types.Pkg Unsafe *types.Pkg
} }

View File

@ -791,7 +791,7 @@ func dcommontype(lsym *obj.LSym, t *types.Type) int {
// TrackSym returns the symbol for tracking use of field/method f, assumed // TrackSym returns the symbol for tracking use of field/method f, assumed
// to be a member of struct/interface type t. // to be a member of struct/interface type t.
func TrackSym(t *types.Type, f *types.Field) *obj.LSym { func TrackSym(t *types.Type, f *types.Field) *obj.LSym {
return ir.Pkgs.Track.Lookup(t.ShortString() + "." + f.Sym.Name).Linksym() return base.PkgLinksym("go.track", t.ShortString() + "." + f.Sym.Name, obj.ABI0)
} }
func TypeSymPrefix(prefix string, t *types.Type) *types.Sym { func TypeSymPrefix(prefix string, t *types.Type) *types.Sym {
@ -1654,18 +1654,9 @@ func ZeroAddr(size int64) ir.Node {
if ZeroSize < size { if ZeroSize < size {
ZeroSize = size ZeroSize = size
} }
s := ir.Pkgs.Map.Lookup("zero") lsym := base.PkgLinksym("go.map", "zero", obj.ABI0)
if s.Def == nil { x := ir.NewLinksymExpr(base.Pos, lsym, types.Types[types.TUINT8])
x := typecheck.NewName(s) return typecheck.Expr(typecheck.NodAddr(x))
x.SetType(types.Types[types.TUINT8])
x.Class = ir.PEXTERN
x.SetTypecheck(1)
s.Def = x
}
z := typecheck.NodAddr(ir.AsNode(s.Def))
z.SetType(types.NewPtr(types.Types[types.TUINT8]))
z.SetTypecheck(1)
return z
} }
func CollectPTabs() { func CollectPTabs() {