一句话:提出 Func2vec,基于过程间控制流图随机游走训练函数嵌入,识别函数同义并挖掘错误处理规约。
识别程序元素之间的关系有助于程序理解、调试和分析,其中一类关系是函数同义:函数在代码中扮演相似角色,但不一定语义等价,语法也可能不同,因此代码克隆或功能等价方法难以识别。本文提出 Func2vec,通过训练神经网络学习函数嵌入,将每个函数映射到连续向量空间,使同义函数的向量彼此接近。其训练数据来自在过程间控制流图上随机游走生成的句子。作者在 Linux 内核上评估了函数同义识别效果,并将 Func2vec 应用于 Linux 文件系统与驱动中的错误处理规约挖掘,结果表明所识别的函数同义能够产生高支持度的错误处理规约。
Identifying relationships among program elements is useful for program understanding, debugging, and analysis. One such kind of relationship is synonymy. Function synonyms are functions that play a similar role in code; examples include functions that perform initialization for different device drivers, and functions that implement different symmetric-key encryption schemes. Function synonyms are not necessarily semantically equivalent and can be syntactically dissimilar; consequently, approaches for identifying code clones or functional equivalence cannot be used to identify them. This paper presents Func2 vec , a technique that learns an embedding mapping each function to a vector in a continuous vector space such that vectors for function synonyms are in close proximity. We compute the function embedding by training a neural network on sentences generated using random walks over the interprocedural control-flow graph. We show the effectiveness of Func2 vec at identifying function synonyms in the Linux kernel. Finally, we apply Func2 vec to the problem of mining error-handling specifications in Linux file systems and drivers. We show that the function synonyms identified by Func2 vec result in error-handling specifications with high support.
@inproceedings{paperbot4605,
title = {Path-based function embedding and its application to error-handling specification mining},
author = {Daniel DeFreez and Aditya V. Thakur and Cindy Rubio-González},
booktitle = {FSE},
year = {2018},
doi = {10.1145/3236024.3236059}
}