Abstract: The need to integrate several versions of a program
into a common one arises frequently, but it is a tedious and time
consuming task to integrate programs by hand. To date, the only
available tools for assisting with program integration are
variants of text-based differential file comparators; these are of
limited utility because one has no guarantees about how the
program that is the product of an integration behaves compared to
the programs that were integrated.
This paper concerns the design of a semantics-based tool for
automatically integrating program versions. The main contribution
of the paper is an algorithm that takes as input three programs A,
B, and Base, where A and B are two variants of Base. Whenever the
changes made to Base to create A and B do not "interfere" (in a
sense defined in the paper), the algorithm produces a program M
that integrates A and B. The algorithm is predicated on the
assumption that differences in the behavior of the variant
programs from that of Base, rather than differences in the text,
are significant and must be preserved in M. Although it is
undecidable whether a program modification actually leads to such
a difference, it is possible to determine a safe approximation by
comparing each of the variants with Base. To determine this
information, the integration algorithm employs a program
representation that is similar (although not identical) to the
dependence graphs that have been used previously in vectorizing
and parallelizing compilers. The algorithm also makes use of the
notion of a program slice to find just those statements of a
program that determine the values of potentially affected
variables.
The program-integration problem has not been formalized
previously. It should be noted, however, that the integration
problem examined here is a greatly simplified one; in particular,
we assume that expressions contain only scalar variables and
constants, and that the only statements used in programs are
assignment statements, conditional statements, and
while-loops.