aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/iface.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2016-06-06 08:29:52 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2016-08-16 15:24:33 +0000
commit562d06fc23261b21d12fbcbd407aadee9cb428cb (patch)
tree6da849975366a238b8be485ce3f5716a00996100 /src/runtime/iface.go
parente6e26eeb299f9829ac70bd400d011bfdd266f1c1 (diff)
downloadgo-562d06fc23261b21d12fbcbd407aadee9cb428cb.tar.gz
go-562d06fc23261b21d12fbcbd407aadee9cb428cb.zip
cmd/compile: inline _, ok = i.(T)
We already inlined _, ok = e.(T) _, ok = i.(E) _, ok = e.(E) The only ok-only variants not inlined are now _, ok = i.(I) _, ok = e.(I) These call getitab, so are non-trivial. Change-Id: Ie45fd8933ee179a679b92ce925079b94cff0ee12 Reviewed-on: https://go-review.googlesource.com/26658 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/iface.go')
-rw-r--r--src/runtime/iface.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/runtime/iface.go b/src/runtime/iface.go
index 1690147fac..7f24a6e69c 100644
--- a/src/runtime/iface.go
+++ b/src/runtime/iface.go
@@ -218,20 +218,17 @@ func assertI2T(t *_type, i iface, r unsafe.Pointer) {
}
}
+// The compiler ensures that r is non-nil.
func assertI2T2(t *_type, i iface, r unsafe.Pointer) bool {
tab := i.tab
if tab == nil || tab._type != t {
- if r != nil {
- memclr(r, t.size)
- }
+ memclr(r, t.size)
return false
}
- if r != nil {
- if isDirectIface(t) {
- writebarrierptr((*uintptr)(r), uintptr(i.data))
- } else {
- typedmemmove(t, r, i.data)
- }
+ if isDirectIface(t) {
+ writebarrierptr((*uintptr)(r), uintptr(i.data))
+ } else {
+ typedmemmove(t, r, i.data)
}
return true
}