ssa: MakeInterface check abi.KindDirectIface

This commit is contained in:
visualfc
2024-06-02 19:56:37 +08:00
parent 73d6bd8400
commit 7596658e6c
13 changed files with 1761 additions and 712 deletions

Binary file not shown.

View File

@@ -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))

View File

@@ -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
}
// -----------------------------------------------------------------------------