mirror of
https://github.com/golang/go
synced 2024-11-26 01:57:56 -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:
parent
4a4212c0e5
commit
a2f825c542
@ -96,13 +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.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
|
||||
ir.Pkgs.Go = types.NewPkg("go", "")
|
||||
|
||||
|
@ -146,7 +146,7 @@ func dumpdata() {
|
||||
dumpglobls(typecheck.Target.Externs[numExterns:])
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -67,8 +67,6 @@ var Syms struct {
|
||||
var Pkgs struct {
|
||||
Go *types.Pkg
|
||||
Itab *types.Pkg
|
||||
Map *types.Pkg
|
||||
Runtime *types.Pkg
|
||||
Track *types.Pkg
|
||||
Unsafe *types.Pkg
|
||||
}
|
||||
|
@ -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
|
||||
// to be a member of struct/interface type t.
|
||||
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 {
|
||||
@ -1654,18 +1654,9 @@ func ZeroAddr(size int64) ir.Node {
|
||||
if ZeroSize < size {
|
||||
ZeroSize = size
|
||||
}
|
||||
s := ir.Pkgs.Map.Lookup("zero")
|
||||
if s.Def == nil {
|
||||
x := typecheck.NewName(s)
|
||||
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
|
||||
lsym := base.PkgLinksym("go.map", "zero", obj.ABI0)
|
||||
x := ir.NewLinksymExpr(base.Pos, lsym, types.Types[types.TUINT8])
|
||||
return typecheck.Expr(typecheck.NodAddr(x))
|
||||
}
|
||||
|
||||
func CollectPTabs() {
|
||||
|
Loading…
Reference in New Issue
Block a user