Improved Compilation of Prolog to C Using Moded Types and Determinism Information

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.

[1]  Manuel V. Hermenegildo,et al.  The ciao prolog system , 2002 .

[2]  Peter Van Roy,et al.  The Wonder Years of Sequential Prolog Implementation , 1996 .

[3]  Fergus Henderson,et al.  Compiling Mercury to High-Level C Code , 2002, CC.

[4]  Michel Ferreira,et al.  Multiple Specialization of WAM Code , 1999, PADL.

[5]  Bart Demoen,et al.  Heap Memory Management in Prolog with Tabling: Principles and Practice , 2001, J. Funct. Log. Program..

[6]  Bart Demoen,et al.  Partial Translation: Towards a Portable and Efficient Prolog Implementation Technology , 1996, J. Log. Program..

[7]  Andreas Krall,et al.  The VAMAI-an abstract machine for incremental global data ow analysis of Prolog , 1995 .

[8]  Peter Van Roy,et al.  High-performance logic programming with the Aquarius Prolog compiler , 1992, Computer.

[9]  Michel Ferreira,et al.  WAM Local Analysis , 2003, PADL.

[10]  Manuel V. Hermenegildo,et al.  Program Development Using Abstract Interpretation (And The Ciao System Preprocessor) , 2003, SAS.

[11]  Manuel V. Hermenegildo,et al.  Abstract specialization and its applications , 2003, PEPM '03.

[12]  Jan Maluszynski,et al.  Analysis and Visualization Tools for Constraint Programming , 2000, Lecture Notes in Computer Science.

[13]  Hassan Aït-Kaci,et al.  Warren's Abstract Machine: A Tutorial Reconstruction , 1991 .

[14]  Philippe Codognet,et al.  Design and Implementation of the GNU Prolog System , 2001, J. Funct. Log. Program..

[15]  André Mariën Improving the compilation of Prolog in the framework of the Warren Abstract Machine , 1993 .

[16]  William H. Winsborough,et al.  Multiple Specialization using Minimal-Function Graph Semantics , 1992, J. Log. Program..

[17]  Philippe Codognet,et al.  WAMCC: Compiling Prolog to C , 1995, ICLP.

[18]  Andrew Taylor,et al.  High Performance Prolog Implementation , 1991 .

[19]  Peter Van Roy,et al.  Can Logic Programming Execute as Fast as Imperative Programming? , 1990 .

[20]  Bart Demoen,et al.  So Many WAM Variations, So Little Time , 2000, Computational Logic.

[21]  Jonathan Wayne Mills A High-Performance Low Risc Machine for Logic Programming , 1989, J. Log. Program..

[22]  Andrew Taylor,et al.  LIPS on a MIPS: Results from a Prolog Compiler for a RISC , 1990, ICLP.

[23]  Philippe Roussel,et al.  The birth of Prolog , 1993, HOPL-II.

[24]  Manuel V. Hermenegildo,et al.  A New Module System for Prolog , 2000, Computational Logic.

[25]  Manuel V. Hermenegildo,et al.  An Assertion Language for Constraint Logic Programs , 2000, Analysis and Visualization Tools for Constraint Programming.

[26]  A. Krall,et al.  The Vam Ai { an Abstract Machine for Incremental Global Dataaow Analysis of Prolog , 2013 .

[27]  Zoltan Somogyi,et al.  The Execution Algorithm of Mercury, an Efficient Purely Declarative Logic Programming Language , 1996, J. Log. Program..

[28]  Simon L. Peyton Jones,et al.  C--: A Portable Assembly Language that Supports Garbage Collection , 1999, PPDP.

[29]  Peter Van Roy,et al.  1983-1993: The Wonder Years of Sequential Prolog Implementation , 1994, J. Log. Program..

[30]  Luís Moniz Pereira,et al.  Computational Logic — CL 2000 , 2000, Lecture Notes in Computer Science.