Hasty Briefsbeta

Bilingual

Fil-C: A memory-safe C implementation

6 months ago
  • #memory-safety
  • #compiler
  • #C-programming
  • Fil-C is a memory-safe implementation of C and C++ that allows existing C code to run safely without modification.
  • It is fanatically compatible with existing C code, making it suitable for retrofitting memory safety into legacy applications.
  • Fil-C can compile an entire memory-safe Linux user space, though some complex programs require modifications.
  • The project is a fork of Clang, licensed under Apache v2.0 with LLVM exceptions, and is currently based on Clang version 20.1.8.
  • Performance has improved from initial slow speeds to being only a few times slower than Clang, depending on the program structure.
  • Fil-C uses a different internal ABI than Clang, requiring all code to be recompiled with Fil-C for compatibility.
  • The InvisiCaps pointer representation ensures memory safety while maintaining the appearance of natural pointer sizes for the architecture.
  • Memory management includes a concurrent garbage collector that is both parallel and precise, using auxiliary capability information.
  • Fil-C has been used to create a memory-safe Linux user space based on Linux From Scratch, though some components still require a non-Fil-C compiler.
  • Despite its immaturity, Fil-C offers a compelling solution for memory safety in C programs, especially where performance trade-offs are acceptable.