paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Exploiting the Sparseness of Control-Flow and Call Graphs for Efficient and On-Demand Algebraic Program Analysis

利用控制流与调用图的稀疏性实现高效按需代数程序分析
OOPSLA 7(OOPSLA2)2023匹配度 3/10 · 论文属于代数程序分析与按需查询优化,虽与静态分析/PL相关,但未涉及LLM/Agent、浮点程序分析或贝叶斯程序分析等用户核心交叉方向,也未讨论在ML系统或Agentic程序中的应用。引用 12 inbox
Giovanna Kobus Conrado, Amir Kafshdar Goharshady, Kerim Kochekov, Yun Chen Tsai, Ahmed Khaled Zaher
crossref: 2026-09-10

AI 速览

一句话:提出按需代数程序分析算法,借助控制流与调用图稀疏性,预处理后每次查询仅需 O(k)。

代数程序分析(APA)将程序摘要建模为正则代数元素,常用于数据流分析、终止性分析与不变式生成等静态分析任务。经典 APA 对单个或同起点查询需 O(n·α(n)·k),而按需场景需回答大量在线 (s,t) 查询,逐次分析代价高昂。本文提出一系列按需 APA 算法:先以 O(n·lg n·k) 轻量预处理,再利用真实程序控制流图的树状结构、有界树宽与嵌套深度,以及调用图相对程序规模较小的树深等稀疏性,将每次查询降至 O(k),即仅需常数次代数操作。实验表明该方法有效且相比经典 APA 快若干数量级。

问题
在按需 APA 设置下,程序可预处理,需高效回答大量在线起止行 (s,t) 查询,避免为每个查询重新运行完整 APA。
方法
利用 CFG 与 CG 的结构稀疏性(树状、有界树宽/嵌套深度、小树深),设计轻量预处理与查询算法。
评估
给出实验结果,验证预处理与查询效率,并显示相较经典 APA 有数个数量级加速。
原文摘要(Abstract)

Algebraic Program Analysis (APA) is a ubiquitous framework that has been employed as a unifying model for various problems in data-flow analysis, termination analysis, invariant generation, predicate abstraction and a wide variety of other standard static analysis tasks. APA models program summaries as elements of a regular algebra . Suppose that a summary inAis assigned to every transition of the program and that we aim to compute the effect of running the program starting at linesand ending at linet. APA first computes a regular expression capturing all program paths of interest. In case of intraprocedural analysis, models all paths fromstot, whereas in the interprocedural case it models all interprocedurally-valid paths, i.e. ‍paths that go back to the right caller function when a callee returns. This regular expression is then interpreted over the algebra to obtain the desired result. Suppose the program hasnlines of code and each evaluation of an operation in the regular algebra takesO(k) time. It is well-known that a single APA query, or a set of queries with the same starting points, can be answered inO(n· α(n) ·k), where α is the inverse Ackermann function. In this work, we consider an on-demand setting for APA: the program is given in the input and can be preprocessed. The analysis has to then answer a large number of on-line queries, each providing a pair (s,t) of program lines which are the start and end point of the query, respectively. The goal is to avoid the significant cost of running a fresh APA instance for each query. Our main contribution is a series of algorithms that, after a lightweight preprocessing ofO(n· lgn·k), answer each query inO(k) time. In other words, our preprocessing has almost the same asymptotic complexity as a single APA query, except for a sub-logarithmic factor, and then every future query is answered instantly, i.e. ‍by a constant number of operations in the algebra. We achieve this remarkable speedup by relying on certain structural sparsity properties of control-flow and call graphs (CFGs and CGs). Specifically, we exploit the fact that control-flow graphs of real-world programs have a tree-like structure and bounded treewidth and nesting depth and that their call graphs have small treedepth in comparison to the size of the program. Finally, we provide experimental results demonstrating the effectiveness and efficiency of our approach and showing that it beats the runtime of classical APA by several orders of magnitude.

链接与引用

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

BibTeX
@article{paperbot1886,
  title = {Exploiting the Sparseness of Control-Flow and Call Graphs for Efficient and On-Demand Algebraic Program Analysis},
  author = {Giovanna Kobus Conrado and Amir Kafshdar Goharshady and Kerim Kochekov and Yun Chen Tsai and Ahmed Khaled Zaher},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {7},
  number = {OOPSLA2},
  year = {2023},
  doi = {10.1145/3622868}
}