arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2109.12079cs.SE
收藏

SEED:基于语义图的4型克隆深度检测

SEED: Semantic Graph based Deep detection for type-4 clone

Zhipeng Xue, Zhijie Jiang, Chenlin Huang, Rulin Xu, Xiangbing Huang, Liumin Hu

摘要:

第四类克隆是指一对语义相似但语法不同的代码片段,这对现有的代码克隆检测技术提出了挑战。然而,以往的研究高度依赖于句法结构和文本标记,这不能精确地表示代码的语义信息,并可能引入不可忽略的噪声到检测模型。为了克服这些限制,我们设计了一种新的基于语义图的深度检测方法,称为SEED。对于一对代码片段,SEED基于中间表示来构造每个代码片段的语义图,以与基于词法和句法分析的表示相比更精确地表示代码语义。为了适应Type-4克隆的特征,构建了一个语义图,重点关注操作符和API调用,而不是所有标记。然后,SEED通过使用图匹配网络生成特征向量,并基于向量之间的相似性执行克隆检测。大量的实验表明,我们的方法显着优于两个基准方法在两个公共数据集和一个定制的数据集。特别是,SEED以F1分数的形式平均优于其他基线方法25.2%。我们的实验表明,种子可以达到最先进的,是有用的4型克隆检测在实践中。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑