paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Pattern-Based Peephole Optimizations with Java JIT Tests

基于模式的窥孔优化与 Java JIT 测试
ISSTA Proceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis2023匹配度 2/10 · 论文聚焦 Java JIT 窥孔优化与测试生成,属于编译器和软件工程方向,与用户画像中的静态分析、LLM/Agent、浮点程序分析及贝叶斯程序分析核心问题无直接关联。仅在 PL 工程实现和工业落地层面有间接参考价值。引用 2 inbox
Zhiqiang Zang, Aditya Thimmaiah, Milos Gligoric
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出 JOG 框架,用 Java 模式同时编写 JIT 窥孔优化与其测试,并自动检测优化间的遮蔽关系。

Java JIT 的窥孔优化通常以 C/C++ 手工编写,测试则分散在 Java 测试中,二者难以同步维护。本文提出 JOG 框架,允许开发者直接在 Java 中以模式形式描述优化:写出优化前后的代码以及必要的前置条件,其写法与 OpenJDK 中已有的优化测试一致。JOG 将每个模式翻译为可集成到 JIT 优化管线中的 C/C++ 代码,同时从模式自动生成对应的 Java 测试;此外,JOG 还能自动检测一对优化之间可能存在的遮蔽(shadow)关系,即某个优化的效果被另一个优化覆盖。评估中作者编写了 162 个模式,包括 68 个 OpenJDK 已有优化、92 个改编自 LLVM 的新优化以及 2 个自行提出的新优化,并向 OpenJDK 提交 8 个 PR,其中 7 个已被合入主分支。结果表明 JOG 在不降低 JIT 优化效果的前提下,使优化与测试的编写更易读、更易维护。

问题
Java JIT 窥孔优化的实现(C/C++)与其测试(Java)相互分离,导致优化难以编写、阅读和维护,且优化之间的遮蔽关系不易发现。
方法
JOG 让开发者在 Java 中以模式形式编写优化前后代码及前置条件,将模式翻译为可集成进 JIT 的 C/C++ 优化 pass,并自动生成 Java 测试,同时自动检测优化对之间的遮蔽关系。
评估
作者用 JOG 编写 162 个模式(68 个 OpenJDK 已有、92 个移植自 LLVM、2 个新提出),向 OpenJDK 提交 8 个 PR(6 个新优化、1 个删除被遮蔽优化、1 个新增生成的 JIT 测试),其中 7 个已合入主分支,并验证优化效果未下降。
原文摘要(Abstract)

We present JOG, a framework that facilitates developing Java JIT peephole optimizations alongside JIT tests. JOG enables developers to write a pattern, in Java itself, that specifies desired code transformations by writing code before and after the optimization, as well as any necessary preconditions. Such patterns can be written in the same way that tests of the optimization are already written in OpenJDK. JOG translates each pattern into C/C++ code that can be integrated as a JIT optimization pass. JOG also generates Java tests for optimizations from patterns. Furthermore, JOG can automatically detect possible shadow relation between a pair of optimizations where the effect of the shadowed optimization is overridden by another. Our evaluation shows that JOG makes it easier to write readable JIT optimizations alongside tests without decreasing the effectiveness of JIT optimizations. We wrote 162 patterns, including 68 existing optimizations in OpenJDK, 92 new optimizations adapted from LLVM, and two new optimizations that we proposed. We opened eight pull requests (PRs) for OpenJDK, including six for new optimizations, one on removing shadowed optimizations, and one for newly generated JIT tests; seven PRs have already been integrated into the master branch of OpenJDK.

链接与引用

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

BibTeX
@inproceedings{ZangT023,
  title = {Pattern-Based Peephole Optimizations with Java JIT Tests},
  author = {Zhiqiang Zang and Aditya Thimmaiah and Milos Gligoric},
  booktitle = {ISSTA},
  year = {2023},
  doi = {10.1145/3597926.3598038}
}