mirror of
https://github.com/golang/go.git
synced 2025-11-10 13:41:05 +00:00
[dev.regabi] cmd/compile: use LinksymOffsetExpr in TypePtr/ItabAddr
Passes toolstash -cmp. Fixes #43737 Change-Id: I2d5228c0213b5f8742e3cea6fac9bc985b19d78c Reviewed-on: https://go-review.googlesource.com/c/go/+/284122 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
0ffa1ead6e
commit
4c835f9169
2 changed files with 9 additions and 26 deletions
|
|
@ -836,39 +836,22 @@ func TypeLinksym(t *types.Type) *obj.LSym {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TypePtr(t *types.Type) *ir.AddrExpr {
|
func TypePtr(t *types.Type) *ir.AddrExpr {
|
||||||
s := TypeSym(t)
|
n := ir.NewLinksymExpr(base.Pos, TypeLinksym(t), types.Types[types.TUINT8])
|
||||||
if s.Def == nil {
|
return typecheck.Expr(typecheck.NodAddr(n)).(*ir.AddrExpr)
|
||||||
n := ir.NewNameAt(src.NoXPos, s)
|
|
||||||
n.SetType(types.Types[types.TUINT8])
|
|
||||||
n.Class = ir.PEXTERN
|
|
||||||
n.SetTypecheck(1)
|
|
||||||
s.Def = n
|
|
||||||
}
|
|
||||||
|
|
||||||
n := typecheck.NodAddr(ir.AsNode(s.Def))
|
|
||||||
n.SetType(types.NewPtr(s.Def.Type()))
|
|
||||||
n.SetTypecheck(1)
|
|
||||||
return n
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func ITabAddr(t, itype *types.Type) *ir.AddrExpr {
|
func ITabAddr(t, itype *types.Type) *ir.AddrExpr {
|
||||||
if t == nil || (t.IsPtr() && t.Elem() == nil) || t.IsUntyped() || !itype.IsInterface() || itype.IsEmptyInterface() {
|
if t == nil || (t.IsPtr() && t.Elem() == nil) || t.IsUntyped() || !itype.IsInterface() || itype.IsEmptyInterface() {
|
||||||
base.Fatalf("ITabAddr(%v, %v)", t, itype)
|
base.Fatalf("ITabAddr(%v, %v)", t, itype)
|
||||||
}
|
}
|
||||||
s := ir.Pkgs.Itab.Lookup(t.ShortString() + "," + itype.ShortString())
|
s, existed := ir.Pkgs.Itab.LookupOK(t.ShortString() + "," + itype.ShortString())
|
||||||
if s.Def == nil {
|
if !existed {
|
||||||
n := typecheck.NewName(s)
|
itabs = append(itabs, itabEntry{t: t, itype: itype, lsym: s.Linksym()})
|
||||||
n.SetType(types.Types[types.TUINT8])
|
|
||||||
n.Class = ir.PEXTERN
|
|
||||||
n.SetTypecheck(1)
|
|
||||||
s.Def = n
|
|
||||||
itabs = append(itabs, itabEntry{t: t, itype: itype, lsym: n.Linksym()})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
n := typecheck.NodAddr(ir.AsNode(s.Def))
|
lsym := s.Linksym()
|
||||||
n.SetType(types.NewPtr(s.Def.Type()))
|
n := ir.NewLinksymExpr(base.Pos, lsym, types.Types[types.TUINT8])
|
||||||
n.SetTypecheck(1)
|
return typecheck.Expr(typecheck.NodAddr(n)).(*ir.AddrExpr)
|
||||||
return n
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// needkeyupdate reports whether map updates with t as a key
|
// needkeyupdate reports whether map updates with t as a key
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,7 @@ func (s *Schedule) StaticAssign(l *ir.Name, loff int64, r ir.Node, typ *types.Ty
|
||||||
// Create a copy of l to modify while we emit data.
|
// Create a copy of l to modify while we emit data.
|
||||||
|
|
||||||
// Emit itab, advance offset.
|
// Emit itab, advance offset.
|
||||||
staticdata.InitAddr(l, loff, itab.X.(*ir.Name).Linksym())
|
staticdata.InitAddr(l, loff, itab.X.(*ir.LinksymOffsetExpr).Linksym)
|
||||||
|
|
||||||
// Emit data.
|
// Emit data.
|
||||||
if types.IsDirectIface(val.Type()) {
|
if types.IsDirectIface(val.Type()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue