Announcing Dynasm-rs: A compiler plugin for assembling and executing code at runtime

In the search for faster interpreters, Just-In-Time compilation is often a useful tool. This compiler extension attempts to make the writing of such programs easier and faster.

At its core, dynasm-rs is an assembler compiler. It reads assembly templates which it then compiles into code that when executed will result in the proper machine code being emitted.

Dynasm is split up into two parts. The first is the compiler extension that performs the translation of assembly templates into rust code, the second part is a small runtime that handles the generation of the wanted machine code. The plugin is particularly interesting in the way it implements an entire assembly dialect in rust syntax.

Links

Repository

Documentation

Tutorial

Examples

A simple hello world program

A brainfsck JIT compiler

State

Currently the project is in alpha, meaning that while everything should work, many things need to be tested.

Additionally, the project only supports x86_64 for now. I'm working on adding x86 support but this will probably take a while.

Contributing

Help is always wanted! Also this was my first major rust project I'd also welcome comments on how it was written.

9 Likes

The example links are broken

Oh whoops, they should be fixed now.