Automatic mining of functionally equivalent code fragments via random testing. Jiang, L. & Su, Z. In Proc. of the 18th Int'l Symp. on Software Testing and Analysis, pages 81--92, 2009. biblatexdata[__markedentry=[remco:6];acmid=1572283;numpages=12] bibtex: Jiang2009abstract bibtex Similar code may exist in large software projects due to some common software engineering practices, such as copying and pasting code and n-version programming. Although previous work has studied syntactic equivalence and small-scale, coarse-grained program-level and function-level semantic equivalence, it is not known whether significant fine-grained, code-level semantic duplications exist. Detecting such semantic equivalence is also desirable because it can enable many applications such as code understanding, maintenance, and optimization. In this paper, we introduce the first algorithm to automatically mine functionally equivalent code fragments of arbitrary size - down to an executable statement. Our notion of functional equivalence is based on input and output behavior. Inspired by Schwartz's randomized polynomial identity testing, we develop our core algorithm using automated random testing: (1) candidate code fragments are automatically extracted from the input program; and (2) random inputs are generated to partition the code fragments based on their output values on the generated inputs. We implemented the algorithm and conducted a large-scale empirical evaluation of it on the Linux kernel 2.6.24. Our results show that there exist many functionally equivalent code fragments that are syntactically different (i.e., they are unlikely due to copying and pasting code). The algorithm also scales to million-line programs; it was able to analyze the Linux kernel with several days of parallel processing.
@inproceedings{jiang_automatic_2009,
title = {Automatic mining of functionally equivalent code fragments via random testing},
abstract = {Similar code may exist in large software projects due to some common software engineering practices, such as copying and pasting code and n-version programming. Although previous work has studied syntactic equivalence and small-scale, coarse-grained program-level and function-level semantic equivalence, it is not known whether significant fine-grained, code-level semantic duplications exist. Detecting such semantic equivalence is also desirable because it can enable many applications such as code understanding, maintenance, and optimization. In this paper, we introduce the first algorithm to automatically mine functionally equivalent code fragments of arbitrary size - down to an executable statement. Our notion of functional equivalence is based on input and output behavior. Inspired by Schwartz's randomized polynomial identity testing, we develop our core algorithm using automated random testing: (1) candidate code fragments are automatically extracted from the input program; and (2) random inputs are generated to partition the code fragments based on their output values on the generated inputs. We implemented the algorithm and conducted a large-scale empirical evaluation of it on the Linux kernel 2.6.24. Our results show that there exist many functionally equivalent code fragments that are syntactically different (i.e., they are unlikely due to copying and pasting code). The algorithm also scales to million-line programs; it was able to analyze the Linux kernel with several days of parallel processing.},
booktitle = {Proc. of the 18th {Int}'l {Symp}. on {Software} {Testing} and {Analysis}},
author = {Jiang, Lingxiao and Su, Zhendong},
year = {2009},
note = {biblatexdata[\_\_markedentry=[remco:6];acmid=1572283;numpages=12]
bibtex: Jiang2009},
keywords = {bdiff\_, code clones, functional equivalence, program analysis, random testing, software similarity},
pages = {81--92}
}
Downloads: 0
{"_id":"n5NypTXQEobWBzDy7","bibbaseid":"jiang-su-automaticminingoffunctionallyequivalentcodefragmentsviarandomtesting-2009","downloads":0,"creationDate":"2016-10-15T13:23:23.251Z","title":"Automatic mining of functionally equivalent code fragments via random testing","author_short":["Jiang, L.","Su, Z."],"year":2009,"bibtype":"inproceedings","biburl":"http://bibbase.org/zotero/pentarious","bibdata":{"bibtype":"inproceedings","type":"inproceedings","title":"Automatic mining of functionally equivalent code fragments via random testing","abstract":"Similar code may exist in large software projects due to some common software engineering practices, such as copying and pasting code and n-version programming. Although previous work has studied syntactic equivalence and small-scale, coarse-grained program-level and function-level semantic equivalence, it is not known whether significant fine-grained, code-level semantic duplications exist. Detecting such semantic equivalence is also desirable because it can enable many applications such as code understanding, maintenance, and optimization. In this paper, we introduce the first algorithm to automatically mine functionally equivalent code fragments of arbitrary size - down to an executable statement. Our notion of functional equivalence is based on input and output behavior. Inspired by Schwartz's randomized polynomial identity testing, we develop our core algorithm using automated random testing: (1) candidate code fragments are automatically extracted from the input program; and (2) random inputs are generated to partition the code fragments based on their output values on the generated inputs. We implemented the algorithm and conducted a large-scale empirical evaluation of it on the Linux kernel 2.6.24. Our results show that there exist many functionally equivalent code fragments that are syntactically different (i.e., they are unlikely due to copying and pasting code). The algorithm also scales to million-line programs; it was able to analyze the Linux kernel with several days of parallel processing.","booktitle":"Proc. of the 18th Int'l Symp. on Software Testing and Analysis","author":[{"propositions":[],"lastnames":["Jiang"],"firstnames":["Lingxiao"],"suffixes":[]},{"propositions":[],"lastnames":["Su"],"firstnames":["Zhendong"],"suffixes":[]}],"year":"2009","note":"biblatexdata[__markedentry=[remco:6];acmid=1572283;numpages=12] bibtex: Jiang2009","keywords":"bdiff_, code clones, functional equivalence, program analysis, random testing, software similarity","pages":"81--92","bibtex":"@inproceedings{jiang_automatic_2009,\n\ttitle = {Automatic mining of functionally equivalent code fragments via random testing},\n\tabstract = {Similar code may exist in large software projects due to some common software engineering practices, such as copying and pasting code and n-version programming. Although previous work has studied syntactic equivalence and small-scale, coarse-grained program-level and function-level semantic equivalence, it is not known whether significant fine-grained, code-level semantic duplications exist. Detecting such semantic equivalence is also desirable because it can enable many applications such as code understanding, maintenance, and optimization. In this paper, we introduce the first algorithm to automatically mine functionally equivalent code fragments of arbitrary size - down to an executable statement. Our notion of functional equivalence is based on input and output behavior. Inspired by Schwartz's randomized polynomial identity testing, we develop our core algorithm using automated random testing: (1) candidate code fragments are automatically extracted from the input program; and (2) random inputs are generated to partition the code fragments based on their output values on the generated inputs. We implemented the algorithm and conducted a large-scale empirical evaluation of it on the Linux kernel 2.6.24. Our results show that there exist many functionally equivalent code fragments that are syntactically different (i.e., they are unlikely due to copying and pasting code). The algorithm also scales to million-line programs; it was able to analyze the Linux kernel with several days of parallel processing.},\n\tbooktitle = {Proc. of the 18th {Int}'l {Symp}. on {Software} {Testing} and {Analysis}},\n\tauthor = {Jiang, Lingxiao and Su, Zhendong},\n\tyear = {2009},\n\tnote = {biblatexdata[\\_\\_markedentry=[remco:6];acmid=1572283;numpages=12] \nbibtex: Jiang2009},\n\tkeywords = {bdiff\\_, code clones, functional equivalence, program analysis, random testing, software similarity},\n\tpages = {81--92}\n}\n\n","author_short":["Jiang, L.","Su, Z."],"key":"jiang_automatic_2009","id":"jiang_automatic_2009","bibbaseid":"jiang-su-automaticminingoffunctionallyequivalentcodefragmentsviarandomtesting-2009","role":"author","urls":{},"keyword":["bdiff_","code clones","functional equivalence","program analysis","random testing","software similarity"],"downloads":0},"search_terms":["automatic","mining","functionally","equivalent","code","fragments","via","random","testing","jiang","su"],"keywords":["bdiff_","code clones","functional equivalence","program analysis","random testing","software similarity"],"authorIDs":[],"dataSources":["QiRZ7m7shEMvADZkd"]}