All Projects → archseer → Enigma

archseer / Enigma

Licence: mpl-2.0
An Erlang VM implementation in Rust

Programming Languages

rust
11053 projects
elixir
2628 projects
erlang
1774 projects

Projects that are alternatives of or similar to Enigma

Mac
bytecode interpreter in c (blog post)
Stars: ✭ 628 (-28.39%)
Mutual labels:  virtual-machine, vm
Smlvm
Smallrepo Virtual Machine
Stars: ✭ 265 (-69.78%)
Mutual labels:  virtual-machine, vm
js5005
js5005 is a virtual CPU with every logic gate simulated. A pretty interface, a built in assembler, display, and 256 bytes of RAM to boot. It's the better i4004.
Stars: ✭ 14 (-98.4%)
Mutual labels:  vm, virtual-machine
vm-automation
VirtualBox automation using Python
Stars: ✭ 1 (-99.89%)
Mutual labels:  vm, virtual-machine
16bitjs
💻 A 16-bit virtual machine, including assembly language with 37 instructions, binary assembler, and a step through debugger
Stars: ✭ 427 (-51.31%)
Mutual labels:  virtual-machine, vm
tsharkVM
tshark + ELK analytics virtual machine
Stars: ✭ 51 (-94.18%)
Mutual labels:  vm, virtual-machine
RISVM
A low overhead, embeddable bytecode virtual machine in C++
Stars: ✭ 21 (-97.61%)
Mutual labels:  vm, virtual-machine
SBTCVM-Gen2-9
SBTCVM is a virtual machine implementation of a balanced ternary (base 3) computer. Features several compiled languages for ternary software development.
Stars: ✭ 32 (-96.35%)
Mutual labels:  vm, virtual-machine
Ethereumjs Monorepo
Monorepo for the Ethereum VM TypeScript Implementation
Stars: ✭ 813 (-7.3%)
Mutual labels:  virtual-machine, vm
Ark
ArkScript is a small, fast, functional and scripting language for C++ projects
Stars: ✭ 312 (-64.42%)
Mutual labels:  virtual-machine, vm
kcs
Scripting in C with JIT(x64)/VM.
Stars: ✭ 25 (-97.15%)
Mutual labels:  vm, virtual-machine
Awesome Wasm Runtimes
A list of webassemby runtimes
Stars: ✭ 490 (-44.13%)
Mutual labels:  virtual-machine, vm
Animach
Scheme语言实现和运行时环境 / A Scheme runtime & implementation
Stars: ✭ 45 (-94.87%)
Mutual labels:  vm, virtual-machine
Lc3 Vm
Write your own virtual machine for the LC-3 computer!
Stars: ✭ 631 (-28.05%)
Mutual labels:  virtual-machine, vm
RSqueak
A Squeak/Smalltalk VM written in RPython.
Stars: ✭ 78 (-91.11%)
Mutual labels:  vm, virtual-machine
open-semantic-desktop-search
Virtual Machine for Desktop Search with Open Semantic Search
Stars: ✭ 22 (-97.49%)
Mutual labels:  vm, virtual-machine
c8c
The chip8 compiler, assembler, and virtual machine
Stars: ✭ 110 (-87.46%)
Mutual labels:  vm, virtual-machine
butterfly
Butterfly connects Virtual Machines and control their traffic flow
Stars: ✭ 48 (-94.53%)
Mutual labels:  vm, virtual-machine
Virtualbox Python
Complete implementation of VirtualBox's COM API with a Pythonic interface.
Stars: ✭ 277 (-68.42%)
Mutual labels:  virtual-machine, vm
Embiggen Disk
embiggden-disk live-resizes a filesystem after first live-resizing any necessary layers below it: an optional LVM LV and PV, and an MBR or GPT partition table
Stars: ✭ 440 (-49.83%)
Mutual labels:  virtual-machine, vm

Enigma

Enigma VM

Build status Windows build status

An implementation of the Erlang VM in Rust. We aim to be complete, correct and fast, in that order of importance.

OTP 22+ compatible (sans the distributed bits for now) — all your code should eventually run on Enigma unchanged. Deprecated opcodes won't be supported.

Why?

Because it's fun and I've been learning a lot. BEAM and HiPE are awesome, but they're massive (~300k SLOC). A small implementation makes it easier for new people to learn Erlang internals. We also get a platform to quickly iterate on ideas for inclusion into BEAM.

Installation

Only prerequisite to building Enigma is Rust. Use rustup to install the latest nightly rust. At this time we don't support stable / beta anymore, because we're relying on async/await, which is scheduled to run in stable some time in Q3 2019.

To boot up OTP you will also need to compile the standard library. At the moment, that relies on the BEAM build system:

git submodule update --init --depth 1
cd otp
/otp_build setup -a
make libs
make local_setup

We hope to simplify this step in the future (once enigma can run the compiler).

Run cargo run to install dependencies, build and run the VM. By default, it will boot up the erlang shell (iex also works, but has some rendering bugs).

Expect crashes, but a lot of the functionality is already available.

Pre-built binaries for various platforms will be available, once we reach a certain level of stability.

Feature status

We implement most of the opcodes, and about half of all BIFs. You can view a detailed progress breakdown on opcodes or BIFs.

Roadmap

  • [x] Get the full OTP kernel/stdlib to boot (init:start).
  • [x] Get the Eshell to run.
  • [x] Get OTP tests to run (works with a custom runner currently).
  • [x] Get the erlang compiler to work.
  • [x] Get IEx to run.
  • [ ] Get OTP tests to pass.

Features

  • [x] Floating point math
  • [x] Spawn & message sending
  • [x] Lambdas / anonymous functions
  • [x] Exceptions & stack traces
  • [x] Process dictionary
  • [x] Signal queue
  • [x] Links & monitors
  • [ ] Timers
  • [x] Maps
  • [x] Binaries
  • [ ] File IO
    • [x] open/read/close/read_file/write
    • [ ] Filesystem interaction
  • [ ] External NIFs
  • [ ] Ports (might never be fully supported, we provide a few boot-critical ones as builtins: tty, fd)
  • [ ] External Term representation
    • [x] Decoding
    • [ ] Encoding
  • [ ] ETS
    • [x] PAM implementation
    • [x] All table types partially, but we do not provide any concurrency guarantees
  • [ ] Regex (some support exists for basic matching)
  • [ ] Garbage Collection (arena-based per-process at the moment)
  • [ ] inet via socket nifs
  • [ ] Code reloading
  • [ ] Tracing/debugging support
  • [ ] Load-time instruction transform
  • [x] Load-time instruction specialization engine

Goals, ideas & experiments

Process scheduling is implemented on top of rust futures:

  • A process is simply a long running future, scheduled on top of tokio-threadpool work-stealing queue
  • A timer is a delay/timeout future relying on tokio-timer time-wheel
  • Ports are futures we can await on
  • File I/O is AsyncRead/AsyncWrite awaitable
  • NIF/BIFs are futures that yield at certain points to play nice with reductions (allows a much simpler yielding implementation)

Future possibilities:

  • Write more documentation about more sparsely documented BEAM aspects (binary matching, time wheel, process monitors, ...)
  • Explore using immix as a GC for Erlang
  • Eir runtime
  • JIT via Eir
  • BIF as a generator function (yield to suspend/on reduce)
  • Provide built-in adapter modules for hyper as a Plug Adapter / HTTP client.
  • Cross-compile to WebAssembly (runtime)

Initial non-goals

Until the VM doesn't reach a certain level of completeness, it doesn't make sense to consider these.

  • Distributed Erlang nodes
  • Tracing / debugging support
  • BEAM compatible NIFs / FFI

Note: NIF/FFI ABI compatibility with OTP is going to be quite some work. But, a rust-style NIF interface will be available. It would also probably be possible to make an adapter compatible with rustler.

Contributing

Contributors are very welcome!

The easiest way to get started is to look at the notes folder and pick a BIF or an opcode to implement. Take a look at src/bif.rs and the bif folder on how other BIFs are implemented. There's also a few issues open with the good first issue tag, which would also be a good introduction to the internals.

Alternatively, search the codebase for TODO, FIXME or unimplemented!, those mark various places where a partial implementation exists, but a bit more work needs to be done.

Test coverage is currently lacking, and there's varying levels of documentation; I will be addressing these soon.

We also have a #enigma channel on the Elixir Slack.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].