Inferring Program Transformations From Singular Examples via Big Code

Inferring Program Transformations From Singular Examples via Big Code
复制标题

DOI:
10.1109/ase.2019.00033
复制
发表时间:
2019-11
期刊:
2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE)
影响因子:
--
通讯作者:
Jiajun Jiang;Luyao Ren;Yingfei Xiong;Lingming Zhang
Jiajun Jiang;Luyao Ren;Yingfei Xiong;Lingming Zhang
中科院分区:
其他
文献类型:
--
作者:
Jiajun Jiang;Luyao Ren;Yingfei Xiong;Lingming Zhang

文献摘要

相似文献

从具体的程序更改中推断程序转换有许多潜在的用途,例如应用系统的程序编辑,重构和自动程序修复。现有的推断程序转换的工作通常依赖于统计信息的一个潜在的大型程序更改的例子。然而,在许多实际场景中,我们没有这么大的程序更改示例集。在本文中,我们解决的挑战,推断一个程序转换从一个单一的例子。我们的核心见解是,“大代码”可以为将具体更改泛化为程序转换提供有效的指导,即,出现在许多文件中的代码元素是通用的,不应该被抽象掉。我们首先提出了一个框架转换推理,程序表示为超图,使细粒度的一般化的转换。然后,我们设计了一个转换推理方法,GENPAT,推断程序转换的基础上,从一个大的代码语料库的代码上下文和统计。我们已经评估了GENPAT下两个不同的应用场景,系统编辑和程序修复。对系统编辑的评估表明,GENPAT显著优于最先进的方法SYDIT,正确转换的病例高达5.5倍。对程序修复的评价表明,GENPAT具有集成到高级程序修复工具中的潜力。GENPAT通过简单地应用从现有补丁推断的转换成功修复了Defects4J基准测试中的19个真实世界的错误,其中4个错误从未被任何现有技术修复过。总体而言,评估结果表明,GENPAT是有效的转换推理,并可能被采用为许多不同的应用程序。
Inferring program transformations from concrete program changes has many potential uses, such as applying systematic program edits, refactoring, and automated program repair. Existing work for inferring program transformations usually rely on statistical information over a potentially large set of program-change examples. However, in many practical scenarios we do not have such a large set of program-change examples. In this paper, we address the challenge of inferring a program transformation from one single example. Our core insight is that "big code" can provide effective guide for the generalization of a concrete change into a program transformation, i.e., code elements appearing in many files are general and should not be abstracted away. We first propose a framework for transformation inference, where programs are represented as hypergraphs to enable fine-grained generalization of transformations. We then design a transformation inference approach, GENPAT, that infers a program transformation based on code context and statistics from a big code corpus. We have evaluated GENPAT under two distinct application scenarios, systematic editing and program repair. The evaluation on systematic editing shows that GENPAT significantly outperforms a state-of-the-art approach, SYDIT, with up to 5.5x correctly transformed cases. The evaluation on program repair suggests that GENPAT has the potential to be integrated in advanced program repair tools-GENPAT successfully repaired 19 real-world bugs in the Defects4J benchmark by simply applying transformations inferred from existing patches, where 4 bugs have never been repaired by any existing technique. Overall, the evaluation results suggest that GENPAT is effective for transformation inference and can potentially be adopted for many different applications.