mirror of
https://github.com/golang/go
synced 2024-11-26 05:27:57 -07:00
[dev.regabi] cmd/compile: remove TypeAssertExpr {Src,Dst}Type fields
CL 283233 added reflectType method to ssagen.state, which we can use to setup type address in the SSA backend in favor of the frontend. However, this will change the order of symbols generation, so not safe for toolstash. Change-Id: Ib6932ec42a9d28c3fd7a1c055596e75494c29843 Reviewed-on: https://go-review.googlesource.com/c/go/+/284115 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
03a875137f
commit
c9b1445ac8
@ -615,11 +615,9 @@ type TypeAssertExpr struct {
|
||||
X Node
|
||||
Ntype Ntype
|
||||
|
||||
// Runtime type information provided by walkDotType.
|
||||
// Caution: These aren't always populated; see walkDotType.
|
||||
SrcType *AddrExpr `mknode:"-"` // *runtime._type for X's type
|
||||
DstType *AddrExpr `mknode:"-"` // *runtime._type for Type
|
||||
Itab *AddrExpr `mknode:"-"` // *runtime.itab for Type implementing X's type
|
||||
// Runtime type information provided by walkDotType for
|
||||
// assertions from non-empty interface to concrete type.
|
||||
Itab *AddrExpr `mknode:"-"` // *runtime.itab for Type implementing X's type
|
||||
}
|
||||
|
||||
func NewTypeAssertExpr(pos src.XPos, x Node, typ Ntype) *TypeAssertExpr {
|
||||
|
@ -6110,8 +6110,8 @@ func (s *state) floatToUint(cvttab *f2uCvtTab, n ir.Node, x *ssa.Value, ft, tt *
|
||||
// commaok indicates whether to panic or return a bool.
|
||||
// If commaok is false, resok will be nil.
|
||||
func (s *state) dottype(n *ir.TypeAssertExpr, commaok bool) (res, resok *ssa.Value) {
|
||||
iface := s.expr(n.X) // input interface
|
||||
target := s.expr(n.DstType) // target type
|
||||
iface := s.expr(n.X) // input interface
|
||||
target := s.reflectType(n.Type()) // target type
|
||||
byteptr := s.f.Config.Types.BytePtr
|
||||
|
||||
if n.Type().IsInterface() {
|
||||
@ -6245,7 +6245,7 @@ func (s *state) dottype(n *ir.TypeAssertExpr, commaok bool) (res, resok *ssa.Val
|
||||
if !commaok {
|
||||
// on failure, panic by calling panicdottype
|
||||
s.startBlock(bFail)
|
||||
taddr := s.expr(n.SrcType)
|
||||
taddr := s.reflectType(n.X.Type())
|
||||
if n.X.Type().IsEmptyInterface() {
|
||||
s.rtcall(ir.Syms.PanicdottypeE, false, nil, itab, target, taddr)
|
||||
} else {
|
||||
|
@ -619,11 +619,6 @@ func walkDot(n *ir.SelectorExpr, init *ir.Nodes) ir.Node {
|
||||
func walkDotType(n *ir.TypeAssertExpr, init *ir.Nodes) ir.Node {
|
||||
n.X = walkExpr(n.X, init)
|
||||
// Set up interface type addresses for back end.
|
||||
|
||||
n.DstType = reflectdata.TypePtr(n.Type())
|
||||
if n.Op() == ir.ODOTTYPE {
|
||||
n.SrcType = reflectdata.TypePtr(n.X.Type())
|
||||
}
|
||||
if !n.Type().IsInterface() && !n.X.Type().IsEmptyInterface() {
|
||||
n.Itab = reflectdata.ITabAddr(n.Type(), n.X.Type())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user