paperbot · PL 论文追踪

全部论文 待读 收藏

P2 SmallRace: Static Race Detection for Dynamic Languages - A Case on Smalltalk

SmallRace:面向动态语言的静态竞态检测——以 Smalltalk 为例
ICSE 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE)2023匹配度 3/10 · 该论文属于静态程序分析与指针分析,与用户研究方向中的程序分析有弱关联,但不涉及 LLM/Agent、浮点程序分析或贝叶斯程序分析,且面向 Smalltalk 动态语言竞态检测,并非用户核心追踪问题。引用 2 inbox
Siwei Cui, Yifei Gao, Rainer Unterguggenberger, Wilfried Pichler, Sean Livingstone, Jeff Huang
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:提出 SmallRace,将 Smalltalk 翻译为统一指针类型的 SmallIR,用过程间线程敏感指针分析实现静态竞态检测。

Smalltalk 至今仍被大量遗留代码库使用,而竞态条件是其多线程编程的关键难题:纯动态类型允许任意对象赋给任意变量,也可派生线程执行以对象传入的匿名代码块,竞态易引入却难在运行时防范。本文提出 SmallRace,一个面向多线程动态语言的静态竞态检测框架。其核心是 SmallIR:所有变量统一声明为泛型指针类型的 LLVM IR 子集,据此设计过程间、线程敏感的指针分析以推断动态变量具体类型。SmallRace 自动把 VisualWorks 的 Smalltalk 源码翻译为 SmallIR,支持大部分现代语法,并生成带详细调试信息的竞态报告。作者在超过百万行的企业生产代码库上评估,发现数十个复杂竞态。

问题
在 Smalltalk 这类纯动态类型多线程语言中,竞态条件极易引入却难以在运行时防范,缺乏可处理大型遗留代码的静态检测手段。
方法
将 Smalltalk 源码自动翻译为 SmallIR(所有变量统一声明为泛型指针的 LLVM IR 子集),并在其上实现过程间、线程敏感的指针分析与竞态检测,输出可操作的竞态报告。
评估
在大型公司的超过一百万行生产代码库上实际部署分析,检测出数十个复杂的真实竞态条件。
原文摘要(Abstract)

Smalltalk, one of the first object-oriented programming languages, has had a tremendous influence on the evolution of computer technology. Due to the simplicity and productivity provided by the language, Smalltalk is still in active use today by many companies with large legacy codebases and with new code written every day. A crucial problem in Smalltalk programming is the race condition. Like in any other parallel language, debugging race conditions is inherently challenging, but in Smalltalk, it is even more challenging due to its dynamic nature. Being a purely dynamically-typed language, Smalltalk allows assigning any object to any variable without type restrictions, and allows forking new threads to execute arbitrary anonymous code blocks passed as objects. In Smalltalk, race conditions can be introduced easily, but are difficult to prevent at runtime. We present SmallRace, a novel static race detection framework designed for multithreaded dynamic languages, with a focus on Smalltalk. A key component of SmallRace is SmallIR, a subset of LLVM IR, in which all variables are declared with the same type-a generic pointer 18✶. This allows SmallRace to design an effective interprocedural thread-sensitive pointer analysis to infer the concrete types of dynamic variables. SmallRace automatically translates Smalltalk source code into SmallIR, supports most of the modern Smalltalk syntax in Visual Works, and generates actionable race reports with detailed debugging information. Importantly, SmallRace has been used to analyze a production codebase in a large company with over a million lines of code, and it has found tens of complex race conditions in the production code.

链接与引用

DOI 原文 · DBLP

BibTeX
@inproceedings{CuiGUPLH23,
  title = {SmallRace: Static Race Detection for Dynamic Languages - A Case on Smalltalk},
  author = {Siwei Cui and Yifei Gao and Rainer Unterguggenberger and Wilfried Pichler and Sean Livingstone and Jeff Huang},
  booktitle = {ICSE},
  year = {2023},
  doi = {10.1109/icse48619.2023.00102}
}