首页> 外文会议>IEEE International Conference on Advanced Computational Intelligence >Detect functionally equivalent code fragments via k-nearest neighbor algorithm
【24h】

Detect functionally equivalent code fragments via k-nearest neighbor algorithm

机译:通过k - 最近邻算法检测功能等效的代码片段

获取原文

摘要

It is important for improving program to detect duplicated code (also known as code clone) in the field of software development and maintenance. The existing solutions can not effectively analyze the complex semantics of programs, and so can not effectively detect functionally equivalent code fragments that execute the same operations but with different syntax. This paper proposes a method to detect functionally equivalent code fragments via k-nearest neighbor algorithm. Firstly, the source code is statically analyzed to get the information of control dependency and data flow; then, k-nearest neighbor clustering algorithm is performed to form functionally independent code fragments; next, the input and output variables of the code fragments are identified, and the code fragments are transformed to compliable and executable functions, then the automatic random assignment for the input variables of functions are carried out. At last, the functions are dynamically tested and are classified into different clusters according to the testing outputs. Experimental results show that this method can effectively get functionally equivalent code fragments with a lower time complexity.
机译:在软件开发和维护领域中改进程序以检测重复代码(也称为代码克隆)是很重要的。现有解决方案无法有效地分析程序的复杂语义,因此无法有效地检测执行相同操作但具有不同语法的功能等效代码片段。本文提出了一种通过k最近邻算法检测功能等同的代码片段的方法。首先,静态分析源代码以获取控制依赖关系和数据流的信息;然后,执行k最近邻群集群算法以形成功能独立的代码片段;接下来,识别代码片段的输入和输出变量,并且代码片段被转换为可协调和可执行的功能,然后执行用于输入变量的自动随机分配。最后,动态测试功能,并根据测试输出分为不同的集群。实验结果表明,该方法可以有效地获得功能等同的代码片段,时间复杂性较低。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号