eface
eface 结构体表示不包含任何方法的 interface{} 类型,包含指向底层数据和类型的两个指针
// go1.13.9 runtime/runtime2.go 197
type eface struct {_type *_typedata unsafe.Pointer}
iface
iface 结构体表示包含方法的接口;
// go1.13.9 runtime/runtime2.go 192
type iface struct {tab *itabdata unsafe.Pointer}
itab
// go1.13.9 runtime/runtime2.go 730
type itab struct {inter *interfacetype_type *_typelink *itabhash uint32 // copy of _type.hash. Used for type switches.bad bool // type does not implement interfaceinhash bool // has this itab been added to hash?unused [2]bytefun [1]uintptr // variable sized}
interfacetype
// go1.13.9 runtime/type.go 354
type interfacetype struct {typ _type //类型pkgpath name // 包路径mhdr []imethod //接口定义的函数列表}
_type
type _type struct {size uintptr // 类型大小ptrdata uintptr // size of memory prefix holding all pointershash uint32 // 类型hashtflag tflag // 类型flagalign uint8 // 类型对齐fieldalign uint8kind uint8 //类型alg *typeAlg// gcdata stores the GC type data for the garbage collector.// If the KindGCProg bit is set in kind, gcdata is a GC program.// Otherwise it is a ptrmask bitmap. See mbitmap.go for details.gcdata *bytestr nameOffptrToThis typeOff}
size类型占用的内存空间,为内存空间的分配提供信息;hash 字段能够帮助我们快速确定类型是否相等
