A Flexible, (C)LP-Based Approach to the Analysis of Object-Oriented Programs

  • Mario Méndez-Lojo
  • Jorge Navas
  • Manuel V. Hermenegildo
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4915)


Static analyses of object-oriented programs usually rely on intermediate representations that respect the original semantics while having a more uniform and basic syntax. Most of the work involving object-oriented languages and abstract interpretation usually omits the description of that language or just refers to the Control Flow Graph (CFG) it represents. However, this lack of formalization on one hand results in an absence of assurances regarding the correctness of the transformation and on the other it typically strongly couples the analysis to the source language. In this work we present a framework for analysis of object-oriented languages in which in a first phase we transform the input program into a representation based on Horn clauses. This facilitates on one hand proving the correctness of the transformation attending to a simple condition and on the other allows applying existing analyzers for (constraint) logic programming to automatically derive a safe approximation of the semantics of the original program. The approach is flexible in the sense that the first phase decouples the analyzer from most language-dependent features, and correct because the set of Horn clauses returned by the transformation phase safely approximates the standard semantics of the input program. The resulting analysis is also reasonably scalable due to the use of mature, modular (C)LP-based analyzers. This allows us to report good results for medium-sized programs.


Logic Program Java Program Abstract Interpretation Horn Clause Source Language 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Albert, E., Gómez-Zamalloa, M., Hubert, L., Puebla, G.: Verification of Java Bytecode using Analysis and Transformation of Logic Programs. In: Hanus, M. (ed.) PADL 2007. LNCS, vol. 4354, pp. 124–139. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  2. 2.
    Alves-Foss, J. (ed.): Formal Syntax and Semantics of Java. LNCS, vol. 1523. Springer, Heidelberg (1999)Google Scholar
  3. 3.
    Bacon, D.F., Sweeney, P.F.: Fast static analysis of c++ virtual function calls. Proc. of OOPSLA 1996, SIGPLAN Notices 31(10), 324–341 (1996)Google Scholar
  4. 4.
    Blanchet, B.: Escape Analysis for Object Oriented Languages. Application to Java(TM). In: Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA 1999), pp. 20–34. ACM, New York (1999)Google Scholar
  5. 5.
    Bruynooghe, M.: A Practical Framework for the Abstract Interpretation of Logic Programs. Journal of Logic Programming 10, 91–124 (1991)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Bueno, F., Cabeza, D., Carro, M., Hermenegildo, M., López-García, P., Puebla, G. (eds.): The Ciao System. Reference Manual (v1.10). Technical report, School of Computer Science (UPM) (2004),
  7. 7.
    Chang, B.-Y.E., Leino, K.R.M.: Abstract interpretation with alien expressions and heap structures. In: Cousot, R. (ed.) VMCAI 2005. LNCS, vol. 3385, pp. 147–163. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  8. 8.
    Le Charlier, B., Van Hentenryck, P.: Experimental Evaluation of a Generic Abstract Interpretation Algorithm for Prolog. ACM Transactions on Programming Languages and Systems 16(1), 35–101 (1994)CrossRefGoogle Scholar
  9. 9.
    Cousot, P., Cousot, R.: Abstract Interpretation: A Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints. In: Proc. of POPL 1977, pp. 238–252 (1977)Google Scholar
  10. 10.
    DeLine, R., Leino, K.R.M.: BoogiePL: A typed procedural language for checking object-oriented programs. Technical Report MSR-TR-2005-70, Microsoft Research (2005)Google Scholar
  11. 11.
    Dietrich, S.W.: Extension Tables: Memo Relations in Logic Programming. In: Fourth IEEE Symposium on Logic Programming, pp. 264–272 (September 1987)Google Scholar
  12. 12.
    Fecht, C.: Gena - a tool for generating prolog analyzers from specifications. In: Mycroft, A. (ed.) SAS 1995. LNCS, vol. 983, pp. 418–419. Springer, Heidelberg (1995)CrossRefGoogle Scholar
  13. 13.
    Genaim, S., Spoto, F.: Information Flow Analysis for Java Bytecode. In: Proc. of VMCAI. LNCS, Springer, Heidelberg (2005)Google Scholar
  14. 14.
    Gosling, J., Joy, B., Steele, G., Bracha, G.: Java(TM) Language Specification, 3rd edn. Addison-Wesley, Professional Reading (2005)zbMATHGoogle Scholar
  15. 15.
    Hermenegildo, M., Puebla, G., Bueno, F., López-García, P.: Program Development Using Abstract Interpretation (and The Ciao System Preprocessor). In: Cousot, R. (ed.) SAS 2003. LNCS, vol. 2694, pp. 127–152. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  16. 16.
    Hermenegildo, M., Puebla, G., Marriott, K., Stuckey, P.: Incremental Analysis of Constraint Logic Programs. ACM TOPLAS 22(2), 187–223 (2000)CrossRefGoogle Scholar
  17. 17.
    Kowalski, R., Kuehner, D.: Linear resolution with selection function. Artificial Intelligence 2, 227–260 (1971)MathSciNetCrossRefzbMATHGoogle Scholar
  18. 18.
    Leavens, G.T., Baker, A.L., Ruby, C.: Preliminary design of jml: A behavioral interface specification language for java. SIGSOFT Softw. Eng. Notes 31(3), 1–38 (2006)CrossRefGoogle Scholar
  19. 19.
    Leroy, X.: Java Bytecode Verification: An Overview. In: Berry, G., Comon, H., Finkel, A. (eds.) CAV 2001. LNCS, vol. 2102, Springer, Heidelberg (2001)CrossRefGoogle Scholar
  20. 20.
    Lev-Ami, T., Sagiv, S.: TVLA: A system for implementing static analyses. In: Palsberg, J. (ed.) SAS 2000. LNCS, vol. 1824, pp. 280–302. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  21. 21.
    Logozzo, F., Cortesi, A.: Abstract interpretation and object-oriented languages: Quo vadis? In: Proc. of the 1st. Int’l. Workshop on Abstract Interpretation of Object-oriented Languages (AIOOL 2005). ENTCS, Elsevier Science, Amsterdam (2005)Google Scholar
  22. 22.
    Logozzo, F.: Cibai: An abstract interpreation-based static analyzer for modular analysis and verification of java classes. In: Cook, B., Podelski, A. (eds.) VMCAI 2007. LNCS, vol. 4349, pp. 283–298. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  23. 23.
    Muthukumar, K., Hermenegildo, M.: Compile-time Derivation of Variable Dependency Using Abstract Interpretation. JLP 13(2/3), 315–347 (1992)CrossRefzbMATHGoogle Scholar
  24. 24.
    Navas, J., Méndez-Lojo, M., Hermenegildo, M.: An Efficient, Context and Path Sensitive Analysis Framework for Java Programs. In: 9th Workshop on Formal Techniques for Java-like Programs FTfJP 2007 (July 2007)Google Scholar
  25. 25.
    Peralta, J., Cruz-Carlon, J.: From static single-assignment form to definite programs and back. In: Extended abstract in International Symposium on Logic-based Program Synthesis and Transformation (LOPSTR) (July 2006)Google Scholar
  26. 26.
    Peralta, J.C., Gallagher, J., Sağlam, H.: Analysis of Imperative Programs through Analysis of Constraint Logic Programs. In: Levi, G. (ed.) SAS 1998. LNCS, vol. 1503, pp. 246–261. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  27. 27.
    Pollet, I.: Towards a generic framework for the abstract interpretation of Java. PhD thesis, Catholic University of Louvain, Dept. of Computer Science (2004)Google Scholar
  28. 28.
    Ruf, E.: Effective synchronization removal for java. PLDI 2000, SIGPLAN Notices 35(5), 208–218 (2000)CrossRefGoogle Scholar
  29. 29.
    Secci, S., Spoto, F.: Pair-sharing analysis of object-oriented programs. In: SAS, pp. 320–335 (2005)Google Scholar
  30. 30.
    Spoto, F.: Julia: A Generic Static Analyser for the Java Bytecode. In: Proc. of the 7th Workshop on Formal Techniques for Java-like Programs, FTfJP 2005, Glasgow, Scotland (July 2005)Google Scholar
  31. 31.
  32. 32.
    Vallee-Rai, R., Hendren, L., Sundaresan, V., Lam, P., Gagnon, E., Co, P.: Soot - a Java optimization framework. In: Proceedings of CASCON 1999, pp. 125–135 (1999)Google Scholar
  33. 33.
    Warren, R., Hermenegildo, M., Debray, S.K.: On the Practicality of Global Flow Analysis of Logic Programs. In: Fifth International Conference and Symposium on Logic Programming, pp. 684–699. MIT Press, Cambridge (1988)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Mario Méndez-Lojo
    • 1
  • Jorge Navas
    • 1
  • Manuel V. Hermenegildo
    • 1
    • 2
  1. 1.University of New MexicoUSA
  2. 2.Technical University of MadridSpain

Personalised recommendations