一句话:提出 Amain,将复杂 AST 转化为马尔可夫链并度量状态距离,实现可扩展的语义代码克隆检测。
代码克隆检测旨在发现功能相似的代码片段,在软件工程中日益重要。基于树的方法虽能处理语义克隆,但树结构复杂,难以扩展到大规模型代码。本文提出 Amain,一种可扩展的基于树的语义克隆检测器:将原始复杂树转化为简单的马尔可夫链,度量链中所有状态之间的距离,再以这些距离值作为特征训练机器学习分类器,从而构建克隆检测器。作者在 Google Code Jam 与 BigCloneBench 两个常用数据集上评估 Amain,实验表明其优于九种最先进工具(SourcererCC、RtvNN、Deckard、ASTNN、TBCNN、CDLH、FCCA、DeepSim、SCDetector)。
Code clone detection aims to find functionally similar code fragments, which is becoming more and more important in the field of software engineering. Many code clone detection methods have been proposed, among which tree-based methods are able to handle semantic code clones. However, these methods are difficult to scale to big code due to the complexity of tree structures. In this paper, we design Amain, a scalable tree-based semantic code clone detector by building Markov chains models. Specifically, we propose a novel method to transform the original complex tree into simple Markov chains and measure the distance of all states in these chains. After obtaining all distance values, we feed them into a machine learning classifier to train a code clone detector. To examine the effectiveness of Amain, we evaluate it on two widely used datasets namely Google Code Jam and BigCloneBench. Experimental results show that Amain is superior to nine state-of-the-art code clone detection tools (i.e., SourcererCC, RtvNN, Deckard, ASTNN, TBCNN, CDLH, FCCA, DeepSim, and SCDetector).
DOI 原文 ·
@inproceedings{paperbot7343,
title = {Detecting Semantic Code Clones by Building AST-based Markov Chains Model},
author = {Yueming Wu and Siyue Feng and Deqing Zou and Hai Jin},
booktitle = {ASE},
year = {2022},
doi = {10.1145/3551349.3560426}
}