WaEmbedder.Memory (WaEmbedderEx v0.1.0)

Copy Markdown View Source

Behaviour for WaEmbedder linear-memory backends (Elixir-facing name).

The implementation lives in the Erlang :wa_embedder_memory module; this module is a thin shim that preserves the WaEmbedder.Memory name and the validate_backend!/1 bang-raising contract for Elixir callers and tests. The default backend is WaEmbedder.Memory.Binary (itself a shim over :wa_embedder_memory_binary).

A backend provides byte-addressable storage for a compiled WASM module's linear memory. Memory references are per-process, cached in the calling process's dictionary under {:__wasm_mem, module_name}.

Summary

Functions

Page size in bytes (64 KiB, per the WASM specification).

Validates that backend is loaded and exports every behaviour callback. Raises ArgumentError listing missing callbacks (or a load failure) otherwise. Delegates the check to :wa_embedder_memory.validate_backend/1.

Functions

page_size()

Page size in bytes (64 KiB, per the WASM specification).

validate_backend!(backend)

Validates that backend is loaded and exports every behaviour callback. Raises ArgumentError listing missing callbacks (or a load failure) otherwise. Delegates the check to :wa_embedder_memory.validate_backend/1.