Update: this repository is archived, the project is continued at urwasm
Repository for presenting the work of our team on the Web Assembly interpreter on Urbit.
The repo contains two main parts: wasm
desk for Urbit and jet testbed. To clone both:
git clone --recursive git@github.com:Quodss/wasm-hackathon.git
To use wasm
desk:
- Make a new desk (e.g.
|new-desk %wasm
) and mount it; - Clone the repo and copy the contents to your new desk;
|commit
the desk- Run
-test /=wasm=/tests ~
to run the unit tests.
The interpreter includes:
.wasm
binary file parserwasm-to-ast.hoon
- Main interpreter engine
ast-interpreter.hoon
- Structure file
sur/wasm.hoon
with type definitions - and other files, like a library for a subset of operators and
.wasm
files for the unit tests
The tests include both simple functions for numerical arithmetics and a bit more elaborated one for string manipulations. The interpreter is still a work in progress, so some instruction definitions might be missing in the interpreter, nor do the modules get parsed completely (imports are ignored)
The jet testbed includes our Vere build that imports wasm3 Web Assembly interpreter in C. It also has its own base
and wasm
desks. We use ++was
function defined in hoon.hoon
for jet testing purposes. We haven't had enough time to turn it into a full jet, but some tests still could be run to verify that the interface between Vere and wasm3 works.
To use the jet testbed:
- Clone repo for Vere
- Checkout branch
add-wasm3
and build Vere:bazel build :urbit
- Boot a fakezod:
./vere/bazel-bin/pkg/vere/urbit -F zod
- Mount
%base
desk. Make and mount%wasm
desk - Copy the contents from respective directories and
|commit
them
Now you can run the tests with -test
, and you can test the performance by evaluating Ackermann function in UWasm, the jet and in native Hoon (without caching): +wasm!ackermann
- ~dozreg-toplud
- ~wanref-rappet
- ~datful-samned
- ~motdeg-bintul