paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Compiler Testing using Template Java Programs

使用模板 Java 程序进行编译器测试
ASE Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering2022匹配度 3/10 · 论文属于PL领域的编译器测试,使用模板程序与DSL洞随机生成JIT编译器测试输入,与用户关注的PL背景有弱关联;但完全不涉及AI/LLM、静态分析、浮点程序分析或贝叶斯程序分析,因此不匹配核心研究方向。引用 21 inbox
Zhiqiang Zang, Nathan Wiatrek, Milos Gligoric, August Shi
crossref: 2026-09-12

AI 速览

一句话:JAttack 框架利用带 DSL 洞的模板 Java 程序随机生成测试输入,发现 JIT 编译器六个关键缺陷。

编译器测试,尤其是即时编译(JIT)编译器的测试,难以生成能触发复杂优化的程序。本文提出 JAttack,一个基于模板的编译器测试框架:开发者用宿主语言 Java 编写模板程序,其中包含由领域特定语言(DSL)描述的洞;每个洞构造扩展抽象语法树(eAST)中的一个节点,定义该洞的搜索空间(一组表达式和值)。JAttack 通过执行模板并随机从搜索空间中选择表达式与值填充洞来生成测试程序,同时引入若干优化以降低生成开销。作者用 JAttack 测试 Java JIT 编译器,共发现并被 Oracle 开发者确认六个关键缺陷,其中四个此前未知,包括两个未知的 CVE。

问题
JIT 编译器的优化只在运行时触发,传统随机测试难以生成结构复杂、能触发深层优化的程序,导致缺陷难以暴露。
方法
提出 JAttack:开发者编写含 DSL 洞的 Java 模板程序,洞定义 eAST 节点及其搜索空间,JAttack 通过执行模板并随机填充洞来生成测试程序,并采用优化降低生成成本。
评估
将 JAttack 用于测试 Java JIT 编译器,发现六个被 Oracle 开发者确认的关键缺陷;其中四个此前未知,包含两个未知 CVE。
原文摘要(Abstract)

We present JAttack, a framework that enables template-based testing for compilers. Using JAttack, a developer writes a template program that describes a set of programs to be generated and given as test inputs to a compiler. Such a framework enables developers to incorporate their domain knowledge on testing compilers, giving a basic program structure that allows for exploring complex programs that can trigger sophisticated compiler optimizations. A developer writes a template program in the host language (Java) that contains holes to be filled by JAttack. Each hole, written using a domain-specific language, constructs a node within an extended abstract syntax tree (eAST). An eAST node defines the search space for the hole, i.e., a set of expressions and values. JAttack generates programs by executing templates and filling each hole by randomly choosing expressions and values (available within the search space defined by the hole). Additionally, we introduce several optimizations to reduce JAttack’s generation cost. While JAttack could be used to test various compiler features, we demonstrate its capabilities in helping test just-in-time (JIT) Java compilers, whose optimizations occur at runtime after a sufficient number of executions. Using JAttack, we have found six critical bugs that were confirmed by Oracle developers. Four of them were previously unknown, including two unknown CVEs (Common Vulnerabilities and Exposures). JAttack shows the power of combining developers’ domain knowledge (via templates) with random testing to detect bugs in JIT compilers.

链接与引用

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

BibTeX
@inproceedings{paperbot7321,
  title = {Compiler Testing using Template Java Programs},
  author = {Zhiqiang Zang and Nathan Wiatrek and Milos Gligoric and August Shi},
  booktitle = {ASE},
  year = {2022},
  doi = {10.1145/3551349.3556958}
}