一句话:提出用贝叶斯优化从代码库学习参数化分析策略,实现按需流/上下文敏感的自适应静态分析。
构建高性价比的静态分析器仍需在精度与开销之间权衡。本文提出一种基于学习的自适应静态分析方法:分析器内含参数化策略,对程序各部分决定是否启用提升精度的技术;通过贝叶斯优化从已有代码库中学习该策略的参数,并用于未见程序。作者据此实现了部分流敏感与部分上下文敏感的 C 静态分析器。实验表明,贝叶斯优化对从代码库学习至关重要;在所有需要流/上下文敏感的查询中,该分析能回答 75%,而分析开销仅为基线不敏感分析的 3.3 倍,远低于完全敏感版本的 40 倍以上。
Building a cost-effective static analyzer for real-world programs is still regarded an art. One key contributor to this grim reputation is the difficulty in balancing the cost and the precision of an analyzer. An ideal analyzer should be adaptive to a given analysis task and avoid using techniques that unnecessarily improve precision and increase analysis cost. However, achieving this ideal is highly nontrivial, and it requires a large amount of engineering efforts. In this article, we present a new learning-based approach for adaptive static analysis. In our approach, the analysis includes a sophisticated parameterized strategy that decides, for each part of a given program, whether to apply a precision-improving technique to that part or not. We present a method for learning a good parameter for such a strategy from an existing codebase via Bayesian optimization. The learnt strategy is then used for new, unseen programs. Using our approach, we developed partially flow- and context-sensitive variants of a realistic C static analyzer. The experimental results demonstrate that using Bayesian optimization is crucial for learning from an existing codebase. Also, they show that among all program queries that require flow- or context-sensitivity, our partially flow- and context-sensitive analysis answers 75% of them, while increasing the analysis cost only by 3.3× of the baseline flow- and context-insensitive analysis, rather than 40× or more of the fully sensitive version.
DOI 原文 ·
@article{paperbot313,
title = {Adaptive Static Analysis via Learning with Bayesian Optimization},
author = {Kihong Heo and Hakjoo Oh and Hongseok Yang and Kwangkeun Yi},
journal = {ACM Transactions on Programming Languages and Systems},
volume = {40},
number = {4},
year = {2018},
doi = {10.1145/3121135}
}