Code clones are semantically similar code fragments pairs that are syntactically similar or different. Detection of code clones can help to reduce the cost of software maintenance and prevent bugs. Numerous approaches of detecting code clones have been proposed previously, but most of them focus on detecting syntactic clones and do not work well on semantic clones with different syntactic features. To detect semantic clones, researchers have tried to adopt deep learning for code clone detection to automatically learn latent semantic features from data. Especially, to leverage grammar information, several approaches used abstract syntax trees (AST) as input and achieved significant progress on code clone benchmarks in various programming languages. However, these AST-based approaches still can not fully leverage the structural information of code fragments, especially semantic information such as control flow and data flow. To leverage control and data flow information, in this paper, we build a graph representation of programs called flow-augmented abstract syntax tree (FA-AST). We construct FA-AST by augmenting original ASTs with explicit control and data flow edges. Then we apply two different types of graph neural networks (GNN) on FA-AST to measure the similarity of code pairs. As far as we have concerned, we are the first to apply graph neural networks on the domain of code clone detection. We apply our FA-AST and graph neural networks on two Java datasets: Google Code Jam and BigCloneBench. Our approach outperforms the state-of-the-art approaches on both Google Code Jam and BigCloneBench tasks.


翻译:代码克隆是同义或不同的词义相似的代码碎片配对。 检测代码克隆可以帮助降低软件维护的成本, 防止错误。 以前曾提出过许多探测代码克隆的方法, 但这些方法大多侧重于检测同义克隆, 对具有不同语义特征的语义克隆没有很好地发挥作用。 为了检测语义克隆, 研究人员试图通过深层学习代码克隆检测, 从数据中自动学习潜在的语义特征。 特别是为了利用语法信息, 一些方法使用抽象语法树( AST ) 来帮助降低软件维护的成本, 防止错误。 但是, 这些基于 代码克隆的方法仍然无法充分利用代码碎片的结构信息, 特别是控制流和数据流等语义信息。 为了利用语义控制和数据流信息, 我们在本文件中, 构建了一个叫做流动抽象语义合成语义树( FA- AST ) 的程序的图形描述。 我们通过在原始的A- AST 网络中增加原始语系语系词语系( AST ), 将BA- Stareal 的代码应用到远域域域域域域域域域域域定义 。 我们的代码应用了我们的直径 Stax 的代码, 我们的代码, 我们的直径 Streal- far- droal- droal- droal- droal 。

0
下载
关闭预览

相关内容

专知会员服务
59+阅读 · 2020年3月19日
【ICLR2020-】基于记忆的图网络,MEMORY-BASED GRAPH NETWORKS
专知会员服务
108+阅读 · 2020年2月22日
[综述]深度学习下的场景文本检测与识别
专知会员服务
77+阅读 · 2019年10月10日
【ACL2020放榜!】事件抽取、关系抽取、NER、Few-Shot 相关论文整理
深度学习自然语言处理
18+阅读 · 2020年5月22日
Hierarchically Structured Meta-learning
CreateAMind
23+阅读 · 2019年5月22日
Transferring Knowledge across Learning Processes
CreateAMind
26+阅读 · 2019年5月18日
ICLR2019最佳论文出炉
专知
11+阅读 · 2019年5月6日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
Facebook PyText 在 Github 上开源了
AINLP
7+阅读 · 2018年12月14日
Hierarchical Imitation - Reinforcement Learning
CreateAMind
19+阅读 · 2018年5月25日
【推荐】YOLO实时目标检测(6fps)
机器学习研究会
20+阅读 · 2017年11月5日
Heterogeneous Deep Graph Infomax
Arxiv
12+阅读 · 2019年11月19日
Arxiv
21+阅读 · 2019年8月21日
Learning by Abstraction: The Neural State Machine
Arxiv
6+阅读 · 2019年7月11日
Arxiv
3+阅读 · 2018年5月11日
VIP会员
相关VIP内容
专知会员服务
59+阅读 · 2020年3月19日
【ICLR2020-】基于记忆的图网络,MEMORY-BASED GRAPH NETWORKS
专知会员服务
108+阅读 · 2020年2月22日
[综述]深度学习下的场景文本检测与识别
专知会员服务
77+阅读 · 2019年10月10日
相关资讯
Top
微信扫码咨询专知VIP会员