CMU CS 17-770 Fall 2024

proj1 | proj2 | proj3a | proj3b

Project 3B: Wasm JIT Compiler

In this project, you will extend your Wasm engine from Project 1 to implement a dynamic compiler (i.e. JIT compiler). The objective of this project is to make your engine fast!

Starter Code

You may choose any design for your JIT compiler as long as the JIT compiler is capable of running all test programs (i.e. no fallback to interpreter) without crashing. Keep in mind that time is limited and more complex designs are more risky. For simplicity and easier debugging, we recommend a single-pass compiler design without an IR and simple register allocation only. You may build upon these components once you have a fully working minimal compiler. It is not required to (simultaneously) implement a garbage collector (3A).

Your JIT must generate assembly directly, i.e. no reusing LLVM or another JIT compiler.

Your project will be evaluated for functional correctness and performance.

Your project is required to run on Linux x86-64 and may be written in the language of your choice. The starter code provides functional x86-64 assembler (Xbyak) in C++. For Rust, you may use monoasm. If you are using any other language and require an assembler, please contact us before using it so we can validate it first.

Tips and Help

  1. Start early. Although you have several weeks, this is not a simple project and requires considerable effort.
  2. Start simple. There is no end to how complex your JIT can be! Ensure you have a minimal working prototype before implementing advanced features, which can esaily be layered over.
  3. Plan your implementation strategy. Decide what your internal representation (if you have one) and compilation strategy might look like.
  4. Commit working code in small chunks. If everything is broken, you can always go back. You can use branches too.
  5. Debug in small chunks. Resist the urge to write large sections of code and then test. It will be easier to find bugs if the new delta is small.