Mining Semantic Loop Idioms

Mining Semantic Loop Idioms
复制标题

DOI:
10.1109/tse.2018.2832048
复制
发表时间:
2018-07
影响因子:
7.4
通讯作者:
Miltiadis Allamanis;Earl T. Barr;C. Bird;Premkumar T. Devanbu;Mark Marron;Charles Sutton
Miltiadis Allamanis;Earl T. Barr;C. Bird;Premkumar T. Devanbu;Mark Marron;Charles Sutton
中科院分区:
计算机科学1区
文献类型:
--
作者:
Miltiadis Allamanis;Earl T. Barr;C. Bird;Premkumar T. Devanbu;Mark Marron;Charles Sutton

文献摘要

被引文献

相似文献

要编写代码,开发人员需要将各种模式组合在一起,比如API协议或数据结构遍历。发现这些模式可以识别代码中的不一致之处或用API或语言构造替换这些模式的机会。我们提出了COLING,这是一种自动挖掘语义习语的代码的技术:令人惊讶的可能性,语义模式。我们专门针对循环习语、循环的语义习语进行卷绕。首先,我们通过对25MLOC以上的循环进行大规模的经验研究,证明了大量自动可识别的模式的存在。我们发现,这个语料库中的大多数循环都是简单且可预测的:90%的循环少于15LOC,90%的循环没有嵌套,并且控制非常简单。受到这一结果的鼓舞,我们然后在第二个可构建的语料库上挖掘循环习语。在这个语料库上,我们显示只有50个循环习语覆盖了50%的具体循环。我们的框架为数据驱动的工具和语言设计打开了大门,发现了引入新的API调用和语言构造的机会。循环习惯用法表明,LINQ将受益于枚举运算符。这可以通过542k视图的StackOverflow问题的存在来确认,该问题恰好请求此功能。
To write code, developers stitch together patterns, like API protocols or data structure traversals. Discovering these patterns can identify inconsistencies in code or opportunities to replace these patterns with an API or a language construct. We present coiling, a technique for automatically mining code for semantic idioms: surprisingly probable, semantic patterns. We specialize coiling for loop idioms, semantic idioms of loops. First, we show that automatically identifiable patterns exist, in great numbers, with a large-scale empirical study of loops over 25MLOC. We find that most loops in this corpus are simple and predictable: 90 percent have fewer than 15LOC and 90 percent have no nesting and very simple control. Encouraged by this result, we then mine loop idioms over a second, buildable corpus. Over this corpus, we show that only 50 loop idioms cover 50 percent of the concrete loops. Our framework opens the door to data-driven tool and language design, discovering opportunities to introduce new API calls and language constructs. Loop idioms show that LINQ would benefit from an Enumerate operator. This can be confirmed by the exitence of a StackOverflow question with 542k views that requests precisely this feature.