paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Deegen: A JIT-Capable VM Generator for Dynamic Languages

Deegen:面向动态语言的可生成 JIT 的虚拟机生成器
OOPSLA 10(OOPSLA1)2026匹配度 2/10 · 论文属于 PL/编译器与运行时方向,关注动态语言 VM 和基线 JIT 的自动生成,与用户画像中的静态分析、LLM/Agent、浮点程序分析或贝叶斯程序分析均无直接交集。引用 2 inbox
Haoran Xu, Fredrik Kjolstad
crossref: 2026-09-10

AI 速览

一句话:提出 Deegen 元编译器,可从 C++ 字节码语义自动生成高性能解释器与基线 JIT 的两层 VM。

构建支持 JIT 的动态语言高性能 VM 通常成本高昂且依赖专家经验。Deegen 是元编译器:用户只需用 C++ 函数给出字节码执行语义,它便自动生成包含先进解释器、基线 JIT 与自适应层级切换的两层执行引擎,并自动应用字节码特化、内联缓存、类型检查消除、热冷拆分、OSR 等优化。作者用其实现 Lua 5.1 VM(LJR)和 SOM VM(DSOM)。在 44 个基准上,LJR 解释器平均比 PUC Lua 快 2.79×、比 LuaJIT 解释器快 1.31×;其基线 JIT 比 PUC Lua 快 4.60×,仅比 LuaJIT 优化 JIT 慢 33%(在 13/44 基准上更快)。DSOM 解释器比五个现有 SOM 解释器快 4.28–5.82×,基线 JIT 编译比 2SOM 快 25.84×且生成代码运行快 15.46×。

问题
为动态语言构建高性能 JIT 虚拟机门槛高、工程量大,缺乏可自动生成解释器与 JIT 的统一方法。
方法
Deegen 以 C++ 实现的字节码执行语义为输入,通过元编译自动生成两层 VM 执行引擎,并自动施加多种解释器/JIT 优化及层级切换逻辑。
评估
作者实现 LJR(Lua 5.1)与 DSOM(SOM)两个 VM,并在多组基准上对比 PUC Lua、LuaJIT、2SOM 等系统,验证解释器与基线 JIT 的性能和编译开销。
原文摘要(Abstract)

Building a high-performance JIT-capable VM for a dynamic language has traditionally required a tremendous amount of time, money, and expertise. We present Deegen, a meta-compiler that allows users to generate a high-performance JIT-capable VM for their own language at an engineering cost similar to writing a simple interpreter. Deegen takes in the execution semantics of the bytecodes implemented as C++ functions, and automatically generates a two-tier VM execution engine with a state-of-the-art interpreter, a state-of-the-art baseline JIT, and the tier-switching logic that connects them into a self-adaptive system. We are the first to show how to automatically generate a baseline JIT compiler that rivals the current state of the art, and an interpreter that outperforms the current state of the art. Our performance comes from Deegen’s ability to automatically apply many state-of-the-art optimizations that previously had to be hand-implemented. These optimizations include bytecode specialization and quickening, register pinning, tag register optimization, call inline caching, generic inline caching, JIT polymorphic IC, JIT IC inline slab, type-check removal and strength reduction, type-based slow-path extraction and outlining, JIT hot-cold code splitting, and JIT OSR-entry. As a result, the performance of the Deegen-generated interpreter and baseline JITs matches or surpasses state-of-the-art interpreters and baseline JITs. To evaluate Deegen, we use it to implement two languages: a Lua 5.1 VM called LuaJIT Remake (LJR) and a SOM VM called DSOM. Across 44 benchmarks, LJR’s interpreter is on average 2.79× faster than the official PUC Lua interpreter, and 1.31× faster than LuaJIT’s interpreter. LJR’s baseline JIT has negligible compilation cost, and its execution performance is on average 4.60× faster than PUC Lua and only 33% slower (but faster on 13/44 benchmarks) than LuaJIT’s optimizing JIT. Across 13 benchmarks, DSOM’s interpreter is 4.28×-5.82× faster than the five existing SOM interpreters, and DSOM’s baseline JIT compiles 25.84× faster than 2SOM’s baseline JIT, while also generating code that runs 15.46× faster.

链接与引用

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

BibTeX
@article{paperbot3814,
  title = {Deegen: A JIT-Capable VM Generator for Dynamic Languages},
  author = {Haoran Xu and Fredrik Kjolstad},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {10},
  number = {OOPSLA1},
  year = {2026},
  doi = {10.1145/3798246}
}