arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2304.12034cs.PL
收藏

无上下文的上下文敏感性:一种实现快速精确指针分析的 Cut-Shortcut 方法

Context Sensitivity without Contexts: A Cut-Shortcut Approach to Fast and Precise Pointer Analysis

Wenjie Ma, Shengyuan Yang, Tian Tan, Xiaoxing Ma, Chang Xu, Yue Li

AI总结:

本文提出 Cut-Shortcut,通过在指针流图上切断精度损失边并添加绕过方法的快捷边,在无上下文中模拟上下文敏感性,并在 Doop 与 Tai-e 上验证其更快且精度可比。

摘要:

在过去几十年中,上下文敏感性一直被认为是提高 Java 指针分析精度的最有效思想之一。然而,尽管上下文敏感性带来了显著的精度收益,但由于每个方法都要在每个上下文下被等价地克隆和分析,它也带来了沉重的效率成本。在本文中,我们提出了一种根本不同的方法,称为 Cut-Shortcut,用于实现快速且精确的 Java 指针分析。其洞见很简单:在不同上下文下克隆方法的主要作用,是过滤在被调用方法内部已经合并的虚假对象流;从典型的指针流图(PFG)视角看,这种作用可以通过切断(Cut)会导致某些指针出现精度损失的边,并在 PFG 上添加直接从源指针到目标指针、绕过该方法的 Shortcut 边来模拟。因此,我们可以在没有上下文的情况下实现上下文敏感性的效果。我们识别了三种通用程序模式,并基于它们开发算法,以在 PFG 上安全地切断和添加快捷边,同时对其进行形式化并形式化证明其可靠性。为了全面验证 Cut-Shortcut 的有效性,我们为两个最先进的 Java 指针分析框架实现了两个版本的 Cut-Shortcut:一个用于声明式的 Doop,采用 Datalog 实现;另一个用于命令式的 Tai-e,采用 Java 实现。我们考虑了近期文献中使用的、满足实验要求的所有大型复杂程序。评估结果极具前景:在两个框架中,Cut-Shortcut 对于大多数被评估程序甚至能够比上下文不敏感性运行得更快,同时获得可与上下文敏感性(如果其可扩展)相媲美的高精度。这是我们首次能够为那些难以分析的程序实现如此良好的效率与精度权衡。

英文摘要:

Over the past decades, context sensitivity has been considered as one of the most effective ideas for improving the precision of pointer analysis for Java. However, despite great precision benefits, as each method is equivalently cloned and analyzed under each context, context sensitivity brings heavy efficiency costs. In this work, we present a fundamentally different approach called Cut-Shortcut for fast and precise pointer analysis for Java. Its insight is simple: the main effect of cloning methods under different contexts is to filter spurious object flows that have been merged inside a callee method; from the view of a typical pointer flow graph (PFG), such effect can be simulated by cutting off (Cut) the edges that introduce precision loss to certain pointers and adding Shortcut edges directly from source pointers to the target ones circumventing the method on PFG. As a result, we can achieve the effect of context sensitivity without contexts. We identify three general program patterns and develop algorithms based on them to safely cut off and add shortcut edges on PFG, formalize them and formally prove the soundness. To comprehensively validate Cut-Shortcut's effectiveness, we implement two versions of Cut-Shortcut for two state-of-the-art pointer analysis frameworks for Java, one in Datalog for the declarative Doop and the other in Java for the imperative Tai-e, and we consider all the large and complex programs used in recent literatures that meet the experimental requirements. The evaluation results are extremely promising: Cut-Shortcut is even able to run faster than context insensitivity for most evaluated programs while obtaining high precision that is comparable to context sensitivity (if scalable) in both frameworks. This is for the first time that we have been able to achieve such a good efficiency and precision trade-off for those hard-to-analyze programs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑