Results 1 -
8 of
8
Static Inference of Modes and Data Dependencies in Logic Programs
- ACM Transactions on Programming Languages and Systems
, 1989
"... Abstract: Mode and data dependency analyses find many applications in the generation of efficient exe-cutable code for logic programs. For example, mode information can be used to generate specialized unification instructions where permissible; to detect determinacy and functionality of programs; to ..."
Abstract
-
Cited by 86 (5 self)
- Add to MetaCart
Abstract: Mode and data dependency analyses find many applications in the generation of efficient exe-cutable code for logic programs. For example, mode information can be used to generate specialized unification instructions where permissible; to detect determinacy and functionality of programs; to gen-erate index structures more intelligently; to reduce the amount of runtime tests in systems that support goal suspension; and in the integration of logic and functional languages. Data dependency information can be used for various source-level optimizing transformations, to improve backtracking behavior, and to parallelize logic programs. This paper describes and proves correct an algorithm for the static infer-ence of modes and data dependencies in a program. The algorithm is shown to be quite efficient for pro-grams commonly encountered in practice.
Automatic Mode Inference for Logic Programs
- Journal of Logic Programming
, 1988
"... In general, logic programs are undirected, i.e. there is no concept of "input" and "output" arguments to a procedure. An argument may be used either as an input or as an output argument, and programs may be executed either in a "forward" direction or in a "backward" direction. However, it is often t ..."
Abstract
-
Cited by 69 (7 self)
- Add to MetaCart
In general, logic programs are undirected, i.e. there is no concept of "input" and "output" arguments to a procedure. An argument may be used either as an input or as an output argument, and programs may be executed either in a "forward" direction or in a "backward" direction. However, it is often the case that in a given program, a predicate is used with some of its arguments used consistently as input arguments and others as output arguments. Such mode information can be used by a compiler to effect various optimizations. This paper considers the problem of automatically inferring the modes of the predicates in a program. The dataflow analysis we use is more powerful than approaches relying on syntactic characteristics of programs, e.g. [18]. Our work differs from that of Mellish [14, 15] in that (i) we give a sound and efficient treatment of variable aliasing in mode inference; (ii) by propagating instantiation information using state transformations rather than through dependen...
Denotational and operational semantics for prolog
- Journal of Logic Programming
, 1988
"... Abstract: The semantics of Prolog programs is usually given in terms of the model theory of first order logic. However, this does not adequately characterize the computational behavior of Prolog programs. Prolog implementations typically use a sequential evaluation strategy based on the textual orde ..."
Abstract
-
Cited by 52 (3 self)
- Add to MetaCart
Abstract: The semantics of Prolog programs is usually given in terms of the model theory of first order logic. However, this does not adequately characterize the computational behavior of Prolog programs. Prolog implementations typically use a sequential evaluation strategy based on the textual order of clauses and literals in a program, as well as non-logical features like ‘‘cut’’. In this work we develop a denotational semantics that captures the computational behavior of Prolog. We present a semantics for ‘‘cut-free’ ’ Prolog, which is then extended to Prolog with cut. For each case we develop a congruence proof that relates the semantics to a standard operational interpreter. As an application of our denotational semantics, we show the correctness of some standard ‘‘folk’ ’ theorems regarding transformations on Pro-log programs.
Functional computations in logic programs
- ACM Transactions on Programming Languages and Systems
, 1989
"... Abstract: While the ability to simulate nondeterminism and compute multiple solutions for a single query is a powerful and attractive feature of logic programming languages, it is expensive in both time and space. Since programs in such languages are very often functional, i.e. do not produce more t ..."
Abstract
-
Cited by 51 (11 self)
- Add to MetaCart
Abstract: While the ability to simulate nondeterminism and compute multiple solutions for a single query is a powerful and attractive feature of logic programming languages, it is expensive in both time and space. Since programs in such languages are very often functional, i.e. do not produce more than one distinct solution for a single input, this overhead is especially undesirable. This paper describes how pro-grams may be analyzed statically to determine which literals and predicates are functional, and how the program may then be optimized using this information. Our notion of ‘‘functionality’ ’ subsumes the notion of ‘‘determinacy’ ’ that has been considered by various researchers. Our algorithm is less reliant on language features such as the cut, and thus extends more easily to parallel execution strategies, than others that have been proposed.
Unfold/Fold Transformations and Loop Optimization of Logic Programs
- In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation
, 1988
"... Abstract: Programs typically spend much of their execution time in loops. This makes the generation of efficient code for loops essential for good performance. Loop optimization of logic programming languages is complicated by the fact that such languages lack the iterative constructs of traditional ..."
Abstract
-
Cited by 23 (1 self)
- Add to MetaCart
Abstract: Programs typically spend much of their execution time in loops. This makes the generation of efficient code for loops essential for good performance. Loop optimization of logic programming languages is complicated by the fact that such languages lack the iterative constructs of traditional languages, and instead use recursion to express loops. In this paper, we examine the application of unfold/fold transformations to three kinds of loop optimization for logic programming languages: recur-sion removal, loop fusion and code motion out of loops. We describe simple unfold/fold transformation sequences for these optimizations that can be automated relatively easily. In the process, we show that the properties of unification and logical variables can sometimes be used to generalize, from traditional languages, the conditions under which these optimizations may be carried out. Our experience suggests that such source-level transformations may be used as an effective tool for the optimization of logic pro-grams. 1.
A Simple Code Improvement Scheme for Prolog
- Journal of Logic Programming
, 1992
"... The generation of efficient code for Prolog programs requires sophisticated code transformation and op-timization systems. Much of the recent work in this area has focussed on high level transformations, typi-cally at the source level. Unfortunately, such high level transformations suffer from the d ..."
Abstract
-
Cited by 23 (3 self)
- Add to MetaCart
The generation of efficient code for Prolog programs requires sophisticated code transformation and op-timization systems. Much of the recent work in this area has focussed on high level transformations, typi-cally at the source level. Unfortunately, such high level transformations suffer from the deficiency of be-ing unable to address low level implementational details. This paper presents a simple code improvement scheme that can be used for a variety of low level optimizations. Applications of this scheme are illustrat-ed using low level optimizations that reduce tag manipulation, dereferencing, trail testing, environment al-location, and redundant bounds checks. The transformation scheme serves as a unified framework for rea-soning about a variety of low level optimizations that have, to date, been dealt with in a more or less ad hoc manner.
Flow analysis of dynamic logic programs
- Journal of Logic Programming
, 1989
"... Abstract: Research on flow analysis and optimization of logic programs typically assumes that the pro-grams being analyzed are static, i.e. any code that can be executed at runtime is available for analysis at compile time. This assumption may not hold for ‘‘real’ ’ programs, which can contain dynam ..."
Abstract
-
Cited by 9 (3 self)
- Add to MetaCart
Abstract: Research on flow analysis and optimization of logic programs typically assumes that the pro-grams being analyzed are static, i.e. any code that can be executed at runtime is available for analysis at compile time. This assumption may not hold for ‘‘real’ ’ programs, which can contain dynamic goals of the form call(X), where X is a variable at compile time, or where predicates may be modified via features like assert and retract. In such contexts, a compiler must be able to take the effects of such dynamic con-structs into account in order to perform nontrivial flow analyses that can be guaranteed to be sound. This paper outlines how this may be done for certain kinds of dynamic programs. Our techniques allow analysis and optimization techniques that have been developed for static programs to be extended to a large class of ‘‘well-behaved’ ’ dynamic programs. Address for correspondence and proofs:
Towards banishing the cut from Prolog
- IEEE Trans. on Software Engineering
, 1990
"... Abstract: There has been a great deal of interest in logic programming languages in recent years. This is due, in great part, to the advantages offered by these languages: declarative readings of programs and separation of program logic from control. However, logic programs can often be dismayingly ..."
Abstract
-
Cited by 7 (1 self)
- Add to MetaCart
Abstract: There has been a great deal of interest in logic programming languages in recent years. This is due, in great part, to the advantages offered by these languages: declarative readings of programs and separation of program logic from control. However, logic programs can often be dismayingly inefficient. The usual solution to this problem has been to return some control to the user in the form of impure language features like cut. Unfortunately, this often results in the loss of precisely those features that made logic programming attractive in the first place. We argue that it is not necessary to resort to such impure features for efficiency. This point is illus-trated by considering how most of the common uses of cut can be eliminated from Prolog source pro-grams, relying on static analysis to generate them at compile time. Three common situations where the cut is used are considered. Static analysis techniques are given to detect such situations, and applicable program transformations are described. We also suggest two language constructs, firstof and oneof, for situations involving ‘‘don’t-care’ ’ nondeterminism. These constructs have better declarative readings than the cut, and extend better to parallel evaluation strategies. Together, these proposals result in a sys-tem where users need rely much less on cuts for efficiency, thereby promoting a purer programming style without sacrificing efficiency.

