mirror of
https://github.com/golang/go.git
synced 2025-11-02 01:30:55 +00:00
[dev.regabi] cmd/compile: address some ir TODOs
Previously, ODOTTYPE/ODOTTYPE2 were forced to reuse some available Node fields for storing pointers to runtime type descriptors. This resulted in awkward field types for TypeAssertExpr and AddrExpr. This CL gives TypeAssertExpr proper fields for the runtime type descriptors, and also tightens the field types as possible/appropriate. Passes toolstash -cmp. Change-Id: I521ee7a1462affc5459de33a0de6c68a7d6416ba Reviewed-on: https://go-review.googlesource.com/c/go/+/280637 Trust: Matthew Dempsky <mdempsky@google.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
parent
4629f6a51d
commit
6acbae4fcc
5 changed files with 18 additions and 17 deletions
|
|
@ -639,12 +639,13 @@ 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.Ntype = reflectdata.TypePtr(n.Type())
|
||||
|
||||
n.DstType = reflectdata.TypePtr(n.Type())
|
||||
if n.Op() == ir.ODOTTYPE {
|
||||
n.Ntype.(*ir.AddrExpr).Alloc = reflectdata.TypePtr(n.X.Type())
|
||||
n.SrcType = reflectdata.TypePtr(n.X.Type())
|
||||
}
|
||||
if !n.Type().IsInterface() && !n.X.Type().IsEmptyInterface() {
|
||||
n.Itab = []ir.Node{reflectdata.ITabAddr(n.Type(), n.X.Type())}
|
||||
n.Itab = reflectdata.ITabAddr(n.Type(), n.X.Type())
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue