一句话:提出 DeepSim,用控制流/数据流语义矩阵和深度模型将代码功能相似性检测转化为二分类问题。
代码相似性度量对代码搜索、重构和复用等软件工程任务至关重要,但已有技术多关注语法相似性,功能相似性度量仍是挑战。本文提出 DeepSim,将代码的控制流和数据流编码为一个语义矩阵,其中每个元素是高维稀疏二值特征向量,并基于该表示设计新的深度学习模型来度量代码功能相似性。该模型学习代码对的隐藏表示,通过拼接隐藏表示将功能相似代码检测转化为二分类问题,从而有效学习语法差异很大但功能相似的代码之间的模式。摘要未给出具体实验数据或量化结果。
Measuring code similarity is fundamental for many software engineering tasks, e.g., code search, refactoring and reuse. However, most existing techniques focus on code syntactical similarity only, while measuring code functional similarity remains a challenging problem. In this paper, we propose a novel approach that encodes code control flow and data flow into a semantic matrix in which each element is a high dimensional sparse binary feature vector, and we design a new deep learning model that measures code functional similarity based on this representation. By concatenating hidden representations learned from a code pair, this new model transforms the problem of detecting functionally similar code to binary classification, which can effectively learn patterns between functionally similar code with very different syntactics.
DOI 原文 ·
@inproceedings{paperbot4579,
title = {DeepSim: deep learning code functional similarity},
author = {Gang Zhao and Jeff Huang},
booktitle = {FSE},
year = {2018},
doi = {10.1145/3236024.3236068}
}