Commit f4e7200b by Ian Lance Taylor

runtime: inline and remove eqtype

    
    Now that type equality is just a pointer equality, write it
    inlined and remove the eqtype function.
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/182978

From-SVN: r272578
parent 0514cb33
5bca69ab3b41df535193474baecc3a8a4c0b3dbe fdf0af774aabb31ba8a62f358b7b40dfe8b35da9
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -205,7 +205,7 @@ func nilinterequal(p, q unsafe.Pointer) bool { ...@@ -205,7 +205,7 @@ func nilinterequal(p, q unsafe.Pointer) bool {
} }
func efaceeq(x, y eface) bool { func efaceeq(x, y eface) bool {
t := x._type t := x._type
if !eqtype(t, y._type) { if t != y._type {
return false return false
} }
if t == nil { if t == nil {
...@@ -229,7 +229,7 @@ func ifaceeq(x, y iface) bool { ...@@ -229,7 +229,7 @@ func ifaceeq(x, y iface) bool {
return false return false
} }
t := *(**_type)(xtab) t := *(**_type)(xtab)
if !eqtype(t, *(**_type)(y.tab)) { if t != *(**_type)(y.tab) {
return false return false
} }
eq := t.equalfn eq := t.equalfn
...@@ -247,7 +247,7 @@ func ifacevaleq(x iface, t *_type, p unsafe.Pointer) bool { ...@@ -247,7 +247,7 @@ func ifacevaleq(x iface, t *_type, p unsafe.Pointer) bool {
return false return false
} }
xt := *(**_type)(x.tab) xt := *(**_type)(x.tab)
if !eqtype(xt, t) { if xt != t {
return false return false
} }
eq := t.equalfn eq := t.equalfn
...@@ -268,7 +268,7 @@ func ifaceefaceeq(x iface, y eface) bool { ...@@ -268,7 +268,7 @@ func ifaceefaceeq(x iface, y eface) bool {
return false return false
} }
xt := *(**_type)(x.tab) xt := *(**_type)(x.tab)
if !eqtype(xt, y._type) { if xt != y._type {
return false return false
} }
eq := xt.equalfn eq := xt.equalfn
...@@ -285,7 +285,7 @@ func efacevaleq(x eface, t *_type, p unsafe.Pointer) bool { ...@@ -285,7 +285,7 @@ func efacevaleq(x eface, t *_type, p unsafe.Pointer) bool {
if x._type == nil { if x._type == nil {
return false return false
} }
if !eqtype(x._type, t) { if x._type != t {
return false return false
} }
eq := t.equalfn eq := t.equalfn
......
...@@ -233,7 +233,7 @@ func (m *itab) init() string { ...@@ -233,7 +233,7 @@ func (m *itab) init() string {
ri++ ri++
} }
if !eqtype(lhsMethod.typ, rhsMethod.mtyp) { if lhsMethod.typ != rhsMethod.mtyp {
m.methods[1] = nil m.methods[1] = nil
return *lhsMethod.name return *lhsMethod.name
} }
...@@ -406,7 +406,7 @@ func ifaceI2I2(inter *_type, i iface) (iface, bool) { ...@@ -406,7 +406,7 @@ func ifaceI2I2(inter *_type, i iface) (iface, bool) {
// Convert an empty interface to a pointer non-interface type. // Convert an empty interface to a pointer non-interface type.
func ifaceE2T2P(t *_type, e eface) (unsafe.Pointer, bool) { func ifaceE2T2P(t *_type, e eface) (unsafe.Pointer, bool) {
if !eqtype(t, e._type) { if t != e._type {
return nil, false return nil, false
} else { } else {
return e.data, true return e.data, true
...@@ -415,7 +415,7 @@ func ifaceE2T2P(t *_type, e eface) (unsafe.Pointer, bool) { ...@@ -415,7 +415,7 @@ func ifaceE2T2P(t *_type, e eface) (unsafe.Pointer, bool) {
// Convert a non-empty interface to a pointer non-interface type. // Convert a non-empty interface to a pointer non-interface type.
func ifaceI2T2P(t *_type, i iface) (unsafe.Pointer, bool) { func ifaceI2T2P(t *_type, i iface) (unsafe.Pointer, bool) {
if i.tab == nil || !eqtype(t, *(**_type)(i.tab)) { if i.tab == nil || t != *(**_type)(i.tab) {
return nil, false return nil, false
} else { } else {
return i.data, true return i.data, true
...@@ -424,7 +424,7 @@ func ifaceI2T2P(t *_type, i iface) (unsafe.Pointer, bool) { ...@@ -424,7 +424,7 @@ func ifaceI2T2P(t *_type, i iface) (unsafe.Pointer, bool) {
// Convert an empty interface to a non-pointer non-interface type. // Convert an empty interface to a non-pointer non-interface type.
func ifaceE2T2(t *_type, e eface, ret unsafe.Pointer) bool { func ifaceE2T2(t *_type, e eface, ret unsafe.Pointer) bool {
if !eqtype(t, e._type) { if t != e._type {
typedmemclr(t, ret) typedmemclr(t, ret)
return false return false
} else { } else {
...@@ -439,7 +439,7 @@ func ifaceE2T2(t *_type, e eface, ret unsafe.Pointer) bool { ...@@ -439,7 +439,7 @@ func ifaceE2T2(t *_type, e eface, ret unsafe.Pointer) bool {
// Convert a non-empty interface to a non-pointer non-interface type. // Convert a non-empty interface to a non-pointer non-interface type.
func ifaceI2T2(t *_type, i iface, ret unsafe.Pointer) bool { func ifaceI2T2(t *_type, i iface, ret unsafe.Pointer) bool {
if i.tab == nil || !eqtype(t, *(**_type)(i.tab)) { if i.tab == nil || t != *(**_type)(i.tab) {
typedmemclr(t, ret) typedmemclr(t, ret)
return false return false
} else { } else {
...@@ -485,7 +485,7 @@ func ifaceT2Ip(to, from *_type) bool { ...@@ -485,7 +485,7 @@ func ifaceT2Ip(to, from *_type) bool {
ri++ ri++
} }
if !eqtype(fromMethod.mtyp, toMethod.typ) { if fromMethod.mtyp != toMethod.typ {
return false return false
} }
......
...@@ -48,11 +48,6 @@ func (t *_type) pkgpath() string { ...@@ -48,11 +48,6 @@ func (t *_type) pkgpath() string {
return "" return ""
} }
// Return whether two type descriptors are equal.
func eqtype(t1, t2 *_type) bool {
return t1 == t2
}
type method struct { type method struct {
name *string name *string
pkgPath *string pkgPath *string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment