mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
03b0065204
commit
84afa1be76
9 changed files with 99 additions and 142 deletions
|
|
@ -127,7 +127,7 @@ var BigEndian = _BigEndian
|
|||
// For benchmarking.
|
||||
|
||||
func BenchSetType(n int, x interface{}) {
|
||||
e := *(*eface)(unsafe.Pointer(&x))
|
||||
e := *efaceOf(&x)
|
||||
t := e._type
|
||||
var size uintptr
|
||||
var p unsafe.Pointer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue