llgo/ssa: MakeInterface

This commit is contained in:
xushiwei
2024-04-29 22:57:40 +08:00
parent 85bb1302ca
commit f64abf37ab
7 changed files with 40 additions and 14 deletions

View File

@@ -22,7 +22,7 @@ import (
"github.com/goplus/llgo/internal/abi"
)
type Interface = iface
// -----------------------------------------------------------------------------
type InterfaceType = abi.InterfaceType
@@ -30,6 +30,10 @@ var (
TyAny = &InterfaceType{}
)
// -----------------------------------------------------------------------------
type Interface = iface
func MakeAnyInt(typ *Type, data uintptr) Interface {
return Interface{
tab: &itab{inter: TyAny, _type: typ, hash: 0, fun: [1]uintptr{0}},
@@ -71,3 +75,5 @@ func CheckI2Int(v Interface, t *Type) (uintptr, bool) {
}
return 0, false
}
// -----------------------------------------------------------------------------

View File

@@ -20,6 +20,8 @@ import (
"unsafe"
)
// -----------------------------------------------------------------------------
// Slice is the runtime representation of a slice.
type Slice struct {
array unsafe.Pointer
@@ -31,3 +33,5 @@ type Slice struct {
func NilSlice() Slice {
return Slice{nil, 0, 0}
}
// -----------------------------------------------------------------------------

View File

@@ -20,6 +20,8 @@ import (
"unsafe"
)
// -----------------------------------------------------------------------------
// String is the runtime representation of a string.
// It cannot be used safely or portably and its representation may
// change in a later release.
@@ -35,3 +37,5 @@ type String struct {
func EmptyString() String {
return String{nil, 0}
}
// -----------------------------------------------------------------------------

View File

@@ -22,6 +22,8 @@ import (
"github.com/goplus/llgo/internal/abi"
)
// -----------------------------------------------------------------------------
type Kind = abi.Kind
type Type = abi.Type
@@ -79,3 +81,5 @@ func basicType(kind abi.Kind) *Type {
Kind_: uint8(kind),
}
}
// -----------------------------------------------------------------------------