ssa: MakeInterface check abi.KindDirectIface
This commit is contained in:
Binary file not shown.
@@ -41,7 +41,7 @@ func Zeroinit(p unsafe.Pointer, size uintptr) unsafe.Pointer {
|
||||
|
||||
// TracePanic prints panic message.
|
||||
func TracePanic(v Eface) {
|
||||
kind := abi.Kind(v._type.Kind_)
|
||||
kind := v._type.Kind()
|
||||
switch {
|
||||
case kind == abi.String:
|
||||
stringTracef(c.Stderr, c.Str("panic: %s\n"), *(*String)(v.data))
|
||||
|
||||
@@ -132,7 +132,7 @@ func doInitNamed(ret *Type, pkgPath, name string, underlying *Type, methods []Me
|
||||
panic("runtime: underlying type is already named")
|
||||
}
|
||||
|
||||
kind := abi.Kind(ret.Kind_)
|
||||
kind := ret.Kind()
|
||||
if ret.TFlag != abi.TFlagUninited || kind != underlying.Kind() {
|
||||
panic("initNamed: unexpected named type")
|
||||
}
|
||||
@@ -246,4 +246,11 @@ func methods(u *abi.UncommonType, from string) []abi.Method {
|
||||
return u.ExportedMethods()
|
||||
}
|
||||
|
||||
func IfaceData(i iface) unsafe.Pointer {
|
||||
if i.tab._type.Kind_&abi.KindDirectIface != 0 {
|
||||
return unsafe.Pointer(&i.data)
|
||||
}
|
||||
return i.data
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user