paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Automatic Linear Resource Bound Analysis for Rust via Prophecy Potentials

通过 Prophecy Potentials 实现 Rust 的自动线性资源界分析
OOPSLA 9(OOPSLA1)2025匹配度 2/10 · 论文属于纯 PL 的静态资源界分析(AARA/类型系统),处理 Rust 借用与预言势,不涉及 LLM/Agent,也不属于浮点程序分析或贝叶斯程序分析,与用户当前关注的 PL↔AI 交叉方向无直接关联。引用 1 inbox
Qihao Lian, Di Wang
crossref: 2026-09-10

AI 速览

一句话:提出 RaRust,一种利用共享势与预言势的 Rust 类型化线性资源界分析,可处理借用、重借用、堆结构与递归。

Rust 类型系统保证内存安全,但良类型程序未必高效,因此需静态分析资源消耗;利用借用机制辅助资源界分析仍属空白。本文提出 RaRust,一种面向良类型 Rust 程序的基于类型的线性资源界分析。它沿用自动摊销资源分析(AARA)构建资源感知类型系统,并引入共享势和预言势,以组合方式处理共享与可变借用。为证明可靠性,作者提出 Resource-Aware Borrow Calculus(RABC),作为 LLBC 的变体。原型实验表明,RaRust 能为含共享/可变借用、重借用、堆分配数据结构、循环和递归的程序推断符号线性资源界。

问题
良类型 Rust 程序不保证高性能,如何对 Rust 程序资源消耗做静态分析,尤其利用借用机制辅助资源界分析,尚未被探索。
方法
提出 RaRust:基于自动摊销资源分析(AARA)的资源感知类型系统,引入共享势和预言势以组合式处理共享/可变借用,并用 RABC(LLBC 变体)证明可靠性。
评估
通过原型实现实验,评估 RaRust 能否为含共享/可变借用、重借用、堆分配数据结构、循环与递归的 Rust 程序推断符号线性资源界。
原文摘要(Abstract)

Rust has become a popular system programming language that strikes a balance between memory safety and performance. Rust’s type system ensures the safety of low-level memory controls; however, a well-typed Rust program is not guaranteed to enjoy high performance. This article studies static analysis for resource consumption of Rust programs, aiming at understanding the performance of Rust programs. Although there have been tons of studies on static resource analysis, exploiting Rust’s memory safety—especially the borrow mechanisms and their properties—to aid resource-bound analysis, remains unexplored. This article presents RaRust , a type-based linear resource-bound analysis for well-typed Rust programs. RaRust follows the methodology of automatic amortized resource analysis (AARA) to build a resource-aware type system. To support Rust’s borrow mechanisms, including shared and mutable borrows, RaRust introduces shared and novel prophecy potentials to reason about borrows compositionally. To prove the soundness of RaRust , this article proposes Resource-Aware Borrow Calculus (RABC) as a variant of recently proposed Low-Level Borrow Calculus (LLBC). The experimental evaluation of a prototype implementation of RaRust demonstrates that RaRust is capable of inferring symbolic linear resource bounds for Rust programs featuring shared and mutable borrows, reborrows, heap-allocated data structures, loops, and recursion.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot3210,
  title = {Automatic Linear Resource Bound Analysis for Rust via Prophecy Potentials},
  author = {Qihao Lian and Di Wang},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {OOPSLA1},
  year = {2025},
  doi = {10.1145/3720492}
}