Skip to main content

Module pi_wasm

Module pi_wasm 

Source
Expand description

PiWasm: WebAssembly polyfill for QuickJS runtime.

Provides globalThis.WebAssembly inside QuickJS, backed by wasmtime. Enables JS extensions to use WebAssembly modules (e.g., Emscripten-compiled code) even though QuickJS lacks native WebAssembly support.

Architecture:

  • Native Rust functions (__pi_wasm_*) handle compile/instantiate/call
  • A JS polyfill wraps them into the standard WebAssembly namespace
  • Memory is synced as ArrayBuffer snapshots (wasmtime → JS) via a getter