rt

package
v1.12.5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	F_direct    = 1 << 5
	F_kind_mask = (1 << 5) - 1
)

GoType.KindFlags const

View Source
const (
	MinInt48 int64 = -(1 << 47)
	MaxInt48 int64 = +(1 << 47) - 1
)

Variables

View Source
var (
	BoolType    = UnpackType(reflect.TypeOf(false))
	ByteType    = UnpackType(reflect.TypeOf(byte(0)))
	IncntType   = UnpackType(reflect.TypeOf(int(0)))
	Int8Type    = UnpackType(reflect.TypeOf(int8(0)))
	Int16Type   = UnpackType(reflect.TypeOf(int16(0)))
	Int32Type   = UnpackType(reflect.TypeOf(int32(0)))
	Int64Type   = UnpackType(reflect.TypeOf(int64(0)))
	UintType    = UnpackType(reflect.TypeOf(uint(0)))
	Uint8Type   = UnpackType(reflect.TypeOf(uint8(0)))
	Uint16Type  = UnpackType(reflect.TypeOf(uint16(0)))
	Uint32Type  = UnpackType(reflect.TypeOf(uint32(0)))
	Uint64Type  = UnpackType(reflect.TypeOf(uint64(0)))
	Float32Type = UnpackType(reflect.TypeOf(float32(0)))
	Float64Type = UnpackType(reflect.TypeOf(float64(0)))

	StringType     = UnpackType(reflect.TypeOf(""))
	BytesType      = UnpackType(reflect.TypeOf([]byte(nil)))
	JsonNumberType = UnpackType(reflect.TypeOf(json.Number("")))

	SliceEfaceType  = UnpackType(reflect.TypeOf([]interface{}(nil)))
	SliceStringType = UnpackType(reflect.TypeOf([]string(nil)))
	SliceI32Type    = UnpackType(reflect.TypeOf([]int32(nil)))
	SliceI64Type    = UnpackType(reflect.TypeOf([]int64(nil)))
	SliceU32Type    = UnpackType(reflect.TypeOf([]uint32(nil)))
	SliceU64Type    = UnpackType(reflect.TypeOf([]uint64(nil)))

	AnyType       = UnpackType(reflect.TypeOf((*interface{})(nil)).Elem())
	MapEfaceType  = UnpackType(reflect.TypeOf(map[string]interface{}(nil)))
	MapStringType = UnpackType(reflect.TypeOf(map[string]string(nil)))

	MapEfaceMapType = MapType(UnpackType(reflect.TypeOf(map[string]interface{}(nil))))
)
View Source
var EmptySlice = *(*GoSlice)(unsafe.Pointer(&emptyBytes))
View Source
var Hex = "0123456789abcdef"
View Source
var RuntimeWriteBarrier uintptr
View Source
var SafeSet = [utf8.RuneSelf]bool{
	' ':      true,
	'!':      true,
	'"':      false,
	'#':      true,
	'$':      true,
	'%':      true,
	'&':      true,
	'\'':     true,
	'(':      true,
	')':      true,
	'*':      true,
	'+':      true,
	',':      true,
	'-':      true,
	'.':      true,
	'/':      true,
	'0':      true,
	'1':      true,
	'2':      true,
	'3':      true,
	'4':      true,
	'5':      true,
	'6':      true,
	'7':      true,
	'8':      true,
	'9':      true,
	':':      true,
	';':      true,
	'<':      true,
	'=':      true,
	'>':      true,
	'?':      true,
	'@':      true,
	'A':      true,
	'B':      true,
	'C':      true,
	'D':      true,
	'E':      true,
	'F':      true,
	'G':      true,
	'H':      true,
	'I':      true,
	'J':      true,
	'K':      true,
	'L':      true,
	'M':      true,
	'N':      true,
	'O':      true,
	'P':      true,
	'Q':      true,
	'R':      true,
	'S':      true,
	'T':      true,
	'U':      true,
	'V':      true,
	'W':      true,
	'X':      true,
	'Y':      true,
	'Z':      true,
	'[':      true,
	'\\':     false,
	']':      true,
	'^':      true,
	'_':      true,
	'`':      true,
	'a':      true,
	'b':      true,
	'c':      true,
	'd':      true,
	'e':      true,
	'f':      true,
	'g':      true,
	'h':      true,
	'i':      true,
	'j':      true,
	'k':      true,
	'l':      true,
	'm':      true,
	'n':      true,
	'o':      true,
	'p':      true,
	'q':      true,
	'r':      true,
	's':      true,
	't':      true,
	'u':      true,
	'v':      true,
	'w':      true,
	'x':      true,
	'y':      true,
	'z':      true,
	'{':      true,
	'|':      true,
	'}':      true,
	'~':      true,
	'\u007f': true,
}

Functions

func Add added in v1.12.0

func Add(ptr unsafe.Pointer, off uintptr) unsafe.Pointer

func BytesFrom added in v1.0.2

func BytesFrom(p unsafe.Pointer, n int, c int) (r []byte)

func CanSizeResue added in v1.12.0

func CanSizeResue(cap int) bool

CanSizeResue

func ClearMemory added in v1.12.0

func ClearMemory(et *GoType, ptr unsafe.Pointer, size uintptr)

func ConvTBool added in v1.12.0

func ConvTBool(val bool, ep *interface{})

func DecodeBase64 added in v1.12.0

func DecodeBase64(raw []byte) ([]byte, error)

func EncodeBase64 added in v1.12.0

func EncodeBase64(src []byte) string

func FuncAddr added in v1.0.2

func FuncAddr(f interface{}) unsafe.Pointer

func GcWriteBarrier2 added in v1.12.0

func GcWriteBarrier2()

func GcwbAddr added in v1.0.2

func GcwbAddr() uintptr

func Get16

func Get16(v []byte) int16

func Get32

func Get32(v []byte) int32

func Get64

func Get64(v []byte) int64

func GuardSlice added in v1.6.1

func GuardSlice(buf *[]byte, n int)

func GuardSlice2 added in v1.12.0

func GuardSlice2(buf []byte, n int) []byte

func IndexByte added in v1.6.1

func IndexByte(ptr []byte, index int) unsafe.Pointer

func IndexChar added in v1.6.1

func IndexChar(src string, index int) unsafe.Pointer

func IsMapfast added in v1.12.0

func IsMapfast(vt reflect.Type) bool

func IsValidNumber added in v1.12.0

func IsValidNumber(s string) bool

func Makemap added in v1.12.0

func Makemap(*GoType, int) unsafe.Pointer

func Mallocgc added in v1.12.0

func Mallocgc(size uintptr, typ *GoType, needzero bool) unsafe.Pointer

func Mapassign added in v1.12.0

func Mapassign(t *GoMapType, h unsafe.Pointer, k unsafe.Pointer) unsafe.Pointer

func Mapassign_fast32 added in v1.12.0

func Mapassign_fast32(t *GoMapType, h unsafe.Pointer, k uint32) unsafe.Pointer

func Mapassign_fast64 added in v1.12.0

func Mapassign_fast64(t *GoMapType, h unsafe.Pointer, k uint64) unsafe.Pointer

func Mapassign_faststr added in v1.12.0

func Mapassign_faststr(t *GoMapType, h unsafe.Pointer, s string) unsafe.Pointer

func Mapiterinit added in v1.12.0

func Mapiterinit(t *GoMapType, m *GoMap, it *GoMapIterator)

func Mapiternext added in v1.12.0

func Mapiternext(it *GoMapIterator)

func Mem2Str

func Mem2Str(v []byte) (s string)

func MemclrHasPointers added in v1.12.0

func MemclrHasPointers(ptr unsafe.Pointer, n uintptr)

func MemclrNoHeapPointers added in v1.12.0

func MemclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)

func Memmove added in v1.12.0

func Memmove(to unsafe.Pointer, from unsafe.Pointer, n uintptr)

func MoreStack

func MoreStack(size uintptr)

func NoEscape added in v1.10.0

func NoEscape(p unsafe.Pointer) unsafe.Pointer

NoEscape hides a pointer from escape analysis. NoEscape is the identity function but escape analysis doesn't think the output depends on the input. NoEscape is inlined and currently compiles down to zero instructions. USE CAREFULLY!

func PackInt

func PackInt(v int) uint64

func Ptr2SlicePtr added in v1.7.1

func Ptr2SlicePtr(s unsafe.Pointer, l int, c int) unsafe.Pointer

func PtrAdd added in v1.12.0

func PtrAdd(ptr unsafe.Pointer, offset uintptr) unsafe.Pointer

func Str2Mem

func Str2Mem(s string) (v []byte)

func StrFrom added in v1.7.1

func StrFrom(p unsafe.Pointer, n int64) (s string)

func StrPtr added in v1.7.1

func StrPtr(s string) unsafe.Pointer

func UnpackInt

func UnpackInt(v uint64) int

Types

type BitVec added in v1.7.1

type BitVec struct {
	N uintptr
	B unsafe.Pointer
}

func (BitVec) Bit added in v1.7.1

func (self BitVec) Bit(i uintptr) byte

func (BitVec) String added in v1.7.1

func (self BitVec) String() string

type Bitmap added in v1.7.1

type Bitmap struct {
	N int
	B []byte
}

func (*Bitmap) Append added in v1.7.1

func (self *Bitmap) Append(bv int)

func (*Bitmap) AppendMany added in v1.7.1

func (self *Bitmap) AppendMany(n int, bv int)

func (*Bitmap) Set added in v1.7.1

func (self *Bitmap) Set(i int, bv int)

type GoEface

type GoEface struct {
	Type  *GoType
	Value unsafe.Pointer
}

func UnpackEface

func UnpackEface(v interface{}) GoEface

func (GoEface) Pack

func (self GoEface) Pack() (v interface{})

type GoIface

type GoIface struct {
	Itab  *GoItab
	Value unsafe.Pointer
}

func AssertI2I added in v1.12.0

func AssertI2I(t *GoType, i GoIface) (r GoIface)

func AssertI2I2 added in v1.11.0

func AssertI2I2(t *GoType, i GoIface) (r GoIface)

func UnpackIface added in v1.1.0

func UnpackIface(v interface{}) GoIface

type GoInterfaceMethod

type GoInterfaceMethod struct {
	Name int32
	Type int32
}

type GoInterfaceType

type GoInterfaceType struct {
	GoType
	PkgPath *byte
	Methods []GoInterfaceMethod
}

func IfaceType

func IfaceType(t *GoType) *GoInterfaceType

type GoItab

type GoItab struct {
	Vt *GoType
	// contains filtered or unexported fields
}

func GetItab added in v1.12.0

func GetItab(inter *GoInterfaceType, typ *GoType, canfail bool) *GoItab

type GoMap

type GoMap struct {
	Count      int
	Flags      uint8
	B          uint8
	Overflow   uint16
	Hash0      uint32
	Buckets    unsafe.Pointer
	OldBuckets unsafe.Pointer
	Evacuate   uintptr
	Extra      unsafe.Pointer
}

type GoMapIterator

type GoMapIterator struct {
	K           unsafe.Pointer
	V           unsafe.Pointer
	T           *GoMapType
	H           *GoMap
	Buckets     unsafe.Pointer
	Bptr        *unsafe.Pointer
	Overflow    *[]unsafe.Pointer
	OldOverflow *[]unsafe.Pointer
	StartBucket uintptr
	Offset      uint8
	Wrapped     bool
	B           uint8
	I           uint8
	Bucket      uintptr
	CheckBucket uintptr
}

type GoMapType

type GoMapType struct {
	GoType
	Key        *GoType
	Elem       *GoType
	Bucket     *GoType
	Hasher     func(unsafe.Pointer, uintptr) uintptr
	KeySize    uint8
	ElemSize   uint8
	BucketSize uint16
	Flags      uint32
}

func MapType

func MapType(t *GoType) *GoMapType

func (*GoMapType) IndirectElem

func (self *GoMapType) IndirectElem() bool

type GoPtrType

type GoPtrType struct {
	GoType
	Elem *GoType
}

type GoSlice

type GoSlice struct {
	Ptr unsafe.Pointer
	Len int
	Cap int
}

func GrowSlice added in v1.11.7

func GrowSlice(et *GoType, old GoSlice, newCap int) GoSlice

Growslice to newCap, not append length Note: the [old, newCap) will not be zeroed if et does not have any ptr data.

func MakeSlice added in v1.12.0

func MakeSlice(oldPtr unsafe.Pointer, et *GoType, newLen int) *GoSlice

type GoString

type GoString struct {
	Ptr unsafe.Pointer
	Len int
}

type GoStructField

type GoStructField struct {
	Name     *byte
	Type     *GoType
	OffEmbed uintptr
}

type GoStructType

type GoStructType struct {
	GoType
	Pkg    *byte
	Fields []GoStructField
}

type GoType

type GoType struct {
	Size       uintptr
	PtrData    uintptr
	Hash       uint32
	Flags      uint8
	Align      uint8
	FieldAlign uint8
	KindFlags  uint8
	Traits     unsafe.Pointer
	GCData     *byte
	Str        int32
	PtrToSelf  int32
}

func AsGoType added in v1.12.0

func AsGoType(t uintptr) *GoType

func PtrElem

func PtrElem(t *GoType) *GoType

func UnpackType

func UnpackType(t reflect.Type) *GoType

func (*GoType) Indirect added in v1.6.1

func (self *GoType) Indirect() bool

func (*GoType) IsInt32 added in v1.12.0

func (t *GoType) IsInt32() bool

func (*GoType) IsInt64 added in v1.12.0

func (t *GoType) IsInt64() bool

func (*GoType) IsNamed added in v1.8.7

func (self *GoType) IsNamed() bool

func (*GoType) IsUint32 added in v1.12.0

func (t *GoType) IsUint32() bool

func (*GoType) IsUint64 added in v1.12.0

func (t *GoType) IsUint64() bool

func (*GoType) Kind

func (self *GoType) Kind() reflect.Kind

func (*GoType) Pack

func (self *GoType) Pack() (t reflect.Type)

func (*GoType) String

func (self *GoType) String() string

type Map32Assign added in v1.12.0

type Map32Assign func(t *GoMapType, h unsafe.Pointer, k uint32) unsafe.Pointer

func GetMap32Assign added in v1.12.0

func GetMap32Assign(vt reflect.Type) Map32Assign

type Map64Assign added in v1.12.0

type Map64Assign func(t *GoMapType, h unsafe.Pointer, k uint64) unsafe.Pointer

func GetMap64Assign added in v1.12.0

func GetMap64Assign(vt reflect.Type) Map64Assign

type MapStrAssign added in v1.12.0

type MapStrAssign func(t *GoMapType, h unsafe.Pointer, s string) unsafe.Pointer

func GetMapStrAssign added in v1.12.0

func GetMapStrAssign(vt reflect.Type) MapStrAssign

type SlicePool added in v1.12.0

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

func NewPool added in v1.12.0

func NewPool(typ *GoType, size int) SlicePool

func (*SlicePool) GetSlice added in v1.12.0

func (self *SlicePool) GetSlice(size int) unsafe.Pointer

func (*SlicePool) Remain added in v1.12.0

func (self *SlicePool) Remain() int

type StackMap added in v1.7.1

type StackMap struct {
	N int32
	L int32
	B [1]byte
}

func (*StackMap) Get added in v1.7.1

func (self *StackMap) Get(i int32) BitVec

func (*StackMap) MarshalBinary added in v1.7.1

func (self *StackMap) MarshalBinary() ([]byte, error)

func (*StackMap) Pin added in v1.7.1

func (self *StackMap) Pin() uintptr

func (*StackMap) String added in v1.7.1

func (self *StackMap) String() string

type StackMapBuilder added in v1.7.1

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

func (*StackMapBuilder) AddField added in v1.7.1

func (self *StackMapBuilder) AddField(ptr bool)

func (*StackMapBuilder) AddFields added in v1.7.1

func (self *StackMapBuilder) AddFields(n int, ptr bool)

func (*StackMapBuilder) Build added in v1.7.1

func (self *StackMapBuilder) Build() (p *StackMap)

type T64Pool added in v1.12.0

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

func NewT64Pool added in v1.12.0

func NewT64Pool(hint int) T64Pool

func (*T64Pool) Conv added in v1.12.0

func (self *T64Pool) Conv(val uint64, typ *GoType, ep *interface{})

func (*T64Pool) Free added in v1.12.0

func (self *T64Pool) Free()

type TslicePool added in v1.12.0

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

func NewTslicePool added in v1.12.0

func NewTslicePool(hint int) TslicePool

func (*TslicePool) Conv added in v1.12.0

func (self *TslicePool) Conv(val GoSlice, typ *GoType, ep *interface{})

func (*TslicePool) Free added in v1.12.0

func (self *TslicePool) Free()

type TstringPool added in v1.12.0

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

func NewTstringPool added in v1.12.0

func NewTstringPool(hint int) TstringPool

func (*TstringPool) Conv added in v1.12.0

func (self *TstringPool) Conv(val string, ep *interface{})

func (*TstringPool) ConvNum added in v1.12.0

func (self *TstringPool) ConvNum(val json.Number, ep *interface{})

func (*TstringPool) Free added in v1.12.0

func (self *TstringPool) Free()

Jump to

Keyboard shortcuts

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