Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/titzer/wizard-engine
Research WebAssembly Engine
https://github.com/titzer/wizard-engine
compiler interpreter virtual-machine webassembly
Last synced: 4 days ago
JSON representation
Research WebAssembly Engine
- Host: GitHub
- URL: https://github.com/titzer/wizard-engine
- Owner: titzer
- Created: 2019-12-11T12:49:27.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-29T18:05:12.000Z (about 2 months ago)
- Last Synced: 2024-10-29T20:11:24.640Z (about 2 months ago)
- Topics: compiler, interpreter, virtual-machine, webassembly
- Language: WebAssembly
- Homepage:
- Size: 5.11 MB
- Stars: 382
- Watchers: 9
- Forks: 38
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# The Wizard Research Engine
The Wizard Research Engine is a fully-featured WebAssembly engine (virtual machine) designed for teaching and research.
Its implementation is designed to be flexible and easy to grasp, ideal for instrumentation, experimentation and modification.
Built with the future in mind, it is written in a fast and lightweight, safe, garbage-collected programming language, [Virgil](https://github.com/titzer/virgil).## Features ##
Wizard supports Wasm standard features, including:
* Wasm MVP features
* Multi-values
* Reference types
* Bulk-memory operations
* SIMDWizard fully supports these Wasm proposals:
* Exception handling
* Tail-call
* GC
* Function References
* Multi-memoryOther features under development:
* Threads
* Stack-switching
* Memory64
* Custom page sizes
* Relaxed section orderWizard can run testcases specified in the `.bin.wast format`, like the specification tests that are part of the Wasm spec repo and proposal repos.
Wizard supports a small embedding environment suitable for running simple programs.
[WASI](https://github.com/WebAssembly/wasi) support in Wizard is a work in progress.## Supported Targets ##
Because Wizard is written in [Virgil](https://github.com/titzer/virgil), it runs on all the targets that Virgil currently supports, including:
* x86-darwin : 32-bit Darwin kernels (MacOS)
* x86-linux : 32-bit Linux kernels
* x86-64-linux : 64-bit Linux kernels
* jar : JAR files for the Java Virtual Machine
* wasm : WebAssembly module for any Wasm engine (!)In fact, because Wizard can itself be compiled to Wasm, it fully self-hosts.
This means that Wizard can run a copy of itself compiled to Wasm!Wizard has special support on the `x86-64-linux` target, with a fast, hand-written interpreter, nearly 40x faster than the simple interpreter, and as fast as interpreter tiers in other engines.
## Design and Implementation ##
Wizard is simple!
As opposed to engines focused on performance, Wizard is just a few thousand lines of code.
Instead, its architecture is focused on flexibility and readability, making it suitable for language and VM research.Wizard is implemented in Virgil, a fast and lightweight programming language.
Learning Virgil is easy; you can pick it up in no time!
Using Virgil allows Wizard to compile to a single native binary of just a few hundred kilobytes.
Development with Wizard is very quick turnaround, as a full production build takes less than a second.
Virgil is garbage-collected, thus Wasm proposals such as GC reuse the collector of the underlying language, which keeps Wizard small and easy to understand.Wizard is the first Wasm engine to do fast in-place interpretation of Wasm bytecode.
Wizard currently has two interpreters:* an easy-to-read, straightforward interpreter which runs on all the supported targets
* a fast interpreter in hand-written x86-64 assembly, which only runs on x86-64-linuxBoth interpreters execute bytecode in-place (no code rewriting) for simplicity and low memory overhead.
Later, Wizard will have a baseline compiler and optimization compiler, to match production engines' performance.## Documentation ##
The most up-to-date documentation is, as always, the implementation in this repository!
See the [Design](Design.md) for a closer look at Wizard's internals.
Read how to [Build and Test](doc/Building.md) Wizard.
Read how to use [tracing options](doc/Tracing.md) in Wizard.
Read how to use built-in [monitors](doc/Monitors.md) for analysis in Wizard.
Read how to build your own custom [monitors](doc/CustomMonitors.md) for instrumentation in Wizard.
### Research Projects
Currently, Wizard supports three closely related research projects:
* Fast-int: the fast, in-place interpreter for Wasm
* Stack-switching: a fast implementation of [WasmFX](https://wasmfx.dev) for Wizard## License
Licensed under the Apache License, Version 2.0. ([rt/LICENSE](LICENSE) or https://www.apache.org/licenses/LICENSE-2.0)