Precision in Practice: A Type-Preserving Java Compiler

  • Christopher League
  • Zhong Shao
  • Valery Trifonov
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2622)


Popular mobile code architectures (Java and .NET) include verifiers to check for memory safety and other security properties. Since their formats are relatively high level, supporting a wide range of source language features is awkward. Further compilation and optimization, necessary for efficiency, must be trusted. We describe the design and implementation of a fully type-preserving compiler for Java and ML. Its strongly-typed intermediate language provides a low-level abstract machine model and a type system general enough to prove the safety of a variety of implementation techniques. We show that precise type preservation is within reach for real-world Java systems.


Type Operation Garbage Collection Runtime System Java Virtual Machine Type Annotation 
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.


  1. [1]
    Lindholm, T., Yellin, F.: The Java Virtual Machine Specification. 2nd edn. Addison-Wesley (1999)Google Scholar
  2. [2]
    ECMA: Common language infrastructure. Drafts of the TC39/TG3 standardization process. (2001)
  3. [3]
    Tolksdorf, R.: Programming languages for the JVM. (2002)
  4. [4]
    Syme, D.: ILX: extending the.NET Common IL for functional language interoperability. In: Proc. BABEL Workshop on Multi-Language Infrastructure and Interoperability, ACM (2001)Google Scholar
  5. [5]
    Morrisett, G., Walker, D., Crary, K., Glew, N.: From System F to typed assembly language. ACM Trans. on Programming Languages and Systems 21 (1999)Google Scholar
  6. [6]
    Necula, G. C.: Proof-carrying code. In: Proc. Symp. on Principles of Programming Languages, Paris, ACM (1997) 106–119Google Scholar
  7. [7]
    Fitzgerald, R., Knoblock, T. B., Ruf, E., Steensgaard, B., Tarditi, D.: Marmot: an optimizing compiler for Java. Software: Practice and Experience 30 (2000)Google Scholar
  8. [8]
    Stichnoth, J. M., Lueh, G. Y., Cierniak, M.: Support for garbage collection at every instruction in a Java compiler. In: Proc. Conf. on Programming Language Design and Implementation, Atlanta, ACM (1999) 118–127Google Scholar
  9. [10]
    League, C., Shao, Z., Trifonov, V.: Representing Java classes in a typed intermediate language. In: Proc. Int’l Conf. Functional Programming, Paris, ACM (1999)Google Scholar
  10. [11]
    League, C., Shao, Z., Trifonov, V.: Type-preserving compilation of Featherweight Java. ACM Trans. on Programming Languages and Systems 24 (2002)Google Scholar
  11. [12]
    Bruce, K. B., Cardelli, L., Pierce, B. C.: Comparing object encodings. Information and Computation 155 (1999) 108–133zbMATHCrossRefMathSciNetGoogle Scholar
  12. [13]
    Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML (Revised). MIT Press (1997)Google Scholar
  13. [14]
    Rémy, D.: Syntactic theories and the algebra of record terms. Technical Report 1869, INRIA (1993)Google Scholar
  14. [15]
    Colby, C., Lee, P., Necula, G. C., Blau, F., Cline, K., Plesko, M.: A certifying compiler for Java. In: Proc. Conf. on Programming Language Design and Implementation, Vancouver, ACM (2000)Google Scholar
  15. [16]
    Necula, G. C.: Personal communication (2001)Google Scholar
  16. [17]
    Schneck, R. R., Necula, G. C.: A gradual approach to a more trustworthy, yet scalable, proof-carrying code. In: Proc. Conf. on Automated Deduction. (2002)Google Scholar
  17. [18]
    Shao, Z., League, C., Monnier, S.: Implementing typed intermediate languages. In: Proc. Int’l Conf. Functional Programming, Baltimore, ACM (1998) 313–323Google Scholar
  18. [19]
    Appel, A. W.: SSA is functional programming. ACM SIGPLAN Notices (1998)Google Scholar
  19. [20]
    Cytron, R., Ferrante, J., Rosen, B. K., Wegman, M. N., Zadeck, F. K.: Efficiently computing static single assignment form and the control dependence graph. ACM Trans. on Programming Languages and Systems 13 (1991) 451–490CrossRefGoogle Scholar
  20. [21]
    Dean, J., Grove, D., Chambers, C.: Optimization of object-oriented programs using static class hierarchy analysis. In: Proc. European Conf. Object-Oriented Programming. (1995)Google Scholar
  21. [22]
    League, C., Trifonov, V., Shao, Z.: Functional Java bytecode. In: Proc. 5th World Conf. on Systemics, Cybernetics, and Informatics. (2001) Workshop on Intermediate Representation Engineering for the Java Virtual Machine.Google Scholar
  22. [23]
    Shao, Z., Saha, B., Trifonov, V., Papaspyrou, N.: A type system for certified binaries. In: Proc. Symp. on Principles of Programming Languages. (2002)Google Scholar
  23. [24]
    George, L.: Customizable and reusable code generators. Technical report, Bell Labs (1997)Google Scholar
  24. [25]
    Benton, N., Kennedy, A.: Interlanguage working without tears: Blending ML with Java. In: Proc. Int’l Conf. Functional Programming, Paris, ACM (1999) 126–137Google Scholar
  25. [26]
    League, C.: A Type-Preserving Compiler Infrastructure. PhD thesis, Yale University (2002)Google Scholar
  26. [27]
    Canning, P., Cook, W., Hill, W., Oltho., W., Mitchell, J. C.: F-bounded polymorphism for object-oriented programming. In: Proc. Int’l Conf. on Functional Programming and Computer Architecture, ACM (1989) 273–280Google Scholar
  27. [28]
    Castagna, G., Pierce, B. C.: Decidable bounded quantification. In: Proc. Symp. on Principles of Programming Languages, Portland, ACM (1994)Google Scholar
  28. [29]
    Barendregt, H.: Typed lambda calculi. In Abramsky, S., Gabbay, D., Maibaum, T., eds.: Handbook of Logic in Computer Science. Volume 2. Oxford (1992)Google Scholar
  29. [30]
    Mitchell, J. C., Plotkin, G. D.: Abstract types have existential type. ACM Transactions on Programming Languages and Systems 10 (1988) 470–502CrossRefGoogle Scholar
  30. [31]
    Schürmann, C., Yu, D., Ni, Z.: An encoding of F-omega in LF. In: Proc.Workshop on Mechanized Reasoning about Languages with Variable Binding, Siena (2001)Google Scholar
  31. [32]
    Peyton Jones, S., Ramsey, N., Reig, F.: C—: a portable assembly language that supports garbage collection. In Nadathur, G., ed.: Proc. Conf. on Principles and Practice of Declarative Programming. Springer (1999) 1–28Google Scholar
  32. [33]
    Bothner, P.: A GCC-based Java implementation. In: Proc. IEEE Compcon. (1997)Google Scholar
  33. [34]
    Benton, N., Kennedy, A., Russell, G.: Compiling Standard ML to Java bytecodes. In: Proc. Int’l Conf. Functional Programming, Baltimore, ACM (1998) 129–140Google Scholar
  34. [35]
    Wright, A., Jagannathan, S., Ungureanu, C., Hertzmann, A.: Compiling Java to a typed lambda-calculus: A preliminary report. In: Proc. Int’l Workshop on Types in Compilation. Volume 1473 of LNCS., Berlin, Springer (1998) 1–14CrossRefGoogle Scholar
  35. [36]
    Glew, N.: An efficient class and object encoding. In: Proc. Conf. on Object-Oriented Programming Systems, Languages, and Applications, ACM (2000)Google Scholar
  36. [37]
    Knoblock, T., Rehof, J.: Type elaboration and subtype completion for Java bytecode. In: Proc. Symp. on Principles of Programming Languages. (2000) 228–242Google Scholar
  37. [38]
    Gagnon, E., Hendren, L., Marceau, G.: Efficient inference of static types for Java bytecode. In: Proc. Static Analysis Symp. (2000)Google Scholar
  38. [39]
    Amme, W., Dalton, N., von Ronne, J., Franz, M.: SafeTSA: A type safe and referentially secure mobile-code representation based on static single assignment form. In: Proc. Conf. on Programming Language Design and Implementation, ACM (2001)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Christopher League
    • 1
  • Zhong Shao
    • 2
  • Valery Trifonov
    • 2
  1. 1.Computer ScienceLong Island UniversityBrooklyn
  2. 2.Computer ScienceNew Haven

Personalised recommendations