Advertisement

Removing Superfluous Versions in Polyvariant Specialization of Prolog Programs

  • Claudio Ochoa
  • Germán Puebla
  • Manuel Hermenegildo
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3901)

Abstract

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.

Keywords

Logic Program Characteristic Tree Partial Evaluation Specialization History Partial Evaluator 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Gallagher, J.: A system for specialising logic programs. Technical Report TR-91-32, University of Bristol (November 1991)Google Scholar
  2. 2.
    Gallagher, J., Bruynooghe, M.: The derivation of an algorithm for program specialisation. New Generation Computing 9, 305–333 (1991)CrossRefzbMATHGoogle Scholar
  3. 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. 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
  5. 5.
    Hopcroft, J.E., Ullman, J.D.: Introduction to Automata Theory, Languages and Computation. Addison-Wesley, Reading (1979)zbMATHGoogle Scholar
  6. 6.
    Leuschel, M.: Ecological partial deduction: Preserving characteristic trees without constraints. In: Proietti, M. (ed.) LOPSTR 1995. LNCS, vol. 1048, pp. 1–16. Springer, Heidelberg (1996)CrossRefGoogle Scholar
  7. 7.
    Leuschel, M., Bruynooghe, M.: Logic program specialisation through partial deduction: Control issues. TPLP 2(4, 5), 461–515 (2002)MathSciNetzbMATHGoogle Scholar
  8. 8.
    Leuschel, M., Martens, B.: Global control for partial deduction through characteristic atoms and global trees. In: Danvy, O., Thiemann, P., Glück, R. (eds.) Dagstuhl Seminar 1996. LNCS, vol. 1110, pp. 263–283. Springer, Heidelberg (1996)CrossRefGoogle Scholar
  9. 9.
    Leuschel, M., Martens, B., De Schreye, D.: Controlling generalisation and polyvariance in partial deduction of normal logic programs. ACM TOPLAS 20(1), 208–258 (1998)CrossRefGoogle Scholar
  10. 10.
    Leuschel, M.: The ECCE partial deduction system and the DPPD library of benchmarks (1996-2002), http://www.ecs.soton.ac.uk/~mal
  11. 11.
    Leuschel, M.: Advanced Techniques for Logic Program Specialisation. PhD thesis, K.U.Leuven (May 1997)Google Scholar
  12. 12.
    Leuschel, M., Schreye, D.D.: Constrained partial deduction and the preservation of characteristic trees. New Generation Computing 16, 283–342 (1998)CrossRefGoogle Scholar
  13. 13.
    Lloyd, J.W., Shepherdson, J.C.: Partial evaluation in logic programming. The Journal of Logic Programming 11, 217–242 (1991)MathSciNetCrossRefzbMATHGoogle Scholar
  14. 14.
    Lloyd, J.W.: Foundations of Logic Programming, 2nd Ext. edn. Springer, Heidelberg (1987)CrossRefzbMATHGoogle Scholar
  15. 15.
    Puebla, G., Albert, E., Hermenegildo, M.: Efficient Local Unfolding with Ancestor Stacks for Full Prolog. In: Etalle, S. (ed.) LOPSTR 2004. LNCS, vol. 3573, pp. 149–165. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  16. 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
  17. 17.
    Puebla, G., Hermenegildo, M.: Abstract Multiple Specialization and its Application to Program Parallelization. JLP 41(2, 3), 279–316 (1999)MathSciNetCrossRefzbMATHGoogle Scholar
  18. 18.
    Winsborough, W.: Multiple Specialization using Minimal-Function Graph Semantics. Journal of Logic Programming 13(2, 3), 259–290 (1992)MathSciNetCrossRefzbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Claudio Ochoa
    • 1
  • Germán Puebla
    • 1
  • Manuel Hermenegildo
    • 1
    • 2
  1. 1.School of Computer ScienceTechnical U. of MadridSpain
  2. 2.Depts. of Comp. Sci. and El. and Comp. Eng.U. of New MexicoUSA

Personalised recommendations