The University of Arizona
banner image

  Detection and Optimization of Suspension-free Logic Programs

Saumya Debray   David Gudeman Peter Bigot
Department of Computer Science
University of Arizona
Tucson, AZ 85721, U.S.A.
 

Abstract
In recent years, language mechanisms to suspend, or delay, the execution of goals until certain variables become bound have become increasingly popular in logic programming languages. While convenient, such mechanisms can make control flow within a program difficult to predict at compile time and therefore render many traditional compiler optimizations inapplicable. Unfortunately, this performance cost is also incurred by programs that do not use any delay primitives. In this paper we describe a simple dataflow analysis for detecting computations where suspension effects can be ignored, and discuss several low-level optimizations that rely on this information. Our algorithm has been implemented in the jc system. Optimizations based on information it produces result in significant performance improvements, resulting in speed comparable to or exceeding that of optimized C programs.