KR20110081720A - Compilation method for embedded system using precompilation during execution - Google Patents
Compilation method for embedded system using precompilation during execution Download PDFInfo
- Publication number
- KR20110081720A KR20110081720A KR1020100002023A KR20100002023A KR20110081720A KR 20110081720 A KR20110081720 A KR 20110081720A KR 1020100002023 A KR1020100002023 A KR 1020100002023A KR 20100002023 A KR20100002023 A KR 20100002023A KR 20110081720 A KR20110081720 A KR 20110081720A
- Authority
- KR
- South Korea
- Prior art keywords
- code
- cache
- stored
- aotc
- code cache
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/47—Retargetable compilers
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/447—Target code generation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
본 발명은 수행 중 선행 컴파일링(In client Ahead-Of-Time Compiling; In c-AOTC)을 이용한 내장형 시스템을 위한 자바 컴파일링 방법으로서, 보다 구체적으로는 (1) 자바 응용프로그램 수행 중, 메소드가 핫스팟(hot spot) 메소드인지 확인하는 단계; (2) 단계 (1)에서 핫스팟 메소드가 아닌 것으로 확인된 경우, 인터프리터(interpreter)로 해당 메소드를 수행한 후, 단계 (1)로 돌아가 다음 메소드를 수행하는 단계; (3) 단계 (1)에서 핫스팟 메소드인 것으로 확인된 경우, 해당 메소드에 대한 머신 코드가 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장되어 있는지를 확인하는 단계; (4) 단계 (3)에서 저장되어 있는 것으로 확인된 경우, 해당 머신 코드를 로딩 및 재배치(relocation)하여 수행한 후, 단계 (1)로 돌아가 다음 메소드를 수행하는 단계; (5) 단계 (3)에서 저장되어 있지 않은 것으로 확인된 경우, 적시 컴파일러(Just-In-Time Compiler; JITC)를 이용하여 해당 메소드의 바이트코드를 머신 코드로 변환한 후, 코드 캐시(code cache)가 풀(full)인지 여부를 확인하는 단계; (6) 단계 (5)에서 상기 코드 캐시가 풀이 아닌 것으로 확인된 경우, 상기 변환된 머신 코드를 상기 코드 캐시에 저장하고 단계 (1)로 돌아가 다음 메소드를 수행하는 단계; 및 (7) 단계 (5)에서 코드 캐시가 풀인 것으로 확인된 경우, 상기 코드 캐시에 저장된 임의의 메소드를 선택하여 해당 머신 코드를 상기 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장하고 상기 코드 캐시에서 삭제한 후, 상기 변환된 머신 코드를 상기 코드 캐시에 저장하고 단계 (1)로 돌아가 다음 메소드를 수행하는 단계를 포함하는 것을 그 구성상의 특징으로 한다.
본 발명에서 제안하고 있는 내장형 시스템을 위한 자바 컴파일링 방법에 따르면, 클라이언트-선행 컴파일러(c-AOTC) 파일에 머신 코드가 저장되어 있지 않은 핫스팟 메소드에 대하여 적시 컴파일러(JITC)를 이용하여 변환된 머신 코드를 코드 캐시에 저장할 때 코드 캐시가 부족할 경우, 코드 캐시에서 임의의 메소드를 선택하여 해당 머신 코드를 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장하고 코드 캐시에서는 삭제한 후, 코드 캐시의 삭제된 공간에 변환된 머신 코드를 저장할 수 있도록 구성함으로써, 적시 컴파일러(JITC)의 이용 시의 코드 캐시의 부족 문제를 해결할 수 있다.The present invention is a Java compilation method for an embedded system using In client Ahead-Of-Time Compiling (In c-AOTC), and more specifically, (1) while executing a Java application, the method Checking whether it is a hot spot method; (2) if it is determined in step (1) that the method is not a hotspot method, performing the method with an interpreter, and then returning to step (1) to perform the next method; (3) if it is determined in step (1) that it is a hotspot method, checking whether the machine code for the method is stored in a client-preceding compiler (c-AOTC) file; (4) if it is determined that the data is stored in step (3), after loading and relocating the corresponding machine code to perform the method, returning to step (1) to perform the next method; (5) If it is confirmed that it is not stored in step (3), after converting the bytecode of the method into machine code using a Just-In-Time Compiler (JITC), the code cache Checking whether) is full; (6) if it is determined in step (5) that the code cache is not full, storing the converted machine code in the code cache and returning to step (1) to perform the next method; And (7) if it is determined in step (5) that the code cache is full, select any method stored in the code cache to store the machine code in the client-preceding compiler (c-AOTC) file and cache the code. And after the deletion, store the converted machine code in the code cache and return to step (1) to perform the next method.
According to the Java compilation method for the embedded system proposed in the present invention, a machine converted by using a timely compiler (JITC) for a hotspot method in which a machine code is not stored in a client-preferred compiler (c-AOTC) file. If you run out of code cache when you store your code in the code cache, select any method in the code cache to store the machine code in a client-preceding compiler (c-AOTC) file, delete it from the code cache, and then delete the code cache. By configuring the machine code to be stored in a separate space, it is possible to solve the problem of insufficient code cache when using a timely compiler (JITC).
Description
본 발명은 자바 컴파일링 방법에 관한 것으로서, 특히 수행 중 선행 컴파일링을 이용한 내장형 시스템을 위한 자바 컴파일링 방법에 관한 것이다.The present invention relates to a Java compilation method, and more particularly, to a Java compilation method for an embedded system using preceding compilation during execution.
최근의 많은 내장형 시스템들은 소프트웨어 플랫폼으로 자바를 선택하고 있다. 예를 들어, 휴대폰, 디지털 TV, 홈 네트워크, 블루레이 디스크, 텔레매틱스 등에서 자바를 내장형 소프트웨어 플랫폼으로 사용하고 있다. 내장형 시스템들이 자바를 선택하는 이유는 첫째로, 가상 머신을 사용함으로써 CPU, OS, 하드웨어 기반이 다양한 내장형 플랫폼에서 일관된 실행 환경을 제공한다는 점이다. 두 번째는 보안상의 이점이다. 즉, 자바 플랫폼은 바이러스나 해킹 자바 코드로 인해 전체 시스템이 다운될 가능성이 작다. 마지막으로는 충분히 성숙하고 풍부한 API를 제공하고 프로그램의 안정성을 높여주는 언어 기능(쓰레기 수집기, 예외 처리)으로 인해 소프트웨어 콘텐츠 개발이 용이하기 때문이다.
Many modern embedded systems are choosing Java as their software platform. For example, mobile phones, digital TVs, home networks, Blu-ray Discs, telematics, etc. use Java as an embedded software platform. The reasons why embedded systems choose Java are: First, by using virtual machines, the CPU, OS, and hardware foundations provide a consistent execution environment on a variety of embedded platforms. Second is the security advantage. In other words, the Java platform is less likely to crash the entire system due to viruses or hacked Java code. Finally, software content development is facilitated by language features (garbage collectors, exception handling) that provide a sufficiently mature and rich API and enhance program stability.
자바는 또한 독립 플랫폼 환경을 제공한다. 따라서 개발자들은 다양한 플랫폼을 위해서 별도로 개발할 필요가 없게 된다. 독립 플랫폼 환경의 장점은 자바 가상머신(Java Virtual Machine, JVM)을 사용함으로써 얻어진다. JVM에서는 바이트코드(bytecode)가 수행되며, 바이트코드는 자바에 의해 컴파일된 중간 단계의 코드이다. 바이트코드는 인터프리터에 의해 명령어로 번역되면서 수행되는 스택을 기반으로 한 명령어이다. 따라서 다양한 플랫폼에 자바 인터프리터만을 구현함으로써 하나의 바이트코드를 수행할 수 있게 된다. 하지만, 소프트웨어를 통한 번역 후 수행은 하드웨어에서 직접 수행하는 것보다 느리기 때문에 적시 컴파일러(Just-In-Time Compiler; JITC)나 선행 컴파일러(Ahead-Of-Time Compiler; AOTC)와 같이 바이트코드를 머신 코드로 번역하는 컴파일 기법을 사용하여 가속해야만 한다. 내장형 시스템에서 JITC을 사용하면 타깃 머신에서 수행 시간 중에 바이트코드를 머신 코드로 변환시키게 된다. 반면에 AOTC는 머신 코드로의 번역 과정을 서버에서 수행한 후 번역된 코드를 타깃 머신에 저장하여 둔 후 실행 시에 사용하게 된다.
Java also provides an independent platform environment. Therefore, developers do not need to develop for various platforms. The advantage of an independent platform environment is obtained by using the Java Virtual Machine (JVM). In the JVM, bytecode is executed, which is an intermediate code compiled by Java. Bytecode is a stack-based instruction executed by the interpreter as it is translated into instructions. Therefore, it is possible to execute one bytecode by implementing only Java interpreter on various platforms. However, post-translational execution through software is slower than performing directly in hardware, so bytecodes such as Just-In-Time Compiler (JITC) or Ahead-Of-Time Compiler (AOTC) Must be accelerated using a compilation technique that translates to. Using JITC in embedded systems translates the bytecode into machine code at runtime on the target machine. On the other hand, AOTC translates the machine code into the machine code and saves the translated code in the target machine for use in execution.
따라서, JITC은 수행 시간 중의 변환 과정에 의해서 사용되는 시간과 메모리의 오버헤드를 가지게 된다. AOTC는 JITC의 수행 시간에 발생되는 오버헤드들을 제거할 수 있기 때문에 내장형 시스템에서 좀 더 유용하다고 할 수 있다. 또한, AOTC는 번역과정에서 강력한 최적화 방법들을 프로그램 전체에 사용함으로써 좀 더 좋은 수준의 머신 코드를 생성해 낼 수 있다. 실제로 Java AOTC는 상용 핸드폰 소프트웨어 플랫폼으로 이미 사용되고 있다.
Therefore, JITC has time and memory overhead used by the conversion process during execution time. AOTC can be more useful in embedded systems because it can eliminate the overhead incurred by JITC. AOTC can also generate better machine code by using powerful optimization methods throughout the program. In fact, Java AOTC is already being used as a commercial mobile phone software platform.
하지만, DTV와 휴대폰 같은 내장형 시스템들은 프로그램을 다운받아서 사용할 수 있도록 되어 있으며, 이런 경우에는 AOTC가 사용되기 힘들기 때문에 인터프리터에 의해서 수행되어야 한다. 느린 인터프리터를 사용하는 것은 곧 전체 성능의 저하를 의미하는 것이다. 따라서 AOTC만이 아니라 다운받아서 사용하는 프로그램을 빠르게 수행하기 위해서 JITC도 함께 사용하는 것이 좋은 방법이라 하겠다. 내장형 시스템에서 JITC을 사용하게 됨으로써 발생하는 가장 기본적인 문제는 JITC의 변환 오버헤드이다. 우리는 더 좋은 성능을 얻기 위해서 이런 오버헤드를 제거해야만 한다.
However, embedded systems such as DTV and mobile phones can download and use the program. In this case, the AOTC is difficult to use and must be performed by an interpreter. Using a slow interpreter means a drop in overall performance. Therefore, it is a good way to use JITC together not only for AOTC but also for quickly downloading and using programs. The most fundamental problem with using JITC in embedded systems is the conversion overhead of JITC. We must remove this overhead to get better performance.
내장형 시스템에서 JITC의 변환 시간 오버헤드와 메모리 오버헤드를 제거하는 방법으로 클라이언트 선행 컴파일러(client Ahead-Of-Time Compiler; c-AOTC)를 사용할 수 있다. 서버에서 수행되는 전통적인 AOTC (server-AOTC)와 다르게 c-AOTC는 이미 사용되고 있는 JITC의 번역 모듈을 이용하여 AOTC를 수행하게 된다. JITC에 의해서 변환된 메소드의 머신 코드는 저장 공간의 파일 시스템(File system)에 파일의 형태로 저장되어진다. 만약 이후의 수행에서 이 메소드가 다시 사용되면, 바이트코드를 번역하는 과정을 거치지 않고 파일에 있는 머신 코드를 그대로 읽어 들여 사용하게 된다. 이렇게 함으로써 JITC 오버헤드를 제거하고 머신 코드로 수행하여 수행시간의 단축을 기대할 수 있다. 많은 JITC은 빈번히 사용되는 메소드만을 컴파일하기 위해 우선 인터프리터로 먼저 수행한 뒤 JITC을 하는 적응형 컴파일(adaptive compilation) 기법을 사용한다. 따라서 adaptive JITC을 사용하는 경우는 JITC 변환 오버헤드와 인터프리터 오버헤드를 함께 제거할 수 있게 된다.
Client Ahead-Of-Time Compiler (c-AOTC) can be used to eliminate JITC's conversion time overhead and memory overhead in embedded systems. Unlike traditional AOTC (server-AOTC) that is executed in server, c-AOTC executes AOTC using JITC's translation module which is already used. The machine code of the method converted by JITC is stored in the form of a file in the file system of the storage space. If this method is used again in a later run, the machine code in the file is read and used as is, without translating the bytecode. This eliminates the JITC overhead and can be done in machine code to reduce execution time. Many JITCs use an adaptive compilation technique that first executes with the interpreter and then JITC to compile only the frequently used methods. Therefore, when using adaptive JITC, the JITC conversion overhead and interpreter overhead can be eliminated together.
다만, 내장형 시스템의 메모리는 항상 제한적이기 때문에 생성된 머신 코드를 저장할 코드 캐시(code cache)가 충분하지 않은 경우가 대부분이며, 그 결과 일부 메소드의 머신 코드는 새롭게 JITC된 메소드의 머신 코드를 위해 삭제되어야 한다. 이로 인하여 이 메소드가 다시 수행될 때는 JITC을 하는 오버헤드가 발생한다는 문제점이 있다.However, since the memory of the embedded system is always limited, there is not enough code cache to store the generated machine code. As a result, some method machine code is deleted for the newly JITC method machine code. Should be. This causes a problem that JITC overhead occurs when this method is executed again.
본 발명은 기존에 제안된 방법들의 상기와 같은 문제점들을 해결하기 위해 제안된 것으로서, 클라이언트-선행 컴파일러(c-AOTC) 파일에 머신 코드가 저장되어 있지 않은 핫스팟 메소드에 대하여 적시 컴파일러(JITC)를 이용하여 변환된 머신 코드를 코드 캐시에 저장할 때 코드 캐시가 부족할 경우, 코드 캐시에서 임의의 메소드를 선택하여 해당 머신 코드를 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장하고 코드 캐시에서는 삭제한 후, 코드 캐시의 삭제된 공간에 변환된 머신 코드를 저장할 수 있도록 구성함으로써, 적시 컴파일러(JITC)의 이용 시의 코드 캐시의 부족 문제를 해결할 수 있는 내장형 시스템을 위한 자바 컴파일링 방법을 제공하는 것을 그 목적으로 한다.The present invention has been proposed to solve the above problems of the conventionally proposed methods, using a timely compiler (JITC) for a hotspot method for which no machine code is stored in a client-preferred compiler (c-AOTC) file. If you run out of code cache when you store the converted machine code in the code cache, select any method in the code cache to store the machine code in a client-precedence compiler (c-AOTC) file and delete it from the code cache. Its purpose is to provide a Java compilation method for embedded systems that can solve the problem of code cache shortages when using a timely compiler (JITC) by configuring it to store translated machine code in the deleted space of the code cache. It is done.
상기한 목적을 달성하기 위한 본 발명의 특징에 따른 내장형 시스템을 위한 자바 컴파일링 방법은, 수행 중 선행 컴파일링(In client Ahead-Of-Time Compiling; In c-AOTC)을 이용한 내장형 시스템을 위한 자바 컴파일링 방법으로서,A Java compilation method for an embedded system according to a feature of the present invention for achieving the above object, Java for embedded system using the pre-compile (In client Ahead-Of-Time Compiling; In c-AOTC) As a compilation method,
(1) 자바 응용프로그램 수행 중, 메소드가 핫스팟(hot spot) 메소드인지 확인하는 단계;(1) checking whether the method is a hot spot method while executing a Java application;
(2) 단계 (1)에서 핫스팟 메소드가 아닌 것으로 확인된 경우, 인터프리터(interpreter)로 해당 메소드를 수행한 후, 단계 (1)로 돌아가 다음 메소드를 수행하는 단계;(2) if it is determined in step (1) that the method is not a hotspot method, performing the method with an interpreter, and then returning to step (1) to perform the next method;
(3) 단계 (1)에서 핫스팟 메소드인 것으로 확인된 경우, 해당 메소드에 대한 머신 코드가 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장되어 있는지를 확인하는 단계;(3) if it is determined in step (1) that it is a hotspot method, checking whether the machine code for the method is stored in a client-preceding compiler (c-AOTC) file;
(4) 단계 (3)에서 저장되어 있는 것으로 확인된 경우, 해당 머신 코드를 로딩 및 재배치(relocation)하여 수행한 후, 단계 (1)로 돌아가 다음 메소드를 수행하는 단계;(4) if it is determined that the data is stored in step (3), after loading and relocating the corresponding machine code to perform the method, returning to step (1) to perform the next method;
(5) 단계 (3)에서 저장되어 있지 않은 것으로 확인된 경우, 적시 컴파일러(Just-In-Time Compiler; JITC)를 이용하여 해당 메소드의 바이트코드를 머신 코드로 변환한 후, 코드 캐시(code cache)가 풀(full)인지 여부를 확인하는 단계;(5) If it is confirmed that it is not stored in step (3), after converting the bytecode of the method into machine code using a Just-In-Time Compiler (JITC), the code cache Checking whether) is full;
(6) 단계 (5)에서 상기 코드 캐시가 풀이 아닌 것으로 확인된 경우, 상기 변환된 머신 코드를 상기 코드 캐시에 저장하고 단계 (1)로 돌아가 다음 메소드를 수행하는 단계; 및(6) if it is determined in step (5) that the code cache is not full, storing the converted machine code in the code cache and returning to step (1) to perform the next method; And
(7) 단계 (5)에서 코드 캐시가 풀인 것으로 확인된 경우, 상기 코드 캐시에 저장된 임의의 메소드를 선택하여 해당 머신 코드를 상기 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장하고 상기 코드 캐시에서 삭제한 후, 상기 변환된 머신 코드를 상기 코드 캐시에 저장하고 단계 (1)로 돌아가 다음 메소드를 수행하는 단계를 포함하는 것을 그 구성상의 특징으로 한다.
(7) If it is found in step (5) that the code cache is full, select any method stored in the code cache to store the corresponding machine code in the client-preceding compiler (c-AOTC) file and in the code cache. After the deletion, storing the converted machine code in the code cache and returning to step (1) to perform the next method.
바람직하게는,Preferably,
상기 단계 (1) 내지 단계 (7)를 수행하여 하나의 클래스에 포함된 모든 메소드에 대하여 변환을 완료하면, 다음 클래스로 이동하여 상기 단계 (1) 내지 단계 (7)를 수행하되, 상기 클라이언트-선행 컴파일러(c-AOTC) 파일은 클래스마다 하나씩 별개로 생성시킬 수 있다.
When the conversion is completed for all methods included in one class by performing the steps (1) to (7), go to the next class and perform the steps (1) to (7), wherein the client- A precompiler (c-AOTC) file can be created, one for each class.
바람직하게는, 상기 단계 (7)에서,Preferably, in step (7),
상기 선택된 임의의 메소드는, 상기 코드 캐시에 저장된 메소드들 중 가장 먼저 저장된 메소드일 수 있다.
The selected method may be the first stored method among the methods stored in the code cache.
바람직하게는, 상기 단계 (7)에서,Preferably, in step (7),
상기 선택된 임의의 메소드는, 상기 코드 캐시에 저장된 메소드들 중 호출 횟수가 가장 적은 메소드일 수 있다.
The selected method may be a method having the least number of calls among methods stored in the code cache.
더욱 바람직하게는,More preferably,
메소드가 호출될 때마다 호출 횟수를 카운트하여 저장하는 단계를 더 포함할 수 있다.The method may further include counting and storing the number of invocations each time the method is called.
본 발명에서 제안하고 있는 내장형 시스템을 위한 자바 컴파일링 방법에 따르면, 클라이언트-선행 컴파일러(c-AOTC) 파일에 머신 코드가 저장되어 있지 않은 핫스팟 메소드에 대하여 적시 컴파일러(JITC)를 이용하여 변환된 머신 코드를 코드 캐시에 저장할 때 코드 캐시가 부족할 경우, 코드 캐시에서 임의의 메소드를 선택하여 해당 머신 코드를 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장하고 코드 캐시에서는 삭제한 후, 코드 캐시의 삭제된 공간에 변환된 머신 코드를 저장할 수 있도록 구성함으로써, 적시 컴파일러(JITC)의 이용 시의 코드 캐시의 부족 문제를 해결할 수 있다.According to the Java compilation method for the embedded system proposed in the present invention, a machine converted by using a timely compiler (JITC) for a hotspot method in which a machine code is not stored in a client-preferred compiler (c-AOTC) file. If you run out of code cache when you store your code in the code cache, select any method in the code cache to store the machine code in a client-preceding compiler (c-AOTC) file, delete it from the code cache, and then delete the code cache. By configuring the machine code to be stored in a separate space, it is possible to solve the problem of lack of code cache when using a timely compiler (JITC).
도 1은 본 발명의 일 실시예에 따른 내장형 시스템을 위한 자바 컴파일링 방법의 구성을 나타내는 흐름도.
도 2는 벤치마크 crpyto에 대하여, 본 발명의 일 실시예에 따른 자바 컴파일링 방법을 이용하여 얻어진 성능 값과 JITC만을 사용하여 컴파일한 방법을 이용하여 얻어진 성능 값을 비교하여 나타낸 도면.
도 3은 벤치마크 png에 대하여, 본 발명의 일 실시예에 따른 자바 컴파일링 방법을 이용하여 얻어진 성능 값과 JITC만을 사용하여 컴파일한 방법을 이용하여 얻어진 성능 값을 비교하여 나타낸 도면.1 is a flow chart showing the configuration of a Java compilation method for an embedded system according to an embodiment of the present invention.
FIG. 2 is a diagram showing a comparison between performance values obtained using a method compiled using JITC and performance values obtained using a Java compilation method according to an embodiment of the present invention with respect to a benchmark crpyto. FIG.
3 is a diagram showing a comparison of performance values obtained using a method compiled using JITC and performance values obtained using a Java compilation method according to an embodiment of the present invention with respect to benchmark png.
이하에서는 첨부된 도면들을 참조하여, 본 발명에 따른 실시예에 대하여 상세하게 설명하기로 한다.
Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings.
도 1은 본 발명의 일 실시예에 따른 내장형 시스템을 위한 자바 컴파일링 방법의 구성을 나타내는 흐름도이다. 도 1에 도시된 바와 같이, 본 발명의 일 실시예에 따른 내장형 시스템을 위한 자바 컴파일링 방법은, 자바 응용프로그램이 시작되고 수행되어 종료되는 과정에서, 메소드가 핫스팟 메소드인지 확인하는 단계(S100), 단계 S100에서 핫스팟 메소드가 아닌 것으로 확인된 경우, 인터프리터로 해당 메소드를 수행한 후, 단계 S100으로 돌아가 다음 메소드를 수행하는 단계(S200), 단계 S100에서 핫스팟 메소드인 것으로 확인된 경우, 해당 메소드에 대한 머신 코드가 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장되어 있는지를 확인하는 단계(S300), 단계 S300에서 저장되어 있는 것으로 확인된 경우, 해당 머신 코드를 로딩 및 재배치하여 수행한 후, 단계 S100으로 돌아가 다음 메소드를 수행하는 단계(S400), 단계 S300에서 저장되어 있지 않은 것으로 확인된 경우, 적시 컴파일러(JITC)를 이용하여 해당 메소드의 바이트코드를 머신 코드로 변환한 후, 코드 캐시가 풀인지 여부를 확인하는 단계(S500, S550), 단계 S550에서 코드 캐시가 풀이 아닌 것으로 확인된 경우, 변환된 머신 코드를 코드 캐시에 저장하고 단계 S100으로 돌아가 다음 메소드를 수행하는 단계(S600), 및 단계 S500에서 코드 캐시가 풀인 것으로 확인된 경우, 코드 캐시에 저장된 임의의 메소드를 선택하여 해당 머신 코드를 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장하고 코드 캐시에서 삭제한 후, 변환된 머신 코드를 코드 캐시에 저장하고 단계 S100으로 돌아가 다음 메소드를 수행하는 단계(S700)를 포함하여 구성될 수 있다.
1 is a flowchart illustrating a configuration of a Java compilation method for an embedded system according to an embodiment of the present invention. As shown in FIG. 1, in the Java compilation method for an embedded system according to an embodiment of the present disclosure, in the process of starting, executing, and terminating a Java application, checking whether the method is a hotspot method (S100). If it is determined in step S100 that the method is not a hotspot method, after performing the corresponding method with an interpreter, the method returns to step S100 to perform the next method (S200). Check whether the machine code is stored in the client-priority compiler (c-AOTC) file (S300), if it is determined that the stored in step S300, after performing the loading and relocation of the corresponding machine code, step Return to S100 to perform the next method (S400), if it is determined that it is not stored in step S300, timely compile After converting the byte code of the method into machine code using JITC, and checking whether the code cache is a pool (S500, S550), if it is determined in step S550 that the code cache is not a pool, the conversion Storing the stored machine code in the code cache and returning to step S100 to perform the next method (S600), and if it is determined in step S500 that the code cache is a pool, select any method stored in the code cache to select the corresponding machine code. After storing in a client-preceding compiler (c-AOTC) file and deleting from the code cache, the converted machine code may be stored in the code cache and the process may return to step S100 to perform the next method (S700). .
단계 S100에서는, 자바 응용프로그램 수행 중에 특정 메소드가 핫스팟 메소드인지 여부를 확인한다. 여기서, 핫스팟 메소드(hotspot method)란, 메소드들 중 수행시간이 커서 컴파일 오버헤드에 중요한 영향을 미치는 메소드를 말한다.
In step S100, it is checked whether a specific method is a hot spot method while executing a Java application. Here, the hotspot method refers to a method having an important effect on compilation overhead because of a large execution time among methods.
단계 S100에서, 핫스팟 메소드가 아닌 것으로 확인된 경우, 인터프리터로 해당 메소드를 수행한 후, 단계 S100으로 돌아가 다음 메소드를 수행하게 되며(S200), 핫스팟 메소드인 것으로 확인된 경우, 해당 메소드에 대한 머신 코드가 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장되어 있는지를 확인한다(S300). 즉, 대상 메소드가 핫스팟 메소드가 아니라면 일반적인 절차대로 인터프리터로 해당 메소드를 수행하게 되며, 만약 핫스팟 메소드라면, 먼저 c-AOTC 파일에 해당 메소드의 머신 코드가 저장되어 있는지 여부를 확인하게 된다.
In step S100, if it is determined that the method is not a hotspot method, after performing the corresponding method with an interpreter, the method returns to step S100 to perform the next method (S200), and if it is determined that the method is a hotspot method, the machine code for the method Check whether is stored in the client-priority compiler (c-AOTC) file (S300). In other words, if the target method is not a hotspot method, the interpreter executes the method as usual. If it is a hotspot method, it first checks whether the machine code of the method is stored in the c-AOTC file.
단계 S300에서, 해당 메소드의 머신 코드가 저장되어 있는 것으로 확인된 경우, 해당 머신 코드를 로딩 및 재배치하여 수행한 후, 단계 S100으로 돌아가 다음 메소드를 수행하게 되면(S400), 해당 메소드의 머신 코드가 저장되어 있지 않은 것으로 확인된 경우, 적시 컴파일러(JITC)를 이용하여 해당 메소드의 바이트코드를 머신 코드로 변환한 후(S500), 코드 캐시가 풀인지 여부를 확인하게 된다(S550). 즉, 대상 메소드에 대한 머신 코드가 이미 변환되어 c-AOTC 파일에 저장되어 있다면, 해당 머신 코드를 로딩 및 재배치하여 수행하되, 만약 해당 머신 코드가 c-AOTC 파일에 저장되어 있지 않다면, JICT를 이용하여 새롭게 변환하게 된다. 또한, 변환 후에는 변환된 머신 코드가 코드 캐시에 저장될 수 있는지 여부를 확인하기 위해서, 코드 캐시가 풀인지 여부를 확인하게 된다. 단계 S400에서 재배치(Relocation)란, c-AOTC에 의해서 파일에 저장된 머신 코드를 재사용할 때 머신 코드에서 사용하는 주소 값을 현재 수행의 상황에 맞도록 수정하는 작업이다. 저장된 머신 코드를 그대로 재사용하려면, 매번 프로그램이 수행될 때마다 JITC가 동일한 메소드에 대해 동일한 머신 코드를 생성할 수 있어야 한다. 하지만 실제로는 프로그램이 수행될 때 데이터와 코드가 메모리에 위치하는 곳(주소)이 다를 수밖에 없으며, 그 결과 이전에 생성된 코드를 그대로 사용하게 되면 코드에 있는 메모리 주소 값은 전혀 다른 데이터를 가리키게 돼서 오작동을 일으키게 된다. 이것을 피하기 위해, 데이터와 코드에 대한 메모리 주소 값을 수정하는 과정을 재배치라고 한다.
In step S300, when it is confirmed that the machine code of the method is stored, after loading and rearranging the corresponding machine code, the process returns to step S100 to perform the next method (S400). If it is determined that it is not stored, the time code compiler (JITC) is used to convert the bytecode of the method into machine code (S500), and then check whether the code cache is full (S550). That is, if the machine code for the target method is already converted and stored in the c-AOTC file, the machine code is loaded and relocated. If the machine code is not stored in the c-AOTC file, the JICT is used. To convert it. In addition, after the conversion, in order to check whether the converted machine code can be stored in the code cache, it is checked whether the code cache is full. Relocation in step S400 is an operation of modifying the address value used in the machine code to match the current execution situation when reusing the machine code stored in the file by c-AOTC. To reuse the stored machine code as it is, every time the program is run, JITC must be able to generate the same machine code for the same method. In reality, however, when the program is run, the data and the location of the code are inevitably different from each other. As a result, if the previously generated code is used as it is, the memory address in the code points to completely different data. It may cause malfunction. To avoid this, the process of modifying memory address values for data and code is called relocation.
단계 S550에서, 코드 캐시가 풀이 아닌 것으로 확인된 경우, 변환된 머신 코드를 코드 캐시에 저장하고 단계 S100으로 돌아가 다음 메소드를 수행하게 되며(S600), 코드 캐시가 풀인 것으로 확인된 경우, 코드 캐시에 저장된 임의의 메소드를 선택하여 해당 머신 코드를 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장하고 코드 캐시에서 삭제한 후, 변환된 머신 코드를 코드 캐시에 저장하고 단계 S100으로 돌아가 다음 메소드를 수행하게 된다(S700). 보다 구체적으로 설명하면, 현재 코드 캐시가 풀이 아니라면, 단계 S500에서 대상 메소드에 대하여 JITC를 이용하여 새롭게 변환한 머신 코드를 코드 캐시에 저장하게 되며, 만약 현재 코드 캐시가 풀이라면 변환한 머신 코드를 저장하기 위해 코드 캐시에 공간을 새롭게 만들게 된다. 이를 위하여, 코드 캐시에 저장된 메소드들 중 임의의 하나 이상을 선택하여 해당 머신 코드를 삭제하되, 삭제하기 전에 먼저 해당 머신 코드를 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장하여 추후 사용할 수 있도록 한다. 이와 같이, 코드 캐시에서 선택된 메소드를 그냥 삭제하는 것이 아니라, 해당 머신 코드를 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장함으로써, 추후 해당 메소드가 다시 수행될 경우 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장된 머신 코드를 로딩하여 다시 사용할 수 있게 된다.
In step S550, if it is determined that the code cache is not a pool, the converted machine code is stored in the code cache and the process returns to step S100 to perform the next method (S600). Select any saved method to save the machine code in a client-preceding compiler (c-AOTC) file and delete it from the code cache, then save the converted machine code in the code cache and return to step S100 to perform the next method. It becomes (S700). More specifically, if the current code cache is not a pool, the newly converted machine code using JITC for the target method is stored in the code cache in step S500. If the current code cache is a pool, the converted machine code is stored. To do this, we create a new space in the code cache. To do this, select any one or more of the methods stored in the code cache and delete the machine code, but before you delete it, save the machine code in a client-preferred compiler (c-AOTC) file for later use. . As such, instead of simply deleting the selected method from the code cache, the machine code is stored in a client-preceding compiler (c-AOTC) file, so that if the method is subsequently executed, the client-preferred compiler (c-AOTC) The machine code stored in the file can be loaded and reused.
단계 S700에서 캐시 코드에서 삭제할 머신 코드를 선택하는 과정이 중요한데, 이를 위해 본 발명에서는 다음과 같은 2가지 방법을 제한한다. 물론, 2가지 방법은 일례일 뿐인 것으로서 이것만으로 제한되는 것은 아니다.
In step S700, the process of selecting the machine code to delete from the cache code is important. To this end, the present invention restricts the following two methods. Of course, the two methods are merely examples and are not limited thereto.
먼저, 코드 캐시에 저장된 메소드들 중 가장 먼저 저장된 메소드를 선택할 수 있다. 이것은 일종의 FIFO(First In First Out) 방식이라 할 수 있다. 본 방식은, 머신 코드가 생성되는 순서를 기억하여 가장 먼저 저장된 머신 코드를 선택한다는 것으로서, 가장 단순한 휴리스틱이지만, 가장 오래전에 생성된 머신 코드가 현재 수행되지 않을 확률이 높다는 가정 하에서 사용될 수 있다.
First, you can select the method stored first among the methods stored in the code cache. This is a kind of FIFO (First In First Out) method. The present method is to select the machine code stored first by remembering the order in which the machine code is generated, which is the simplest heuristic, but can be used under the assumption that the machine code generated the longest is unlikely to be currently executed.
다른 하나의 방식으로서, 코드 캐시에 저장된 메소드들 중 호출 횟수가 가장 적은 메소드를 선택할 수 있다. 본 방식은, 프로그램의 수행 동안 자주 수행되는 메소드는 계속하여 자주 호출되어 사용될 것이라는 판단을 기반으로 한다. Java VM에서 이와 같은 판단은 JITC의 대상이 되는 핫스팟 메소드를 선택할 때도 사용되는 전제이다. 본 방식을 이용하여 메소드를 선택할 경우, 메소드가 호출될 때마다 호출 횟수를 카운트하여 저장하는 과정이 추가로 요구된다.
As another method, one of the methods stored in the code cache may be selected the least number of times. This approach is based on the determination that methods that are frequently performed during the execution of a program will continue to be called and used frequently. This decision in the Java VM is also a premise used when selecting hotspot methods that are targeted by JITC. When the method is selected using this method, a process of counting and storing the number of invocations each time the method is called is additionally required.
단계 S100 내지 S700을 수행하여 하나의 클래스에 포함된 모든 메소드에 대하여 변환을 완료하면, 다음 클래스로 이동하여 포함 메소드들에 대하여 단계 S100 내지 S700을 수행하게 된다. 이때, 클라이언트-선행 컴파일러(c-AOTC) 파일은 클래스마다 하나씩 별개로 생성시키는 것이 바람직하다.
When the conversion is completed for all methods included in one class by performing steps S100 to S700, the process moves to the next class and performs steps S100 to S700 for the included methods. In this case, it is preferable to generate a client-preceding compiler (c-AOTC) file separately for each class.
단계 S100 내지 S700으로 구현되는 본 발명에 따른 자바 컴파일링 방법을 기존 방법과 비교하여 설명하면 다음과 같다. 기존에는 JITC 수행 시에 코드 캐시가 부족할 경우 두 가지 선택을 할 수 있었다. 첫 번째 선택은, 더 이상의 JITC을 수행하지 않는 것이다. 이 경우 JITC을 포기한 시점 이후에 선택된 핫스팟 메소드를 프로그램의 수행 내내 인터프리터로만 수행하기 때문에 JITC으로 성능 향상을 얻을 기회를 놓치게 된다. 두 번째 선택은, 이미 JITC되어 있던 메소드 중에서 하나를 선택하여 코드 캐시에서 해당하는 머신 코드를 제거하는 것이다. 이 경우에는 이미 핫스팟으로 선택되었던 메소드의 머신 코드를 더 이상 수행할 수 없다. 따라서 이후에 그 메소드를 다시 JITC으로 번역해야 하는 오버헤드가 뒤따르게 된다. 이에 비하여, 본 발명에서 제안하고 있는 방법에 따를 경우, 코드 캐시가 부족할 때 JITC이 선택하는 위의 두 가지 방식이 가지는 모든 단점이 사라지게 된다. 즉, 핫스팟 메소드로 선택되는 모든 메소드를 JITC로 번역하여 사용할 수 있으며, 코드 캐시 부족으로 제거된 머신 코드를 다시 사용하기 위해서 다시 JITC으로 번역할 필요도 없게 된다.
When comparing the Java compilation method according to the present invention implemented in the step S100 to S700 with the existing method as follows. In the past, when the code cache ran out when JITC was run, two choices were available. The first choice is to no longer perform JITC. In this case, after giving up the JITC, the selected hotspot method is executed only by the interpreter for the entire execution of the program, thus losing the opportunity to obtain the performance improvement with the JITC. The second option is to select one of the methods that has already been JITCed to remove the corresponding machine code from the code cache. In this case, you can no longer run the machine code for the method that has already been selected as a hotspot. This is followed by the overhead of translating the method back to JITC. In contrast, according to the method proposed in the present invention, all the disadvantages of the above two methods selected by the JITC when the code cache is insufficient disappear. In other words, all methods selected as hotspot methods can be translated into JITC, and there is no need to translate them back into JITC to reuse machine code that has been removed due to lack of code cache.
다음으로 본 발명에서 제안하고 있는 수행 중 선행 컴파일링(In c-AOTC)을 이용한 내장형 시스템을 위한 자바 컴파일링 방법의 성능을 평가한 실험 결과를 설명하기로 한다.
Next, an experimental result of evaluating the performance of the Java compilation method for the embedded system using the precompilation (In c-AOTC) proposed in the present invention will be described.
실험은 SUN Microsystems사의 CVM RI version build 1.01_fcs-std-b12에 구현한 JITC에서 수행되었다. 구현한 JITC은 안정성 검사에서 거의 대부분을 통과했으며, JVM 규격을 따르고 있다. 실험에 사용한 머신은 MIPS기반의 SoC로 300MHz의 clock 속도를 가진다. I-cache로 16KB, D-cache로 16KB, 메인 메모리로 128MB를 사용하고 있다. c-AOTC 파일을 저장하기 위해서 40GB의 하드 디스크를 설치했다. OS는 내장형 리눅스(kernel v2.4.18)를 사용하고 있다. 벤치마크는 EEMBC중에서 crypto와 png를 사용하였다. 성능 측정을 위해서 각각의 벤치마크를 10번씩 수행하여 그 중 중간값을 가지는 5개를 선택하여 그 평균값을 얻었다. 벤치마크의 결과에 다소 편차가 나타나기 때문에 이런 방식을 취하였다. 이런 편차는 내장형 시스템을 사용함으로써 발생하는 것으로 일반적인 PC나 서버환경보다 민감한 것으로 보인다. 벤치마크를 10번씩 수행하는 것은 CVM 자체를 처음부터 10번씩 수행하는 것을 의미한다. 한 번 실행된 CVM 위에서 벤치마크 프로그램만 10번 수행하게 되면 In c-AOTC의 영향을 왜곡시킬 수 있기 때문이다. 각각의 벤치마크들이 수행하기 전에 모든 저장된 c-AOTC 파일들을 제거하여 In c-AOTC의 영향을 좀 더 정확하게 측정할 수 있도록 하였다. 각 벤치마크를 JITC을 이용해 수행했을 때, 생성하는 머신 코드의 양을 측정하여 벤치마크에 주어지는 코드 캐시의 양을 조절하여 코드 캐시가 모자란 상황을 연출하여 실험을 하였다. crypto는 138KB만큼의 머신 코드를 생성하며, png는 45KB만큼의 머신 코드를 생성한다.
The experiment was performed on the JITC implemented in SUN Microsystems' CVM RI version build 1.01_fcs-std-b12. The implemented JITC has passed most of the stability checks and follows the JVM specification. The machine used in the experiment is a MIPS-based SoC with a clock speed of 300MHz. It uses 16KB for I-cache, 16KB for D-cache, and 128MB for main memory. I installed a 40GB hard disk to store c-AOTC files. The operating system uses built-in Linux (kernel v2.4.18). The benchmark used crypto and png among EEMBC. For the performance measurement, each benchmark was run 10 times, and five of them were selected to obtain the average value. We took this approach because there is some variation in the results of the benchmark. This variation is caused by the use of embedded systems and seems to be more sensitive than typical PC or server environments. Running the benchmark ten times means running the CVM itself ten times from the beginning. This is because running the benchmark program only 10 times on the once executed CVM can distort the impact of Inc-AOTC. Before each benchmark was run, all stored c-AOTC files were removed to better measure the impact of In c-AOTC. When each benchmark was executed using JITC, we experimented by measuring the amount of machine code generated and adjusting the amount of code cache given to the benchmark to create a situation where the code cache was insufficient. crypto generates 138KB of machine code, and png generates 45KB of machine code.
벤치마크가 사용할 수 있는 코드 캐시를 각 벤치마크별로 100%, 90%, 75%, 50%로 제한을 두고 성능을 평가해 보았다. 벤치마크의 성능은 벤치마크의 스코어(score)가 아닌 직접 수행되는 시간을 측정하였다.
We evaluated performance by limiting the code cache that the benchmark can use to 100%, 90%, 75%, and 50% for each benchmark. The performance of the benchmark was measured directly on time, not on the score of the benchmark.
비교대상이 되는 JITC의 성능은 코드 캐시가 100%인 경우 벤치마크의 최선의 성능을 보이게 된다. 코드 캐시가 제한이 있을 경우의 JITC은 코드 캐시가 허용하는 한 메소드를 JITC으로 컴파일 하지만, 코드 캐시가 부족해지면 이후에 핫스팟 메소드로 선택되더라도 컴파일하지 못하게 된다.
JITC's performance is comparable to benchmark performance when the code cache is 100%. If the code cache is limited, JITC compiles the method to JITC as long as the code cache allows, but if the code cache runs out, it will not compile even if it is later selected as a hotspot method.
표 1은, 벤치마크 crpyto에 대하여, 본 발명의 일 실시예에 따른 자바 컴파일링 방법을 이용하여 얻어진 성능 값과 JITC만을 사용하여 컴파일한 방법을 이용하여 얻어진 성능 값을 비교하여 나타낸 표이다. 표 1에서, JITC은 위에서 이야기한 코드 캐시가 제한된 상태에서 JITC을 사용한 성능 값이며, 나머지 FIFO, LFU는 코드 캐시가 제한된 상태에서 본 발명에 따른 방법(In c-AOTC)에 각각의 휴리스틱을 사용한 성능 값이다(FIFO는 코드 캐시에 저장된 메소드들 중 가장 먼저 저장된 메소드를 선택하는 방식을 나타내며, LFU는 코드 캐시에 저장된 메소드들 중 호출 횟수가 가장 적은 메소드를 선택하는 방식을 나타낸다).Table 1 shows a comparison of performance values obtained using a method compiled using JITC and performance values obtained using a Java compilation method according to an embodiment of the present invention with respect to benchmark crpyto. In Table 1, JITC is a performance value using JITC with the above-mentioned code cache limited, and the remaining FIFOs and LFUs using each heuristic in the method (In c-AOTC) according to the present invention with the code cache limited. It is a performance value (FIFO indicates how to select the first stored method in the code cache, and LFU indicates how to select the least number of methods stored in the code cache).
도 2는 표 1의 값을 100% JITC의 시간인 8559ms로 나누어 성능 비율 값을 그래프로 표현한 것이다. 따라서, 도 2에서 ‘1’의 값은 JITC이 100%의 코드 캐시를 가지는 경우이다. 도 2에서 성능을 비교해 보면, 코드 캐시가 줄어듦에 따라 기존 방법인 JITC의 성능 저하가 가장 큼을 분명하게 확인할 수 있다. 본 발명에서 제안하고 있는 방법(In c-AOTC)의 성능은 JITC이 100% 수행되는 성능에 본 방법에서 발생하는 머신 코드의 파일 입출력(File I/O) 오버헤드 값이 합쳐진 것이다. 따라서 코드 캐시가 적을 때 본 발명에서 제안하고 있는 방법(In c-AOTC)에서 발생하는 File I/O의 오버헤드가 메소드에 JITC을 사용하지 못하여 잃어버리는 손해보다 작다고 결론 낼 수 있다. 또한, 도 2로부터, 본 발명에서 제안하고 있는 방법(In c-AOTC)에서 사용되는 휴리스틱 간에도 성능의 차이가 심하게 나타나고 있음을 확인할 수 있다.
2 is a graph showing the performance ratio value by dividing the value of Table 1 by 8559 ms, which is the time of 100% JITC. Therefore, the value '1' in FIG. 2 is a case where the JITC has a code cache of 100%. Comparing the performance in Figure 2, it can be clearly seen that as the code cache is reduced, the performance degradation of the conventional method, JITC is the biggest. The performance of the method proposed by the present invention (In c-AOTC) is that the performance of JITC is 100% combined with the file I / O overhead of the machine code generated in the method. Therefore, it can be concluded that, when the code cache is small, the overhead of File I / O occurring in the method proposed by the present invention (In c-AOTC) is smaller than the loss lost by not using JITC in the method. In addition, it can be seen from FIG. 2 that the performance difference is severely shown among the heuristics used in the method (In c-AOTC) proposed by the present invention.
표 2는, 벤치마크 crypto에 대하여, 본 발명에서 제안하고 있는 방법(In c-AOTC)에서 휴리스틱별로 발생하는 머신 코드의 저장, 로딩의 횟수를 보여주고 있다. 벤치마크 crypto에서 JITC에 의해 머신 코드로 번역되는 메소드는 39개이며, ‘저장’ 값이 ‘39’인 경우 코드 캐시의 모든 메소드가 c-AOTC 파일에 저장되는 것을 의미한다. 표 2에서 코드 캐시가 적어짐에 따라 저장과 로딩의 횟수가 크게 증가하며, 이런 File I/O에 비례해서 도 2에서 그 성능이 저하됨을 확인할 수 있다. 또한, FIFO에 비해 LFU는 더 적은 저장을 가지게 되는데, 이는 파일에 저장하는 머신 코드의 양이 더 적어서 추가로 사용하는 파일 시스템(file system)이 적음을 의미한다.Table 2 shows the number of times of storing and loading the machine code generated by each heuristic in the method proposed by the present invention (In c-AOTC) for the benchmark crypto. In the benchmark crypto, there are 39 methods that are translated into machine code by JITC, and a "save" value of "39" means that all methods in the code cache are stored in the c-AOTC file. As the code cache decreases in Table 2, the number of times of storing and loading increases greatly, and the performance decreases in FIG. 2 in proportion to the File I / O. In addition, LFU has less storage than FIFO, which means that the amount of machine code stored in a file is less, which means less file system.
휴리스틱
표 3은, 벤치마크 png에 대하여, 본 발명의 일 실시예에 따른 자바 컴파일링 방법을 이용하여 얻어진 성능 값과 JITC만을 사용하여 컴파일한 방법을 이용하여 얻어진 성능 값을 비교하여 나타낸 표이다. 또한, 도 3은 표 3의 값을 100% JITC의 시간인 8269ms로 나누어 성능 비율 값을 그래프로 표현한 것이다. 벤치마크 png에 대해서도, 벤치마크 crypto와 마찬가지로 코드 캐시가 줄어듦에 따라 JITC의 성능 저하가 가장 크고, 본 발명에서 제안하고 있는 방법(FIFO, LFU)이 제한된 코드 캐시를 사용하는 JITC보다 성능이 월등함을 확인할 수 있다.Table 3 is a table comparing benchmark values with those obtained using a method compiled using JITC and a performance value obtained using a Java compilation method according to an embodiment of the present invention. In addition, FIG. 3 is a graph showing performance ratio values by dividing the values of Table 3 by 8269 ms, which is the time of 100% JITC. As for benchmark png, the performance of JITC is greatest as the code cache decreases, as in benchmark crypto, and the method proposed by the present invention (FIFO, LFU) outperforms JITC using a limited code cache. can confirm.
표 4는, 벤치마크 png에 대하여, 본 발명에서 제안하고 있는 방법(In c-AOTC)에서 휴리스틱별로 발생하는 머신 코드의 저장, 로딩의 횟수를 보여주고 있다. 벤치마크 png에서 JITC에 의해 머신 코드로 번역되는 메소드는 16개이다. 표 4에서 코드 캐시가 적어짐에 따라 저장과 로딩의 횟수가 크게 증가하며, 이런 File I/O에 비례해서 도 3에서 그 성능이 저하됨을 확인할 수 있다. 또한, 저장할 머신 코드의 양이 FIFO 방식보다 LFU 방식에서 더 적음을 분명하게 확인할 수 있다.Table 4 shows the number of times of storing and loading the machine code generated for each heuristic in the method (In c-AOTC) proposed by the present invention for the benchmark png. In the benchmark png, there are 16 methods that are translated into machine code by JITC. In Table 4, as the number of code caches decreases, the number of times of storing and loading increases greatly, and the performance decreases in FIG. 3 in proportion to the file I / O. It can also be clearly seen that the amount of machine code to store is less in the LFU method than in the FIFO method.
휴리스틱
이상 설명한 본 발명은 본 발명이 속한 기술분야에서 통상의 지식을 가진 자에 의하여 다양한 변형이나 응용이 가능하며, 본 발명에 따른 기술적 사상의 범위는 아래의 특허청구범위에 의하여 정해져야 할 것이다.The present invention described above may be variously modified or applied by those skilled in the art, and the scope of the technical idea according to the present invention should be defined by the following claims.
S100: 메소드가 핫스팟 메소드인지 확인하는 단계
S200: 인터프리터로 해당 메소드를 수행하는 단계
S300: 해당 메소드에 대한 머신 코드가 c-AOTC 파일에 저장되어 있는지를 확인하는 단계
S400: 해당 머신 코드를 로딩 및 재배치하여 수행하는 단계
S500: JITC을 이용하여 해당 메소드의 바이트코드를 머신 코드로 변환하는 단계
S550: 코드 캐시가 풀인지 여부를 확인하는 단계
S600: 변환된 머신 코드를 코드 캐시에 저장하는 단계
S700: 코드 캐시에 저장된 임의의 메소드를 선택하여 해당 머신 코드를 c-AOTC 파일에 저장하고 코드 캐시에서 삭제한 후, 변환된 머신 코드를 코드 캐시에 저장하는 단계S100: Step of checking if the method is a hotspot method
S200: step of performing the method with the interpreter
S300: Step to check if the machine code for the method is stored in the c-AOTC file
S400: steps performed by loading and relocating the machine code
S500: converting the byte code of the method into machine code using JITC
S550: Checking whether the code cache is a pool
S600: storing the converted machine code in a code cache
S700: selecting any method stored in the code cache, storing the corresponding machine code in the c-AOTC file, deleting it from the code cache, and storing the converted machine code in the code cache
Claims (5)
(1) 자바 응용프로그램 수행 중, 메소드가 핫스팟(hot spot) 메소드인지 확인하는 단계;
(2) 단계 (1)에서 핫스팟 메소드가 아닌 것으로 확인된 경우, 인터프리터(interpreter)로 해당 메소드를 수행한 후, 단계 (1)로 돌아가 다음 메소드를 수행하는 단계;
(3) 단계 (1)에서 핫스팟 메소드인 것으로 확인된 경우, 해당 메소드에 대한 머신 코드가 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장되어 있는지를 확인하는 단계;
(4) 단계 (3)에서 저장되어 있는 것으로 확인된 경우, 해당 머신 코드를 로딩 및 재배치(relocation)하여 수행한 후, 단계 (1)로 돌아가 다음 메소드를 수행하는 단계;
(5) 단계 (3)에서 저장되어 있지 않은 것으로 확인된 경우, 적시 컴파일러(Just-In-Time Compiler; JITC)를 이용하여 해당 메소드의 바이트코드를 머신 코드로 변환한 후, 코드 캐시(code cache)가 풀(full)인지 여부를 확인하는 단계;
(6) 단계 (5)에서 상기 코드 캐시가 풀이 아닌 것으로 확인된 경우, 상기 변환된 머신 코드를 상기 코드 캐시에 저장하고 단계 (1)로 돌아가 다음 메소드를 수행하는 단계; 및
(7) 단계 (5)에서 코드 캐시가 풀인 것으로 확인된 경우, 상기 코드 캐시에 저장된 임의의 메소드를 선택하여 해당 머신 코드를 상기 클라이언트-선행 컴파일러(c-AOTC) 파일에 저장하고 상기 코드 캐시에서 삭제한 후, 상기 변환된 머신 코드를 상기 코드 캐시에 저장하고 단계 (1)로 돌아가 다음 메소드를 수행하는 단계
를 포함하는 것을 특징으로 하는 내장형 시스템을 위한 자바 컴파일링 방법.
As a Java compilation method for embedded system using In client Ahead-Of-Time Compiling (In c-AOTC),
(1) checking whether the method is a hot spot method while executing a Java application;
(2) if it is determined in step (1) that the method is not a hotspot method, performing the method with an interpreter, and then returning to step (1) to perform the next method;
(3) if it is determined in step (1) that it is a hotspot method, checking whether the machine code for the method is stored in a client-preceding compiler (c-AOTC) file;
(4) if it is determined that the data is stored in step (3), after loading and relocating the corresponding machine code to perform the method, returning to step (1) to perform the next method;
(5) If it is confirmed that it is not stored in step (3), after converting the bytecode of the method into machine code using a Just-In-Time Compiler (JITC), the code cache Checking whether) is full;
(6) if it is determined in step (5) that the code cache is not full, storing the converted machine code in the code cache and returning to step (1) to perform the next method; And
(7) If the code cache is found to be full in step (5), select any method stored in the code cache to store the machine code in the client-preceding compiler (c-AOTC) file and in the code cache. After deleting, storing the converted machine code in the code cache and returning to step (1) to perform the next method
Java compilation method for an embedded system comprising a.
상기 단계 (1) 내지 단계 (7)를 수행하여 하나의 클래스에 포함된 모든 메소드에 대하여 변환을 완료하면, 다음 클래스로 이동하여 상기 단계 (1) 내지 단계 (7)를 수행하되, 상기 클라이언트-선행 컴파일러(c-AOTC) 파일은 클래스마다 하나씩 별개로 생성시키는 것을 특징으로 하는 내장형 시스템을 위한 자바 컴파일링 방법.
The method of claim 1,
When the conversion is completed for all methods included in one class by performing the steps (1) to (7), go to the next class and perform the steps (1) to (7), wherein the client- Precompiler (c-AOTC) files are generated separately for each class, Java compilation method for an embedded system.
상기 선택된 임의의 메소드는, 상기 코드 캐시에 저장된 메소드들 중 가장 먼저 저장된 메소드인 것을 특징으로 하는 내장형 시스템을 위한 자바 컴파일링 방법.
The method of claim 1, wherein in step (7),
The selected method is Java compilation method for an embedded system, characterized in that the first stored method of the method stored in the code cache.
상기 선택된 임의의 메소드는, 상기 코드 캐시에 저장된 메소드들 중 호출 횟수가 가장 적은 메소드인 것을 특징으로 하는 내장형 시스템을 위한 자바 컴파일링 방법.
The method of claim 1, wherein in step (7),
The selected method is a Java compilation method for an embedded system, characterized in that the method is the least number of methods stored in the code cache.
메소드가 호출될 때마다 호출 횟수를 카운트하여 저장하는 단계를 더 포함하는 것을 특징으로 하는 내장형 시스템을 위한 자바 컴파일링 방법.The method of claim 4, wherein
And counting and storing the number of invocations each time the method is called.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| KR1020100002023A KR101088516B1 (en) | 2010-01-08 | 2010-01-08 | Compilation method for embedded system using precompilation during execution |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| KR1020100002023A KR101088516B1 (en) | 2010-01-08 | 2010-01-08 | Compilation method for embedded system using precompilation during execution |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| KR20110081720A true KR20110081720A (en) | 2011-07-14 |
| KR101088516B1 KR101088516B1 (en) | 2011-11-30 |
Family
ID=44920169
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| KR1020100002023A Expired - Fee Related KR101088516B1 (en) | 2010-01-08 | 2010-01-08 | Compilation method for embedded system using precompilation during execution |
Country Status (1)
| Country | Link |
|---|---|
| KR (1) | KR101088516B1 (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2017018644A1 (en) * | 2015-07-30 | 2017-02-02 | 삼성전자 주식회사 | Electronic device, compiling method and computer-readable recording medium |
| WO2020101288A1 (en) * | 2018-11-16 | 2020-05-22 | Samsung Electronics Co., Ltd. | User equipment, server, control method of the user equipment and control method of the server |
-
2010
- 2010-01-08 KR KR1020100002023A patent/KR101088516B1/en not_active Expired - Fee Related
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2017018644A1 (en) * | 2015-07-30 | 2017-02-02 | 삼성전자 주식회사 | Electronic device, compiling method and computer-readable recording medium |
| US10635421B2 (en) | 2015-07-30 | 2020-04-28 | Samsung Electronics Co., Ltd. | Electronic device, compiling method and computer-readable recording medium |
| WO2020101288A1 (en) * | 2018-11-16 | 2020-05-22 | Samsung Electronics Co., Ltd. | User equipment, server, control method of the user equipment and control method of the server |
| KR20200057301A (en) * | 2018-11-16 | 2020-05-26 | 삼성전자주식회사 | User terminal device, server, control method of user terminal device and control method of server |
| US11194603B2 (en) | 2018-11-16 | 2021-12-07 | Samsung Electronics Co., Ltd. | User equipment, server, control method of the user equipment and control method of the server for performing ahead-of-time (AOT) compilation of an application based on usage frequency |
Also Published As
| Publication number | Publication date |
|---|---|
| KR101088516B1 (en) | 2011-11-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| Bala et al. | Dynamo: A transparent dynamic optimization system | |
| US8296745B2 (en) | Method and apparatus for portable stub generation | |
| KR102112081B1 (en) | Method and device for identifying high-use intermediate code in a language virtual machine | |
| US10216497B2 (en) | Selective compiling method, device, and corresponding computer program product | |
| CN111399990B (en) | Method and apparatus for interpreting and executing smart contract instructions | |
| US8307353B2 (en) | Cross-domain inlining in a system virtual machine | |
| WO2011054223A1 (en) | Method and device for dynamically loading relocatable file | |
| US20240134666A1 (en) | Hybrid just in time load module compiler with performance optimizations | |
| CN110245467A (en) | Android application protection method based on Dex2C and LLVM | |
| US8281296B2 (en) | Cross-ISA inlining in a system virtual machine | |
| US20160378452A1 (en) | Policy-Based Compression of Machine Code Generated by a Virtual Machine | |
| KR20080103970A (en) | Computer-readable Media and Methods for Adaptive Compiled Code | |
| US7823140B2 (en) | Java bytecode translation method and Java interpreter performing the same | |
| KR101088516B1 (en) | Compilation method for embedded system using precompilation during execution | |
| Hong et al. | Java client ahead-of-time compiler for embedded systems | |
| KR101088515B1 (en) | Computer-readable recording media that records install-time compiler programs for embedded Java systems | |
| Lim et al. | A selective ahead-of-time compiler on android device | |
| KR20130077673A (en) | A extended method for eliminating null pointer check using method specialization | |
| Kubica et al. | μBPF: Using eBPF for Microcontroller Compartmentalization | |
| 홍성현 | Client Ahead-Of-Time Compiler for App-Downloading Systems | |
| Hong et al. | Client ahead‐of‐time compiler for embedded Java platforms | |
| Alexander et al. | Boosting instruction set simulator performance with parallel block optimisation and replacement | |
| Däumler et al. | Reducing startup time of a deterministic virtualizing runtime environment | |
| You et al. | A static region‐based compiler for the Dalvik virtual machine | |
| HK40032971B (en) | Method and device for explaining and executing intelligent contract instruction |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A201 | Request for examination | ||
| PA0109 | Patent application |
St.27 status event code: A-0-1-A10-A12-nap-PA0109 |
|
| PA0201 | Request for examination |
St.27 status event code: A-1-2-D10-D11-exm-PA0201 |
|
| D13-X000 | Search requested |
St.27 status event code: A-1-2-D10-D13-srh-X000 |
|
| R17-X000 | Change to representative recorded |
St.27 status event code: A-3-3-R10-R17-oth-X000 |
|
| D14-X000 | Search report completed |
St.27 status event code: A-1-2-D10-D14-srh-X000 |
|
| E902 | Notification of reason for refusal | ||
| PE0902 | Notice of grounds for rejection |
St.27 status event code: A-1-2-D10-D21-exm-PE0902 |
|
| E13-X000 | Pre-grant limitation requested |
St.27 status event code: A-2-3-E10-E13-lim-X000 |
|
| P11-X000 | Amendment of application requested |
St.27 status event code: A-2-2-P10-P11-nap-X000 |
|
| P13-X000 | Application amended |
St.27 status event code: A-2-2-P10-P13-nap-X000 |
|
| PG1501 | Laying open of application |
St.27 status event code: A-1-1-Q10-Q12-nap-PG1501 |
|
| E701 | Decision to grant or registration of patent right | ||
| PE0701 | Decision of registration |
St.27 status event code: A-1-2-D10-D22-exm-PE0701 |
|
| GRNT | Written decision to grant | ||
| PR0701 | Registration of establishment |
St.27 status event code: A-2-4-F10-F11-exm-PR0701 |
|
| PR1002 | Payment of registration fee |
St.27 status event code: A-2-2-U10-U11-oth-PR1002 Fee payment year number: 1 |
|
| PG1601 | Publication of registration |
St.27 status event code: A-4-4-Q10-Q13-nap-PG1601 |
|
| PN2301 | Change of applicant |
St.27 status event code: A-5-5-R10-R13-asn-PN2301 St.27 status event code: A-5-5-R10-R11-asn-PN2301 |
|
| FPAY | Annual fee payment |
Payment date: 20141103 Year of fee payment: 4 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 4 |
|
| FPAY | Annual fee payment |
Payment date: 20151102 Year of fee payment: 5 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 5 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 6 |
|
| FPAY | Annual fee payment |
Payment date: 20171101 Year of fee payment: 7 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 7 |
|
| P22-X000 | Classification modified |
St.27 status event code: A-4-4-P10-P22-nap-X000 |
|
| P22-X000 | Classification modified |
St.27 status event code: A-4-4-P10-P22-nap-X000 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 8 |
|
| FPAY | Annual fee payment |
Payment date: 20191028 Year of fee payment: 9 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 9 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 10 |
|
| PN2301 | Change of applicant |
St.27 status event code: A-5-5-R10-R11-asn-PN2301 |
|
| PN2301 | Change of applicant |
St.27 status event code: A-5-5-R10-R14-asn-PN2301 |
|
| P14-X000 | Amendment of ip right document requested |
St.27 status event code: A-5-5-P10-P14-nap-X000 |
|
| P16-X000 | Ip right document amended |
St.27 status event code: A-5-5-P10-P16-nap-X000 |
|
| Q16-X000 | A copy of ip right certificate issued |
St.27 status event code: A-4-4-Q10-Q16-nap-X000 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 11 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 12 |
|
| P14-X000 | Amendment of ip right document requested |
St.27 status event code: A-5-5-P10-P14-nap-X000 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 13 |
|
| PN2301 | Change of applicant |
St.27 status event code: A-5-5-R10-R13-asn-PN2301 St.27 status event code: A-5-5-R10-R11-asn-PN2301 |
|
| PC1903 | Unpaid annual fee |
St.27 status event code: A-4-4-U10-U13-oth-PC1903 Not in force date: 20241126 Payment event data comment text: Termination Category : DEFAULT_OF_REGISTRATION_FEE |
|
| H13 | Ip right lapsed |
Free format text: ST27 STATUS EVENT CODE: N-4-6-H10-H13-OTH-PC1903 (AS PROVIDED BY THE NATIONAL OFFICE); TERMINATION CATEGORY : DEFAULT_OF_REGISTRATION_FEE Effective date: 20241126 |
|
| PC1903 | Unpaid annual fee |
St.27 status event code: N-4-6-H10-H13-oth-PC1903 Ip right cessation event data comment text: Termination Category : DEFAULT_OF_REGISTRATION_FEE Not in force date: 20241126 |