Itanium상의 자바 적시 컴파일러를 위한 가벼운 루프 불변 코드 이동

Lightweight Loop Invariant Code Motion for Java Just-In-Time Compiler on Itanium

  • 유준민 (삼성전자 반도체 사업부) ;
  • 최형규 (서울대학교 컴퓨터공학부) ;
  • 문수묵 (서울대학교 컴퓨터공학부)
  • 발행 : 2005.03.01

초록

루프 불변 코드 이동(loop invariant code motion, LICM) 컴파일러 최적화는 비교적 많은 분석 작업을 필요로 하기 때문에 컴파일 시간이 수행 시간의 일부가 되는 자바 적시(Just-In-Time) 컴파일러에는 사용하기 쉽지 않다. "전통적인" LICM 기법에서는 보통 코드를 분석하여 레지스터의 정의-사용체인과 사용-정의 체인을 미리 만든 뒤 이를 바탕으로 코드 이동을 수행하는 데, 본 논문은 자바 가상 머신(Java virtual machine)이 스택 머신 (stack machine)이라서 좀 더 단순한 코드 형태를 생성한다는 특징을 이용하여 정의-사용 체인을 루프 불변 코드에 대해서만 만들고 사용-정의 체인 없이도 정확히 동작하는 알고리즘을 제시한다. 또한 기존의 방식보다 더 많은 루프 불변 코드 이동을 하게 하는 두 가지 방법을 제시한다. 우선, 간단하기 때문에 루프에 경로가 하나인 경우만 LICM을 적용하는 기존의 기법과 달리, 경로가 여러 개인 루프에서도 부분적으로 중복되는 코드에 대해서도 LICM을 안전하게 적용한다. 또한 부분적으로 중복되는 루프 불변 널(null) 포인터 체크 코드도 Itanium의 조건 수행(predication)을 이용하여 이동시키다. 제안된 기법은 Itanium 마이크로프로세서를 위한 인텔의 ORP(Open Runtime Platform) 자바 가상 머신 위의 적시 컴파일러에 구현하였다. SPECjvm98 벤치마크에 대해 실험을 수행한 결과 전체 적시 컴파일 시간을 1.3% 정도만을 증가시켰지만 전체 수행 시간을 기하 평균으로 2.2% 향상 시켰다.

Loop invariant code motion (LICM) optimization includes relatively heavy code analyses, thus being not readily applicable to Java Just-In-Time (JIT) compilation where the JIT compilation time is part of the whole running time. 'Classical' LICM optimization first analyzes the code and constructs both the def-use chains and the use-def chains. which are then used for performing code motions. This paper proposes a light-weight LICM algorithm, which requires only the def-use chains of loop invariant code (without use-def chains) by exploiting the fact that the Java virtual machine is based on a stack machine, hence generating code with simpler patterns. We also propose two techniques that allow more code motions than classical LICM techniques. First, unlike previous JIT techniques that uses LICM only in single-path loops for simplicity, we apply LICM to multi-path loops (natural loops) safely for partially redundant code. Secondly, we move loop-invariant, partially-redundant null pointer check code via predication support in Itanium. The proposed techniques were implemented in a JIT compiler for Itanium processor on ORP (Open Runtime Platform) Java virtual machine of Intel. On SPECjvrn98 benchmarks, the proposed technique increases the JIT compilation overhead by the geometric mean of 1.3%, yet it improves the total running time by the geometric mean of 2.2%.

키워드

참고문헌

  1. F.Yellin and T. Lindholm, 'The Java Virtual Machine Specification,' Addisin-Wesley, 1996
  2. S.-M. Moon and K. Ebcioglu 'A Just-in-Time Compiler,' IEEE Computer, March 2000
  3. B.-S. Yang, S.-M. Moon, S. Park, J. Lee, S. Lee, J. Park, Y. C. Chung, S. Kim, K. Ebcioglu, and E. Altman, 'LaTTe: A Java VM just-in-time compiler with fast and ecient register allocation,' In Proceedings of the 1999 International Conference on Parallel Architectures and Compilation Techniques (PACT '99), pages 128-138, Newport Beach, California, Oct. 1999. IEEE Computer Society Press. http://latte.snu.ac.kr https://doi.org/10.1109/PACT.1999.807503
  4. Ali-Reza Adl-Tabatabai, Michal Cierniak, Guei-Yuan Lueh, Vishesh M. Parakh, and James M. Stichnoth. 'Fast, Effective Code Generation in a Just-In-Time Java Compiler,' In Proceedings of the ACM SIGPLAN '98 Conference on Programming Language Design and Implementation (PLDI), pp, 280-290, Montreal, Canada, June 1998 https://doi.org/10.1145/277650.277740
  5. M. Cierniak, G.-Y. Lueh, and J. M. Stichnoth, 'Practicing JUDO: Java under dynamic optimizations,' In Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation (PLDI-00), volume 35.5 of ACM Sigplan Notices, pages 13{26, N.Y., June 18{21 2000. ACM Press https://doi.org/10.1145/349299.349306
  6. Open Runtime Platform (ORP), Intel Microprocessor Research Laboratory, http://intel.com/research/mrl/orp
  7. V. IA-Application, 'Intel IA-64 architecture software developer's manual volume 1 : IA-64 application architecture.'
  8. 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. submitted for publication
  9. Steven S. Muchnick, 'Advanced Compiler Design Implementation,' pp.252-258, pp.397-406, pp.407-415, Morgan Kaufman, 1997
  10. Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. Kenneth Zadeck, 'Efficiently Computing Static Single Assignment Form and the Control Dependence Graph,' in ACM Transactions on Programming Languages and Systems. ACM, October 1991 https://doi.org/10.1145/115372.115320
  11. Robert Kennedy, Sun Chan, Shin-Ming Liu, Raymond Lo, Peng Tu, and Fred Chow. 'Partial redundancy elimination in SSA form,' ACM Transactions on Programming Languages and Systems, 21(3):627--676, 1999 https://doi.org/10.1145/319301.319348
  12. Nystrom, N., Hosking, A. L., Cutts, Q., and Diwan, A., 'Partial redundancy elimination for access path expressions,' Unpublished manuscript. Palsberg, J. and Schwartzbach, M. I. 1994. Object-Oriented Type Systems. Wiley
  13. Qiong Cai and Jingling Xue, 'Optimal and Efficient Speculation-Based Partial Redundancy Elimination,' In Proceedings of the IEEE/ACM International Symposium on Code Generation and Optimization (CGO'03), 2003 https://doi.org/10.1109/CGO.2003.1191536
  14. The Standard Performance Evaluation Corporation. SPEC JVM98 Benchmarks. http://www.spec.org/osg/jvm98/, 1998