바이트코드 최적화기

The Bytecode Optimizer

  • 이야리 (동국대학교 컴퓨터공학과) ;
  • 홍경표 (동국대학교 컴퓨터공학과) ;
  • 오세만 (동국대학교 컴퓨터공학과)
  • 발행 : 2003.02.01

초록

자바언어는 인터넷 및 분산 환경 시스템에서 효과적으로 응용 프로그램을 개발할 수 있도록 설계된 프로그래밍 언어로써 객제지향 패러다임 특성 및 다양한 개발 환경을 지원하고 있다. 그러나, 자바는 클래스 파일이 이동하여 JVM 환경에서 인터프리팅 되는 시스템이므로, 성능의 저하 없이 실행되기 위해서는 효율적인 최적화와 실행 시스템이 요구된다. 본 논문은 네트워크 상에서 동적으로 다운로드 되는 클래스 파일을 바이트코드 수준에서 최적화하였다. 최적화된 바이트코드들이 인터프리팅 되는 시스템에서 적은 네트워크 로드를 가지고 실행할 수 있도록 하며, 효율적인 실행 속도를 보이도록 하는 것이다. 본 논문에서 구현된 바이트코드 최적화기에서는 내부적으로 바이트코드 최적화기와 클래스 파일 생성기를 이용하여 실행시간을 개선하고 전체 클래스 파일의 크기를 줄이게 된다. 바이트코드 최적화기는 바이트코드를 클래스사이의 계층 분석과 제어 흐름의 분석을 통하여 클래스들간의 연관 관계를 분석한 후 그래프를 구성하고, 패턴 탐색 결과 기본 블록 분리를 통하여 전역 최적화를 이루고, 기본 블록 안에서의 연산강도 경감, 그리고 도달할 수 없는 코드 블록의 제거를 수행한다. 바이트코드 최적화 단계를 수행한 클래스 파일은 부분적으로 클래스 파일의 최적화를 가져와 전체 클래스 파일의 크기를 줄이고, 인터프리터를 통하여 실행될 때 수행 속도 면에서 좀더 빠른 실행속도를 가지게 된다.

The Java programming language is designed for developing effective applications in a heterogeneous network environment. Major problem in Java is its performance. many attractive features of Java make the development of software easy, but also make it expensive to support ; applications written in Java are often much slower than their counterparts written in C or C++. To use Java`s attractive features without the performance penalty, sophisticated optimizations and runtime systems are required. Optimising Java bytecode has several advantages. First, the bytecode is independent of any compiler that is used to generate it. Second, the bytecode optimization can be performed as a pre=pass to Just-In-Time(JIT) compilation. Many attractive features of Java make the development of software easy, but also make it expensive to support. The goal of this work is to develop automatic construction of code optimizer for Java bytecode. We`ve designed and implemented a Bytecode Optimizer that performs the peephole optimization, bytecode-specific optimization, and method-inlining techniques. Using the Classfile optimizer, we see up to 9% improvement in speed and about 20% size reduction in Java class files, when compared to average code using the interpreter alone.

키워드

참고문헌

  1. Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman, Compilers: Principles,Techniques and Tools, Addison-Wesley, 1986
  2. DashO, preEmptive solution Inc., http://www.preemptive.com/
  3. Geoff Cohen, Prof.Jeff Chase, Prof.Sid Chatterjee(UNC), John Bley, Geoff Berry, Dr.David Kaminsky(IBM), JOIE, The Java Object Instrumentation Environment
  4. Han Bok Lee and Benjamin G. Zorn, BIT: A Tools for Instrumenting Java Bytecodes, Proceedings USENIX Symposium on Internet Technologies and Systems, 1998
  5. Jonathan Meyer, Jasmin - Jasmin Assembler, http://www.cat.nyu.edu/meyer/jasmin/guide.html
  6. Ken Arnold and James Gosling, The Java Programming Language Second Edition, Addison Wesley, 1998
  7. Mahadevan Ganapathi, Charles N. Fisher and John L. Hennessy, 'Retargetable Compiler Code Generation,' ACM Computing Surveys, Vol.14, No.4, pp.573-593, 1982 https://doi.org/10.1145/356893.356897
  8. Make Java fast:Optimize!, http://www.javaworld.com/javaworld/jw-04-1997/jw-04-optimize.html
  9. M. Dham, Byte Code Enginnering with the JavaClass API, University Berlin, 1998 http://bcel.sourceforge.net/
  10. OpenJIT homepage, http://www.openjit.org
  11. Tim Lindholm and Frank Yellin, The Java Virtual Machine Specification, Second Edition, Addison Wesley, 1999
  12. Yari Lee, Jungsook Kim, Kyongpyo Hong and Seman Oh, 'Design and Implementation of a Java Byrecode Optimizer,' Proceedings of the IASTED International Conference Internet and Multimedia Systems and Applications, Hawaii, pp.62-66, August 2001
  13. 고광만, 오세만, 트리 패턴 매칭 코드 생성 알고리즘, 한국정보과학회 논문지(B), 25권 10호, pp.1566-1574, 1998. 10
  14. 이야리, 오세만, 자바 바이트코드 최적화기, 한국정보과학회 프로그래밍언어연구회 논문지, 제15권 제2호, pp.9-18, 2001.11
  15. 홍경표, 이야리, 오세만, 자바 클래스 파일 최적화, 한국정보과학회 봄 학술 발표논문집, 제28권 제1호, pp.55-57, 2001.4