runtime

package
v0.9.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const MaxZero = 1024

TODO(xsw): check this must match declarations in runtime/map.go.

Variables

View Source
var ZeroVal [MaxZero]byte

Functions

func AllocU added in v0.5.0

func AllocU(size uintptr) unsafe.Pointer

AllocU allocates uninitialized memory.

func AllocZ added in v0.5.0

func AllocZ(size uintptr) unsafe.Pointer

AllocZ allocates zero-initialized memory.

func AssertIndexRange added in v0.8.3

func AssertIndexRange(b bool)

func AssertNegativeShift added in v0.8.3

func AssertNegativeShift(b bool)

func AssertRuntimeError added in v0.8.3

func AssertRuntimeError(b bool, msg string)

func CStrCopy added in v0.4.0

func CStrCopy(dest unsafe.Pointer, s String) *int8

CStrCopy copies a Go string to a C string buffer and returns it.

func CStrDup added in v0.4.0

func CStrDup(s String) *int8

func ChanCap added in v0.8.10

func ChanCap(p *Chan) int

func ChanClose added in v0.8.10

func ChanClose(p *Chan)

func ChanLen added in v0.8.10

func ChanLen(p *Chan) (n int)

func ChanRecv added in v0.8.10

func ChanRecv(p *Chan, v unsafe.Pointer, eltSize int) (recvOK bool)

func ChanSend added in v0.8.10

func ChanSend(p *Chan, v unsafe.Pointer, eltSize int) bool

func ChanTryRecv added in v0.8.10

func ChanTryRecv(p *Chan, v unsafe.Pointer, eltSize int) (recvOK bool, tryOK bool)

func ChanTrySend added in v0.8.10

func ChanTrySend(p *Chan, v unsafe.Pointer, eltSize int) bool

func CreateThread added in v0.9.7

func CreateThread(th *pthread.Thread, attr *pthread.Attr, routine pthread.RoutineFunc, arg c.Pointer) c.Int

func EfaceEqual added in v0.8.7

func EfaceEqual(v, u eface) bool

func IfacePtrData added in v0.8.6

func IfacePtrData(i iface) unsafe.Pointer

func IfaceType added in v0.8.6

func IfaceType(i iface) *abi.Type

func Implements added in v0.8.7

func Implements(T, V *abi.Type) bool

Implements reports whether the type V implements the interface type T.

func InitNamed added in v0.8.5

func InitNamed(ret *Type, pkgPath, name string, underlying *Type, methods, ptrMethods []Method)

InitNamed initializes an uninitialized named type.

func MakeMap added in v0.9.0

func MakeMap(t *maptype, hint int) *hmap

func MapAccess1 added in v0.9.0

func MapAccess1(t *maptype, h *hmap, key unsafe.Pointer) unsafe.Pointer

func MapAccess2 added in v0.9.0

func MapAccess2(t *maptype, h *hmap, key unsafe.Pointer) (unsafe.Pointer, bool)

func MapAssign added in v0.9.0

func MapAssign(t *maptype, h *Map, key unsafe.Pointer) unsafe.Pointer

func MapClear added in v0.9.0

func MapClear(t *maptype, h *hmap)

func MapDelete added in v0.9.0

func MapDelete(t *maptype, h *hmap, key unsafe.Pointer)

func MapIterNext added in v0.9.0

func MapIterNext(it *hiter) (ok bool, k unsafe.Pointer, v unsafe.Pointer)

func New added in v0.8.9

func New(t *Type) unsafe.Pointer

New allocates memory and initializes it to zero.

func NewArray added in v0.8.9

func NewArray(t *Type, n int) unsafe.Pointer

NewArray allocates memory for an array and initializes it to zero.

func NewMapIter added in v0.9.0

func NewMapIter(t *maptype, h *hmap) *hiter

func Panic added in v0.8.7

func Panic(v any)

Panic panics with a value.

func PanicSliceConvert added in v0.9.7

func PanicSliceConvert(x int, y int)

failures in the conversion ([x]T)(s) or (*[x]T)(s), 0 <= x <= y, y == len(s)

func PrintBool added in v0.8.3

func PrintBool(v bool)

func PrintByte added in v0.8.5

func PrintByte(v byte)

func PrintComplex added in v0.8.9

func PrintComplex(v complex128)

func PrintEface added in v0.8.5

func PrintEface(e Eface)

func PrintFloat added in v0.8.3

func PrintFloat(v float64)

func PrintHex added in v0.8.3

func PrintHex(v uint64)

func PrintIface added in v0.8.3

func PrintIface(i Iface)

func PrintInt added in v0.8.3

func PrintInt(v int64)

func PrintPointer added in v0.8.3

func PrintPointer(p unsafe.Pointer)

func PrintSlice added in v0.8.3

func PrintSlice(s Slice)

func PrintString added in v0.8.3

func PrintString(s String)

func PrintUint added in v0.8.3

func PrintUint(v uint64)

func Recover added in v0.8.8

func Recover() (ret any)

Recover recovers a panic.

func Rethrow added in v0.8.7

func Rethrow(link *Defer)

Rethrow rethrows a panic.

func Select added in v0.9.0

func Select(ops ...ChanOp) (isel int, recvOK bool)

Select executes a blocking select operation.

func SetDirectIface added in v0.8.10

func SetDirectIface(t *abi.Type)

func SliceCopy added in v0.8.5

func SliceCopy(dst Slice, data unsafe.Pointer, num int, etSize int) int

SliceCopy copy data to slice and returns a slice.

func StringEqual added in v0.8.5

func StringEqual(x, y String) bool

func StringIterNext added in v0.8.5

func StringIterNext(it *StringIter) (ok bool, k int, v rune)

func StringLess added in v0.8.5

func StringLess(x, y String) bool

func StringToBytes added in v0.8.5

func StringToBytes(s String) []byte

func StringToRunes added in v0.8.5

func StringToRunes(s string) []rune

func StructField added in v0.8.5

func StructField(name string, typ *Type, off uintptr, tag string, embedded bool) abi.StructField

StructField returns a struct field.

func TracePanic added in v0.4.0

func TracePanic(v any)

TracePanic prints panic message.

func TrySelect added in v0.9.0

func TrySelect(ops ...ChanOp) (isel int, recvOK, tryOK bool)

TrySelect executes a non-blocking select operation.

func Typedmemclr added in v0.8.9

func Typedmemclr(typ *Type, ptr unsafe.Pointer)

typedmemclr clears the typed memory at ptr with type typ. The memory at ptr must already be initialized (and hence in type-safe state). If the memory is being initialized for the first time, see memclrNoHeapPointers.

If the caller knows that typ has pointers, it can alternatively call memclrHasPointers.

TODO: A "go:nosplitrec" annotation would be perfect for this.

func Typedmemmove added in v0.8.9

func Typedmemmove(typ *Type, dst, src unsafe.Pointer)

typedmemmove copies a value of type typ to dst from src. Must be nosplit, see #16026.

TODO: Perfect for go:nosplitrec since we can't have a safe point anywhere in the bulk barrier or memmove.

func Zeroinit added in v0.5.0

func Zeroinit(p unsafe.Pointer, size uintptr) unsafe.Pointer

Zeroinit initializes memory to zero.

Types

type Chan added in v0.8.10

type Chan struct {
	// contains filtered or unexported fields
}

func NewChan added in v0.8.10

func NewChan(eltSize, cap int) *Chan

type ChanOp added in v0.9.0

type ChanOp struct {
	C *Chan

	Val  unsafe.Pointer
	Size int32

	Send bool
}

ChanOp represents a channel operation.

type Defer added in v0.8.6

type Defer struct {
	Addr unsafe.Pointer // sigjmpbuf
	Bits uintptr
	Link *Defer
	Reth unsafe.Pointer // block address after Rethrow
	Rund unsafe.Pointer // block address after RunDefers
}

Defer presents defer statements in a function.

type Eface added in v0.8.5

type Eface = eface

func ToEface added in v0.8.5

func ToEface(i Iface) Eface

ToEface converts an iface to an eface.

type FuncType added in v0.8.5

type FuncType = abi.FuncType

func Func added in v0.8.5

func Func(in, out []*Type, variadic bool) *FuncType

Func returns a function type.

type Iface added in v0.8.5

type Iface = iface

type Imethod added in v0.8.5

type Imethod = abi.Imethod

type InterfaceType

type InterfaceType = abi.InterfaceType

func Interface

func Interface(pkgPath, name string, methods []Imethod) *InterfaceType

Interface returns an interface type. Don't call NewNamed for named interface type.

type Itab added in v0.8.5

type Itab = itab

func NewItab added in v0.8.5

func NewItab(inter *InterfaceType, typ *Type) *Itab

NewItab returns a new itab.

type Kind

type Kind = abi.Kind

type Map added in v0.4.0

type Map = hmap

Map represents a Go map.

func MakeSmallMap added in v0.4.0

func MakeSmallMap() *Map

MakeSmallMap creates a new small map.

type Method added in v0.8.5

type Method = abi.Method

type Slice

type Slice struct {
	// contains filtered or unexported fields
}

Slice is the runtime representation of a slice.

func GrowSlice added in v0.8.9

func GrowSlice(src Slice, num, etSize int) Slice

GrowSlice grows slice and returns the grown slice.

func MakeSlice added in v0.8.10

func MakeSlice(len, cap int, etSize int) Slice

func NewSlice3 added in v0.5.0

func NewSlice3(base unsafe.Pointer, eltSize, cap, i, j, k int) (s Slice)

func SliceAppend added in v0.8.2

func SliceAppend(src Slice, data unsafe.Pointer, num, etSize int) Slice

SliceAppend append elem data and returns a slice.

type String

type String struct {
	// contains filtered or unexported fields
}

String is the runtime representation of a string. It cannot be used safely or portably and its representation may change in a later release.

Unlike reflect.StringHeader, its Data field is sufficient to guarantee the data it references will not be garbage collected.

func StringCat added in v0.5.0

func StringCat(a, b String) String

StringCat concatenates two strings.

func StringFrom added in v0.8.9

func StringFrom(data unsafe.Pointer, n int) (s String)

func StringFromBytes added in v0.8.5

func StringFromBytes(b Slice) (s String)

func StringFromCStr added in v0.8.9

func StringFromCStr(cstr *int8) (s String)

func StringFromRune added in v0.8.5

func StringFromRune(r rune) (s String)

func StringFromRunes added in v0.8.5

func StringFromRunes(rs []rune) (s String)

func StringSlice added in v0.8.9

func StringSlice(base String, i, j int) String

type StringIter added in v0.8.5

type StringIter struct {
	// contains filtered or unexported fields
}

func NewStringIter added in v0.8.5

func NewStringIter(s string) *StringIter

type Type

type Type = abi.Type

func ArrayOf added in v0.8.5

func ArrayOf(length uintptr, elem *Type) *Type

ArrayOf returns the array type with element elem and length.

func Basic

func Basic(_kind Kind) *Type

func ChanOf added in v0.8.10

func ChanOf(dir int, strChan string, elem *Type) *Type

func MapOf added in v0.9.0

func MapOf(key, elem *Type, bucket *Type, flags int) *Type

func NewNamed added in v0.8.5

func NewNamed(kind abi.Kind, size uintptr, methods, ptrMethods int) *Type

NewNamed returns an uninitialized named type.

func PointerTo added in v0.8.5

func PointerTo(elem *Type) *Type

PointerTo returns the pointer type with element elem.

func SliceOf added in v0.8.5

func SliceOf(elem *Type) *Type

SliceOf returns the slice type with element elem.

func Struct added in v0.8.5

func Struct(pkgPath string, size uintptr, fields ...abi.StructField) *Type

Struct returns a struct type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL