diff options
Diffstat (limited to 'libgo/go/runtime/iface.go')
-rw-r--r-- | libgo/go/runtime/iface.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/libgo/go/runtime/iface.go b/libgo/go/runtime/iface.go index 74b54f5..5667ddb 100644 --- a/libgo/go/runtime/iface.go +++ b/libgo/go/runtime/iface.go @@ -232,7 +232,7 @@ func (m *itab) init() string { ri++ } - if lhsMethod.typ != rhsMethod.mtyp { + if !eqtype(lhsMethod.typ, rhsMethod.mtyp) { m.methods[1] = nil return *lhsMethod.name } @@ -296,6 +296,7 @@ func getitab(lhs, rhs *_type, canfail bool) unsafe.Pointer { } // Not found. Grab the lock and try again. + lockInit(&itabLock, lockRankItab) lock(&itabLock) if m = itabTable.find(lhsi, rhs); m != nil { unlock(&itabLock) @@ -405,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 t != e._type { + if !eqtype(t, e._type) { return nil, false } else { return e.data, true @@ -414,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 || t != *(**_type)(i.tab) { + if i.tab == nil || !eqtype(t, *(**_type)(i.tab)) { return nil, false } else { return i.data, true @@ -423,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 t != e._type { + if !eqtype(t, e._type) { typedmemclr(t, ret) return false } else { @@ -438,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 || t != *(**_type)(i.tab) { + if i.tab == nil || !eqtype(t, *(**_type)(i.tab)) { typedmemclr(t, ret) return false } else { @@ -484,7 +485,7 @@ func ifaceT2Ip(to, from *_type) bool { ri++ } - if fromMethod.mtyp != toMethod.typ { + if !eqtype(fromMethod.mtyp, toMethod.typ) { return false } @@ -514,8 +515,8 @@ func reflectlite_ifaceE2I(inter *interfacetype, e eface, dst *iface) { dst.data = e.data } -// staticbytes is used to avoid convT2E for byte-sized values. -var staticbytes = [...]byte{ +// staticuint64s is used to avoid allocating in convTx for small integer values. +var staticuint64s = [...]uint64{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |