Skip to main content

Module types

Module types 

Source
Expand description

WASM value-representation constants and memory layout.

Every PEPL value is stored on the linear-memory heap as a 12-byte cell:

offset+0 : i32  — tag   (see TAG_* constants)
offset+4 : 8 bytes — payload (interpretation depends on tag)

§Payload layouts

TagBytes 4..8 (word-1)Bytes 8..12 (word-2)
NIL00
NUMBERf64 occupies all 8 bytes (little-endian)
BOOLi32 (0 = false, 1 = true)0 (padding)
STRINGi32 data-offseti32 byte-length
LISTi32 array-offseti32 element-count
RECORDi32 entries-offseti32 field-count
VARIANTi32 variant-idi32 data-ptr (record)
LAMBDAi32 func-indexi32 closure-ptr
COLORi32 rgba-packed0 (padding)
ACTION_REFi32 action-id0 (padding)

Constants§

COMPILER_VERSION
Compiler version embedded in the custom section.
CUSTOM_SECTION_NAME
Custom section name for PEPL metadata.
GLOBAL_GAS
Gas counter — incremented on each tick.
GLOBAL_GAS_LIMIT
Gas limit — set at init, trap when exceeded.
GLOBAL_HEAP_PTR
Heap allocation pointer — next free byte in linear memory.
GLOBAL_STATE_PTR
Pointer to the state record value.
HEAP_START
Heap starts after the data segment region. We reserve the first 4 KiB for static data (string constants, etc.).
IMPORT_COUNT
Number of imported functions (offset for locally-defined function indices).
IMPORT_GET_TIMESTAMP
env.get_timestamp() -> i64 — deterministic event timestamp (milliseconds).
IMPORT_HOST_CALL
env.host_call(cap_id: i32, fn_id: i32, args_ptr: i32) -> i32
IMPORT_LOG
env.log(ptr: i32, len: i32)
IMPORT_TRAP
env.trap(ptr: i32, len: i32) — aborts execution with a message.
INITIAL_MEMORY_PAGES
Initial linear memory size in pages (64 KiB each).
MAX_MEMORY_PAGES
Maximum linear memory pages (16 MiB).
TAG_ACTION_REF
TAG_BOOL
TAG_COLOR
TAG_LAMBDA
TAG_LIST
TAG_NIL
TAG_NUMBER
TAG_RECORD
TAG_STRING
TAG_VARIANT
TYPE_COUNT
Total number of fixed type signatures.
TYPE_F64_I32
(f64) -> i32
TYPE_I32X2_I32
(i32, i32) -> i32
TYPE_I32X2_VOID
(i32, i32) -> ()
TYPE_I32X3_I32
(i32, i32, i32) -> i32
TYPE_I32X3_VOID
(i32, i32, i32) -> ()
TYPE_I32_F64_VOID
(i32, f64) -> ()
TYPE_I32_I32
(i32) -> i32
TYPE_I32_VOID
(i32) -> ()
TYPE_VOID_I32
() -> i32
TYPE_VOID_I64
() -> i64
TYPE_VOID_VOID
() -> ()
VALUE_SIZE
Size of a single PEPL value cell on the heap (bytes).