Help us shape the future of Go! Take the 2026 Go Developer Survey

vars

package
v1.15.5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxStack   = 4096 // 4k states
	StackSize  = unsafe.Sizeof(Stack{})
	StateSize  = int64(unsafe.Sizeof(State{}))
	StackLimit = MaxStack * StateSize
)
View Source
const (
	MAX_ILBUF  = 100000 // cutoff at 100k of IL instructions
	MAX_FIELDS = 50     // cutoff at 50 fields struct
)
View Source
const (
	PanicNilPointerOfNonEmptyString int = 1 + iota
)

Variables

View Source
var (
	DebugSyncGC   = os.Getenv("SONIC_SYNC_GC") != ""
	DebugAsyncGC  = os.Getenv("SONIC_NO_ASYNC_GC") == ""
	DebugCheckPtr = os.Getenv("SONIC_CHECK_POINTER") != ""
)
View Source
var (
	ArgPtrs   = []bool{true, true, true, false}
	LocalPtrs = []bool{}

	ArgPtrs_generic   = []bool{true}
	LocalPtrs_generic = []bool{}
)
View Source
var (
	ByteType                 = reflect.TypeOf(byte(0))
	JsonNumberType           = reflect.TypeOf(json.Number(""))
	JsonUnsupportedValueType = reflect.TypeOf(new(json.UnsupportedValueError))
)
View Source
var (
	ErrorType                 = reflect.TypeOf((*error)(nil)).Elem()
	JsonMarshalerType         = reflect.TypeOf((*json.Marshaler)(nil)).Elem()
	EncodingTextMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
)
View Source
var ERR_nan_or_infinite = &json.UnsupportedValueError{
	Str:   "NaN or ±Infinite",
	Value: reflect.ValueOf("NaN or ±Infinite"),
}
View Source
var ERR_too_deep = &json.UnsupportedValueError{
	Str:   "Value nesting too deep",
	Value: reflect.ValueOf("..."),
}
View Source
var UseVM = os.Getenv("SONIC_ENCODER_USE_VM") != ""

Functions

func ComputeProgram

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

func Error_marshaler

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

func Error_number

func Error_number(number json.Number) error

func Error_type

func Error_type(vtype reflect.Type) error

func Error_unsuppoted added in v1.12.10

func Error_unsuppoted(typ *rt.GoType) error

func FindOrCompile

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

func FreeBuffer

func FreeBuffer(p *bytes.Buffer)

func FreeBytes

func FreeBytes(p *[]byte)

func FreeStack

func FreeStack(p *Stack)

func GetProgram

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

func GoPanic

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

func IsSimpleByte

func IsSimpleByte(vt reflect.Type) bool

func NewBuffer

func NewBuffer() *bytes.Buffer

func NewBytes

func NewBytes() *[]byte

func ResetProgramCache added in v1.14.2

func ResetProgramCache()

func ResetStack

func ResetStack(p *Stack)

Types

type Encoder

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

type Stack

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

func NewStack

func NewStack() *Stack

func (*Stack) Cur

func (s *Stack) Cur() *State

func (*Stack) Drop

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

func (*Stack) Load

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

func (*Stack) Pop

func (s *Stack) Pop() State

func (*Stack) Push

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

func (*Stack) Save

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

func (*Stack) Top

func (s *Stack) Top() *State

type State

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

Jump to

Keyboard shortcuts

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