A portable approach to dynamic optimization in run-time specialization
- 29 Downloads
- 3 Citations
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.
Keywords
Program Specialization Partial Evaluation Run-time Code Generation Just-In-Time Compilation Java Virtual Machine Language Intermediate LanguagePreview
Unable to display preview. Download preview PDF.
References
- 1).ACM. inProc. of Conference on Programming Language Design and Implementation (PLDI’96), 31,5 ofACM SIGPLAN Notices, Philadelphia, PA, May 1996.Google Scholar
- 2).Asai, K., “Binding-time Analysis for Both Static and Dynamic Expressions,” inSAS’99, 1694 ofLecture Notes in Computer Science, 1999.CrossRefGoogle 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.Google Scholar
- 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.Google Scholar
- 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.Google Scholar
- 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.Google Scholar
- 7).Bothner, P. “Kawa — Compilining Dynamic Languages to the Java VM,” inUSENIX, New Orleans, June 1998.Google Scholar
- 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.Google Scholar
- 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.Google Scholar
- 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.MATHGoogle 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.Google Scholar
- 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.CrossRefGoogle 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.CrossRefGoogle 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.Google Scholar
- 15).Guenter, B., Knoblock, T. B. and Ruf, E., “Specializing Shaders,” inSIGGRAPH’95 (Computer Graphics Proceedings, Annual Conference Series), pp. 343–349, 1995.Google Scholar
- 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.Google Scholar
- 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.Google Scholar
- 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.Google Scholar
- 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.Google Scholar
- 21).Lindholm, T. and Yellin, F.,The Java Virtual Machine Specification, Addison-Wesley, 1997.Google Scholar
- 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.CrossRefGoogle 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.CrossRefGoogle 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.Google Scholar
- 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.CrossRefGoogle 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.CrossRefGoogle 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.Google Scholar
- 29).Schultz, U., “Partial Evaluation for Class-based Object-oriented Languages,” in Danvy and Filinski10),. pp. 173–197.CrossRefGoogle 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.Google Scholar
- 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.CrossRefGoogle 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.CrossRefGoogle 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