paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Is this class thread-safe? inferring documentation using graph-based learning

这个类是线程安全的吗?使用基于图的学习推断文档
ASE Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering2018匹配度 4/10 · 论文属于机器学习与程序分析交叉,使用轻量级静态分析图表示加图分类器判断线程安全,与“AI/ML用于程序分析”有部分关联;但它不涉及LLM/Agent、浮点程序分析、贝叶斯程序分析,也不面向Agentic程序或ML系统静态分析,因此与用户当前核心方向匹配度有限。引用 11 inbox
Andrew Habib, Michael Pradel
crossref: 2026-09-12

AI 速览

一句话:TSFinder 结合轻量级静态分析提取的类图表示与图分类器,自动判定类是否线程安全并推断其文档。

并发面向对象软件中大量类依赖线程安全保证,但许多类缺乏相关文档,迫使开发者要么仔细阅读实现、要么保守地加锁、要么盲目假定线程安全。为弥补这一缺失,本文提出 TSFinder,自动将类分类为线程安全或线程不安全。其核心思路是将轻量级静态分析提取的类图表示与基于图的分类器相结合:静态分析为每个类构建包含方法与同步等信息的图,分类器在该图上学习判别模式。作者用已知线程安全与不安全的类训练分类器,在未见过的类上达到 94.5% 的准确率,且每个类约需 3 秒,足以高效地为大量类推断线程安全文档。

问题
许多线程安全类缺少文档,开发者难以判断类在多线程使用下的安全保证,只能人工审查实现、保守同步或乐观假设其线程安全。
方法
TSFinder 用轻量级静态分析从类中提取图表示,并训练基于图的分类器来判定类是否线程安全。
评估
在已知线程安全与不安全的类上训练后,于未见过的类上评估,分类准确率达到 94.5%,每类约耗时 3 秒,表明可高效推断文档。
原文摘要(Abstract)

Thread-safe classes are pervasive in concurrent, object-oriented software. However, many classes lack documentation regarding their safety guarantees under multi-threaded usage. This lack of documentation forces developers who use a class in a concurrent program to either carefully inspect the implementation of the class, to conservatively synchronize all accesses to it, or to optimistically assume that the class is thread-safe. To overcome the lack of documentation, we present TSFinder, an approach to automatically classify classes as supposedly thread-safe or thread-unsafe. The key idea is to combine a lightweight static analysis that extracts a graph representation from classes with a graph-based classifier. After training the classifier with classes known to be thread-safe and thread-unsafe, it achieves an accuracy of 94.5% on previously unseen classes, enabling the approach to infer thread safety documentation with high confidence. The classifier takes about 3 seconds per class, i.e., it is efficient enough to infer documentation for many classes.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot4803,
  title = {Is this class thread-safe? inferring documentation using graph-based learning},
  author = {Andrew Habib and Michael Pradel},
  booktitle = {ASE},
  year = {2018},
  doi = {10.1145/3238147.3238212}
}