Search and commands

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

Type to search packages.

vars

v1.15.5
github.com/bytedance/sonic/internal/encoder/vars

Documentation

pkg.go.dev ↗

Table of contents

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

54 matches

Top ↑

Constants

MaxStack (4 declarations)

const (
	MaxStack   = 4096 // 4k states
	StackSize  = unsafe.Sizeof(Stack{})
	StateSize  = int64(unsafe.Sizeof(State{}))
	StackLimit = MaxStack * StateSize
)

MAX_ILBUF (2 declarations)

const (
	MAX_ILBUF  = 100000 // cutoff at 100k of IL instructions
	MAX_FIELDS = 50     // cutoff at 50 fields struct
)

PanicNilPointerOfNonEmptyString

const (
	PanicNilPointerOfNonEmptyString int = 1 + iota
)

Variables

DebugSyncGC (3 declarations)

var (
	DebugSyncGC   = os.Getenv("SONIC_SYNC_GC") != ""
	DebugAsyncGC  = os.Getenv("SONIC_NO_ASYNC_GC") == ""
	DebugCheckPtr = os.Getenv("SONIC_CHECK_POINTER") != ""
)

ArgPtrs (4 declarations)

var (
	ArgPtrs   = []bool{true, true, true, false}
	LocalPtrs = []bool{}

	ArgPtrs_generic   = []bool{true}
	LocalPtrs_generic = []bool{}
)

ByteType (3 declarations)

var (
	ByteType                 = reflect.TypeOf(byte(0))
	JsonNumberType           = reflect.TypeOf(json.Number(""))
	JsonUnsupportedValueType = reflect.TypeOf(new(json.UnsupportedValueError))
)

ErrorType (3 declarations)

var (
	ErrorType                 = reflect.TypeOf((*error)(nil)).Elem()
	JsonMarshalerType         = reflect.TypeOf((*json.Marshaler)(nil)).Elem()
	EncodingTextMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
)

ERR_nan_or_infinite

var ERR_nan_or_infinite = &json.UnsupportedValueError{
	Str:   "NaN or ±Infinite",
	Value: reflect.ValueOf("NaN or ±Infinite"),
}

ERR_too_deep

var ERR_too_deep = &json.UnsupportedValueError{
	Str:   "Value nesting too deep",
	Value: reflect.ValueOf("..."),
}

UseVM

var UseVM = os.Getenv("SONIC_ENCODER_USE_VM") != ""

Functions

ComputeProgram

func ComputeProgram(vt *rt.GoType, compute func(*rt.GoType, ...interface{}) (interface{}, error), pv bool) (interface{}, error)

Error_marshaler

func Error_marshaler(ret []byte, pos int) error

Error_number

func Error_number(number json.Number) error

Error_type

func Error_type(vtype reflect.Type) error

Error_unsuppoted

func Error_unsuppoted(typ *rt.GoType) error

FindOrCompile

func FindOrCompile(vt *rt.GoType, pv bool, compiler func(*rt.GoType, ...interface{}) (interface{}, error)) (interface{}, error)

FreeBuffer

func FreeBuffer(p *bytes.Buffer)

FreeBytes

func FreeBytes(p *[]byte)

FreeStack

func FreeStack(p *Stack)

GetProgram

func GetProgram(vt *rt.GoType) interface{}

GoPanic

func GoPanic(code int, val unsafe.Pointer, buf string)

IsSimpleByte

func IsSimpleByte(vt reflect.Type) bool

NewBuffer

func NewBuffer() *bytes.Buffer

NewBytes

func NewBytes() *[]byte

ResetProgramCache

func ResetProgramCache()

ResetStack

func ResetStack(p *Stack)

Types

Encoder

type Encoder func(
	rb *[]byte,
	vp unsafe.Pointer,
	sb *Stack,
	fv uint64,
) error

Stack

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

NewStack

func NewStack() *Stack

Stack.Cur

func (s *Stack) Cur() *State

Stack.Drop

func (s *Stack) Drop() (int, uint64, unsafe.Pointer, unsafe.Pointer)

Stack.Load

func (s *Stack) Load() (int, uint64, unsafe.Pointer, unsafe.Pointer)

Stack.Pop

func (s *Stack) Pop() State

Stack.Push

func (s *Stack) Push(v State) bool

Stack.Save

func (s *Stack) Save(x int, f uint64, p unsafe.Pointer, q unsafe.Pointer) bool

Stack.Top

func (s *Stack) Top() *State

State

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

Dependency graph