Skip to main content
Log in

A portable approach to dynamic optimization in run-time specialization

  • Special Feature
  • Published:
New Generation Computing Aims and scope Submit manuscript

Abstract

This paper proposes arun-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 canoptimize the specialized programs after specialization. The system uses Java virtual machine language (JVML) as the intermediate language, which allows the system to easily achieve practicalportability and to use existing sophisticated just-in-time (JIT) compilers as its back-end. The binding-time analysis algorithm is based on a type system, and covers a non-object-oriented subset of JVML. The specializer generates programs on a per-instruction basis, and can performmethod inlining at run-time. Our performance measurements show 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 overhead of JIT compilation of specialized code, we observed that the overall performance of the application can be improved.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. ACM. inProc. of Conference on Programming Language Design and Implementation (PLDI’96), 31,5 ofACM SIGPLAN Notices, Philadelphia, PA, May 1996.

  2. Asai, K., “Binding-time Analysis for Both Static and Dynamic Expressions,” inSAS’99, 1694 ofLecture Notes in Computer Science, 1999.

    Chapter  Google Scholar 

  3. Auslander, J., Philipose, M., Chambers, C., Eggers, S. J. and Bershad, B. N., “Fast, Effective Dynamic Compilation,” inProc. of Conference on Programming Language Design and Implementation (PLDI’96),1) pp. 149–159.

  4. Benton, N., Kennedy, A. and Russell, G., “Compiling standard ML to Java bytecodes,” inProc. of the third ACM SIGPLAN International Conference on Functional Programming, Baltimore, MD, September 1998.

  5. Berlin, A. A. and Surati, R. J., “Partial Evaluation for Scientific Computing: The Supercomputer Toolkit Experience,” inPartial Evaluation and Semantics-Based Program Manipulation, pp. 133–141, Orlando, FL, June 1994. ACM SIGPLAN. Published as Technical Report 94/9, Department of Computer Science, University of Melbourne.

  6. Bertelsen, P., “Binding-time analysis for a JVM core language,” ftp://ftp.dina.kvl.dk/pub/Staff/Peter.Bertelsen/bta-core-jvm.ps.gz, April 1999.

  7. Bothner, P. “Kawa — Compilining Dynamic Languages to the Java VM,” inUSENIX, New Orleans, June 1998.

  8. Choi, J.-D., Gupta, M., Serrano, M., Sreedhar, V. C. and Midkiff, S., “Escape Analysis for Java,” inProc. of Object-oriented Programming Systems, Languages and Applications (OOPSLA’99) (Northrop, L. M., ed.),34, 10 ofACM SIGPLAN Notices, pp. 1–19, Denver, Colorado, USA, October 1999. ACM.

  9. Consel, C. and Noël, F., “A General Approach for Run-time Specialization and its Application to C,” inConference Record of Symposium on Principles of Programming Languages (POPL’96), pp. 145–170, St. Petersburg Beach, Florida, January 1996, ACM SIGPLAN-SIGACT.

  10. Second Symposium on Programs as Data Objects (PADO II) (Danvy, O. and Filinski, A., eds.),2053 Lecture Notes in Computer Science, Aarhus, Denmark, Springer-Verlag, May 2001.

    MATH  Google Scholar 

  11. Engler, D. R., “VCODE: A Retargetable, Extensible, Very Fast Dynamic Code Generation System,” inProc. of Conference on Programming Language Design and Implementation (PLDI’96), 31, 5 ofACM SIGPLAN Notices, Philadelphia, PA, May 1996. pp. 160–170.

  12. Fujinami, N., “Determination of Dynamic Method Dispatches Using Run-time Code Generation,” inTypes in Compilation (TIC’98) (Leroy, X. and Ohori, A., eds.),1473 ofLecture Notes in Computer Science, pp. 253–271, Kyoto, Japan, Springer-Verlag, March 1998.

    Chapter  Google Scholar 

  13. Futamura, Y., “Partial Evaluation of Computation Process—an Approach to a Compiler-compiler,”Higher-Order and Symbolic Computation, 12, 4, pp. 381–391, 1999. Reprinted fromSystems, Computers, Controls, 2, 5, pp. 45–50, 1971.

    Article  Google Scholar 

  14. Grant, B., Philipose, M., Mock, M., Chambers, C. and Eggers, S. J., “An Evaluation of Staged Run-time Optimization in DyC,”. inProc. of Conference on Programming Language Design and Implementation (PLDI), 1999.

  15. Guenter, B., Knoblock, T. B. and Ruf, E., “Specializing Shaders,” inSIGGRAPH’95 (Computer Graphics Proceedings, Annual Conference Series), pp. 343–349, 1995.

  16. Henglein, F., “Efficient Type Inference for Higher-order Binding-time Analysis,” inFPCA’91 Proc. of Functional Programming Languages and Computer Architecture (LNCS 523), 523 ofLecture Notes in Computer Science, pp. 448–472, 1991.

  17. Hornof, L and Noyé, J., “Accurate Binding-time Analysis for Imperative Languages: Flow, Context, and Return Sensitivity,” inProc. of Partial Evaluation and Semantics-based Program Manipulation (PEPM’97), 32, 12 ofACM SIGPLAN, pp. 63–73, Amsterdam, June 1997. ACM.

  18. Hornof, L. and Jim, T., “Certifying Compilation and Run-time Code Generation,” inWorkshop on Partial Evaluation and Semantics-based Program Manipulation (Danvy, O., ed.),NS-99-1 ofBRICS Notes Series, pp. 60–74, San Antonio, Texas, ACM SIGPLAN, January 1999.

    Google Scholar 

  19. Jones, N. D., Gomard, C. K. and Sestoft, P.,Partial Evaluation and Automatic Program Generation, Prentice Hall, 1993.

  20. Lee, P. and Leone, M., “Optimizing ML with Run-time Code Generation,” inProc. of Conference on Programming Language Design and Implementation (PLDI’96), 31, 5 ofACM SIGPLAN Notices, Philadelphia, PA, May 1996. pp. 137–148.

  21. Lindholm, T. and Yellin, F.,The Java Virtual Machine Specification, Addison-Wesley, 1997.

  22. Masuhara, H. and Yonezawa, A., “Design and Partial Evaluation of Meta-objects for a Concurrent Reflective Language,” inEuropean Conference on Object-Oriented Programming (ECOOP’98) (Jul, E., ed.),1445 ofLecture Notes in Computer Science, pp. 418–439, Brussels, Belgium, Springer-Verlag, July 1998.

    Chapter  Google Scholar 

  23. Masuhara, H. and Yonezawa, A., “Run-time Bytecode Specialization: A Portable Approach to Generating Optimized Specialized Code,” in Danvy and Filinski10),, pp. 138–154.

    Chapter  Google Scholar 

  24. Noël, F., Hornof, L., Consel, C. and Lawall, J. L., “Automatic, Template-based Run-time Specialization: Implementation and Experimental Study,” inIEEE International Conference on Computer Languages (ICCL ’98), pp 123–142, Chicago, Illinois, USA, May 1998.

  25. Ogawa, H., Shimura, K., Matsuoka, S., Maruyama, F., Sohda, Y. and Kimura, Y., “OpenJIT: An Open-ended, Reflective JIT Compile Framework for Java,” in14th European Conference on Object-oriented Programming (ECOOP 2000) (Bertino, E., ed.),1850 ofLecture Notes in Computer Science, pp. 362–387, Sophia Antipolis and Cannes, France, Springer-Verlag, June 2000.

    Chapter  Google Scholar 

  26. Poletto, M., Hsieh, W. C., Engler, D. R. and Kaashoek, M. F., “C and tcc: a Language and Compiler for Dynamic Code Generation,”Transactions on Programming Languages and Systems, 21, 2, pp. 324–369, March 1999.

    Article  Google Scholar 

  27. Pu, C., Autrey, T., Black, A., Consel, C., Cowan, C., Inouye, J., Kethana, L., Walpole, J. and Zhang, K., “Optimistic Incremental Specialization: Streamlining a Commercial Operating System,” inProc. of the ACM Symposium on Operating System Principles (SOSP), pp. 314–324, Copper Mountain Resort, Colorado, USA, December 1995.

    Google Scholar 

  28. Schultz, U.,Object-oriented Software Engineering using Partial Evaluation. PhD thesis, University of Rennes, December 2000, English version available as IRISA PI 1395.

  29. Schultz, U., “Partial Evaluation for Class-based Object-oriented Languages,” in Danvy and Filinski10),. pp. 173–197.

    Chapter  Google Scholar 

  30. Schultz, U. P., Lawall, J. L., Consel, C. and Muller, G. “Towards Automatic Specialization of Java Programs,” inEuropean Conference on Object-oriented Programming (ECOOP’99) (Guerraoui, R., ed.),1628 ofLecture Notes in Computer Science, pp. 367–390, Lisbon, Portugal, Springer-Verlag, June 199.

  31. Stata, R. and Abadi, M. “A Type System for Java Bytecode Subroutines,”Transactions on Programming Languages and Systems, 21, 1, pp. 90–137, January 1999.

    Article  Google Scholar 

  32. Volanschi, E., Consel, C., Muller, G. and Cowan, C., “Declarative Specialization of Object-oriented Programs,” inProc. of Conference on Object-oriented Programming Systems, Languages, and Applications (OOPSLA) (Bloom, T., ed.),32, 10 ofACM SIGPLAN Notices, pp. 286–300, Atlanta, October 1997.

    Article  Google Scholar 

  33. Wickline, P., Lee, P. and Pfenning, F., “Run-time Code Generation and Modal-ML,” inProc. of Conference on Programming Language Design and Implementation (PLDI’98), 33, 5 ofACM SIGPLAN Notices, pp. 224–235, Montreal, Canada, ACM, June 1998.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Additional information

This paper is an extended version of “A Portable Approach to Generating Optimized Specialized Code”, inProceedings of Second Symposium on Programs as Data Objects (PADO-II), Lecture Notes in Computer Science, vol. 2053, pp. 138–154, Aarhus, Denmark, May 2001.23)

Hidehiko Masuhara, D.Sc.: He is an Assistant Professor at Department of Graphics and Computer Science, Graduate School of Arts and Sciences, University of Tokyo. He received his B.S., M.S. and D.Sc. degrees from Department of Information Science, University of Tokyo in 1992, 1994, and 1999, respectively. His research interests are in programming languages, especially in mechanisms to support flexible and efficient computation such as dynamic optimization and reflection. He received the best-paper award from Information Processing Society of Japan in 1996.

Akinori Yonezawa, Ph.D.: He is a Professor of computer science at Department of Computer Science, University of Tokyo. He received Ph.D. in Computer Science from the Massachusetts Institute of Technology in 1977. His current major research interests are in the areas of concurrent/parallel computation models, programming languages, object-oriented computing, and distributed computing. He is the designer of an object-oriented concurrent language ABCL/1 and the editor of several books and served as an associate editor of ACM Transaction of Programming Languages and Systems (TOPLAS). Since 1998, he has been an ACM Fellow.

About this article

Cite this article

Masuhara, H., Yonezawa, A. A portable approach to dynamic optimization in run-time specialization. NGCO 20, 101–124 (2002). https://doi.org/10.1007/BF03037261

Download citation

  • Received:

  • Revised:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF03037261

Keywords

Navigation