runtime: inline and remove eqtype
Now that type equality is just a pointer equality, write it
inlined and remove the eqtype function.
Change-Id: Ie3f27be0a4cb6f7dc2b6470dd5ae63c6c8beed42
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/182978
Reviewed-by: Ian Lance Taylor <iant@golang.org>
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 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 @@
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 @@
return false
}
xt := *(**_type)(x.tab)
- if !eqtype(xt, t) {
+ if xt != t {
return false
}
eq := t.equalfn
@@ -268,7 +268,7 @@
return false
}
xt := *(**_type)(x.tab)
- if !eqtype(xt, y._type) {
+ if xt != y._type {
return false
}
eq := xt.equalfn
@@ -285,7 +285,7 @@
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 @@
ri++
}
- if !eqtype(lhsMethod.typ, rhsMethod.mtyp) {
+ if lhsMethod.typ != rhsMethod.mtyp {
m.methods[1] = nil
return *lhsMethod.name
}
@@ -406,7 +406,7 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
return ""
}
-// Return whether two type descriptors are equal.
-func eqtype(t1, t2 *_type) bool {
- return t1 == t2
-}
-
type method struct {
name *string
pkgPath *string