Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

rt

v1.15.5
github.com/bytedance/sonic/internal/rt

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

150 matches

Top ↑

Constants

F_direct (2 declarations)

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

GoType.KindFlags const

MinInt48 (2 declarations)

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

Variables

BoolType (27 declarations)

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

EmptySlice

var EmptySlice = *(*GoSlice)(unsafe.Pointer(&emptyBytes))

Hex

var Hex = "0123456789abcdef"

RuntimeWriteBarrier

var RuntimeWriteBarrier uintptr

SafeSet

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,
}

SubrB64Decode

var SubrB64Decode uintptr

SubrB64Encode

var SubrB64Encode uintptr

Functions

Add

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

BytesFrom

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

CanSizeResue

func CanSizeResue(cap int) bool

CanSizeResue

ClearMemory

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

ConvT64

func ConvT64(v uint64) unsafe.Pointer

ConvTBool

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

ConvTslice

func ConvTslice(v []byte) unsafe.Pointer

ConvTstring

func ConvTstring(v string) unsafe.Pointer

DecodeBase64

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

EncodeBase64

func EncodeBase64(buf []byte, src []byte) []byte

EncodeBase64ToString

func EncodeBase64ToString(src []byte) string

FuncAddr

func FuncAddr(f interface{}) unsafe.Pointer

GcWriteBarrier2

func GcWriteBarrier2()

GcwbAddr

func GcwbAddr() uintptr

Get16

func Get16(v []byte) int16

Get32

func Get32(v []byte) int32

Get64

func Get64(v []byte) int64

GuardSlice

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

GuardSlice2

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

IndexByte

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

IndexChar

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

IsMapIndirectElem

func IsMapIndirectElem(vt reflect.Type) bool

IsMapfast

func IsMapfast(vt reflect.Type) bool

MakeSliceStd

func MakeSliceStd(et *GoType, len int, cap int) unsafe.Pointer

Makemap

func Makemap(*GoType, int) unsafe.Pointer

MakemapSmall

func MakemapSmall() unsafe.Pointer

Mallocgc

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

Mapassign

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

Mapassign_fast32

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

Mapassign_fast64

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

Mapassign_fast64ptr

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

Mapassign_faststr

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

Mapiterinit

func Mapiterinit(t *GoMapType, m unsafe.Pointer, it *GoMapIterator)

Mapiternext

func Mapiternext(it *GoMapIterator)

Maplen

func Maplen(h unsafe.Pointer) int

Mem2Str

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

MemEqual

func MemEqual(a unsafe.Pointer, b unsafe.Pointer, size uintptr) bool

MemclrHasPointers

func MemclrHasPointers(ptr unsafe.Pointer, n uintptr)

MemclrNoHeapPointers

func MemclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)

Memmove

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

MoreStack

func MoreStack(size uintptr)

NoEscape

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!

PackInt

func PackInt(v int) uint64

Ptr2SlicePtr

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

PtrAdd

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

Str2Mem

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

StrFrom

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

StrPtr

func StrPtr(s string) unsafe.Pointer

Strhash

func Strhash(_ unsafe.Pointer, _ uintptr) uintptr

Throw

func Throw(s string)

UnpackInt

func UnpackInt(v uint64) int

Types

GoEface

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

UnpackEface

func UnpackEface(v interface{}) GoEface

GoEface.Pack

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

GoIface

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

AssertI2I

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

AssertI2I2

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

UnpackIface

func UnpackIface(v interface{}) GoIface

GoInterfaceMethod

type GoInterfaceMethod struct {
	Name int32
	Type int32
}

GoInterfaceType

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

IfaceType

func IfaceType(t *GoType) *GoInterfaceType

GoItab

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

GetItab

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

GoMapIterator

type GoMapIterator struct {
	K           unsafe.Pointer
	V           unsafe.Pointer
	T           *GoMapType
	H           unsafe.Pointer
	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
	// Required by the Go 1.24-1.25 GOEXPERIMENT=noswissmap hiter layout.
	// Newer legacy linkname shims ignore this trailing storage.
	ClearSeq uint64
}

GoMapIterator mirrors the pre-Go 1.24 hiter layout. Go 1.24+ runtime provides a linkname compatibility shim whose real iterator pointer lands in H.

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
}

MapType

func MapType(t *GoType) *GoMapType

GoPtrType

type GoPtrType struct {
	GoType
	Elem *GoType
}

GoSlice

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

GrowSlice

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.

MakeSlice

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

GoString

type GoString struct {
	Ptr unsafe.Pointer
	Len int
}

GoStructField

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

GoStructType

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

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
}

AsGoType

func AsGoType(t uintptr) *GoType

PtrElem

func PtrElem(t *GoType) *GoType

UnpackType

func UnpackType(t reflect.Type) *GoType

GoType.Indirect

func (self *GoType) Indirect() bool

In Go 1.26+, TFlagDirectIface is in the TFlag (Flags) field, not Kind_.

GoType.IsInt32

func (t *GoType) IsInt32() bool

GoType.IsInt64

func (t *GoType) IsInt64() bool

GoType.IsNamed

func (self *GoType) IsNamed() bool

GoType.IsUint32

func (t *GoType) IsUint32() bool

GoType.IsUint64

func (t *GoType) IsUint64() bool

GoType.Kind

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

GoType.Pack

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

GoType.String

func (self *GoType) String() string

Map32Assign

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

GetMap32Assign

func GetMap32Assign(vt reflect.Type) Map32Assign

Map64Assign

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

GetMap64Assign

func GetMap64Assign(vt reflect.Type) Map64Assign

MapStrAssign

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

GetMapStrAssign

func GetMapStrAssign(vt reflect.Type) MapStrAssign

SlicePool

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

NewPool

func NewPool(typ *GoType, size int) SlicePool

SlicePool.GetSlice

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

SlicePool.Remain

func (self *SlicePool) Remain() int

T64Pool

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

NewT64Pool

func NewT64Pool(hint int) T64Pool

T64Pool.Conv

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

T64Pool.Free

func (self *T64Pool) Free()

TslicePool

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

NewTslicePool

func NewTslicePool(hint int) TslicePool

TslicePool.Conv

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

TslicePool.Free

func (self *TslicePool) Free()

TstringPool

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

NewTstringPool

func NewTstringPool(hint int) TstringPool

TstringPool.Conv

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

TstringPool.ConvNum

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

TstringPool.Free

func (self *TstringPool) Free()

Dependency graph