Removing Superfluous Versions in Polyvariant Specialization of Prolog Programs
Polyvariant specialization allows generating multiple versions of a procedure, which can then be separately optimized for different uses. Since allowing a high degree of polyvariance often results in more optimized code, polyvariant specializers, such as most partial evaluators, can generate a large number of versions. This can produce unnecessarily large residual programs. Also, large programs can be slower due to cache miss effects. A possible solution to this problem is to introduce a minimization step which identifies sets of equivalent versions, and replace all occurrences of such versions by a single one. In this work we present a unifying view of the problem of superfluous polyvariance. It includes both partial deduction and abstract multiple specialization. As regards partial deduction, we extend existing approaches in several ways. First, previous work has dealt with pure logic programs and a very limited class of builtins. Herein we propose an extension to traditional characteristic trees which can be used in the presence of calls to external predicates. This includes all builtins, libraries, other user modules, etc. Second, we propose the possibility of collapsing versions which are not strictly equivalent. This allows trading time for space and can be useful in the context of embedded and pervasive systems. This is done by residualizing certain computations for external predicates which would otherwise be performed at specialization time. Third, we provide an experimental evaluation of the potential gains achievable using minimization which leads to interesting conclusions.
KeywordsLogic Program Characteristic Tree Partial Evaluation Specialization History Partial Evaluator
Unable to display preview. Download preview PDF.
- 1.Gallagher, J.: A system for specialising logic programs. Technical Report TR-91-32, University of Bristol (November 1991)Google Scholar
- 3.Gallagher, J.P.: Tutorial on specialisation of logic programs. In: Proc. of PEPM 1993, pp. 88–98. ACM Press, New York (1993)Google Scholar
- 4.Hermenegildo, M., Bueno, F., Puebla, G., López-García, P.: Program Analysis, Debugging and Optimization Using the Ciao System Preprocessor. In: 1999 ICLP, pp. 52–66. MIT Press, Cambridge (1999)Google Scholar
- 10.Leuschel, M.: The ECCE partial deduction system and the DPPD library of benchmarks (1996-2002), http://www.ecs.soton.ac.uk/~mal
- 11.Leuschel, M.: Advanced Techniques for Logic Program Specialisation. PhD thesis, K.U.Leuven (May 1997)Google Scholar
- 16.Puebla, G., Hermenegildo, M.: Implementation of Multiple Specialization in Logic Programs. In: Proc. of PEPM 1995, June 1995, pp. 77–87. ACM Press, New York (1995)Google Scholar