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

一种评价抽象树映射算法的差分测试方法

A Differential Testing Approach for Evaluating Abstract Syntax Tree Mapping Algorithms

Yuanrui Fan, Xin Xia, David Lo, Ahmed E. Hassan, Yuan Wang, Shanping Li

摘要:

抽象语法树(AST)映射算法被广泛用于分析源代码中的变化。尽管AST映射算法的基础作用,但很少努力评估AST映射算法的准确性,即,算法捕获代码演变的程度。我们观察到,一个程序元素通常只有一个最佳映射的程序元素。基于这一观察,我们提出了一个层次化的方法来自动比较不同算法的映射语句和标记的相似性。通过执行比较,我们确定每个比较的算法是否为语句或其标记生成不准确的映射。我们邀请了12位外部专家来确定三种常用的AST映射算法是否为一个语句及其200个语句的标记生成准确的映射。根据专家的反馈,我们观察到我们的方法达到了0.98- 1.00的准确率和0.65- 0.75的召回率。此外,我们进行了一项大规模的研究,数据集的10个Java项目,共包含263,165个文件修订。我们的方法确定GumTree、MTDiff和IJM分别为20%-29%、25%-36%和21%-30%的文件修订生成不准确的映射。我们的实验结果表明,最先进的AST映射算法仍然需要改进。

英文摘要:

Abstract syntax tree (AST) mapping algorithms are widely used to analyze changes in source code. Despite the foundational role of AST mapping algorithms, little effort has been made to evaluate the accuracy of AST mapping algorithms, i.e., the extent to which an algorihtm captures the evolution of code. We observe that a program element often has only one best-mapped program element. Based on this observation, we propose a hierarchical approach to automatically compare the similarity of mapped statements and tokens by different algorithms. By performing the comparison, we determine if each of the compared algorithms generates inaccurate mappings for a statement or its tokens. We invite 12 external experts to determine if three commonly used AST mapping algorithms generate accurate mappings for a statement and its tokens for 200 statements. Based on the experts' feedback,we observe that our approach achieves a precision of 0.98--1.00 and a recall of 0.65--0.75. Furthermore, we conduct a large-scale study with a dataset of ten Java projects, containing a total of 263,165 file revisions. Our approach determines that GumTree, MTDiff and IJM generate inaccurate mappings for 20%--29%, 25%--36% and 21%--30% of the file revisions, respectively. Our experimental results show that state-of-art AST mapping agorithms still need improvements.

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

↑