Walloc.jai is the JAI port of https://github.com/wingo/walloc. You can drop it into your modules
directory. The port produces bit-identical heaps to the original C implementation.
This repository also contains a test harness that runs the port side by side with the original. To build and run the harness:
jai build.jai, which will create a public directory and copy both allocators as well as html/js in.- Run a local server in the public directory, such as
python -m http.server, and navigate to localhost in your browser.
testbed/walloc.o is the precompiled version of the original walloc.c (compiled
with clang -Oz --target=wasm64 -nostdlib -c -o walloc.o walloc.c)
The testbed runs both allocators side by side, comparing the WASM memories and the pointers the allocators return. The generated test cases attempt to trigger all code paths in the allocators (small objects, large objects, multipage objects).