diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-06-21 22:21:40 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-06-21 22:21:40 +0000 |
commit | f4e7200b1df3dde7d2d9cec8861c6567356db40f (patch) | |
tree | 0228f7d9bd47636d53adb5a8e0cc2ec7f110184a /libgo | |
parent | 0514cb33749fefd2542e7294a35d0ef0ccae30b3 (diff) | |
download | gcc-f4e7200b1df3dde7d2d9cec8861c6567356db40f.zip gcc-f4e7200b1df3dde7d2d9cec8861c6567356db40f.tar.gz gcc-f4e7200b1df3dde7d2d9cec8861c6567356db40f.tar.bz2 |
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
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/go/runtime/alg.go | 10 | ||||
-rw-r--r-- | libgo/go/runtime/iface.go | 12 | ||||
-rw-r--r-- | libgo/go/runtime/type.go | 5 |
3 files changed, 11 insertions, 16 deletions
diff --git a/libgo/go/runtime/alg.go b/libgo/go/runtime/alg.go index c6bc6b6..ec951e3 100644 --- a/libgo/go/runtime/alg.go +++ b/libgo/go/runtime/alg.go @@ -205,7 +205,7 @@ func nilinterequal(p, q unsafe.Pointer) bool { } func efaceeq(x, y eface) bool { t := x._type - if !eqtype(t, y._type) { + if t != y._type { return false } if t == nil { @@ -229,7 +229,7 @@ func ifaceeq(x, y iface) bool { return false } t := *(**_type)(xtab) - if !eqtype(t, *(**_type)(y.tab)) { + if t != *(**_type)(y.tab) { return false } eq := t.equalfn @@ -247,7 +247,7 @@ func ifacevaleq(x iface, t *_type, p unsafe.Pointer) bool { return false } xt := *(**_type)(x.tab) - if !eqtype(xt, t) { + if xt != t { return false } eq := t.equalfn @@ -268,7 +268,7 @@ func ifaceefaceeq(x iface, y eface) bool { return false } xt := *(**_type)(x.tab) - if !eqtype(xt, y._type) { + if xt != y._type { return false } eq := xt.equalfn @@ -285,7 +285,7 @@ func efacevaleq(x eface, t *_type, p unsafe.Pointer) bool { if x._type == nil { return false } - if !eqtype(x._type, t) { + if x._type != t { return false } eq := t.equalfn diff --git a/libgo/go/runtime/iface.go b/libgo/go/runtime/iface.go index 6def738..d434f9e 100644 --- a/libgo/go/runtime/iface.go +++ b/libgo/go/runtime/iface.go @@ -233,7 +233,7 @@ func (m *itab) init() string { ri++ } - if !eqtype(lhsMethod.typ, rhsMethod.mtyp) { + if lhsMethod.typ != rhsMethod.mtyp { m.methods[1] = nil return *lhsMethod.name } @@ -406,7 +406,7 @@ func ifaceI2I2(inter *_type, i iface) (iface, bool) { // Convert an empty interface to a pointer non-interface type. func ifaceE2T2P(t *_type, e eface) (unsafe.Pointer, bool) { - if !eqtype(t, e._type) { + if t != e._type { return nil, false } else { return e.data, true @@ -415,7 +415,7 @@ func ifaceE2T2P(t *_type, e eface) (unsafe.Pointer, bool) { // Convert a non-empty interface to a pointer non-interface type. 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 } else { return i.data, true @@ -424,7 +424,7 @@ func ifaceI2T2P(t *_type, i iface) (unsafe.Pointer, bool) { // Convert an empty interface to a non-pointer non-interface type. func ifaceE2T2(t *_type, e eface, ret unsafe.Pointer) bool { - if !eqtype(t, e._type) { + if t != e._type { typedmemclr(t, ret) return false } else { @@ -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. 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) return false } else { @@ -485,7 +485,7 @@ func ifaceT2Ip(to, from *_type) bool { ri++ } - if !eqtype(fromMethod.mtyp, toMethod.typ) { + if fromMethod.mtyp != toMethod.typ { return false } diff --git a/libgo/go/runtime/type.go b/libgo/go/runtime/type.go index 3bdb8f1..8af6246 100644 --- a/libgo/go/runtime/type.go +++ b/libgo/go/runtime/type.go @@ -48,11 +48,6 @@ func (t *_type) pkgpath() string { return "" } -// Return whether two type descriptors are equal. -func eqtype(t1, t2 *_type) bool { - return t1 == t2 -} - type method struct { name *string pkgPath *string |