📖Perceus: garbage free reference counting with reuse

authors
Reinking, Alex and Xie, Ningning and De Moura, Leonardo and Leijen, Daan
year
2021
  • Functional but in-place (FBIP) programming paradigm. Allows writing mutating algorithms in purely functional way.
    • This is analogous to tail calls which allow writing loops with recursion. But here, FBIP allows writing mutating algorithms
  • The algorithm emits precise reference counting instructions so that non-cyclic references are dropped as soon as possible. They call it garbage free because only live data is retained.
  • Precise ref counting enables many further optimizations:
    • drop specialization removes many ref counting operations in the fast path
    • reuse analysis allows updating immutable data in-place
    • reuse specialization removes many in-place field updates
  • The use of reference counting means that no runtime system is needed and Koka can link with C/C++ libraries.