Renaming and Shifted Code in Structured Merging: Looking Ahead for Precision and Performance

kaestner@cs.cmu.edu (O. Leßenich, S. Apel, C. Kästner, G. Seibt, J. Siegmund)
Fri, 09 Feb 2018 09:07:32 -0500

Olaf Leßenich, Sven Apel, Christian Kästner, Georg Seibt, and Janet Siegmund. Renaming and Shifted Code in Structured Merging: Looking Ahead for Precision and Performance. In Proceedings of the 32nd IEEE/ACM International Conference on Automated Software Engineering (ASE), pages 543--553, Los Alamitos, CA: IEEE Computer Society, November 2017.

Diffing and merging of source-code artifacts is an essential task when integrating changes in software versions. While state-of-the-art line-based tools (e.g., git merge) are fast and independent of the programming language used, they have only a low precision. Recently, it has been shown that the precision of merging can be substantially improved by using a language-aware, structured approach that works on abstract syntax trees. But, precise structured merging is NP hard, especially, when considering the notoriously difficult scenarios of renamings and shifted code. To address these scenarios without compromising scalability, we propose a syntax-aware, heuristic optimization for structured merging that employs a lookahead mechanism during tree matching. The key idea is that renamings and shifted code are not arbitrarily distributed but their occurrence follows patterns, which we address with a syntax-specific lookahead. Our experiments with 48 real-world open-source projects (4878 merge scenarios with over 400 million lines of code) demonstrate that we can significantly improve matching precision in 28 percent while maintaining performance.