ABSTRACT
We present an optimized implementation of the linear scan register allocation algorithm for Sun Microsystems' Java HotSpot™ client compiler. Linear scan register allocation is especially suitable for just-in-time compilers because it is faster than the common graph-coloring approach and yields results of nearly the same quality.Our allocator improves the basic linear scan algorithm by adding more advanced optimizations: It makes use of lifetime holes, splits intervals if the register pressure is too high, and models register constraints of the target architecture with fixed intervals. Three additional optimizations move split positions out of loops, remove register-to-register moves and eliminate unnecessary spill stores. Interval splitting is based on use positions, which also capture the kind of use and whether an operand is needed in a register or not. This avoids the reservation of a scratch register.Benchmark results prove the efficiency of the linear scan algorithm: While the compilation speed is equal to the old local register allocator that is part of the Sun JDK 5.0, integer benchmarks execute about 15% faster. Floating-point benchmarks show the high impact of the Intel SSE2 extensions on the speed of numeric Java applications: With the new SSE2 support enabled, SPECjvm98 executes 25% faster compared with the current Sun JDK 5.0.
References
- P. Briggs, K. D. Cooper, and L. Torczon. Improvements to graph coloring register allocation. ACM Transactions on Programming Languages and Systems, 16(3):428--455, 1994. Google Scholar
Digital Library
- G. J. Chaitin, M. A. Auslander, A. K. Chandra, J. Cocke, M. E. Hopkins, and P. W. Markstein. Register allocation via coloring. Computer Languages, 6:47--57, 1981.Google Scholar
Digital Library
- R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems, 13(4):451--490, 1991. Google Scholar
Digital Library
- R. Griesemer and S. Mitrovic. A compiler for the Java HotSpot™ virtual machine. In L. Böszörményi, J. Gutknecht, and G. Pomberger, editors, The School of Niklaus Wirth: The Art of Simplicity, pages 133--152. dpunkt.verlag, 2000. Google Scholar
Digital Library
- Institute of Electrical and Electronics Engineers. IEEE Standard for Binary Floating-Point Arithmetic. ANSI/IEEE Standard 754-1985.Google Scholar
- Intel Corporation. IA-32 Intel Architecture Software Developer's Manual, Volume 1: Basic Architecture, 2004. Order Number 253665.Google Scholar
- T. Kotzmann and H. Mössenböck. Escape analysis in the context of dynamic compilation and deoptimization. In Proceedings of the First Conference on Virtual Execution Environments, 2005. Google Scholar
Digital Library
- H. Mössenböck. Adding static single assignment form and a graph coloring register allocator to the Java HotSpot™ client compiler. Technical Report 15, Institute for Practical Computer Science, Johannes Kepler University Linz, 2000.Google Scholar
- H. Mössenböck and M. Pfeiffer. Linear scan register allocation in the context of SSA form and register constraints. In Proceedings of the 11th International Conference on Compiler Construction, pages 229--246, 2002. Google Scholar
Digital Library
- M. Paleczny, C. Vick, and C. Click. The Java HotSpot™ server compiler. In Proceedings of the Java Virtual Machine Research and Technology Symposium, 2001. Google Scholar
Digital Library
- J. Park and S.-M. Moon. Optimistic register coalescing. ACM Transactions on Programming Languages and Systems, 26(4):735--765, 2004. Google Scholar
Digital Library
- M. Poletto, D. R. Engler, and M. F. Kaashoek. tcc: A system for fast, flexible, and high-level dynamic code generation. In Proceedings of the ACM SIGPLAN 1997 conference on Programming language design and implementation, pages 109--121. ACM Press, 1997. Google Scholar
Digital Library
- M. Poletto and V. Sarkar. Linear scan register allocation. ACM Transactions on Programming Languages and Systems, 21(5):895--913, 1999. Google Scholar
Digital Library
- R. Pozo and B. Miller. SciMark 2.0. http://math.nist.gov/scimark2/.Google Scholar
- Standard Performance Evaluation Corporation. SPECjvm98. http://www.spec.org/jvm98/.Google Scholar
- Sun Microsystems, Inc. The Java HotSpot™ Virtual Machine, v1.4.1, 2002. http://java.sun.com/products/hotspot.Google Scholar
- O. Traub, G. Holloway, and M. D. Smith. Quality and speed in linear-scan register allocation. In Proceedings of the ACM SIGPLAN 1998 conference on Programming language design and implementation, pages 142--151. ACM Press, 1998. Google Scholar
Digital Library
- C. Wimmer. Linear scan register allocation for the Java HotSpot™ client compiler. Master's thesis, Johannes Kepler University Linz, 2004.Google Scholar
Index Terms
Optimized interval splitting in a linear scan register allocator


Christian Wimmer
Hanspeter Mössenböck




Comments