paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Prism: Decomposing Program Semantics for Code Clone Detection through Compilation

Prism:通过编译分解程序语义的代码克隆检测
ICSE Proceedings of the IEEE/ACM 46th International Conference on Software Engineering2024匹配度 3/10 · 论文处于机器学习与程序语言交叉,使用多架构汇编代码和嵌入方法增强代码克隆检测,与程序语义表示相关;但其任务并非用户核心关注的静态分析、Agentic/LLM 程序分析、形式化验证,也未涉及浮点程序分析或贝叶斯程序分析。引用 6 inbox
Haoran Li, Siqian Wang, Weihong Quan, Xiaoli Gong, Huayou Su, Jin Zhang
crossref: 2026-09-12

AI 速览

一句话:Prism 借助多架构汇编代码规范高层语言的行为语义,并融合多特征表示,显著提升代码克隆检测效果。

代码克隆检测中语义相似度是关键评价因素,常用做法是用嵌入向量表示代码,使语义相似的克隆对具有相近向量。然而高层编程语言的多样性与灵活性会导致克隆对的代码表示不一致,从而削弱语义刻画能力。作者重新审视汇编语言后观察到:不同汇编代码能够在计算逻辑与内存访问模式上与克隆对对齐,因此多种汇编语言可捕获程序的行为语义,增强对程序的理解。基于此提出 Prism,一种融合多架构汇编代码行为语义的代码克隆检测方法,直接提取多语言域的语法与语义信息;同时引入多特征融合策略,通过全局信息交互扩展表示空间,捕捉各特征间的互补信息及其关联,形成更具表达力的代码表示。在 OJClone 数据集上,Prism 的精确率与召回率分别达到 0.999 与 0.999,表现优异。

问题
高层语言的多样性与灵活性使得语义相似的克隆对在嵌入表示空间中可能不一致,导致代码克隆检测的语义相似度刻画不准确。
方法
将代码编译为多种架构的汇编代码,用汇编规范化的行为语义对齐克隆对的计算逻辑与内存访问模式,并设计基于全局信息交互的多特征融合策略扩展代码表示空间。
评估
在 OJClone 数据集上进行实验,Prism 取得 0.999 的精确率与 0.999 的召回率。
原文摘要(Abstract)

Code clone detection (CCD) is of critical importance in software engineering, while semantic similarity is a key evaluation factor for CCD. The embedding technique, which represents an object using a numerical vector, is utilized to generate code representations, where code snippets with similar semantics (clone pairs) should have similar vectors. However, due to the diversity and flexibility of high-level program languages, the code representation of clone pairs may be inconsistent. Assembly code provides the program execution trace and can normalize the diversity of high-level languages in terms of the program behavior semantics. After revisiting the assembly language, we find that different assembly codes can align with the computational logic and memory access patterns of cloned pairs. Therefore, the use of multiple assembly languages can capture the behavior semantics to enhance the understanding of programs. Thus, we propose Prism, a new method for code clone detection fusing behavior semantics from multiple architecture assembly code, which directly captures multilingual domains' syntax and semantic information. Additionally, we introduce a multi-feature fusion strategy that leverages global information interaction to expand the representation space. This fusion process allows us to capture the complementary information from each feature and leverage the relationships between them to create a more expressive representation of the code. After testing the OJClone dataset, the Prism model exhibited exceptional performance with precision and recall scores of 0.999 and 0.999, respectively.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot11329,
  title = {Prism: Decomposing Program Semantics for Code Clone Detection through Compilation},
  author = {Haoran Li and Siqian Wang and Weihong Quan and Xiaoli Gong and Huayou Su and Jin Zhang},
  booktitle = {ICSE},
  year = {2024},
  doi = {10.1145/3597503.3639129}
}