Existing code repositories contain numerous instances of code patterns that are idiomatic ways of accomplishing a particular programming task. Sometimes, the programming language in use supports specific operators or APIs that can express the same idiomatic imperative code much more succinctly. However, those code patterns linger in repositories because the developers may be unaware of the new APIs or have not gotten around to them. Detection of idiomatic code can also point to the need for new APIs. We share our experiences in mine idiomatic patterns from the Hack repo at Facebook. We found that existing techniques either cannot identify meaningful patterns from syntax trees or require test-suite-based dynamic analysis to incorporate semantic properties to mine useful patterns. The key insight of the approach proposed in this paper -- \emph{Jezero} -- is that semantic idioms from a large codebase can be learned from \emph{canonicalized} dataflow trees. We propose a scalable, lightweight static analysis-based approach to construct such a tree that is well suited to mine semantic idioms using nonparametric Bayesian methods. Our experiments with Jezero on Hack code shows a clear advantage of adding canonicalized dataflow information to ASTs: \emph{Jezero} was significantly more effective than a baseline that did not have the dataflow augmentation in being able to effectively find refactoring opportunities from unannotated legacy code.


翻译:现有代码库包含许多代码模式的事例, 它们是完成特定编程任务的特殊方式。 有时, 使用的编程语言支持特定操作员或API, 能够更简洁地表达相同的单词必用代码。 但是, 这些代码模式在库中会存在, 因为开发者可能不知道新的 API, 或者没有绕过它们。 探测单词代码也可以显示对新的 API 的需要。 我们分享了我们在Facebook Hack repo 上从 Hack Repo 上找到的地雷单词型模式的经验。 我们发现, 现有的技术要么无法识别来自合成树的有意义的模式, 或需要基于测试的、 完全的动态分析, 才能将同一语义的特性与我的有用模式结合起来。 本文中建议的方法的关键洞察到, 开发者可能不知道新的 API 。 我们建议一种可缩放的、 轻量的静态分析方法, 来构建这样一棵树, 这棵树非常适合地雷的单词系, 或者需要基于测试的测试 测试基础数据流, 能够有效地显示一个不偏差的 Bay_ 数据流 。 我们用一种有效的数据实验, 能够 。

0
下载
关闭预览

相关内容

最新《高级算法》Advanced Algorithms,176页pdf
专知会员服务
90+阅读 · 2020年10月22日
Linux导论,Introduction to Linux,96页ppt
专知会员服务
76+阅读 · 2020年7月26日
【电子书】大数据挖掘,Mining of Massive Datasets,附513页PDF
专知会员服务
101+阅读 · 2020年3月22日
【干货书】机器学习Python实战教程,366页pdf
专知会员服务
332+阅读 · 2020年3月17日
强化学习最新教程,17页pdf
专知会员服务
168+阅读 · 2019年10月11日
机器学习入门的经验与建议
专知会员服务
90+阅读 · 2019年10月10日
意识是一种数学模式
CreateAMind
3+阅读 · 2019年6月24日
计算机 | 入门级EI会议ICVRIS 2019诚邀稿件
Call4Papers
10+阅读 · 2019年6月24日
已删除
将门创投
3+阅读 · 2019年4月12日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
Python机器学习教程资料/代码
机器学习研究会
8+阅读 · 2018年2月22日
【论文】图上的表示学习综述
机器学习研究会
12+阅读 · 2017年9月24日
Arxiv
0+阅读 · 2021年9月15日
Arxiv
0+阅读 · 2021年9月14日
Arxiv
30+阅读 · 2021年8月18日
VIP会员
相关VIP内容
最新《高级算法》Advanced Algorithms,176页pdf
专知会员服务
90+阅读 · 2020年10月22日
Linux导论,Introduction to Linux,96页ppt
专知会员服务
76+阅读 · 2020年7月26日
【电子书】大数据挖掘,Mining of Massive Datasets,附513页PDF
专知会员服务
101+阅读 · 2020年3月22日
【干货书】机器学习Python实战教程,366页pdf
专知会员服务
332+阅读 · 2020年3月17日
强化学习最新教程,17页pdf
专知会员服务
168+阅读 · 2019年10月11日
机器学习入门的经验与建议
专知会员服务
90+阅读 · 2019年10月10日
相关资讯
意识是一种数学模式
CreateAMind
3+阅读 · 2019年6月24日
计算机 | 入门级EI会议ICVRIS 2019诚邀稿件
Call4Papers
10+阅读 · 2019年6月24日
已删除
将门创投
3+阅读 · 2019年4月12日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
Python机器学习教程资料/代码
机器学习研究会
8+阅读 · 2018年2月22日
【论文】图上的表示学习综述
机器学习研究会
12+阅读 · 2017年9月24日
Top
微信扫码咨询专知VIP会员