mirror of
https://github.com/golang/go.git
synced 2025-11-10 13:41:05 +00: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
3 changed files with 6 additions and 13 deletions
|
|
@ -615,10 +615,8 @@ 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
|
||||
// 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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6111,7 +6111,7 @@ func (s *state) floatToUint(cvttab *f2uCvtTab, n ir.Node, x *ssa.Value, ft, tt *
|
|||
// 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
|
||||
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…
Add table
Add a link
Reference in a new issue