Documentation
¶
Overview ¶
Package wasmbin rewrites the one part of a WebAssembly binary the engine needs to change: the limits of the module's own linear memory.
A browser cannot cap a memory the module defines itself, as wazero's WithMemoryLimitPages does; the cap has to be in the binary. Making the memory shared at the same time lets the engine's worker read and write the guest's memory directly while it serves WASI calls (the threads proposal's limits encoding: 0x01 min max, 0x03 min max shared).
Index ¶
Constants ¶
const MaxPages = 65536
MaxPages is the most pages a 32-bit memory can have.
Variables ¶
var ErrInvalid = errors.New("invalid WebAssembly binary")
ErrInvalid is wrapped by every refusal of a binary.
Functions ¶
func LimitMemory ¶
LimitMemory returns a copy of mod whose defined memory has maximum maxPages (or its own maximum if lower), shared if asked. It refuses a module that imports its memory, defines more than one, or needs more than maxPages to start.
Types ¶
This section is empty.