Alex Reinking, Ningning Xie, L. de Moura, Daan Leijen
{"title":"Perceus: garbage free reference counting with reuse","authors":"Alex Reinking, Ningning Xie, L. de Moura, Daan Leijen","doi":"10.1145/3453483.3454032","DOIUrl":null,"url":null,"abstract":"We introduce Perceus, an algorithm for precise reference counting with reuse and specialization. Starting from a functional core language with explicit control-flow, Perceus emits precise reference counting instructions such that (cycle-free) programs are _garbage free_, where only live references are retained. This enables further optimizations, like reuse analysis that allows for guaranteed in-place updates at runtime. This in turn enables a novel programming paradigm that we call _functional but in-place_ (FBIP). Much like tail-call optimization enables writing loops with regular function calls, reuse analysis enables writing in-place mutating algorithms in a purely functional way. We give a novel formalization of reference counting in a linear resource calculus, and prove that Perceus is sound and garbage free. We show evidence that Perceus, as implemented in Koka, has good performance and is competitive with other state-of-the-art memory collectors.","PeriodicalId":20557,"journal":{"name":"Proceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation","volume":null,"pages":null},"PeriodicalIF":0.0000,"publicationDate":"2020-11-22","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"19","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3453483.3454032","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 19
Abstract
We introduce Perceus, an algorithm for precise reference counting with reuse and specialization. Starting from a functional core language with explicit control-flow, Perceus emits precise reference counting instructions such that (cycle-free) programs are _garbage free_, where only live references are retained. This enables further optimizations, like reuse analysis that allows for guaranteed in-place updates at runtime. This in turn enables a novel programming paradigm that we call _functional but in-place_ (FBIP). Much like tail-call optimization enables writing loops with regular function calls, reuse analysis enables writing in-place mutating algorithms in a purely functional way. We give a novel formalization of reference counting in a linear resource calculus, and prove that Perceus is sound and garbage free. We show evidence that Perceus, as implemented in Koka, has good performance and is competitive with other state-of-the-art memory collectors.
我们介绍Perceus,一种具有重用和专门化的精确引用计数算法。从具有显式控制流的函数式核心语言开始,Perceus发出精确的引用计数指令,这样(无循环)程序是_garbage free_,其中仅保留活引用。这支持进一步的优化,比如允许在运行时保证就地更新的重用分析。这反过来又促成了一种新的编程范式,我们称之为FBIP (functional but in-place)。就像尾部调用优化支持使用常规函数调用编写循环一样,重用分析支持以纯函数的方式编写原地突变算法。我们给出了线性资源演算中引用计数的一种新的形式化,并证明了Perceus是健全的和无垃圾的。我们展示的证据表明,在Koka中实现的Perceus具有良好的性能,可以与其他最先进的内存收集器竞争。