Over the last several decades, software developers have produced a large body of software applications. Automatic code transfer identifies useful code in a donor application, then transfers the code into a recipient application, enabling the recipient to reuse code originally developed for other applications. The technique therefore makes it possible to work with the large body of developed applications as a source of usefully repurposable functionality. We have demonstrated the use of code transfer to enhance the security, performance, and delivered functionality of recipient applications. Notable technical contributions of our code transfer systems include the use of dynamic analysis to implement name translations, data structure translations, and the identification and elimination of irrelevant code.
There is a strong analogy between code transfer and horizontal gene transfer in biological organisms. Examples of horizontal gene transfer include plasmid transfer (which plays a major role in acquired antibiotic resistance), virally-mediated gene therapy, and the transfer of insect toxin genes from bacteria to fungal symbionts. Because of its ability to directly transfer functionality evolved and refined in one organism into another, horizontal gene transfer is recognized as a significant factor in the development of many forms of life. By enabling the immediate transfer and reuse of functionality across multiple applications, code transfer can similarly promote promote and enhance the rapid development and evolution of large software systems.
The following papers present code transfer systems that we have developed:
CodeCarbonCopy
Stelios Sidiroglou-Douskos, Eric Lahtinen, Anthony Eden, Fan Long, and Martin Rinard
Proceedings of 2017 11th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering
Paderborn, Germany, September 2017
CodeCarbonCopy starts with donor functionality identified by a developer. The developer also identifies an insertion point in the recipient. CodeCarbonCopy then transfers the identified donor functionality into th recipient. Key steps include data structure translations, naming translations, and the removal of irrelevant code. We have demonstrated the use of CodeCarbonCopy to transfer, for example, image processing operations and code that implements a new file format. CCC supports the translation of both scalar and dynamic array data structures.
Automatic Error Elimination by Horizontal Code Transfer Across Multiple Applications
Stelios Sidiroglou-Douskos, Eric Lahtinen, Fan Long, and Martin Rinard
Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2015)
Portland, Oregon, June 2015
CodePhage automatically eliminates errors in recipient software applications by finding correct code in donor applications, then transferring that correct code from the donor into the recipient. The result is a software hybrid that productively combines beneficial code from multiple applications. CodePhage starts with an application and an input that (because of a missing check) triggers an error. It then finds the missing check in another donor application, then automatically transfers the check into the recipient application to eliminate the error.
Although CodePhage generates source-level patches in the recipient, it works with stripped binary donors and can operate on shipped donor binaries without access to donor source code. CodePhage can therefore productively leverage the combined software development effort invested in multiple donor applications. And CodePhage requires no developer intervention, only the recipient, an input that triggers an error in the recipient, and a (potentially binary) donor that processes the same input file. It can therefore be used in conjunction with automatic error detection systems (such as DIODE) to deliver a fully autonomous, continuously operating system for systematically detecting and eliminating application errors.
Program Fracture and Recombination for Efficient Automatic Code Reuse
Peter Amidon, Eli Davis, Stelios Sidiroglou-Douskos, and Martin Rinard
2015 IEEE High Performance Extreme Computing Conference (HPEC '15)
Waltham, Massachusetts, September 2015
Starting with multiple programs, program fracture and recombination fractures the program into shards, encapsulates each shard into its own separately invocable program for exploration, matches shards that implement the same functionality, then replaces matched shards with the best version across applications. The goal is to automaticaly find and utilize the best implementation of each piece of implemented functionality across all available applications.