A Mechanically Verified Garbage Collector for OCamlA Mechanically Verified Garbage Collector for OCamlS. Shamsu et al.

被引:0
作者
Sheera Shamsu [1 ]
Dipesh Kafle [2 ]
Dhruv Maroo [1 ]
Kartik Nagar [1 ]
Karthikeyan Bhargavan [3 ]
KC Sivaramakrishnan [1 ]
机构
[1] IIT Madras,
[2] NIT Trichy,undefined
[3] Inria,undefined
[4] Tarides,undefined
关键词
Formal verification; Mark and sweep garbage collection; F*; Low*; Mechanized formal proofs; Graph traversal proofs;
D O I
10.1007/s10817-025-09721-0
中图分类号
学科分类号
摘要
The OCaml programming language finds application across diverse domains, including systems programming, web development, scientific computing, formal verification, and symbolic mathematics. OCaml is a memory-safe programming language that uses a garbage collector (GC) to free unreachable memory. It features a low-latency, high-performance GC, tuned for functional programming. The GC has two generations—a minor heap collected using a copying collector and a major heap collected using an incremental mark-and-sweep collector. Alongside the intricacies of an efficient GC design, OCaml compiler uses efficient object representations for some object classes, such as interior pointers for supporting mutually recursive functions, which further complicates the GC design. The GC is a critical component of the OCaml runtime system, and its correctness is essential for the safety of OCaml programs. In this paper, we propose a strategy for crafting a correct, proof-oriented GC from scratch, designed to evolve over time with additional language features. Our approach neatly separates abstract GC correctness from OCaml-specific GC correctness, offering the ability to integrate further GC optimizations, while preserving core abstract GC correctness. As an initial step to demonstrate the viability of our approach, we have developed a verified stop-the-world mark-and-sweep GC for OCaml. The approach is fully mechanized in F* and its low-level subset Low*. We use the KaRaMel compiler to compile Low* to C, and integrate the verified GC with the OCaml runtime. Our GC is evaluated against off-the-shelf OCaml GC and Boehm–Demers–Weiser conservative GC, and the experimental results show that verified OCaml GC is competitive with the standard OCaml GC.
引用
收藏
相关论文
empty
未找到相关数据