Abstract
We describe the current status of and provide performance results for a prototype compiler of Prolog to C, ciaocc. ciaocc is novel in that it is designed to accept different kinds of high-level information, typically obtained via an automatic analysis of the initial Prolog program and expressed in a standardized language of assertions. This information is used to optimize the resulting C code, which is then processed by an off-the-shelf C compiler. The basic translation process essentially mimics the unfolding of a bytecode emulator with respect to the particular bytecode corresponding to the Prolog program. This is facilitated by a flexible design of the instructions and their lower-level components. This approach allows reusing a sizable amount of the machinery of the bytecode emulator: predicates already written in C, data definitions, memory management routines and areas, etc., as well as mixing emulated bytecode with native code in a relatively straightforward way. We report on the performance of programs compiled by the current version of the system, both with and without analysis information.
This work is partially supported by Spanish MCYT Project TIC 2002-0055 CUBICO, and EU Projects IST-2001-34717 Amos and IST-2001-38059 ASAP, and by the Prince of Asturias Chair in Information Science and Technology at the University of New Mexico. J. Morales is also supported by an MCYT fellowship co-financed by the European Social Fund.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Colmerauer, A.: The Birth of Prolog. In: Second History of Programming Languages Conference. ACM SIGPLAN Notices, pp. 37–52 (1993)
Van Roy, P.: 1983-1993: The Wonder Years of Sequential Prolog Implementation. Journal of Logic Programming 19/20, 385–441 (1994)
Pereira, F.: C-Prolog User’s Manual, Version 1.5, University of Edinburgh (1987)
Warren, D.: An Abstract Prolog Instruction Set. Technical Report 309, Artificial Intelligence Center, SRI International, 333 Ravenswood Ave, Menlo Park CA 94025 (1983)
Ait-Kaci, H.: Warren’s Abstract Machine, A Tutorial Reconstruction. MIT Press, Cambridge (1991)
Taylor, A.: High-Performance Prolog Implementation. PhD thesis, Basser Department of Computer Science, Unversity of Sidney (1991)
Krall, A., Berger, T.: The VAMAI - an abstract machine for incremental global dataflow analysis of Prolog. In: de la Banda, M.G., Janssens, G., Stuckey, P. (eds.) ICLP ’95 Post-Conference Workshop on Abstract Interpretation of Logic Languages, Tokyo, Science University of Tokyo, pp. 80–91 (1995)
Van Roy, P., Despain, A.: High-Performace Logic Programming with the Aquarius Prolog Compiler. IEEE Computer Magazine, 54–68 (1992)
Swedish Institute for Computer Science PO Box 1263, S-164 28 Kista, Sweden: SICStus Prolog 3.8 User’s Manual. 3.8 edn. (1999) Available from http://www.sics.se/sicstus/
Mariën, A.: Improving the Compilation of Prolog in the Framework of the Warren Abstract Machine. PhD thesis, Katholieke Universiteit Leuven (1993)
Diaz, D., Codognet, P.: Design and Implementation of the GNU Prolog System. Journal of Functional and Logic Programming 2001 (2001)
Jones, S.L.P., Ramsey, N., Reig, F.: C–: A Portable Assembly Language that Supports Garbage Collection. In: Nadathur, G. (ed.) PPDP 1999. LNCS, vol. 1702, pp. 1–28. Springer, Heidelberg (1999)
Codognet, P., Diaz, D.: WAMCC: Compiling Prolog to C. In: Sterling, L. (ed.) International Conference on Logic Programming, pp. 317–331. MIT Press, Cambridge (1995)
Quintus Computer Systems Inc. Mountain View CA 94041: Quintus Prolog User’s Guide and Reference Manual—Version 6. (1986)
Santos-Costa, V., Damas, L., Reis, R., Azevedo, R.: The Yap Prolog User’s Manual. (2000) Available from http://www.ncc.up.pt/~vsc/Yap
Demoen, B., Nguyen, P.L.: So Many WAM Variations, So Little Time. In: Palamidessi, C., Moniz Pereira, L., Lloyd, J.W., Dahl, V., Furbach, U., Kerber, M., Lau, K.-K., Sagiv, Y., Stuckey, P.J. (eds.) CL 2000. LNCS (LNAI), vol. 1861, pp. 1240–1254. Springer, Heidelberg (2000)
Bueno, F., Cabeza, D., Carro, M., Hermenegildo, M., López-García, P., Puebla, G.: The Ciao Prolog System. Reference Manual (v1.8). The Ciao System Documentation Series–TR CLIP4/2002.1, School of Computer Science, Technical University of Madrid (UPM) (2002), System and on-line version of the manual available at http://clip.dia.fi.upm.es/Software/Ciao/
Puebla, G., Hermenegildo, M.: Abstract Specialization and its Applications. In: ACM Partial Evaluation and Semantics based Program Manipulation (PEPM 2003), pp. 29–43. ACM Press, New York (2003) (invited talk)
Winsborough, W.: Multiple Specialization using Minimal-Function Graph Semantics. Journal of Logic Programming 13, 259–290 (1992)
Ferreira, M., Damas, L.: Multiple Specialization of WAM Code. In: Gupta, G. (ed.) PADL 1999. LNCS, vol. 1551, p. 243. Springer, Heidelberg (1999)
Mills, J.: A high-performance low risc machine for logic programming. Journal of Logic Programming (6), 179–212 (1989)
Taylor, A.: LIPS on a MIPS: Results from a prolog compiler for a RISC. In: 1990 International Conference on Logic Programming, pp. 174–189. MIT Press, Cambridge (1990)
Hermenegildo, M., Greene, K.: The &-Prolog System: Exploiting Independent And-Parallelism. New Generation Computing 9, 233–257 (1991)
Puebla, G., Bueno, F., Hermenegildo, M.: An Assertion Language for Constraint Logic Programs. In: Deransart, P., Małuszyński, J. (eds.) DiSCiPl 1999. LNCS, vol. 1870, pp. 23–61. Springer, Heidelberg (2000)
Hermenegildo, M., Puebla, G., Bueno, F., López-García, P.: Program Development Using Abstract Interpretation (and The Ciao System Preprocessor). In: Cousot, R. (ed.) SAS 2003. LNCS, vol. 2694, pp. 127–152. Springer, Heidelberg (2003)
Cabeza, D., Hermenegildo, M.: A New Module System for Prolog. In: Palamidessi, C., Moniz Pereira, L., Lloyd, J.W., Dahl, V., Furbach, U., Kerber, M., Lau, K.-K., Sagiv, Y., Stuckey, P.J. (eds.) CL 2000. LNCS (LNAI), vol. 1861, pp. 131–148. Springer, Heidelberg (2000)
Van Roy, P.: Can Logic Programming Execute as Fast as Imperative Programming? PhD thesis, Univ. of California Berkeley (1990) Report No. UCB/CSD 90/600
Henderson, F., Somogyi, Z.: Compiling Mercury to High-Level C Code. In: Horspool, R.N. (ed.) CC 2002. LNCS, vol. 2304, pp. 197–212. Springer, Heidelberg (2002)
Somogyi, Z., Henderson, F., Conway, T.: The execution algorithm of Mercury: an efficient purely declarative logic programming language. JLP 29 (1996)
Tarau, P., De Bosschere, K., Demoen, B.: Partial Translation: Towards a Portable and Efficient Prolog Implementation Technology. Journal of Logic Programming 29, 65–83 (1996)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2004 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Morales, J., Carro, M., Hermenegildo, M. (2004). Improved Compilation of Prolog to C Using Moded Types and Determinism Information. In: Jayaraman, B. (eds) Practical Aspects of Declarative Languages. PADL 2004. Lecture Notes in Computer Science, vol 3057. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-24836-1_7
Download citation
DOI: https://doi.org/10.1007/978-3-540-24836-1_7
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-22253-8
Online ISBN: 978-3-540-24836-1
eBook Packages: Springer Book Archive