Run-Time Bytecode Specialization

A Portable Approach to Generating Optimized Specialized Code
  • Hidehiko Masuhara
  • Akinori Yonezawa
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2053)


This paper proposes a run-time bytecode specialization (BCS) technique that analyzes programs and generates specialized programs at run-time in an intermediate language. By using an intermediate language for code generation, a back-end system can optimize the specialized programs after specialization. As the intermediate language, the system uses Java virtual machine language (JVML), which allows the system to easily achieve practical portability and to use sophisticated just-in-time compilers as its back-end. The binding-time analysis algorithm, which is based on a type system, covers a non-object-oriented subset of JVML. A specializer, which generates programs on a per-instruction basis, can perform method inlining at run-time. The performance measurement showed that a non-trivial application program specialized at run-time by BCS runs approximately 3–4 times faster than the unspecialized one. Despite the large amount of overheads at JIT compilation of specialized code, we observed that the overall performance of the application can be improved.


Specialized Code Machine Code Partial Evaluator Intermediate Language Annotate Program 
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.
    K. Asai. Binding-time analysis for both static and dynamic expressions. In SAS’ 99 (LNCS 1694), 1999.Google Scholar
  2. 2.
    J. Auslander, M. Philipose, C. Chambers, S. J. Eggers, and B. N. Bershad. Fast, effective dynamic compilation. In PLDI’96, pp.149–159, 1996.Google Scholar
  3. 3.
    N. Benton, A. Kennedy, and G. Russell. Compiling standard ML to Java bytecodes. In ICFP’98, 1998.Google Scholar
  4. 4.
    A. A. Berlin and R. J. Surati. Partial evaluation for scientific computing: The supercomputer toolkit experience. In PEPM’94, pp.133–141, 1994.Google Scholar
  5. 5.
    P. Bertelsen. Binding-time analysis for a JVM core language. Apr. 1999.
  6. 6.
    P. Bothner. Kawa — compilinig dynamic languages to the Java VM. In USENIX, 1998.Google Scholar
  7. 7.
    J.-D. Choi, M. Gupta, M. Serrano, V. C. Sreedhar, and S. Midkiff. Escape analysis for Java. In L. M. Northrop, editor, OOPSLA’99, pp.1–19, 1999.Google Scholar
  8. 8.
    C. Consel and F. Noël. A general approach for run-time specialization and its application to C. In POPL’ 96, pp.145–170, 1996.Google Scholar
  9. 9.
    D. R. Engler. VCODE: a retargetable, extensible, very fast dynamic code generation system. In PLDI’96, pp.160–170, 1996.Google Scholar
  10. 10.
    N. Fujinami. Determination of dynamic method dispatches using run-time code generation. In TIC’98, pp.253–271, 1998.Google Scholar
  11. 11.
    Y. Futamura. Partial evaluation of computation process—an approach to a compiler-compiler. Higher-Order and Symbolic Computation, 12(4):381–391, 1999. Reprinted from Systems, Computers, Controls, 2(5):45–50, 1971.zbMATHCrossRefGoogle Scholar
  12. 12.
    B. Grant, M. Philipose, M. Mock, C. Chambers, and S. J. Eggers. An evaluation of staged run-time optimization in DyC. In PLDI’99, 1999.Google Scholar
  13. 13.
    B. Guenter, T. B. Knoblock, and E. Ruf. Specializing shaders. In SIGGRAPH’95, pp.343–349, 1995.Google Scholar
  14. 14.
    F. Henglein. Efficient type inference for higher-order binding-time analysis. In FPCA’91, pp.448–472, 1991.Google Scholar
  15. 15.
    L. Hornof and T. Jim. Certifying compilation and run-time code generation. In PEPM’99, pp.60–74, 1999.Google Scholar
  16. 16.
    L. Hornof and J. Noyé. Accurate binding-time analysis for imperative languages: Flow, context, and return sensitivity. In PEPM’97, pp. 63–73, 1997.Google Scholar
  17. 17.
    N. D. Jones, C. K. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice Hall, 1993.Google Scholar
  18. 18.
    P. Lee and M. Leone. Optimizing ML with run-time code generation. In PLDI’96, pp.137–148, 1996.Google Scholar
  19. 19.
    T. Lindholm and F. Yellin. The Java Virtual Machine Specification. Addison-Wesley, 1997.Google Scholar
  20. 20.
    H. Masuhara and A. Yonezawa. Design and partial evaluation of meta-objects for a concurrent reflective language. In ECOOP’98, pp.418–439, 1998.Google Scholar
  21. 21.
    H. Masuhara and A. Yonezawa. Generating optimized residual code in run-time specialization. In International Colloquium on Partial Evaluation and Program Transformation, pp.83–102, 1999.Google Scholar
  22. 22.
    F. Noël, L. Hornof, C. Consel, and J. L. Lawall. Automatic, template-based runtime specialization: Implementation and experimental study. In ICCL’98, pp.123–142, 1998.Google Scholar
  23. 23.
    H. Ogawa, K. Shimura, S. Matsuoka, F. Maruyama, Y. Sohda, Y. Kimura, Open-JIT: an open-ended, reflective JIT compiler framework for Java, In ECOOP 2000, pp.362–387, 2000.Google Scholar
  24. 24.
    M. Poletto, W. C. Hsieh, D. R. Engler, and M. F. Kaashoek. ‘C and tcc: a language and compiler for dynamic code generation. TOPLAS, 21(2):324–369, 1999.CrossRefGoogle Scholar
  25. 25.
    C. Pu, T. Autrey, A. Black, C. Consel, C. Cowan, J. Inouye, L. Kethana, J. Walpole, and K. Zhang. Optimistic incremental specialization: streamlining a commercial operating system. In SOSP’95, pp.314–324, 1995.Google Scholar
  26. 26.
    U. P. Schultz, J. L. Lawall, C. Consel, and G. Muller. Towards automatic specialization of Java programs. In ECOOP99, pp.367–390, 1999.Google Scholar
  27. 27.
    R. Stata and M. Abadi. A type system for Java bytecode subroutines. TOPLAS, 21(1):90–137, 1999.CrossRefGoogle Scholar
  28. 28.
    E. Volanschi, C. Consel, G. Muller, and C. Cowan. Declarative specialization of object-oriented programs. In OOPSLA’ 97, pp.286–300, 1997.Google Scholar
  29. 29.
    P. Wickline, P. Lee, and F. Pfenning. Run-time code generation and Modal-ML. In PLDI’98, pp.224–235, 1998.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2001

Authors and Affiliations

  • Hidehiko Masuhara
    • 1
  • Akinori Yonezawa
    • 2
  1. 1.Department of Graphics and Computer Science Graduate School of Arts and SciencesUniversity of TokyoJapan
  2. 2.Department of Information ScienceUniversity of TokyoJapan

Personalised recommendations