llgo/ssa: AfterInit/SliceLit/InterfaceData, unsafe.Slice; ssa/abi: Basic/Struct

This commit is contained in:
xushiwei
2024-05-22 10:07:21 +08:00
parent 556939139b
commit c19786bdfb
18 changed files with 361 additions and 202 deletions

View File

@@ -8,21 +8,20 @@ import (
"unsafe"
)
type iface struct {
tab *itab
data unsafe.Pointer
}
/*
type eface struct {
_type *_type
data unsafe.Pointer
}
/*
func efaceOf(ep *any) *eface {
return (*eface)(unsafe.Pointer(ep))
}
*/
type iface struct {
tab *itab
data unsafe.Pointer
}
// layout of Itab known to compilers
// allocated in non-garbage-collected memory
@@ -35,3 +34,11 @@ type itab struct {
_ [4]byte
fun [1]uintptr // variable sized. fun[0]==0 means _type does not implement inter.
}
func MakeInterface(inter *InterfaceType, typ *Type, data unsafe.Pointer) Interface {
tab := &itab{inter: inter, _type: typ, hash: 0, fun: [1]uintptr{0}}
return Interface{
tab: tab, data: data,
}
}
*/