ztcl::wasm
ztcl::wasm subcommand ?arg ...?
Runs WebAssembly modules in the sandbox and the limits of the interpreter: decodes and validates a module, links its imports to Tcl commands, other instances, or WASI preview 1, and calls its exports with Tcl values. Load it with package require ztcl::wasm.
Subcommands
| Synopsis | What it does |
|---|---|
load fileName |
Reads, decodes, and validates a module file, and gives a module handle. Needs the capability file. |
new bytes |
Decodes and validates the bytes of a module, and gives a module handle. |
instantiate module ?option value ...? |
Links the imports (-imports, -link, -wasi), runs the start function, and gives an instance handle. |
call instance function ?-limit units? ?-raw? ?--? ?arg ...? |
Calls an export and gives its result, a list of its results, or an empty string. |
package fileName ?prefix? ?-wasi dict? |
Loads a Tcl C package built for wasm32-wasi with libztclstubs.a and runs its init function. Needs the capability file. |
| `run module | fileName ?option value ...?` |
| `memory instance size | grow |
global instance name ?value? |
Reads or sets an exported global. |
| `exports module | instance` |
imports module |
A list of module, name, kind, and type for each import. |
info module |
A dict of the counts and the features of a module. |
delete handle ?handle ...? |
Deletes modules and instances. |
jit ?boolean? |
Reads or sets the use of the JIT tier for the calls of the interpreter. Gives 1 when the JIT is on. The JIT is on by default on x86-64 Linux and macOS, and the interpreter runs elsewhere. |
Facts
- Capability: none.
- Compute cost: one compute unit for each call and each loop pass of the wasm code
- The full page: ztcl::wasm.