...

Package caching

import "github.com/bytedance/sonic/internal/caching"
Overview
Index

Overview ▾

Constants

const (
    FieldMap_N     = int64(unsafe.Offsetof(FieldMap{}.N))
    FieldMap_b     = int64(unsafe.Offsetof(FieldMap{}.b))
    FieldEntrySize = int64(unsafe.Sizeof(FieldEntry{}))
)

Variables

var (
    V_strhash = rt.UnpackEface(strhash)
    S_strhash = *(*uintptr)(V_strhash.Value)
)

func StrHash

func StrHash(s string) uint64

type FieldEntry

type FieldEntry struct {
    ID   int
    Name string
    Hash uint64
}

type FieldMap

type FieldMap struct {
    N uint64
    // contains filtered or unexported fields
}

func CreateFieldMap

func CreateFieldMap(n int) *FieldMap

func (*FieldMap) At

func (self *FieldMap) At(p uint64) *FieldEntry

func (*FieldMap) Get

func (self *FieldMap) Get(name string) int

Get searches FieldMap by name. JIT generated assembly does NOT call this function, rather it implements its own version directly in assembly. So we must ensure this function stays in sync with the JIT generated one.

func (*FieldMap) GetCaseInsensitive

func (self *FieldMap) GetCaseInsensitive(name string) int

func (*FieldMap) Set

func (self *FieldMap) Set(name string, i int)

type ProgramCache

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

func CreateProgramCache

func CreateProgramCache() *ProgramCache

func (*ProgramCache) Compute

func (self *ProgramCache) Compute(vt *rt.GoType, compute func(*rt.GoType, ...interface{}) (interface{}, error), ex ...interface{}) (interface{}, error)

func (*ProgramCache) Get

func (self *ProgramCache) Get(vt *rt.GoType) interface{}