Array Bounds Check Elimination using Ineguality Graph in Java Just-in-Time Compiler

대소관계 그래프를 이용한 Just-in-Time 컴파일 환경에서의 배열 경계 검사 제거

  • Published : 2005.12.01

Abstract

One of the problems in boosting Java performance using a Just-in-Time (JIT) compiler is removing redundant array bound checks. In conventional static compilers, many powerful algorithms have been developed, yet they are not directly applicable to JIT compilation where the compilation time is part of the whole running time. In the current JIT compilers, we tan use either a naive algorithm that is not powerful enough or an aggressive algorithm which requires the transformation into a static single assignment (SSA) form of programs (and back to the original form after optimization), thus causing too much overhead not appropriate for JIT compilation This paper proposes a new algorithm based on an inequality graph which can eliminate array bounds check codes aggressively without resorting to the SSA form. When we actually perform this type of optimization, there are many constraints in code motion caused by the precise exception rule in Java specification, which would cause the algorithm to miss many opportunities for eliminating away bound checks. We also propose a new method to overcome these constraints.

Just-in-Time 컴파일러를 이용하여 자바의 성능을 향상시키려면 여러 문제들을 극복하여야 한다. 이 문제 중 중요한 부분을 차지하는 것이 배열경계 검사(Array bounds check) 명령어를 어떻게 최적화하느냐는 것이다 정적인 컴파일 환경의 경우에는 이미 많은 연구가 진행되어 매우 강력한 성능을 가지는 알고리즘이 알려져 있으나 컴파일 시간이 수행시간의 일부인 Just-in-Time 컴파일 환경에 이를 적용하기에는 컴파일에 시간을 너무 많이들이는 결과를 낳아 적절하지 않다. 현재 Just-in-Time 컴파일러들은 가볍고 단순한 반면에 중복된 배열 경계 검사를 찾아내는 능력이 다소 부족한 알고리즘을 사용하거나 아니면 강력하지만 정적 단일 배정(Static Single Assignment) 형태로 명령어 표현 방식을 변환해 주어야만 하는 알고리즘을 사용하고 있다. 정적 단일 배정 형태로의 변환 및 되돌림은 가볍고 빠른 컴파일러를 지향하는 Just-in-Time 컴파일러에 부합되지 않는다. 본 논문은 변수 간의 대소관계를 표현하는 그래프를 배열 경계 검사 알고리즘에 적용하는 것을 통해 충분한 성능을 내면서도 정적 단일 배정 형태로의 변환을 필요로 하지 않는 알고리즘을 제안한다. Java에서의 모든 최적화는 Java 언어 명세에서 강제하고 있는 정확한 예외 처리(precise exception) 규칙을 따라야 한다. 명령어의 위치를 바꿈으로써 성능 향상을 꾀하는 최적화의 경우 이것으로 인해 많은 제약을 받게 되는데, 배열 경계 검사 최적화(Array bounds check elimination optimization) 또한 이 규칙에 의해 많은 최적화 기회를 잃는다. 우리는 이 제약을 극복하여 배열 경계 검사최적화의 적용 범위를 넓힐 수 있는 새로운 방법도 아울러 제안하고자 한다.

Keywords

References

  1. Michal Cierniak, Guei-Yuan Lueh and James M. Stichnoth. Practicing JUDO: Javaunder dynamic optimizations. ACM SIGPLAN Notices, Proceedings of the ACM SIGPLAN 2000 conference on Programming language design and implementation. v.35 n.5. 2000
  2. Rajiv Gupta. Optimizing array bound checks using flow analysis. ACM Letters on Programming Languages and Systems (LOPLAS). v.2 n.1-4, pp.135-150. 1993 https://doi.org/10.1145/176454.176507
  3. Rastislav Bodik , Rajiv Gupta and Vivek Sarkar. ABCD: eliminating array bounds checks on demand. ACM SIGPLAN Notices. v.35 n.5, pp.321-333, 2000 https://doi.org/10.1145/358438.349342
  4. Rastislav Bodik , Rajiv Gupta and Vivek Sarkar. ABCD: eliminating array bounds checks on demand. ACM SIGPLAN Notices. v.35 n.5, pp.321-333. 2000
  5. S.Kim, S.-M. Moon and K. Ebcioglu. vLaTTe: A Java Just-in-Time Compiler for VLIW with Fast Scheduling and Register Allocation. July 2000
  6. Feng Qian, Laurie J. Hendren and Clark Verbrugge. A Comprehensive Approach to Array Bounds Check Elimination for Java. Lecture Notes In Computer Science, Proceedings of the 11th International Conference on Compiler Construction. pp.325-342. 2002
  7. Manish Gupta ,Jong-Deok Choi and Michael Hind. Optimizing Java Programs in the Presence of Exceptions. Lecture Notes In Computer Science, Proceedings of the 14th European Conference on Object-Oriented Programming, pp.402-446. 2000