基于程序依赖图和图注意网络的代码克隆检测  

Code Clone Detection Based on Program Dependence Graph and Graph Attention Networks

在线阅读下载全文

作  者:杜思宇 徐欣[2] DU Siyu;XU Xin(School of Computer Science,Hangzhou Dianzi University Hangzhou 310018,China;School of Communication Engineering,Hangzhou University of Electronic Science and Technology,Hangzhou 310018,China)

机构地区:[1]杭州电子科技大学计算机学院,浙江杭州310018 [2]杭州电子科技大学通信工程学院,浙江杭州310018

出  处:《杭州电子科技大学学报(自然科学版)》2024年第4期27-36,共10页Journal of Hangzhou Dianzi University:Natural Sciences

摘  要:随着软件剽窃和代码克隆现象的不断增加,对相似代码段的有效检测变得至关重要,特别是涉及语义相似克隆的代码克隆检测,对于推动研究进展和维护知识产权具有重要意义。语义相似克隆的特征涉及功能和语义的相似性,相较于句法相似性,这种相似性更难检测。为解决这一问题,提出了一种新颖的检测方法,采用程序依赖图而非抽象语法树,以更有效地表达代码的语义信息;通过引入图注意网络,从程序依赖图中提取出关键的语义特征,并最终计算出两段代码之间的功能相似性。实验证明,提出的基于程序依赖图和图注意网络的方法在语义相似克隆的检测方面明显优于当前已有的方法。With the escalating prevalence of software plagiarism and code cloning incidents,the efficient detection of similar code segments has become increasingly vital,particularly in the context of semantic similarity-based code clone detection,which holds significant implications for advancing research and safeguarding intellectual property rights.Semantic similarity clones,characterized by their shared functionality and semantic underpinnings,pose a greater challenge to detection than syntactic similarities.To address this issue,this paper proposes an innovative detection approach that employs Program Dependency Graph(PDG)instead of Abstract Syntax Tree,thereby offering a more effective means of representing code's semantic information.By integrating Graph Attention Networks(GAT)into our method,it can extract salient semantic features from PDG and subsequently calculate the functional similarity between two pieces of codes.Experimental results demonstrate that the proposed method based on PDG and GAT significantly outperforms existing methods in detecting semantic similarity clones.

关 键 词:克隆检测 程序依赖图 图注意网络 

分 类 号:TP183[自动化与计算机技术—控制理论与控制工程]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象