SLACC:基于Simion的语言无关代码克隆
SLACC: Simion-based Language Agnostic Code Clones
摘要:
成功的跨语言克隆检测可以使研究人员和开发人员创建强大的语言迁移工具,一旦掌握了一种程序设计语言,就可以方便地学习其他语言,并促进代码片段在更广泛的代码库中的重用。然而,识别跨语言克隆提出了特殊的挑战,克隆检测问题。任意语言之间缺乏公共的底层表示意味着检测克隆需要以下解决方案之一:1)跨每个目标语言复制的静态分析框架,其注释匹配所有语言的语言特征,或者2)基于运行时行为检测克隆的动态分析框架。在这项工作中,我们证明了后者的解决方案,一个动态分析方法称为SLACC跨语言克隆检测的可行性。与之前的克隆检测技术一样,我们使用输入/输出行为来匹配克隆,尽管我们通过放大输入的数量和覆盖更多的数据类型来克服之前工作的局限性;因此,实现了比之前尝试更好的聚类。由于聚类是基于输入/输出行为生成的,因此SLACC支持跨语言克隆检测。作为一个额外的挑战,我们的目标是静态类型语言Java和动态类型语言Python。与最近的Java克隆检测工具HitoshiIO相比,SLACC检索的集群数量是HitoshiIO的6倍,并且精度更高(86.7% vs. 30.7%)。这是第一个对动态类型语言执行克隆检测的工作(精度= 87.3%),也是第一个对缺乏公共底层表示的语言执行克隆检测的工作(精度= 94.1%)。它为实现可伸缩语言迁移工具的更大目标迈出了第一步。
英文摘要:
Successful cross-language clone detection could enable researchers and developers to create robust language migration tools, facilitate learning additional programming languages once one is mastered, and promote reuse of code snippets over a broader codebase. However, identifying cross-language clones presents special challenges to the clone detection problem. A lack of common underlying representation between arbitrary languages means detecting clones requires one of the following solutions: 1) a static analysis framework replicated across each targeted language with annotations matching language features across all languages, or 2) a dynamic analysis framework that detects clones based on runtime behavior. In this work, we demonstrate the feasibility of the latter solution, a dynamic analysis approach called SLACC for cross-language clone detection. Like prior clone detection techniques, we use input/output behavior to match clones, though we overcome limitations of prior work by amplifying the number of inputs and covering more data types; and as a result, achieve better clusters than prior attempts. Since clusters are generated based on input/output behavior, SLACC supports cross-language clone detection. As an added challenge, we target a static typed language, Java, and a dynamic typed language, Python. Compared to HitoshiIO, a recent clone detection tool for Java, SLACC retrieves 6 times as many clusters and has higher precision (86.7% vs. 30.7%). This is the first work to perform clone detection for dynamic typed languages (precision = 87.3%) and the first to perform clone detection across languages that lack a common underlying representation (precision = 94.1%). It provides a first step towards the larger goal of scalable language migration tools.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。