WAM Local Analysis

  • Michel Ferreira
  • Luís Damas
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2562)


The abstract interpretation framework has been used mainly in the global analysis of programs. Most often also, this interpretation is applied to the source Prolog program. In this paper we present an abstract interpretation of more local nature, and applied to the intermediate code (WAM). The purpose of obtaining a more efficient specialized version of the program remains the same as in global analysis approaches. Our specialization is multiple, meaning that we generate a different version for each entry pattern detected by analysis. This poly-variant unfolding of predicates allows the local (predicate level) analysis to propagate inter-procedurally relevant information. Besides time and complexity reduction of local versus global analysis, our approach is suited for goal-independent specialization, and for the partial selection of predicates to specialize. The evaluation of this more general specialization of programs in a full compiler shows that it is an alternative to global and goal-dependent methods.


Prolog Compilation Abstract Interpretation Multiple Specialization 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1. Hassan Aït-Kaci. Warren’s Abstract Machine - A Tutorial Reconstruction. MIT Press, 1991.Google Scholar
  2. 2.
    Mats Carlsson. Internals of Sicstus Prolog version 0.6. Internal Report, Gigalips Project, November 1987.Google Scholar
  3. 3.
    Mats Carlsson. Design and Implementation of an OR-Parallel Prolog Engine. SICS Dissertation Series 02, The Royal Institute of Technology, 1990.Google Scholar
  4. 4.
    Philippe Codognet and Daniel Diaz. wamcc: Compiling Prolog to C. In Leon Sterling, editor, Proc. of the 12th International Conference on Logic Programming, pages 317–332, Cambridge, June 13-18 1995. MIT Press.Google Scholar
  5. 5.
    P. Cousot and R. Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proc. of SPPL’77, pages 238–252, Los Angeles, California, 1977.Google Scholar
  6. 6.
    P. Cousot and R. Cousot. Abstract interpretation and application to logic programs. The Journal of Logic Programming, 13(1, 2, 3 and 4):103–179, 1992.MATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    S. K. Debray. Abstract Interpretation and Low-Level Code Optimization. In Proc. of PEPM’95, pages 111–121. ACM Press, June 1995.Google Scholar
  8. 8.
    M. Ferreira. Advanced Specialization Techniques for the Compilation of Declarative Languages . PhD thesis, Universidade do Porto, April 2002.Google Scholar
  9. 9.
    M. Ferreira and L. Damas. Multiple specialization of WAM code. Proc. of PADL’99, LNCS, 1551:243–258, 1999.Google Scholar
  10. 10.
    M. Hermenegildo, R. Warren, and S. K. Debray. Global Flow Analysis as a Practical Compilation Tool. JLP, 13(4):349–367, August 1992.CrossRefGoogle Scholar
  11. 11.
    D. Jacobs, A. Langen, and W. Winsborough. Multiple specialization of logic programs with run-time tests. Proc. of ICLP’90, pages 717–731, June 1990.Google Scholar
  12. 12.
    A. Kelly, A. Macdonald, K. Marriott, P. Stuckey, and R. Yap. Effectiveness of optimizing compilation for CLP(R). Proc. of JICSLP’96, pages 37–51, 1996.Google Scholar
  13. 13.
    A. King and P. Soper. Depth-k sharing and freeness. In Proc. of the ICLP’94, pages 553–568. The MIT Press, 1994.Google Scholar
  14. 14.
    A. Krall and T. Berger. The VAMAI-an abstract machine for incremental global dataflow analysis of Prolog. In ICLP’95 Post-Conference Workshop on Abstract Interpretation of Logic Languages, pages 80–91, Tokyo, 1995.Google Scholar
  15. 15.
    A. Krall and U. Neumerkel. The Vienna Abstract Machine. In Proc. of PLIP’90, number 456 in LNCS, pages 121–135. Sweeden, Springer-Verlag, 1990.Google Scholar
  16. 16.
    Thomas Lindgren. Polyvariant detection of uninitialized arguments of Prolog predicates. Journal of Logic Programming, 28(3):217–229, September 1996.MATHCrossRefMathSciNetGoogle Scholar
  17. 17.
    G. Puebla and M. Hermenegildo. Implementation of Multiple Specialization in Logic Programs. In Proc. of PEPM’95, pages 77–87. ACM Press, June 1995.Google Scholar
  18. 18.
    Taisuke Sato and Hisao Tamaki. Enumeration of success patterns in logic programs. Theoretical Computer Science, 34(1–2):227–240, November 1984.MATHCrossRefMathSciNetGoogle Scholar
  19. 19.
    J. Tan and I. Lin. Compiling dataflow analysis of logic programs. In Proc. of PLDI’92, pages 106–115, San Francisco, California, 1992. SIGPLAN.Google Scholar
  20. 20.
    A. Taylor. Removal of Dereferencing and Trailing in Prolog Compilation. In Proc. of ICLP’89, pages 48–60, Lisbon, 1989. The MIT Press.Google Scholar
  21. 21.
    A. Taylor. High Performance Prolog Implementation. PhD thesis, University of Sydney, June 1991.Google Scholar
  22. 22.
    P. Van Roy. Can Logic Programming Execute as Fast as Imperative Programming? PhD thesis, University of California at Berkeley, November 1990.Google Scholar
  23. 23.
    W. H. Winsborough. Path-dependent reachability analysis for multiple specialization. In Proc. of NACLP’89. “MIT Press”, 1989.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Michel Ferreira
    • 1
  • Luís Damas
    • 1
  1. 1.DCC-FC & LIACCUniversity of PortoPortoPortugal

Personalised recommendations