]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: remove TypeAssertExpr {Src,Dst}Type fields
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 15 Jan 2021 15:21:33 +0000 (22:21 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Sat, 16 Jan 2021 01:36:11 +0000 (01:36 +0000)
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>
src/cmd/compile/internal/ir/expr.go
src/cmd/compile/internal/ssagen/ssa.go
src/cmd/compile/internal/walk/expr.go

index 39659c45c01b033ee5ea034fb007fb3a9f68bb1f..5b1be7fc0f3ecbf9ab89284315a88e4af7cb7a0d 100644 (file)
@@ -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 {
index c48ac22d2a1fb3122aeae1c5e0ec7d6f8ec932a5..48942e01d6ed2951281a1ed400a7a15dd44615cf 100644 (file)
@@ -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 {
index 449f8ea3ec0fd5440073b6e967afecf830f7d2ce..c9b7c0704e8887a54e71f26625b5caacac71ac30 100644 (file)
@@ -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())
        }