The purpose of this dissertation is to provide constructive proof that the logic programming language Prolog can be implemented an order of magnitude more efficiently than the best previous systems, so that its speed approaches imperative languages such as C for a significant class of problems. The driving force in the design is to encode each occurrence of a general feature of Prolog as simply as possible. The resulting system, Aquarius Prolog, is about five times faster than Quintus Prolog, a high Performance commercial system, on a set of representative programs. The design is based on the following ideas: (1) Reduce instruction granularity. Use an execution model, the Berkeley Abstract Machine (BAM), that retains the good features of the Warren Abstract Machine (WAM), a standard execution model for Prolog, but is more easily optimized and closer to a real machine. (2) Exploit determinism. Compile deterministic programs with efficient conditional branches. Most predicates written by human programmers are deterministic, yet previous systems often compile them in an inefficient manner by simulating conditional branching with backtracking. (3) Specialize unification. Compile unification to the simplest possible code. Unification is a general pattern-matching operation that can do many things in the implementation: pass parameters, assign values to variables, allocate memory, and do conditional branching. (4) Dataflow analysis. Derive type information by global dataflow analysis to support these ideas.Because of limitations of the dataflow analysis, the system is not yet competitive with the C language for all programs. I outline the work that is needed to close the remaining gap.
Cited By
- Lapeyrade S Reasoning with ontologies for non-player character's decision-making in games Proceedings of the Eighteenth AAAI Conference on Artificial Intelligence and Interactive Digital Entertainment, (303-306)
- Warren D WAM for everyone Declarative Logic Programming, (237-277)
- Carro M, Morales J, Muller H, Puebla G and Hermenegildo M High-level languages for small devices Proceedings of the 2006 international conference on Compilers, architecture and synthesis for embedded systems, (271-281)
- Penn G Balancing clarity and efficiency in typed feature logic through delaying Proceedings of the 42nd Annual Meeting on Association for Computational Linguistics, (239-es)
- Lopes R, Castro L and Costa V (2019). From simulation to practice, ACM SIGPLAN Notices, 38:2 supplement, (56-64), Online publication date: 15-Feb-2003.
- Lopes R, Castro L and Costa V From simulation to practice Proceedings of the 2002 workshop on Memory system performance, (56-64)
- Debray S Abstract interpretation and low-level code optimization Proceedings of the 1995 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation, (111-121)
- De Bosschere K, Debray S, Gudeman D and Kannan S Call forwarding Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages, (409-420)
- Costa A, De Gloria A, Faraboschi P and Olivieri M An analysis of dynamic scheduling techniques for symbolic applications Proceedings of the 26th annual international symposium on Microarchitecture, (185-191)
- De Gloria A and Faraboschi P Instruction-level parallelism in Prolog Proceedings of the 19th annual international symposium on Computer architecture, (224-233)
- De Gloria A and Faraboschi P (2019). Instruction-level parallelism in Prolog, ACM SIGARCH Computer Architecture News, 20:2, (224-233), Online publication date: 1-May-1992.
- Holmer B, Sano B, Carlton M, Van Roy P, Haygood R, Bush W, Despain A, Pendleton J and Dobry T (1990). Fast Prolog with an extended general purpose architecture, ACM SIGARCH Computer Architecture News, 18:2SI, (282-291), Online publication date: 1-Jun-1990.
- Holmer B, Sano B, Carlton M, Van Roy P, Haygood R, Bush W, Despain A, Pendleton J and Dobry T Fast Prolog with an extended general purpose architecture Proceedings of the 17th annual international symposium on Computer Architecture, (282-291)
Index Terms
- Can logic programming execute as fast as imperative programming?