CstorageProviderinterface
interface CstorageProvider ...
One coherent family of physical storage operations.
representation is native for native pointers or linear32 for 32-bit linear memory. The facade checks it against the target before publishing this table. Linear32 implementations must also supply layout, reference, integers, structs, and host. Their structs must be reference-valued. The integer facade must use the exact integer provider attached to this storage family.
Allocation, descriptors, scalar codecs, and copies must agree on byte order, alignment, width, and pointer units. Decode inputs contain at least the scalar width in bytes. Borrowed views preserve source lifetimes; borrows, generic casts, and const views are part of the implementation contract. Opaque values in these signatures carry provider storage, not permission to change a compiled representation at runtime.
Members
| Name | Kind | Description |
|---|
priority | field | |
boundedCount | method | Returns the requested count after any representation-specific extent check. |
representation | field | Target pointer/layout convention: native or linear32. |
integers | field | Integer operations sharing this storage representation; required for linear32. |
structs | field | Struct descriptors and row operations sharing this storage family. |
host | field | Opaque memory-host operations sharing these allocations and pointers. |
layout | field | Returns target layout facts for a type or descriptor; required for linear32. |
scalar | method | Returns the canonical descriptor for a scalar kind within this provider. |
descriptor | method | Reports layout and bounds for a provider value. |
reference | field | Creates a deferred descriptor reference for recursive layouts. |
allocateArray | method | Allocates count elements of the supplied descriptor. |
allocateBytes | method | Allocates a writable byte region containing count bytes. |
borrowString | method | Returns a read-only byte view whose lifetime borrows the source string. |
castBytes | method | Returns a read-only byte view borrowing the pointer owner. |
castElements | field | Interprets a pointer using any supplied element ctype. |
copy | method | Copies count bytes into destination without replacing its owner. |
fill | method | Fills count bytes in destination with the given byte value. |
sizeOf | method | Returns the descriptor size in bytes. |
string | method | Copies count source bytes into an independent Lua string. |
decodeUint8 | method | Decodes one unsigned 8-bit integer using the target storage byte order. |
encodeUint8 | method | Encodes one unsigned 8-bit integer using the target storage byte order. |
decodeInt8 | method | Decodes one signed 8-bit integer using the target storage byte order. |
encodeInt8 | method | Encodes one signed 8-bit integer using the target storage byte order. |
decodeUint16 | method | Decodes one unsigned 16-bit integer using the target storage byte order. |
encodeUint16 | method | Encodes one unsigned 16-bit integer using the target storage byte order. |
decodeInt16 | method | Decodes one signed 16-bit integer using the target storage byte order. |
encodeInt16 | method | Encodes one signed 16-bit integer using the target storage byte order. |
decodeUint32 | method | Decodes one unsigned 32-bit integer using the target storage byte order. |
encodeUint32 | method | Encodes one unsigned 32-bit integer using the target storage byte order. |
decodeInt32 | method | Decodes one signed 32-bit integer using the target storage byte order. |
encodeInt32 | method | Encodes one signed 32-bit integer using the target storage byte order. |
decodeUint64 | method | Decodes one unsigned 64-bit integer using the target storage byte order. |
encodeUint64 | method | Encodes one unsigned 64-bit integer using the target storage byte order. |
decodeInt64 | method | Decodes one signed 64-bit integer using the target storage byte order. |
encodeInt64 | method | Encodes one signed 64-bit integer using the target storage byte order. |
decodeFloat32 | method | Decodes one IEEE-754 binary32 value using the target storage byte order. |
encodeFloat32 | method | Encodes one IEEE-754 binary32 value using the target storage byte order. |
decodeFloat64 | method | Decodes one IEEE-754 binary64 value using the target storage byte order. |
encodeFloat64 | method | Encodes one IEEE-754 binary64 value using the target storage byte order. |
boundedCountmethod
boundedCount: function(borrows source: any, count: integer): integer
@readonly
Returns the requested count after any representation-specific extent check. Callers remain responsible for valid native pointer extents.
Arguments
| Name | Type | Description |
|---|
borrows source | any | |
count | integer | |
Returns
representationfield
@readonly
Target pointer/layout convention: native or linear32.
integersfield
@readonly
Integer operations sharing this storage representation; required for linear32.
structsfield
@readonly
Struct descriptors and row operations sharing this storage family.
hostfield
@readonly
Opaque memory-host operations sharing these allocations and pointers.
layoutfield
layout: (function(subject: any): any)?
@readonly
Returns target layout facts for a type or descriptor; required for linear32.
scalarmethod
scalar: function(kind: string): any
@readonly
Returns the canonical descriptor for a scalar kind within this provider.
Arguments
| Name | Type | Description |
|---|
kind | string | |
Returns
descriptormethod
descriptor: function(value: any): any
@readonly
Reports layout and bounds for a provider value.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
referencefield
reference: (function(resolve: function(): any): any)?
@readonly
Creates a deferred descriptor reference for recursive layouts.
allocateArraymethod
allocateArray: function(element: any, count: integer): any
@readonly
Allocates count elements of the supplied descriptor.
Arguments
| Name | Type | Description |
|---|
element | any | |
count | integer | |
Returns
allocateBytesmethod
allocateBytes: function(count: integer): uint8[?]
@readonly
Allocates a writable byte region containing count bytes.
Arguments
| Name | Type | Description |
|---|
count | integer | |
Returns
borrowStringmethod
borrowString: function(borrows bytes: string): const uint8[?] borrows (bytes)
@readonly
Returns a read-only byte view whose lifetime borrows the source string.
Arguments
| Name | Type | Description |
|---|
borrows bytes | string | |
Returns
| Type | Description |
|---|
const uint8[?] borrows (bytes) | |
castBytesmethod
castBytes: function(borrows pointer: any): const uint8[?] borrows (pointer)
@readonly
Returns a read-only byte view borrowing the pointer owner.
Arguments
| Name | Type | Description |
|---|
borrows pointer | any | |
Returns
| Type | Description |
|---|
const uint8[?] borrows (pointer) | |
castElementsfield
@readonly
Interprets a pointer using any supplied element ctype.
copymethod
copy: function(borrows destination: any, borrows source: any, count: integer): nil
@readonly
Copies count bytes into destination without replacing its owner.
Arguments
| Name | Type | Description |
|---|
borrows destination | any | |
borrows source | any | |
count | integer | |
Returns
fillmethod
fill: function(destination: any, count: integer, value: integer): nil
@readonly
Fills count bytes in destination with the given byte value.
Arguments
| Name | Type | Description |
|---|
destination | any | |
count | integer | |
value | integer | |
Returns
sizeOfmethod
sizeOf: function(element: any): integer
@readonly
Returns the descriptor size in bytes.
Arguments
| Name | Type | Description |
|---|
element | any | |
Returns
stringmethod
string: function(borrows source: any, count: integer): string
@readonly
Copies count source bytes into an independent Lua string.
Arguments
| Name | Type | Description |
|---|
borrows source | any | |
count | integer | |
Returns
decodeUint8method
decodeUint8: function(bytes: string): uint32
@readonly
Decodes one unsigned 8-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeUint8method
encodeUint8: function(value: uint32): string
@readonly
Encodes one unsigned 8-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | uint32 | |
Returns
decodeInt8method
decodeInt8: function(bytes: string): int32
@readonly
Decodes one signed 8-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeInt8method
encodeInt8: function(value: int32): string
@readonly
Encodes one signed 8-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | int32 | |
Returns
decodeUint16method
decodeUint16: function(bytes: string): uint32
@readonly
Decodes one unsigned 16-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeUint16method
encodeUint16: function(value: uint32): string
@readonly
Encodes one unsigned 16-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | uint32 | |
Returns
decodeInt16method
decodeInt16: function(bytes: string): int32
@readonly
Decodes one signed 16-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeInt16method
encodeInt16: function(value: int32): string
@readonly
Encodes one signed 16-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | int32 | |
Returns
decodeUint32method
decodeUint32: function(bytes: string): uint32
@readonly
Decodes one unsigned 32-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeUint32method
encodeUint32: function(value: uint32): string
@readonly
Encodes one unsigned 32-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | uint32 | |
Returns
decodeInt32method
decodeInt32: function(bytes: string): int32
@readonly
Decodes one signed 32-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeInt32method
encodeInt32: function(value: int32): string
@readonly
Encodes one signed 32-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | int32 | |
Returns
decodeUint64method
decodeUint64: function(bytes: string): uint64
@readonly
Decodes one unsigned 64-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeUint64method
@readonly
Encodes one unsigned 64-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | uint64 | |
Returns
decodeInt64method
decodeInt64: function(bytes: string): int64
@readonly
Decodes one signed 64-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeInt64method
@readonly
Encodes one signed 64-bit integer using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | int64 | |
Returns
decodeFloat32method
decodeFloat32: function(bytes: string): float
@readonly
Decodes one IEEE-754 binary32 value using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeFloat32method
encodeFloat32: function(value: number): string
@readonly
Encodes one IEEE-754 binary32 value using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | number | |
Returns
decodeFloat64method
decodeFloat64: function(bytes: string): number
@readonly
Decodes one IEEE-754 binary64 value using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
bytes | string | |
Returns
encodeFloat64method
encodeFloat64: function(value: number): string
@readonly
Encodes one IEEE-754 binary64 value using the target storage byte order.
Arguments
| Name | Type | Description |
|---|
value | number | |
Returns
Int64Providerinterface
interface Int64Provider ...
64-bit signed and unsigned arithmetic for generated portable operations.
Values must retain their full width rather than round through a Lua number. Arithmetic, comparisons, shifts, and conversions must agree with the signedness created by int64/uint64. toNumber is the explicit potentially inexact conversion. When physical storage supplies integers, this must be that same implementation.
Members
| Name | Kind | Description |
|---|
priority | field | |
int64 | method | Constructs or converts a signed 64-bit value. |
uint64 | method | Constructs or converts an unsigned 64-bit value. |
add | method | Adds two full-width values. |
sub | method | Subtracts the right operand. |
mul | method | Multiplies full-width values. |
div | method | Divides using the integer representation semantics. |
mod | method | Computes the corresponding integer remainder. |
pow | method | Raises to an integer power. |
neg | method | Negates the value. |
band | method | Computes 64-bit conjunction. |
bor | method | Computes 64-bit disjunction. |
bxor | method | Computes 64-bit exclusive-or. |
bnot | method | Inverts all 64 bits. |
lshift | method | Shifts left within the 64-bit representation. |
rshift | method | Shifts right with zero fill. |
arshift | method | Shifts right with sign extension. |
compare | method | Returns a negative number, zero, or a positive number for ordering. |
toNumber | method | Converts to a Lua number, which may lose integer precision. |
toString | method | Returns an exact decimal representation. |
int64method
@readonly
Constructs or converts a signed 64-bit value.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
uint64method
@readonly
Constructs or converts an unsigned 64-bit value.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
addmethod
add: function(left: any, right: any): any
@readonly
Adds two full-width values.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
submethod
sub: function(left: any, right: any): any
@readonly
Subtracts the right operand.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
mulmethod
mul: function(left: any, right: any): any
@readonly
Multiplies full-width values.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
divmethod
div: function(left: any, right: any): any
@readonly
Divides using the integer representation semantics.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
modmethod
mod: function(left: any, right: any): any
@readonly
Computes the corresponding integer remainder.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
powmethod
pow: function(left: any, right: any): any
@readonly
Raises to an integer power.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
negmethod
neg: function(value: any): any
@readonly
Negates the value.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
bandmethod
band: function(left: any, right: any): any
@readonly
Computes 64-bit conjunction.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
bormethod
bor: function(left: any, right: any): any
@readonly
Computes 64-bit disjunction.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
bxormethod
bxor: function(left: any, right: any): any
@readonly
Computes 64-bit exclusive-or.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
bnotmethod
bnot: function(value: any): any
@readonly
Inverts all 64 bits.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
lshiftmethod
lshift: function(value: any, count: number): any
@readonly
Shifts left within the 64-bit representation.
Arguments
| Name | Type | Description |
|---|
value | any | |
count | number | |
Returns
rshiftmethod
rshift: function(value: any, count: number): any
@readonly
Shifts right with zero fill.
Arguments
| Name | Type | Description |
|---|
value | any | |
count | number | |
Returns
arshiftmethod
arshift: function(value: any, count: number): any
@readonly
Shifts right with sign extension.
Arguments
| Name | Type | Description |
|---|
value | any | |
count | number | |
Returns
comparemethod
compare: function(left: any, right: any): number
@readonly
Returns a negative number, zero, or a positive number for ordering.
Arguments
| Name | Type | Description |
|---|
left | any | |
right | any | |
Returns
toNumbermethod
toNumber: function(value: any): number
@readonly
Converts to a Lua number, which may lose integer precision.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
toStringmethod
toString: function(value: any): string
@readonly
Returns an exact decimal representation.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns
StructvalueProviderinterface
interface StructvalueProvider ...
Struct-value operations supplied as part of the storage family.
Descriptors, arrays, and constructed values must agree with compiler layouts and canonical struct declarations. referenceValued reports whether a row reference addresses the underlying storage. The storage implementation supplies compatible struct operations as part of the same family.
Members
| Name | Kind | Description |
|---|
scalar | method | Returns a scalar descriptor accepted by define and array. |
array | method | Allocates count elements using this family's element descriptor. |
define | method | Constructs a type descriptor from a compiler layout and method table. |
referenceValued | field | Whether row references address their underlying storage. |
scalarmethod
scalar: function(kind: string): any
@readonly
Returns a scalar descriptor accepted by define and array.
Arguments
| Name | Type | Description |
|---|
kind | string | |
Returns
arraymethod
array: function(element: any, count: integer): any
@readonly
Allocates count elements using this family's element descriptor.
Arguments
| Name | Type | Description |
|---|
element | any | |
count | integer | |
Returns
definemethod
define: function(layout: any, methods: table): any
@readonly
Constructs a type descriptor from a compiler layout and method table.
Arguments
| Name | Type | Description |
|---|
layout | any | |
methods | table | |
Returns
referenceValuedfield
@readonly
Whether row references address their underlying storage.
WasmProviderinterface
interface WasmProvider ...
Opaque linear-memory operations belonging to a storage implementation.
Allocation and pointer values must refer to that implementation's memory host. Offsets and copy lengths are bytes; pointer's index/stride pair locates an element in an allocation. Loads and stores use the scalar kind's width and encoding. Bounds and owner lifetimes must remain valid across every operation. This interface is supplied through CstorageProvider.host, not a separate SPI.
Members
| Name | Kind | Description |
|---|
allocate | method | Allocates the requested number of bytes in this memory host. |
pointer | method | Locates a zero-based element using index and byte stride. |
offset | method | Offsets an existing pointer by count bytes. |
load | method | Reads a scalar kind at a byte offset from the pointer. |
store | method | Writes a scalar kind at a byte offset from the pointer. |
copy | method | Copies bytes between regions belonging to this host. |
descriptor | method | Returns bounds and layout information for a host value. |
allocatemethod
allocate: function(bytes: integer): any
@readonly
Allocates the requested number of bytes in this memory host.
Arguments
| Name | Type | Description |
|---|
bytes | integer | |
Returns
pointermethod
pointer: function(allocation: any, index: integer, stride: integer): any
@readonly
Locates a zero-based element using index and byte stride.
Arguments
| Name | Type | Description |
|---|
allocation | any | |
index | integer | |
stride | integer | |
Returns
offsetmethod
offset: function(pointer: any, count: integer): any
@readonly
Offsets an existing pointer by count bytes.
Arguments
| Name | Type | Description |
|---|
pointer | any | |
count | integer | |
Returns
loadmethod
load: function(pointer: any, byteOffset: integer, kind: string): any
@readonly
Reads a scalar kind at a byte offset from the pointer.
Arguments
| Name | Type | Description |
|---|
pointer | any | |
byteOffset | integer | |
kind | string | |
Returns
storemethod
store: function(pointer: any, byteOffset: integer, kind: string, value: any): nil
@readonly
Writes a scalar kind at a byte offset from the pointer.
Arguments
| Name | Type | Description |
|---|
pointer | any | |
byteOffset | integer | |
kind | string | |
value | any | |
Returns
copymethod
copy: function(destination: any, source: any, bytes: integer): nil
@readonly
Copies bytes between regions belonging to this host.
Arguments
| Name | Type | Description |
|---|
destination | any | |
source | any | |
bytes | integer | |
Returns
descriptormethod
descriptor: function(value: any): any
@readonly
Returns bounds and layout information for a host value.
Arguments
| Name | Type | Description |
|---|
value | any | |
Returns