Professional Documents
Culture Documents
Code Migration Report
Code Migration Report
all of the declarations in the original PL/IX code, all Transform Statement
of the external variables are stored in a global table. .. Transform StatementIf
These declarations are printed to a le that is not in- --> "if ("
cluded anywhere in the new C++ code, but references .... Transform Expression
to the variables in it are made via extern statements. ...... Transform LogicalNot
An alternative solution is to include this le in all oth- --> "(!"
ers and remove the corresponding extern declarations. ........ Transform IdentifierReference
--> "kill"
--> ")"
[Verhoef97] is the use of a repository that holds all to evaluate the performance of the new version of the
the necessary information for the system to be trans- optimizer (which includes the three migrated subsys-
formed, as opposed to applying transformations at the tems), the optimizer was run on four sets of source
syntactic/semantic level using grammar and semantic code, namely:
actions re-write rules. This repository is populated at i) A single 13,000 line pre-processed C source
parse time and is annotated appropriately by a cus- le, about 7,000 lines of which were actual code
tom made for PL/IX linker. All code transformations (rather than declarations); ii) The Independent JPEG
have been built in terms of modular application pro- Group's free JPEG software, sixth public release (C
grams at the repository level. It has become apparent sources); iii) Stage 1 of the GNU C compiler, version
from this project, that the transformation logic should 2.7.2.2 (C sources) and; iv) The GNU C++ library,
be as modular and localized as possible (i.e. dierent version 2.7.1 (C++ sources)
transformation programs for each language construct), The performance results obtained when running the
and focus on three main points; a) transformation of optimizer against these four test cases with the PL/IX
data types, b) development of support utilities (i.e. and C++ versions of the subsystems respectively are
macros, interface classes) and, c) transformation of reported in Table 2. These are preliminary results
the source code entities (i.e. the actual application). obtained after the optimization heuristics were added
The schema in the repository has been built in such a in the transformation tool. More results are being
way as to be compatible with the PL/AS and PL/X collected as the migration tool is undergoing further
domain model. Therefore, the transformation process enhancement related to heuristics that can be incor-
is also applicable, with minor schema and transforma- porated to the transformation logic and used for en-
tion logic changes, to applications written in PL/AS hancing the performance of the new code.
and PL/X. We currently investigate the possibility of The time it takes the tool to generate migrant code
applying the same transformation logic to applications as a function of the size of the input code (time for
written in PL/I. parsing is shown in parentheses) as well as the eort in
As indicated in the introduction, the migration tool person days for adapting and integrating the migrated
was built in two phases. The rst phase aimed at de- code with the rest of the original legacy system are
veloping a tool which would produce C and C++ code illustrated in Tables 3 and 4 respectively.
that resembled substantially the hand-transformed These results indicate a signicant enhancement in
code produced for a legacy subsystem. The second productivity for the migration process, with no de-
phase aimed on incorporating into the transforma- terioration in the performance of the migrated code.
tion routines heuristics that have been used to hand- In particular, manual transformation of one subsystem
optimize the migrant code. The migration tool has (DS) required approximately 50 person-days. By com-
been tested with three subsystems of the legacy sys- parison, it took only one person day to adapt the auto-
tem. The performance results obtained for these sub- matically generated migrant code for the same subsys-
systems are reported in Table 2. tem so that it can be compiled, linked, and integrated
As indicated earlier, the legacy system that has with the rest of the legacy system. Statistics gathered
been partly migrated is a compiler optimizer. In order for the other two subsystems (BI and SM) follow the
guage (as opposed to SmallTalk), and with a highly
Subsystem Code Size Automatic optimized application which, in our case, is the IBM
Transliteration compiler back-end. Therefore our margins of perfor-
(KLOC) (person days) mance improvement are limited compared to the ones
BI 6.2KLOC 0.3pd that could be obtained in SmallTalk to C conversion.
SM 7.4KLOC 2pd In [Feldman93] and [Gillesp98] the authors report
DS 7.8KLOC 1pd that the performance of the converted code using the
f2c and p2c utilities respectively, is the same as the
Subsystem Code Size Manual Transliteration
DS 6.2KLOC 50pd performance of the original code, indicating thus a
Subsystem Code Size Manual Optimization performance ratio of 1.0. However, the code gener-
ated by these tools is reported to be non-maintainable
DS 6.2KLOC 10pd due to the structure and the characteristics of the gen-
erated code (no informal information and code struc-
Table 4: The eort to adapt and integrate the new ture preserved). This is to be expected since these
components to the rest of the system compared to the tools were meant to produce code, which after compi-
eort to manually transform the same subsystem. lation is binary-equivalent with respect to the original
code. We took a dierent approach, and we generate
code that is structurally "similar" with respect to the
Subsystem Subsystem Original New original code so that we could still produce portable
Size System Size System Size and maintainable code without of course aecting the
(KLOC) (MB) (MB) performance.
BI 6.2KLOC 27.150 27.265 On these aspects, our tool performs well, as it both
DS 7.8KLOC 26.738 27.976 maintains an acceptable performance ratio, and allows
SM 7.4KLOC 26.687 28.172 for the new code to be more maintainable and portable
due to resources, analysis tools, and the range of exist-
Table 5: The total size of the compiled system (binary) ing compilers available for C-based systems, as com-
before and after migration. pared to limited support that is available for PL/IX-
based systems. In this respect, we can say that our
tool could be placed in the middle of the spectrum rep-
same trend and indicate an eort of approximately resented in its extremes by: i) the SmallTalk to C con-
half a person-day and two person-days respectively. verter which deals with low optimized SmallTalk con-
The diculty of the integration task depends largely structs and not compatible programming paradigms
on the usage patterns of the data structures in the between the source and the target language and on
legacy system which have not been migrated yet and the other end by ii) the Fortran to C converter which
therefore need be shadowed, so that the new version of deals with easier mappings between the source and the
the system can be compiled and linked as a whole. Fi- target language, but with no further maintainability
nally, in Table 5 the size of the old and the new version and portability requirements for the target system.
of the overall system is compared. As it is shown, the
new system is approximately 5% larger in size than
the original one. This can be explained by the added
C++ libraries to handle and simulate the behavior of
9 Conclusion
several PL/IX language-specic constructs. We have described an experiment in code migra-
The comparison of the PL/IX to C converter dis- tion in the presence of global constraints, namely non-
cussed in this paper, with the other tools found in the deterioration in the performance of the maintainable
literature is summarized in the following points. In migrant code, and an incremental migration process.
[Yasuma95] the authors present a higher performance Our experiment suggests that it is possible to develop
ratio (that is the performance of the old system di- tools which reduce the human eort required for the
vided by the performance of the new system) for the migration process by one to two orders of magnitude,
migrant code (ratio = 1.22) than the performance ra- while respecting such constraints.
tio we could obtain on our initial experiments (ratio = We are currently completing a thorough evaluation
1.02). The reason for this discrepancy is that we deal of the migrant code in comparison to its legacy an-
both with PL/IX, which is a highly optimized lan- cestor. We are also in the process of enhancing our
migration tools to meet maintainabilityand other non- [Borras88] Borras, P., Clement, D., Despeyroux, Th.,
functional requirements for the migrant code. Khan , J., Lang, G., Pasual, V., \CEN-
TAUR: The System", Proceedings of the
Acknowlgement SIGSOFT/SIGPLAN Software Engineering
Symposium on Practical Software Develop-
The authors would like to thank Bill O'Farrell and ment Environments, Boston, Mass, 1988.
Stephen Perelgut of IBM Center for Advanced Studies,
for their technical and management support without [Brodie95] Brodie, M., Stonebraker, M., \Migrating
which this eort would not be possible. We would Legacy Systems", Morgan Kaufman Publish-
also like to thank Greg Mori for his eorts on the rst ers, 1995.
phase of the tool implementation. [Chen90] Chen, Y., Nishimoto, M., Ramamoorthy,
About the authors C., \The C Information Abstraction Sys-
tem.", IEEE Transactions on Software En-
Kostas Kontogiannis is an Assistant Professor at gineering, vol.16, No.3, 1990, pp.32 5-334.
the Electrical & Computer Engineering department, [CserRep] Consortium for Software Engineering Re-
University of Waterloo. His interests include software search: http://www.cser.ca
re-engineering, software migration and, distributed
object technology. Johannes Martin is a Ph.D can- [Feldman93] Feldman, S., Gay, D., Maimone, M.,
didate at the Computer Science department, Univer- Schryer, N., \A Fortran to C Converter",
sity of Victoria. His research interests include soft- AT&T Technical Report No. 149, 1993.
ware architectures, software re-engineering and, tools
for source code visualization. Kenny Wong is a post- [Finni97] Finnigan , P. et.al \The Software Book-
doctoral Research Associate at the department of shelf", IBM Systems Journal, vol.36, No.4,
Computer Science, University of Victoria. His inter- 1997.
ests include software migration, tools for visualization [Gillesp98] Gillespie, D., \A Pascal To C Converter",
of software architectures, and distributed systems. The HP-UX Porting and Archive Center,
Richard Gregory is a fourth year student at the Com- http://hpux.u-
puter Science department, University of Toronto. His aizu.ac.jp/hppd/hpux/Languages/p2c-
interests include software re-engineering and network- 1.20/readme.html
centric computing. Hausi Muller is a Professor at the
University of Victoria, department of Computer Sci- [Johnson94] Johnson, H., \Substring Matching for
ence. His interests include software visualization, dis- Clon e Detection and Change Tracking", In-
tributed object technology and network-centric com- ternational Conference on Software Mainte-
puting. John Mylopoulos is a Professor at the Uni- nance 1994, Victoria BC, 21-23 September,
versity of Toronto, department of Computer Science. 1994, pp.120-126.
His interests include software requirements, concep- [Ladd95] Ladd, D., Ramming, J., \A : a Lan-
tual modeling, software repositories, and software re- guage for Implementing Language Proces-
engineering. sors", IEEE Transactions on Software En-
gineering, vol.21, no.11, Nov. 1995, pp.894-
901.
References [Paul94] Paul, S., Prakash, A., \A Framework for
[Baker94] Baker S. B, \Parameterized Pattern Match- Source Code Search Using Program Pat-
ing: Algorithms and Applications", Journal terns", IEEE Transactions on Software En-
Computer and System Sciences, 1994. gineering, June 1994, Vol. 20, No.6, pp. 463-
475.
[Ballance92] Ballance, R., Graham, S., Van De Van- [Reps84] Reps, T., Teitelbaum, T., \The Synthe-
ter, M., \The Pan Language-Based Edit- sizer Generator", In Proc. of the SIG-
ing System", ACM Transactions on Software SOFT/SIGPLAN Symposium on Practical
Engineering and Methodology, Jan. 1992, Software Development Environments, Pitts-
Vol. 1, No.1, pp.95-127. burgh PA, 1984, pp.42-48.
[Sigma98] Sigma Research Inc. : http://www.sigma-
research.com/for2win
[Steen85] Steen, J., \Interactive examination of a C
program with Csope", Proceedings USENIX
Assoc., Winter Conference, Jan. 1985.
[Yasuma95] Yasumatsu, K., Doi, N., \Spice: A Sys-
tem for Translating SmallTalkPrograms Into
a C Environment" IEEE Transactions on
Software Engineering, vol. 21. no.11, Novem-
ber 1995.
[Verhoef97] van den Brand, M., Sellink, A., Verhoef,
C., \Generation of Components for Soft-
ware Renovation Factories from Context-
free Grammars", Proceedings Working Con-
ference on Reverse Engineering, WCRE'97,
Amsterdam, The Netherlands, October
1997.
[Xino98] Xinotech Inc. http://www.xinotech.com