paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Cross-language code search using static and dynamic analyses

使用静态和动态分析的跨语言代码搜索
FSE Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering2021匹配度 2/10 · 论文属于跨语言代码搜索,结合静态与动态分析,但不涉及 LLM/Agent、浮点程序分析或贝叶斯程序分析,也未将静态分析应用于 ML/Agentic 程序,因此与用户画像的核心交叉方向交集很小;仅与程序分析和开发者工具有一般关联。引用 35 inbox
George Mathew, Kathryn T. Stolee
crossref: 2026-09-12

AI 速览

一句话:提出跨语言代码搜索技术 COSAL,结合静态与动态相似度并用非支配排序排序,无需机器学习模型。

随着代码搜索在软件开发中普及,以代码为查询检索相似代码的 code-to-code 搜索需求增长,应用于重复代码检测、补丁识别和语言翻译。现有方法多用 token、AST 等静态相似度近似动态行为,精度低且大多不支持跨语言;少数跨语言方法依赖需标注数据的机器学习模型。本文提出 COSAL,一种结合静态与动态分析的跨语言代码到代码搜索技术,基于 token 相似度、结构相似度和行为相似度进行非支配排序,无需机器学习模型。作者在 43,146 个 Java/Python 文件与 55,499 个 Java 文件两个数据集上评估,发现非支配排序优于单一或加权度量,COSAL 在同语言和跨语言任务上的精度与召回均优于当前最先进工具,并讨论了在大型开源仓库上的可扩展性。

问题
现有 code-to-code 搜索多用静态相似度近似动态行为,精度低,且大多不支持跨语言;少数跨语言方法需标注训练数据。
方法
COSAL 结合静态与动态分析,基于 token、结构和行为相似度对代码片段进行非支配排序,无需机器学习模型。
评估
在 43,146 个 Java/Python 文件与 55,499 个 Java 文件两个数据集上实验,表明非支配排序优于单一或加权度量,且精度与召回优于最先进的同语言和跨语言工具。
原文摘要(Abstract)

As code search permeates most activities in software development,code-to-code search has emerged to support using code as a query and retrieving similar code in the search results. Applications include duplicate code detection for refactoring, patch identification for program repair, and language translation. Existing code-to-code search tools rely on static similarity approaches such as the comparison of tokens and abstract syntax trees (AST) to approximate dynamic behavior, leading to low precision. Most tools do not support cross-language code-to-code search, and those that do, rely on machine learning models that require labeled training data. We present Code-to-Code Search Across Languages (COSAL), a cross-language technique that uses both static and dynamic analyses to identify similar code and does not require a machine learning model. Code snippets are ranked using non-dominated sorting based on code token similarity, structural similarity, and behavioral similarity. We empirically evaluate COSAL on two datasets of 43,146Java and Python files and 55,499 Java files and find that 1) code search based on non-dominated ranking of static and dynamic similarity measures is more effective compared to single or weighted measures; and 2) COSAL has better precision and recall compared to state-of-the-art within-language and cross-language code-to-code search tools. We explore the potential for using COSAL on large open-source repositories and discuss scalability to more languages and similarity metrics, providing a gateway for practical,multi-language code-to-code search.

链接与引用

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

BibTeX
@inproceedings{paperbot6344,
  title = {Cross-language code search using static and dynamic analyses},
  author = {George Mathew and Kathryn T. Stolee},
  booktitle = {FSE},
  year = {2021},
  doi = {10.1145/3468264.3468538}
}