aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime2.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2015-10-21 12:12:25 -0700
committerMatthew Dempsky <mdempsky@google.com>2015-10-21 23:08:22 +0000
commit84afa1be76f89a602c1aef73603175e644f1dc2f (patch)
tree090b42d927619808e5c4bb61461dfc20b5857463 /src/runtime/runtime2.go
parent03b0065204df9cd141919890b23de6291ab52885 (diff)
downloadgo-84afa1be76f89a602c1aef73603175e644f1dc2f.tar.xz
runtime: make iface/eface handling more type safe
Change compiler-invoked interface functions to directly take iface/eface parameters instead of fInterface/interface{} to avoid needing to always convert. For the handful of functions that legitimately need to take an interface{} parameter, add efaceOf to type-safely convert *interface{} to *eface. Change-Id: I8928761a12fd3c771394f36adf93d3006a9fcf39 Reviewed-on: https://go-review.googlesource.com/16166 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/runtime2.go')
-rw-r--r--src/runtime/runtime2.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 97d5ed2752..d4e3758678 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -82,6 +82,10 @@ type eface struct {
data unsafe.Pointer
}
+func efaceOf(ep *interface{}) *eface {
+ return (*eface)(unsafe.Pointer(ep))
+}
+
// The guintptr, muintptr, and puintptr are all used to bypass write barriers.
// It is particularly important to avoid write barriers when the current P has
// been released, because the GC thinks the world is stopped, and an