cp-14 · Runtime Systems

cp-01..cp-13 produce code. cp-14 builds the runtime that the code calls into: a tagged value representation, a mark-sweep garbage collector, and high-level operations (add, print, array indexing).

Build & run

cmake -S src/cpp -B build
cmake --build build
./build/tests/test_runtime    # → 36/36 checks passed
./build/mlrt-demo             # → hello, world  [0, 1, 4]  ...

What lives here

src/cpp/src/
    value.hpp         — tagged 64-bit Value
    heap.hpp/.cpp     — Object header + mark-sweep GC
    runtime.hpp/.cpp  — add / sub / mul / print / array ops
    main.cpp          — demo binary
tests/
    test_runtime.cpp  — 14 tests, 36 checks

The runtime is standalone — no LLVM, no IR. cp-17's capstone wires it into the JIT from cp-12.

Reading order

  1. steps/01-the-runtime-layer.md
  2. steps/02-value-representation.md
  3. steps/03-object-layout.md
  4. steps/04-mark-sweep-gc.md
  5. steps/05-roots-and-safepoints.md
  6. steps/06-allocation-strategies.md
  7. steps/07-beyond-mark-sweep.md