-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
70 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,83 @@ | ||
# Web49 | ||
|
||
Web49 contains a few tools for working with webassembly | ||
Web49 contains a few tools for working with WebAssembly. | ||
|
||
## miniwasm | ||
* interpreters | ||
* miniwasm | ||
* [fast](#benchmarks) wasm interpreter | ||
* uses technology from [minivm](https://github.com/fastvm/minivm) | ||
* suports multiple wasm formats | ||
* wasm binary format: ~100% complete | ||
* wasm text format: ~95% complete | ||
* wasm spect test: ~75% complete | ||
* includes a custom [WASI](https://github.com/webassembly/wasi) [implementation](src/api/wasi.c) | ||
* raywasm | ||
* wasm interpreter based on miniwasm | ||
* includes [raylib](https://github.com/raysan5/raylib) [bindings](src/api/raylib.c) [generated from](src/api/raylib.py) [json](src/api/raylib.json) | ||
* wasm binary tools rewrite | ||
* much simpler than WABT's tools | ||
* much smaller than Binaryen's tools | ||
* [wat2wasm](main/wat2wasm.c) | ||
* convert wasm text into wasm binary | ||
* [wasm2wat](main/wasm2wat.c) | ||
* generates nearly identical wat as binaryen or wabt | ||
* turn wasm binary into wasm text | ||
* supports all of wasm 1.0 and some extensions | ||
* [wasm2wasm](main/wasm2wasm.c) | ||
* shrink numbers in wasm files generated by llvm | ||
* saves 0-4 bytes per 32 bit number | ||
* saves 0-10 bytes per 64 bit number | ||
* round trip parse and reemit | ||
|
||
MiniWASM applies what was learned in developing MiniVM to a webassembly intepreter. | ||
## Benchmarks | ||
|
||
MiniVM was about 2x faster than Wasm3, with more types and more dynamism. | ||
MiniVM was natively a register-only machine, and MiniWASM too will be mostly registers. | ||
Benchmarks performed by [wasm3](https://github.com/wasm3/wasm3) and miniwasm. Ran on an 2020 Macbook Air (M1 + 8GiB ram) using [bench.py](bench.py). | ||
|
||
MiniWASM intends to support all of what people use today in webassembly, tho it is still under heavy development. | ||
All Benchmarks compiled with: `emcc -O2` | ||
|
||
## wasm2wat | ||
One can also view results run on [github actions](https://github.com/FastVM/Web49/actions) | ||
One can run the benchmarks for themselves. | ||
|
||
The wasm2wat tool is a faster rewrite of wabt's wasm2wat, doing only the bare minimum for now. | ||
* python3 | ||
* with pip | ||
* make | ||
* tested with GNUMake | ||
* works with BSDMake too | ||
* and a C compiler | ||
* gcc/clang/tcc works | ||
* msvc would work if someone rewrites two macros | ||
* #define NEXT() break | ||
* #define LABEL(X) case X: | ||
* probably a couple others | ||
|
||
## wat2wasm | ||
```sh | ||
git clone https://github.com/fastvm/web49 | ||
cd web49 | ||
make CC=gcc # gcc is fastest in my tests | ||
python3 -m pip install matplotlib | ||
python3 bench.py | ||
``` | ||
|
||
The wat2wasm tool is a much faster rewrite of wabt's wat2wasm, it does not handle names correctly yet. | ||
### [Binary Trees](test/bench/binary-trees.c) | ||
 | ||
|
||
## wasm2wasm | ||
### [Coremark](test/bench/coremark.c) | ||
 | ||
|
||
The wasm2wasm tool intends to do the same thing as a round trip to the text format and back. Effectivly seeing the binary as it is seen by miniwasm/wasm2wat= | ||
### [Fannkuch Redux](test/bench/fannkuch-redux.c) | ||
 | ||
|
||
# whoami | ||
### [Fibonacci on ints32_t](test/bench/fib_i32.c) | ||
 | ||
|
||
I am Shaw Summa, of MiniVM fame. | ||
### [Mandelbrot with SIMD](test/bench/mandelbrot-simd.c) | ||
 | ||
|
||
### [Mandelbrot without SIMD](test/bench/mandelbrot.c) | ||
 | ||
|
||
### [Nbody](test/bench/nbody.c) | ||
 | ||
|
||
### [Executing A Trap](test/bench/trap.c) | ||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.