GithubHelp home page GithubHelp logo

doytsujin / wizard-engine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from titzer/wizard-engine

0.0 1.0 0.0 1.69 MB

Research WebAssembly Engine

Shell 27.11% JavaScript 0.58% C 0.91% Java 0.17% Makefile 5.37% WebAssembly 65.85%

wizard-engine's Introduction

Wizard: An advanced WebAssembly Engine for Research

The Wizard Engine is a lightweight WebAssembly virtual machine designed for teaching and research. Its implementation is designed to be flexible and easy to grasp, ideal for experimentation and modification. Built with the future in mind, it is written in a fast and lightweight safe, garbage-collected programming language, Virgil.

Features

Wizard supports Wasm standard features, including:

  • Wasm MVP features
  • Multi-values
  • Reference types
  • Bulk-memory operations
  • SIMD (wip)

Wizard fully supports these Wasm proposals:

  • Tail-call
  • GC
  • Multi-memory
  • Function References
  • Relaxed section order

Other features under development:

  • Type imports
  • Threads
  • Exception handling

Wizard 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 support in Wizard is a work in progress.

Supported Targets

Because Wizard is written in 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-linux

Both 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 for a closer look at Wizard's internals.

Read how to Build and Test Wizard.

Read how to use tracing options in Wizard.

Research Projects

Currently, Wizard supports three closely related research projects:

  • Generalized import system: a Wasm extension for expressing source-level constructs in Wasm
  • Jawa: a Java virtual machine runtime system implementation using the generalized import sytsem
  • Fast-int: the fast, in-place interpreter for Wasm

License

Licensed under the Apache License, Version 2.0. (rt/LICENSE or https://www.apache.org/licenses/LICENSE-2.0)

wizard-engine's People

Contributors

titzer avatar arnevogel avatar syrusakbary avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.