A Low-Footprint Java-to-Native Compilation Scheme Using Formal Methods

  • Alexandre Courbot
  • Mariela Pavlova
  • Gilles Grimaud
  • Jean-Jacques Vandewalle
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3928)


Ahead-of-Time and Just-in-Time compilation are common ways to improve runtime performances of restrained systems like Java Card by turning critical Java methods into native code. However, native code is much bigger than Java bytecode, which severely limits or even forbids these practices for devices with memory constraints.

In this paper, we describe and evaluate a method for reducing natively-compiled code by suppressing runtime exception check sites, which are emitted when compiling bytecodes that may potentially throw runtime exceptions. This is made possible by completing the Java program with JML annotations, and using a theorem prover in order to formally prove that the compiled methods never throw runtime exceptions. Runtime exception check sites can then safely be removed from the generated native code, as it is proved they will never be entered.

We have experimented our approach on several card-range and embedded Java applications, and were able to remove almost all the exception check sites. Results show memory footprints for native code that are up to 70% smaller than the non-optimized version, and sometimes as low than 115% the size of the Java bytecode when compiled for ARM thumb.


Virtual Machine Smart Card Proof Obligation Java Virtual Machine Memory Footprint 
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.
    Mulchandani, D.: Java for embedded systems. Internet Computing, IEEE 2(3), 30–39 (1998)CrossRefGoogle Scholar
  2. 2.
    Lagosanto, L.: Next-generation embedded java operating system for smart cards. In: 4th Gemplus Developer Conference (2002)Google Scholar
  3. 3.
    Grimaud, G., Vandewalle, J.-J.: Introducing research issues for next generation Java-based smart card platforms. In: Proc. Smart Objects Conference (sOc 2003), Grenoble, France (2003)Google Scholar
  4. 4.
    Burdy, L., Requet, A., Lanet, J.-L.: Java applet correctness: A developeroriented approach. In: Araki, K., Gnesi, S., Mandrioli, D. (eds.) FME 2003. LNCS, vol. 2805, pp. 422–439. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  5. 5.
    Lindholm, T., Yellin, F.: Java Virtual Machine Specification. Addison-Wesley Longman Publishing Co., Inc., Amsterdam (1999)Google Scholar
  6. 6.
    Ishizaki, K., Kawahito, M., Yasue, T., Takeuchi, M., Ogasawara, T., Suganuma, T., Onodera, T., Komatsu, H., Nakatani, T.: Design, implementation, and evaluation of optimizations in a just-in-time compiler. In: JAVA 1999: Proceedings of the ACM 1999 conference on Java Grande, pp. 119–128. ACM Press, New York (1999)CrossRefGoogle Scholar
  7. 7.
    Proebsting, T.A., Townsend, G., Bridges, P., Hartman, J.H., Newsham, T., Watterson, S.A.: Toba: Java for applications: A way ahead of time (wat) compiler. In: Third USENIX Conference on Object-Oriented Technologies (COOTS), Portland, Oregon, University of Arizona (June 1997)Google Scholar
  8. 8.
    Muller, G., Moura, B., Bellard, F., Consel, C.: Harissa: a flexible and efficient java environment mixing bytecode and compiled code. In: Third USENIX Conference on Object-Oriented Technologies (COOTS), USENIX, Portland (June 1997)Google Scholar
  9. 9.
    JC Virtual Machine,
  10. 10.
    Vall´ee-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
  11. 11.
    Hummel, J., Azevedo, A., Kolson, D., Nicolau, A.: Annotating the Java bytecodes in support of optimization. Concurrency: Practice and Experience 9(11), 1003–1016 (1997)CrossRefGoogle Scholar
  12. 12.
    Azevedo, A., Nicolau, A., Hummel, J.: Java annotation-aware just-in-time (ajit) complilation system. In: JAVA 1999: Proceedings of the ACM 1999 conference on Java Grande, pp. 142–151. ACM Press, New York (1999)CrossRefGoogle Scholar
  13. 13.
    Leavens, G.T., Poll, E., Clifton, C., Cheon, Y., Ruby, C., Cok, D., Mller, P., Kiniry, J.: JML Reference Manual (July 2005)Google Scholar
  14. 14.
    Pavlova, M.: Java bytecode logic and specification. tech. rep., INRIA, Sophia- Antipolis, Draft version (2005)Google Scholar
  15. 15.
    Meyer, B.: Object-Oriented Software Construction, 2nd edn. Prentice-Hall, Englewood Cliffs (1997)MATHGoogle Scholar
  16. 16.
    Java In The Small,

Copyright information

© IFIP International Federation for Information Processing 2006

Authors and Affiliations

  • Alexandre Courbot
    • 1
  • Mariela Pavlova
    • 2
  • Gilles Grimaud
    • 1
  • Jean-Jacques Vandewalle
    • 3
  1. 1.POPS Research GroupIRCICA/LIFL, Univ. Lille 1, INRIA futursFrance
  2. 2.Everest Research GroupINRIA Sophia-AntipolisFrance
  3. 3.Gemplus Systems Research LabsLa CiotatFrance

Personalised recommendations