SEED: Semantic Graph Based Deep Detection for Type-4 Clone

被引:8
作者
Xue, Zhipeng [1 ]
Jiang, Zhijie [1 ]
Huang, Chenlin [1 ]
Xu, Rulin [1 ]
Huang, Xiangbing [1 ]
Hu, Liumin [1 ]
机构
[1] Natl Univ Def Technol, Changsha, Peoples R China
来源
REUSE AND SOFTWARE QUALITY (ICSR 2022) | 2022年 / 13297卷
基金
中国国家自然科学基金;
关键词
Intelligent software engineering; Clone detection; Semantic graph; Graph neural network;
D O I
10.1007/978-3-031-08129-3_8
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Type-4 clones refer to a pair of code snippets with similar semantics but written in different syntax, which challenges the existing code clone detection techniques. Previous studies, however, highly rely on syntactic structures and textual tokens, which cannot precisely represent the semantic information of code and might introduce non-negligible noise into the detection models. To overcome these limitations, we design a novel semantic graph-based deep detection approach, called SEED. For a pair of code snippets, SEED constructs a semantic graph of each code snippet based on intermediate representation to represent the code semantic more precisely compared to the representations based on lexical and syntactic analysis. To accommodate the characteristics of Type-4 clones, a semantic graph is constructed focusing on the operators and API calls instead of all tokens. Then, SEED generates the feature vectors by using the graph match network and performs clone detection based on the similarity among the vectors. Extensive experiments show that our approach significantly outperforms two baseline approaches over two public datasets and one customized dataset. Especially, SEED outperforms other baseline methods by an average of 25.2% in the form of F1-Score. Our experiments demonstrate that SEED can reach state-of-the-art and be useful for Type-4 clone detection in practice.
引用
收藏
页码:120 / 137
页数:18
相关论文
共 25 条
[1]   Analyzing cloning evolution in the Linux kernel [J].
Antoniol, G ;
Villano, U ;
Merlo, E ;
Di Penta, M .
INFORMATION AND SOFTWARE TECHNOLOGY, 2002, 44 (13) :755-765
[2]  
Ben-Nun T., 2018, Advances in Neural Information Processing Systems, P3585
[3]  
Cho KYHY, 2014, Arxiv, DOI [arXiv:1406.1078, DOI 10.48550/ARXIV.1406.1078]
[4]  
Jiang LX, 2007, PROC INT CONF SOFTW, P96
[5]   Automated Vulnerability Detection in Source Code Using Minimum Intermediate Representation Learning [J].
Li, Xin ;
Wang, Lu ;
Xin, Yang ;
Yang, Yixian ;
Chen, Yuling .
APPLIED SCIENCES-BASEL, 2020, 10 (05)
[6]  
Li YJ, 2017, Arxiv, DOI arXiv:1511.05493
[7]  
Li YJ, 2019, PR MACH LEARN RES, V97
[8]   CP-Miner: Finding copy-paste and related bugs in large-scale software code [J].
Li, ZM ;
Lu, S ;
Myagmar, S ;
Zhou, YY .
IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2006, 32 (03) :176-192
[9]   Sourcerer: mining and searching internet-scale software repositories [J].
Linstead, Erik ;
Bajracharya, Sushil ;
Ngo, Trung ;
Rigor, Paul ;
Lopes, Cristina ;
Baldi, Pierre .
DATA MINING AND KNOWLEDGE DISCOVERY, 2009, 18 (02) :300-336
[10]   JDeodorant: Clone Refactoring [J].
Mazinanian, Davood ;
Tsantalis, Nikolaos ;
Stein, Raphael ;
Valenta, Zackary .
2016 IEEE/ACM 38TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING COMPANION (ICSE-C), 2016, :613-616