Abstract
Program specialization is normally supported by global analysis of the program. Compilers use the information deduced to generate more efficient, specialized implementations of the program. This specialization can be single or multiple, depending if each procedure of the program is specialized into one or more versions. We present a Prolog compiler that does multiple specialization, using an algorithm that works over the WAM code, deducing the reachable procedure activations based on local analysis. The idea is to use the analysis that is done in the Prolog to WAM compilation, and that generates local specialized instructions, and to propagate this information through the entire program. The creation of multiple versions of predicates allows the propagation to be interprocedural, and to achieve global program specialization. Results from an implementation generating C code as target language are presented, showing a performance comparable to native code Prolog compilers.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Hassan Aït-Kaci. Warren’s Abstract Machine — A Tutorial Reconstruction. MIT Press, 1991.
M. Bruynooghe and G. Jenssens. An instance of abstract interpretation integrating type and mode inferencing. In Proc. of ICSLP’88, pages 669–683, Seattle, Washington, 1988. MIT Press.
Philippe Codognet and Daniel Diaz. wamcc: Compiling Prolog to C. In Proc. of ICLP’95. MIT Press, 1995.
P. Cousot and R. Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proc. of SPPL’77, pages 238–252, Los Angeles, California, 1977.
S. K. Debray and D. S. Warren. Automatic mode inference for prolog programs. The Journal of Logic Programming, 5(3):78–88, September 1988.
D. Gudeman, K. De Bosschere, and S. Debray. jc: An efficient and portable sequential implementation of janus. In Joint International Conference and Symposium on Logic Programming, Washington, 1992. “MIT Press”.
B. Haussman. Turbo Erlang: Approaching the Speed of C. In Evan Tick, editor, Implementations of Logic Programming Systems. Kluwer, 1994.
M. Hermenegildo, R. Warren, and S. K. Debray. Global Flow Analysis as a Practical Compilation Tool. JLP, 13(4):349–367, August 1992.
D. Jacobs and A. Langen. Accurate and efficient approximation of variable aliasing in logic programs. In Proc. NACLP’89, pages 154–165. “MIT Press”, 1989.
A. Krall and U. Neumerkel. The Vienna Abstract Machine. In Proc. of PLIP”90, number 456 in LNCS, pages 121–135. Sweeden, Springer-Verlag, 1990.
C. S. Mellish. Abstract interpretation of prolog programs. In Proc of ICLP’86, number 225 in Lecture Notes in Computer Science. Springer-Verlag, 1986.
S. Peyton Jones, T. Nordin, and D. Oliva. C-: a portable assembly language. In [To appear in the proceedings of IFL’97]., St. Andrews, Scotland, 1997.
J. Tan and I. Lin. Compiling dataflow analysis of logic programs. In Proc. of PLDI’92, pages 106–115, San Francisco, California, 1992. SIGPLAN.
A. Taylor. High Performance Prolog Implementation. PhD thesis, University of Sydney, June 1991.
P. Van Roy. Can Logic Programming Execute as Fast as Imperative Programming? PhD thesis, University of California at Berkeley, November 1990.
P. Van Roy. 1983–1993: The Wonder Years of Sequential Prolog Implementation. The Journal of Logic Programming, 19/20, May/July 1994.
David H. D. Warren. An Abstract Prolog Instruction Set. Technical Note 309, SRI International, 1983.
W. H. Winsborough. Path-dependent reachability analysis for multiple specialization. In Proc. of NACLP’89. “MIT Press”, 1989.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1998 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Ferreira, M., Damas, L. (1998). Multiple Specialization of WAM Code. In: Gupta, G. (eds) Practical Aspects of Declarative Languages. PADL 1999. Lecture Notes in Computer Science, vol 1551. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-49201-1_17
Download citation
DOI: https://doi.org/10.1007/3-540-49201-1_17
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-65527-5
Online ISBN: 978-3-540-49201-6
eBook Packages: Springer Book Archive