CMU CS 17-770 Fall 2024

proj1 | proj2 | proj3a | proj3b

Project 3A: Wasm-GC Garbage Collector

In this project, you will extend your Wasm engine from Project 1 to implement the Wasm GC proposal and a collector for it. The objective of this project is to make your engine robust to long-running programs that would exhaust memory if their objects are not reclaimed.

Starter Code

You may choose any design for your collector as long as it can correctly reclaim cycles. That means that reference-counting will not be sufficient. It is not required to implement a moving collector. You may use conservative stack scanning, but that risks failing some test cases.

Your project will be evaluated by running it on programs that will run out of memory without a garbage collector.

You do not need to implement a JIT on top of a GC for this project; GC over your interpreter is sufficient.

Instruction Set Extensions

You must implement the following opcodes in your engine (a subset of the entire Wasm GC): If you are using the starter code, GC extensions are not implemented. This will require you to extend the parser to support new heap types, reference types, and opcodes. Alternatively, you may use the Rust wasmparser crate; this already supports GC opcode parsing.

Heap Types

Your implementation should support the following heap types:

Notable simplifications to Wasm-GC for this project

Please note that we've chosen a subset of the Wasm-GC extension for this project in order to make it manageable in size.

Getting Started

You will likely benefit from extending your Project 1, since you should have already implemented a fully working interpreter.

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 GC 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 and collection algorithm 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.