Versions in this module Expand all Collapse all v0 v0.1.0 Nov 25, 2026 Changes in this version + const FieldValueCopy + const MethodImportBase + const RecordListDirect + const RecordValueReceiver + const VMFieldBase + var AnySliceType = values.NewType("[]any", values.Pair) + var ByteSliceType = values.NewOwnedType("[]uint8", values.Pair, ...) + var ErrAllocation = errors.New("allocation budget exceeded") + var ErrAllocations = errors.New("allocation count limit exceeded") + var ErrBounds = errors.New("index or slice bounds out of range") + var ErrCallbackExpired = errors.New("callback scope has expired") + var ErrCallbackInactive = errors.New("callback requires an active native call on its originating VM") + var ErrCallbackScopeOpen = errors.New("callback scope already open") + var ErrDeferStack = errors.New("defer stack is no longer active") + var ErrDepth = errors.New("call depth limit exceeded") + var ErrDivideByZero = errors.New("integer division by zero") + var ErrFunction = errors.New("invalid function value") + var ErrInvalidState = errors.New("invalid VM state") + var ErrNegativeShift = errors.New("negative shift amount") + var ErrNil = errors.New("nil pointer dereference") + var ErrNilFunction = errors.New("call of nil function") + var ErrNilMap = errors.New("assignment to nil map") + var ErrOutput = errors.New("output limit exceeded") + var ErrReentry = errors.New("VM is already running") + var ErrRegisters = errors.New("register limit exceeded") + var ErrSteps = errors.New("instruction limit exceeded") + var ErrTypeAssertion = errors.New("interface conversion failed") + var ErrorSliceType = values.NewType("[]error", values.Pair) + var JSONObjectType = values.NewType("map[string]any", values.Pointer) + var NativeAnyCodec = &NativeValueCodec + var NativeErrorCodec = &NativeValueCodec + func ModelValueShape(row *RecordType) *values.Shape + func NativeModelPointerLayout(model *kvo.Model, typ reflect.Type) *values.NativeLayout + func NativeModelValueLayout(model *kvo.Model, typ reflect.Type) *values.NativeLayout + func NativeMutableRecord(v values.Value, model *kvo.Model) (kvo.Record, error) + func NativeMutableRecordValue(model *kvo.Model, r kvo.Record) (values.Value, error) + func PreserveCallbackPanic(value any) error + func RecordScalarType(t kvo.AnyType) *values.Type + func RecordValue(v values.Value, model *kvo.Model) (kvo.Record, error) + func RecordWordType(p kvo.PropImpl) *values.Type + func RegisterNativeCopies(pkg *Package) + func StandardLibraryPaths() []string + func StandardLibrarySource(path string) (string, bool) + func ValidateDirectBindings(packages []Package) error + func ValidateShape(s *values.Shape) error + func ValueModels(packages []Package) (map[*kvo.Model]*ValueModel, error) + type BorrowSource struct + Domain string + Result int + ScopeParameter int + type Budget = Limits + type BudgetScope struct + func (s *BudgetScope) BorrowRecords(c *VM) *RecordScope + func (s *BudgetScope) End(c *VM) error + type Callable struct + func (f *Callable) Value(p *Program, signature Signature) (values.Value, error) + func (f Callable) AcceptsBorrowedBytes(domain string) bool + func (f Callable) CheckConcurrentUse() error + func (f Callable) CheckSignature(want Signature) error + func (f Callable) HasCaptures() bool + func (f Callable) Name() string + func (f Callable) Program() *Program + func (f Callable) Signature() Signature + type CallbackScope struct + func (s *CallbackScope) Close() error + func (s *CallbackScope) WithCall(fn func(*VM) error) error + type CaptureSlot struct + Slot uint16 + Type *values.Type + type Closure struct + Captures []Operand + Function uint32 + type ConcurrentFunctionOf = Callable + type Conversion struct + From NumericType + To NumericType + type Coverage struct + func NewCoverage(p *Program) *Coverage + func (c *Coverage) Instructions() []InstructionCoverage + func (c *Coverage) Lines() []LineCoverage + func (c *Coverage) Merge(other *Coverage) error + type DeferKind uint8 + const DeferDirect + const DeferIndirect + const DeferInvoke + const DeferPanic + const DeferRecover + type DeferOp struct + Args []Operand + ExternalStack bool + Function Operand + Invoke uint32 + Kind DeferKind + Receiver uint16 + Signature uint32 + Target FunctionRef + type DirectBinding struct + Call DirectFunc + Op Opcode + Window bool + func DirectUnary(fn func(uint64) uint64) DirectBinding + type DirectFunc func(*VM, values.Value, values.Value) (values.Value, error) + type DynamicMethod struct + Function FunctionRef + ID string + Signature Signature + Variadic bool + type DynamicType struct + Methods []DynamicMethod + Shape *values.Shape + type ExecutionError struct + Err error + Function string + PC int + Position SourcePosition + func (e *ExecutionError) Error() string + func (e *ExecutionError) Unwrap() error + type ExtendedKind uint8 + const ExtendedAddressLoad + const ExtendedAddressStore + const ExtendedAppend + const ExtendedCap + const ExtendedClear + const ExtendedComplex + const ExtendedComplexBinary + const ExtendedComplexNegate + const ExtendedConvert + const ExtendedCopy + const ExtendedDelete + const ExtendedEqual + const ExtendedField + const ExtendedFieldAddr + const ExtendedFieldStore + const ExtendedGetChildKey + const ExtendedGetKey + const ExtendedImag + const ExtendedIndex + const ExtendedIndexAddr + const ExtendedLen + const ExtendedLookup + const ExtendedMakeInterface + const ExtendedMakeMap + const ExtendedMakeSlice + const ExtendedMapUpdate + const ExtendedMinMax + const ExtendedNativeAddress + const ExtendedNativeAlloc + const ExtendedNext + const ExtendedOwn + const ExtendedPackedArray + const ExtendedPackedLoad + const ExtendedPackedStore + const ExtendedRange + const ExtendedReal + const ExtendedRecordCopy + const ExtendedRecordList + const ExtendedRecordListIndex + const ExtendedRecordListLen + const ExtendedSetKey + const ExtendedSlice + const ExtendedSliceToArray + const ExtendedTypeAssert + type ExtendedOp struct + ChildKey uint64 + Flags uint8 + In []Operand + Index uint64 + Kind ExtendedKind + Out []Operand + Packed bool + Record *RecordType + Shape *values.Shape + Source *values.Shape + type ExternalConstant struct + Name string + Rune bool + Type *values.Type + Untyped constant.Value + Value values.Value + type ExternalFunction struct + Call Native + Direct DirectBinding + Doc string + DynamicTypes []*values.Type + Instantiate func([]*values.Type) (ExternalFunction, error) + Name string + On *RecordType + Ownership *OwnershipEffects + ParamNames []string + Signature Signature + Variadic bool + func BindStandardFunction(path, name string, signature Signature) (*ExternalFunction, bool) + func (f *ExternalFunction) LinkName() string + type ExternalMethod struct + Call Native + Direct DirectBinding + DynamicTypes []*values.Type + Instantiate func([]*values.Type) (ExternalFunction, error) + Name string + Ownership *OwnershipEffects + Receiver *values.Type + Signature Signature + Variadic bool + func (m ExternalMethod) Binding() ExternalFunction + type ExternalValue struct + Name string + Read Native + Type *values.Type + func (v ExternalValue) LinkName() string + type Function struct + CallbackByteDomains []string + Captures []CaptureSlot + CapturesVerifiedForConcurrency bool + Code []Instruction + ConcurrentBorrowCalls map[int][]int + Internal bool + Lines []int + LocalRecordReads map[int]bool + Method bool + Name string + OwnershipSites []OwnershipSite + PCount int + Position SourcePosition + Positions []SourcePosition + RCount int + RecoverPC uint32 + RecoverTransparent bool + Signature Signature + type FunctionOf = Callable + type FunctionRef struct + Index uint32 + Native bool + func MethodImportRef(index int) FunctionRef + func (r FunctionRef) MethodImport() (int, bool) + type GuestValue struct + Program *Program + Value values.Value + func (g *GuestValue) MarshalJSON() ([]byte, error) + func (g *GuestValue) String() string + type HostShapes struct + After int + Set []uint64 + Table []*values.Shape + type Import struct + Name string + Ownership *OwnershipEffects + Package string + Receiver *values.Type + Signature Signature + TypeArgs []*values.Type + type Instruction uint64 + func ABC(op Opcode, a, b, c uint16) Instruction + func ABCD12(op Opcode, a, b, c, d uint16) Instruction + func WithBC(op Opcode, a uint16, bc uint32) Instruction + func (i Instruction) A() uint16 + func (i Instruction) ABCD12() (a, b, c, d uint16) + func (i Instruction) B() uint16 + func (i Instruction) BC() uint32 + func (i Instruction) C() uint16 + func (i Instruction) Op() Opcode + func (i Instruction) SignedD12() int + type InstructionCoverage struct + Branch bool + Count uint64 + Function string + NotTaken uint64 + PC int + Position SourcePosition + Taken uint64 + type Invoke struct + InterfaceName string + Method values.Method + type JSONTypes struct + Array uint32 + Boolean uint32 + Float uint32 + Integer uint32 + Object uint32 + String uint32 + Unsigned uint32 + type Layout struct + PCount int + RCount int + Slots []uint16 + func LayoutOf(types []*values.Type) (Layout, error) + func ParameterLayout(params []*values.Type, method bool) (Layout, error) + type Limits struct + AllocationBytes uint64 + Allocations uint64 + Depth int + Duration time.Duration + HardAllocationBytes uint64 + HardAllocations uint64 + HardDuration time.Duration + OutputBytes uint64 + PSlots int + RSlots int + Steps uint64 + UnlimitedSteps bool + type LineCoverage struct + Branches int + Executed int + File string + Instructions int + Line int + Outcomes int + func (l LineCoverage) Covered() bool + type LinkEnvironment struct + func NewLinkEnvironment(packages ...Package) (*LinkEnvironment, error) + func (e *LinkEnvironment) Link(m *Module) (*Program, error) + func (e *LinkEnvironment) LinkWithHostData(m *Module, hostData any) (*Program, error) + func (e *LinkEnvironment) Packages() []Package + type LinkOptions struct + DefaultLimits *Limits + Methods []MethodTables + Shapes []*values.Shape + func (o LinkOptions) Link(m *Module, packages ...Package) (*Program, error) + func (o LinkOptions) NewEnvironment(packages ...Package) (*LinkEnvironment, error) + type MethodTables struct + Imports []Import + Types []DynamicType + type Module struct + Closures []Closure + Conversions []Conversion + Defers []DeferOp + ExtendedOps []ExtendedOp + FunctionRefs []FunctionRef + Functions []Function + Globals []*values.Shape + HostShapes HostShapes + Imports []Import + Init string + Invokes []Invoke + JSONTypes JSONTypes + MethodImports []Import + NoOptimization bool + Shapes []*values.Shape + Signatures []Signature + SourceBranches map[string]map[int]SourceBranch + Sources map[string]string + StrictCallWindows bool + Strings []string + Types []DynamicType + Words []uint64 + func (m *Module) Disassemble() string + func (m *Module) DisassembleFunction(index int) string + func (m *Module) ListedShapes() iter.Seq[*values.Shape] + type Native func(*VM) error + type NativeFunctionType struct + func NewNativeFunctionType(signature Signature) (*NativeFunctionType, error) + type NativeSliceDecl struct + Element *values.NativeLayout + Layout *values.NativeLayout + type NativeValueCodec struct + Decode func(*VM, values.Value) (values.Value, error) + Encode func(*VM, values.Value) (values.Value, error) + func NativeInterfaceCodec(t reflect.Type) *NativeValueCodec + type NumericKind uint8 + const NumericFloat + const NumericSigned + const NumericUnsigned + type NumericType struct + Bits uint8 + Kind NumericKind + type Opcode uint16 + const OpAddF32 + const OpAddF64 + const OpAddI64 + const OpAddImmI64 + const OpAddMulF64 + const OpAlloc + const OpAnd + const OpCallFunc + const OpCallHost + const OpCallHostMethodP + const OpCallHostMethodPP + const OpCallHostMethodPS + const OpCallHostMethodPU + const OpCallHostMethodPV + const OpCallHostMethodS + const OpCallHostMethodSP + const OpCallHostMethodSS + const OpCallHostMethodSU + const OpCallHostMethodSV + const OpCallHostMethodU + const OpCallHostMethodUP + const OpCallHostMethodUS + const OpCallHostMethodUU + const OpCallHostMethodUV + const OpCallHostMethodV + const OpCallHostP + const OpCallHostPP + const OpCallHostPPP + const OpCallHostPPS + const OpCallHostPPU + const OpCallHostPPV + const OpCallHostPS + const OpCallHostPSP + const OpCallHostPSS + const OpCallHostPSU + const OpCallHostPSV + const OpCallHostPU + const OpCallHostPUP + const OpCallHostPUS + const OpCallHostPUU + const OpCallHostPUV + const OpCallHostPV + const OpCallHostRP + const OpCallHostRR + const OpCallHostS + const OpCallHostSP + const OpCallHostSPP + const OpCallHostSPS + const OpCallHostSPU + const OpCallHostSPV + const OpCallHostSS + const OpCallHostSSP + const OpCallHostSSS + const OpCallHostSSU + const OpCallHostSSV + const OpCallHostSU + const OpCallHostSUP + const OpCallHostSUS + const OpCallHostSUU + const OpCallHostSUV + const OpCallHostSV + const OpCallHostU + const OpCallHostUP + const OpCallHostUPP + const OpCallHostUPS + const OpCallHostUPU + const OpCallHostUPV + const OpCallHostUS + const OpCallHostUSP + const OpCallHostUSS + const OpCallHostUSU + const OpCallHostUSV + const OpCallHostUU + const OpCallHostUUP + const OpCallHostUUS + const OpCallHostUUU + const OpCallHostUUV + const OpCallHostUV + const OpCallHostV + const OpCallIndirect + const OpCallVirt + const OpCheckNil + const OpCheckShift + const OpClearP + const OpClosure + const OpConcatStr + const OpConst + const OpConvert + const OpDefer + const OpDeferStack + const OpDivF32 + const OpDivF64 + const OpDivI64 + const OpDivU64 + const OpEqF32 + const OpEqF64 + const OpEqP + const OpEqR + const OpEqStr + const OpExtended + const OpFunction + const OpGlobal + const OpJNil + const OpJNotNil + const OpJnz + const OpJump + const OpJz + const OpLeI64 + const OpLeU64 + const OpLoad + const OpLoadIndexByte + const OpLoadIndexPtr + const OpLoadIndexR + const OpLoadIndexWord + const OpLoopAddLeI64 + const OpLoopAddLtI64 + const OpLoopLeI64 + const OpLoopLtI64 + const OpLtF32 + const OpLtF64 + const OpLtI64 + const OpLtStr + const OpLtU64 + const OpMoveP + const OpMoveR + const OpMoveV + const OpMulAddF64 + const OpMulF32 + const OpMulF64 + const OpMulI64 + const OpOr + const OpPanic + const OpRecover + const OpRemI64 + const OpRemU64 + const OpReturn + const OpRunDefers + const OpShl + const OpShrI64 + const OpShrU64 + const OpStore + const OpStoreIndexByte + const OpStoreIndexPtr + const OpStoreIndexR + const OpStoreIndexWord + const OpString + const OpSubAddF64 + const OpSubF32 + const OpSubF64 + const OpSubI64 + const OpXor + func HostCallOpcode(method bool, args []values.Repr, result values.Repr) Opcode + func UnaryHostOpcode(sig Signature) Opcode + func (op Opcode) HostRegisters() (a, b byte, ok bool) + func (op Opcode) String() string + func (op Opcode) TiedHostArgument() (int, bool) + type Operand struct + Repr values.Repr + Slot uint16 + type OwnershipEffects struct + Borrowed []BorrowSource + CallbackBytes string + Callbacks []ScopedCallback + Ends []ScopeEnd + NoInvalidate bool + NoRetain bool + func (e *OwnershipEffects) Clone() *OwnershipEffects + func (e *OwnershipEffects) Equal(other *OwnershipEffects) bool + func (e *OwnershipEffects) Validate(sig Signature) error + type OwnershipSite struct + PC int + Reason string + type Package struct + Aliases []TypeAlias + ConcurrentCallbackParams map[string][]int + ConcurrentInterfaceParams map[string][]int + Constants []ExternalConstant + EntryTypes []*values.Type + Functions []ExternalFunction + Methods []ExternalMethod + Path string + Records []*RecordType + SharedTypes []SharedType + Source string + SourceFiles []SourceFile + StructValues map[string]func(string, []*values.Shape) *values.CellStruct + Types []TypeDecl + ValueModels []ValueModel + Values []ExternalValue + func MergePackages(packages ...Package) ([]Package, error) + func ModelPackage(path string, schemas ...*kvo.Schema) (Package, error) + func TimePackage() Package + func WithTimePackage(packages []Package) ([]Package, error) + func WithoutRecords(p Package, models ...*kvo.Model) Package + func (p *Package) OwnsMethodReceiver(t *values.Type) bool + func (p *Package) Record(model *kvo.Model, mutable bool) *RecordType + func (p Package) HasSource() bool + func (p Package) Sources() []SourceFile + type PanicError struct + Type *values.Type + Value values.Value + func (e *PanicError) Error() string + func (e *PanicError) Unwrap() error + type Program struct + func Link(m *Module, packages ...Package) (*Program, error) + func LinkWithHostData(m *Module, hostData any, packages ...Package) (*Program, error) + func (p *Program) AcquireVM(ctx context.Context) *VM + func (p *Program) AssertValue(v values.Value, target *values.Type) (values.Value, bool, error) + func (p *Program) Callable(v values.Value) (Callable, error) + func (p *Program) DefaultLimits() Limits + func (p *Program) DisassembleFloatLoops() string + func (p *Program) EncodeJSON(ctx context.Context, v values.Value, limit int) (json.RawMessage, error) + func (p *Program) HostData() any + func (p *Program) InterfaceType(v values.Value) *values.Type + func (p *Program) JSONValue(ctx context.Context, v values.Value, limit int) (any, error) + func (p *Program) LookupFunction(name string, want *Signature) (Callable, error) + func (p *Program) NativeFunction(typ *NativeFunctionType, fn Native) (values.Value, error) + func (p *Program) NativeFunctionData(v values.Value) any + func (p *Program) PackInterface(t *values.Type, v values.Value) (values.Value, error) + func (p *Program) PointerInterface(t *values.Type, ptr unsafe.Pointer) (values.Value, error) + func (p *Program) Shape(t *values.Type) *values.Shape + func (p *Program) UnpackInterface(v values.Value) (*values.Shape, values.Value, error) + type RecordScope struct + func WithRecords(ctx context.Context) (context.Context, *RecordScope) + func (s *RecordScope) Close() + func (s *RecordScope) Edit(model *kvo.Model, m *row2.Editor) values.Value + func (s *RecordScope) EditRecord(model *kvo.Model, m *kvo.Editor) values.Value + func (s *RecordScope) Mutable(v values.Value, model *kvo.Model) (*row2.Editor, error) + func (s *RecordScope) MutableRecord(v values.Value, model *kvo.Model) (*kvo.Editor, error) + func (s *RecordScope) Read(model *kvo.Model, m row2.View) values.Value + func (s *RecordScope) ReadRecord(model *kvo.Model, m kvo.Record) values.Value + type RecordType struct + Model *kvo.Model + Mutable bool + Name string + NativeAllocation reflect.Type + Pointer *values.Type + SchemaView bool + Value *values.Type + func NewRecordType(name string, model *kvo.Model, mutable bool) *RecordType + type ScopeEnd struct + Domain string + ScopeParameter int + type ScopedCallback struct + Argument int + Domain string + type SharedType struct + Name string + Native reflect.Type + Type *values.Type + type Signature struct + Params []*values.Type + Results []*values.Type + type SourceBranch struct + Inverted bool + PC int + type SourceFile struct + Name string + Text string + type SourcePosition struct + Column int + File string + Line int + type TypeAlias struct + Name string + Target *values.Type + type TypeDecl struct + Name string + NativeCodec *NativeValueCodec + NativeSlice *NativeSliceDecl + ScalarBase *values.Type + Shape *values.Shape + SourceName string + TypeArgs []*values.Type + type VM struct + Context context.Context + Output func(string) error + P []unsafe.Pointer + Position SourcePosition + R []uint64 + func (c *VM) AllocCells(n uint64) (unsafe.Pointer, error) + func (c *VM) AnyValue(x any) (values.Value, error) + func (c *VM) BorrowBytes(data []byte) (values.Value, error) + func (c *VM) CallbackError(err error) error + func (c *VM) ChargeAllocation(bytes uint64) error + func (c *VM) Coverage() *Coverage + func (c *VM) EncodeJSON(v values.Value, limit int) (json.RawMessage, error) + func (c *VM) EncodeJSONObject(v values.Value, limit int) (json.RawMessage, error) + func (c *VM) ErrorValue(err error) (values.Value, error) + func (c *VM) FlushMutableRecord(v values.Value, model *kvo.Model) error + func (c *VM) FlushRecord(editor *kvo.Editor) error + func (c *VM) IncreaseCPUBudget(ms uint64) error + func (c *VM) IncreaseMemBudget(bytes, allocs uint64) error + func (c *VM) Interface(slot int) (*values.Type, values.Value, error) + func (c *VM) JSONValue(v values.Value, limit int) (any, error) + func (c *VM) JSONValueWithSize(v values.Value, limit int) (any, int, error) + func (c *VM) LoadNative(s *values.Shape, p unsafe.Pointer) (values.Value, error) + func (c *VM) MutableRecord(v values.Value, model *kvo.Model) (*kvo.Editor, any, error) + func (c *VM) NarrowBudget(steps uint64, duration time.Duration) *BudgetScope + func (c *VM) NarrowCPUBudget(soft, hard time.Duration) *BudgetScope + func (c *VM) NativeAny(v values.Value) (any, error) + func (c *VM) NativeArguments(params []*values.Type, args []any) ([]values.Value, error) + func (c *VM) NativeError(value values.Value) (error, error) + func (c *VM) NativeFunction(typ *NativeFunctionType, fn Native) (values.Value, error) + func (c *VM) NativeFunctionWithData(typ *NativeFunctionType, fn Native, data any) (values.Value, error) + func (c *VM) NativeSlice(layout, element *values.NativeLayout, data unsafe.Pointer, ...) (values.Value, error) + func (c *VM) PanicCallback(err error) + func (c *VM) Program() *Program + func (c *VM) Record(v values.Value, model *kvo.Model) (kvo.Record, error) + func (c *VM) RecordValue(model *kvo.Model, m kvo.Record) (values.Value, error) + func (c *VM) SetBackedEditRecordResult(model *kvo.Model, e *kvo.Editor, backing any) error + func (c *VM) SetCallResult(i int, v values.Value) + func (c *VM) SetEditRecordResult(model *kvo.Model, e *kvo.Editor) error + func (c *VM) SetError(result int, err error) error + func (c *VM) SetInterface(slot int, t *values.Type, v values.Value) (err error) + func (c *VM) SetReadRecordResult(model *kvo.Model, m row2.View) error + func (c *VM) SetRecordResult(model *kvo.Model, m kvo.Record) error + func (c *VM) SetValue(slot int, v values.Value) + func (c *VM) SliceElement(s *values.Shape, v values.Value, index uint64) (values.Value, error) + func (c *VM) StoreNative(s *values.Shape, p unsafe.Pointer, v values.Value) error + func (c *VM) TypedInterfaceValue(x any) (values.Value, error) + func (c *VM) Value(slot int) values.Value + func (vm *VM) AllocatedBytes() uint64 + func (vm *VM) CallArgument(i int) values.Value + func (vm *VM) CallbackScope() *CallbackScope + func (vm *VM) CheckConcurrentBorrow(parameter int) error + func (vm *VM) LookupMethod(value values.Value, name string, signature Signature) (Callable, error) + func (vm *VM) OpenCallbackScope(limits Limits) (*CallbackScope, error) + func (vm *VM) PackAggregate(t *values.Type, members ...values.Value) (values.Value, error) + func (vm *VM) PackMap(t *values.Type, items ...values.Value) (values.Value, error) + func (vm *VM) Release() + func (vm *VM) Run(fn Callable, slots []values.Value) error + func (vm *VM) SetBudget(l Limits) + func (vm *VM) SetCoverage(c *Coverage) error + func (vm *VM) UnpackAggregate(t *values.Type, v values.Value) ([]values.Value, error) + func (vm *VM) UnpackMap(t *values.Type, v values.Value) ([]values.Value, error) + type ValueModel struct + Model *kvo.Model + Props [2]uint64 + Type *values.Type