using the compiler

Runtimes & Environment

Picking how a module allocates and frees memory, the environment variables that steer a build, and how the toolchain is tested.

Runtimes

RuntimeAllocatorCollectionUse
none Default. Only code that never allocates managed objects compiles.
stubbumpnever frees The fast baseline. Nothing rewinds it for you: a long session leaks unless the module resets its own bump position with __mark/__resetTo. Per-frame allocation belongs on frame.
framenursery + old regionat the frame boundary The frame-generational collector, and what Rive projects bake with (wasmRuntime: in rive.yaml, default frame). Allocations land in a bump nursery, except objects of 256 KB and up, which go straight to the old region; at the frame boundary the host runs a minor collection that evacuates survivors into the old region and resets the nursery. Majors run when the old region outgrows its budget, sliced across boundaries for large heaps. ASC_RUNTIME folds to 3 here (see compiler constants).

--exportRuntime exposes the stock-asc surface (__new, __pin, __unpin, __collect, __rtti_base) under stub and frame for hosts that manage guest objects directly; a none build loads no runtime, so there is nothing to export.

arena rewind hazard

Under the stub runtime’s __mark/__resetTo arena reuse, module-static caches are structurally unsafe — after a rewind the statics dangle. Keep caches inside objects whose lifetime the arena owns.

Environment knobs

VariableEffect
RIVE_RASC_SIMD=1bake the SIMD artifact
RIVE_RASC_RELAXED=1bake the relaxed-SIMD artifact
RASC_WASM_OPTpath to wasm-opt for -O2
RIVE_RASC_STDstdlib location for project bakes
RIVE_WASM_AOT_CACHEwamrc artifact cache directory
RIVE_WASM_PREGROW_PAGESpregrow linear memory under AOT

Verification culture

The compiler’s test suite (./test.sh) sweeps fixtures across runtimes and optimization levels — a couple hundred combinations — checking byte-identity wherever a feature is off, plus upstream asc’s own compiler and stdlib tests running unmodified, and differential runs against real asc when available. The ported workloads carry their own harnesses: 8.2 million checks against the C Box2D reference, bit-exact goldens against the reference Draco decoder. The working rules are “measured or reverted” and “one flipped bit = revert.”