skip to main content
article
Open Access

Static inference of modes and data dependencies in logic programs

Published:01 July 1989Publication History
Skip Abstract Section

Abstract

Mode and data dependency analyses find many applications in the generation of efficient executable 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, generate index structures more intelligently, 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 inference of modes and data dependencies in a program. The algorithm is shown to be quite efficient for programs commonly encountered in practice.

References

  1. 1 BRUYNOOGHE, M., DEMOEN, B., CALLEBAUT, A., AND JANSSENS, C. Abstract interpretation: Towards the global optimization of Prolog programs. In Proceedings of the Fourth IEEE Symposium on Logic Programming (San Francisco, Sept. 1987). IEEE, New York, 1987.Google ScholarGoogle Scholar
  2. 2 CHANG, J., DESPAIN, A. M., AND DEGROOT, D. AND-parallelism of logic programs based on a static data dependency analysis. In Digest of Papers, Compcon 85 (Feb. 1985). IEEE, New York, 1985.Google ScholarGoogle Scholar
  3. 3 CHANG, J., AND DESPAIN, A.M. Semi-intelligent backtracking of Prolog based on static data dependency analysis. In Proceedings of the 1985 Symposium on Logic Programming (Boston, July 1985). IEEE, New York, 1985, pp. 10-21.Google ScholarGoogle Scholar
  4. 4 COUSOT, P., AND COUSOT, R. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proceedings of the Fourth Annual ACM Symposium on Principles of Programming Languages (1977). ACM, New York, 1977, pp. 238-252. Google ScholarGoogle Scholar
  5. 5 DEBRAY, S. K. Synthesizing control strategies for AND-parallel logic programs. Tech. Rep. 87-12, Dept. of Computer Science, Univ. of Arizona, Tucson, May 1987.Google ScholarGoogle Scholar
  6. 6 DEBRAY, S. K., AND WARREN, D. S. Automatic mode inference for logic programs, J. Logic Program. 5, 3 (Sept. 1988), 207-229. Google ScholarGoogle Scholar
  7. 7 DEBRA~, S.K. Unfold/fold transformations and loo~, optimization of logic programs. In Proceedings of the ACM SIGPLAN 1988 Conference on P 'ogramming Language Design and Implementation (Atlanta, Ga., June 1988). ACM, New York, 1988, 297-307. SIGPLAN Not. 23, 7. Google ScholarGoogle Scholar
  8. 8 DEBRAY, S. $., AND MISHRA, P. Denotational and operational semantics for Prolog. J. Logic Program. 5, I (Mar. 1988), 61-91. Google ScholarGoogle Scholar
  9. 9 DEBRAY, S. $., AND WARREN, D.S. Functional computations in logic programs. ACM Trans. Program. Lang. Syst. This issue, pp. 418-450. Google ScholarGoogle Scholar
  10. 10 DEERAY, S.K. Flow analysis of dynamic logic programs. J. Logic Program. 1989. To appear. (Preliminary version in Proceedings of the Fourth IEEI~ Symposium on Logic Programming (San Francisco, Sept. 1987)). Google ScholarGoogle Scholar
  11. 11 DERANSART, P., AND MAEUSZYNSKI, J. Relating logic programs and attribute grammars. J. Logic Program. 2, 2 (July 1985), 119-156.Google ScholarGoogle Scholar
  12. 12 DIETRICH, S.W. Extension tables: Memo relations in logic programming. In Proceedings of the Fourth IEEE Symposium on Logic Programming (San ?rancisco, Sept. 1987). IEEE, New York, 1987, pp. 264-272.Google ScholarGoogle Scholar
  13. 13 JANSSENS, G., AND BRUYNOOGHE, M. An instance o ~ abstract interpretation integrating type and mode inferencing. In Proceedings of the Fifth International Conference on Logic Programming (Seattle, Wash., Aug. 1988). MIT Press, Cambridge, Mass., 1988, pp. 669-683.Google ScholarGoogle Scholar
  14. 14 JONES, N. D., AND MYCROFT, A. Stepwise development of operational and denotational semantics for PROLOG. In Proceedings of the 1984 International Symposium on Logic Programming (Atlantic City, N.J., Feb. 1984). IEEE, New York, 1984, pp. 289-298.Google ScholarGoogle Scholar
  15. 15 MANNILA, H., AND UKKONEN, E. Flow analysis of Prolog programs. In Proceedings of the Fourth IEEE Symposium on Logic Programming (San ?rancisco, Sept. 1987). IEEE, New York, 1987.Google ScholarGoogle Scholar
  16. 16 MELLISH, C. S. The automatic generation of mode declarations for Prolog programs. DAI Research Paper 163, Dept. of Artificial Intelligence, Univ. of Edinburgh, Aug. 1981.Google ScholarGoogle Scholar
  17. 17 MELL!SH, C.S. Some global optimizations for a Prolog compiler. J. Logic Program. 2, I (Apr. 1985), 43-66.Google ScholarGoogle Scholar
  18. 18 MELLISH, C. S. Abstract interpretation of Prolog ~rograms. In Proceedings of the Third International Logic Programming Conference (London, July 1986). LNCS 225, Springer, New York, 1986. Google ScholarGoogle Scholar
  19. 19 NAISH, L. Negation and Control in Prolog. LNCS 238, Springer, New York, 1986. Google ScholarGoogle Scholar
  20. 20 PLAISTED, D. The occur-check problem in Prolog. In Proceedings of the 1984 International Symposium on Logic Programming (Atlantic City, N.J., Feb. 1984). IEEE, New York, 1984, pp. 272-280.Google ScholarGoogle Scholar
  21. 21 REDD~, U.S. Transformation of logic programs into fimctional programs. In Proceedings of the 1984 International Symposium on Logic Programming (Atlantic City, N.J., Feb. 1984). IEEE, New York, 1984, pp. 187-196.Google ScholarGoogle Scholar
  22. 22 SONDERGAARD, H. An application of abstract interp :etation of logic programs: Occur check reduction. In Proceedings ESOP '86 (Saarbrucken, Mar 1986). Google ScholarGoogle Scholar
  23. 23 Sicstus Prolog User's Manual. Swedish Institute of Co mputer Science, Sweden, Sept. 1987.Google ScholarGoogle Scholar
  24. 24 TAMAKI, H., ANO SATO, T. OLD-resolution with tabulation. In Proceedings of the Third International Conference on Logic Programming (Londcn, July 1986). LNCS 225, Springer, New York, 1986. Google ScholarGoogle Scholar
  25. 25 VAN ROY, P., DEMOEN, B., AND WILLEMS, Y.D. Improving the execution speed of compiled Prolog with modes, clause selection and determinism. In Proceedings of TAPSOFT 1987 (Pisa, Mar. 1987). Google ScholarGoogle Scholar
  26. 26 WARREN, D. H.D. Implementing Prolog--compiling predicate logic programs. Res. Reps. 39 and 40, Dept. of Artificial Intelligence, Univ. of Edinbu~'gh, 1977.Google ScholarGoogle Scholar
  27. 27 WARREN, R., HERMENEGILDO, M., AND DEBRAY, S. K. On the practicality of global flow analysis of logic programs. In Proceedings of the Fifth In~ ernational Conference on Logic P~'ogramming (Seattle, Wash., Aug. 1988). MIT Press, Cambridge, Mass., 1988.Google ScholarGoogle Scholar

Index Terms

  1. Static inference of modes and data dependencies in logic programs

        Recommendations

        Reviews

        Ralph Walter Wilkerson

        The static inference of data dependency and mode information (i.e., input and output arguments) in logic programs serves an essential purpose in the generation of optimized code. By combining the analysis of these dependencies, Debray develops an algorithm that uses flow analysis techniques to handle dependencies between variables. The algorithm is carefully described and full attention is given to detailed aspects of the computation. The author also gives a formal proof of its soundness and an analysis of its complexity. The method is amply illustrated through numerous examples normally encountered in logic programming situations.

        Access critical reviews of Computing literature here

        Become a reviewer for Computing Reviews.

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image ACM Transactions on Programming Languages and Systems
          ACM Transactions on Programming Languages and Systems  Volume 11, Issue 3
          July 1989
          137 pages
          ISSN:0164-0925
          EISSN:1558-4593
          DOI:10.1145/65979
          Issue’s Table of Contents

          Copyright © 1989 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 1 July 1989
          Published in toplas Volume 11, Issue 3

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • article

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader