Path-Based Function Embedding and its Application to Specification\n Mining

Daniel DeFreez, Aditya Thakur, Cindy Rubio-González

arXiv (Cornell University) · 2018 · 15 citations · 0 references

DOIFull text

Open access

Concepts

Abstract

Identifying the relationships among program elements is useful for program\nunderstanding, debugging, and analysis. One such relationship is synonymy.\nFunction synonyms are functions that play a similar role in code, e.g.\nfunctions that perform initialization for different device drivers, or\nfunctions that implement different symmetric-key encryption schemes. Function\nsynonyms are not necessarily semantically equivalent and can be syntactically\ndissimilar; consequently, approaches for identifying code clones or functional\nequivalence cannot be used to identify them. This paper presents func2vec, an\nalgorithm that maps each function to a vector in a vector space such that\nfunction synonyms are grouped together. We compute the function embedding by\ntraining a neural network on sentences generated from random walks over an\nencoding of the program as a labeled pushdown system (l-PDS). We demonstrate\nthat func2vec is effective at identifying function synonyms in the Linux\nkernel. Furthermore, we show how function synonyms enable mining error-handling\nspecifications with high support in Linux file systems and drivers.\n