KR101100439B1 - A method for performing effective just-in-time compile in multi-core environment - Google Patents

A method for performing effective just-in-time compile in multi-core environment Download PDF

Info

Publication number
KR101100439B1
KR101100439B1 KR1020100129537A KR20100129537A KR101100439B1 KR 101100439 B1 KR101100439 B1 KR 101100439B1 KR 1020100129537 A KR1020100129537 A KR 1020100129537A KR 20100129537 A KR20100129537 A KR 20100129537A KR 101100439 B1 KR101100439 B1 KR 101100439B1
Authority
KR
South Korea
Prior art keywords
thread
timely
compiler
code
machine code
Prior art date
Application number
KR1020100129537A
Other languages
Korean (ko)
Inventor
문수묵
정동헌
Original Assignee
한국과학기술연구원
서울대학교산학협력단
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 한국과학기술연구원, 서울대학교산학협력단 filed Critical 한국과학기술연구원
Priority to KR1020100129537A priority Critical patent/KR101100439B1/en
Application granted granted Critical
Publication of KR101100439B1 publication Critical patent/KR101100439B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/468Specific access rights for resources, e.g. using capability register
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/524Deadlock detection or avoidance

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE: An effective JITC performing method in a multicore environment is provided to support JITC requests by sharing a main thread and a thread performing a JITC and efficiently utilizing a multicore. CONSTITUTION: A JITC thread with a relatively lower priority than a main thread is generated if a compile request about a predetermined code section is received among performing the application(S200). The JITC thread is performed if the idle time of the main thread or the machine code of the JITC thread is necessary(S300). A machine code generated by performing the JITC thread is stored in a code cache(S400).

Description

멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법{A METHOD FOR PERFORMING EFFECTIVE JUST-IN-TIME COMPILE IN MULTI-CORE ENVIRONMENT}How to perform efficient and timely compilation in a multicore environment {A METHOD FOR PERFORMING EFFECTIVE JUST-IN-TIME COMPILE IN MULTI-CORE ENVIRONMENT}

본 발명은 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법에 관한 것으로서, 특히 동시에 복수 개의 코드 영역을 컴파일하여 적시 컴파일러 스레드를 생성해 사용함으로써, 멀티코어를 제대로 활용할 수 있는 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법에 관한 것이다.The present invention relates to a method for performing efficient and timely compilation in a multicore environment. In particular, the present invention relates to an efficient and timely compilation in a multicore environment that can utilize multicore properly by compiling a plurality of code regions at the same time and creating and using a compiler thread in a timely manner. It relates to how to perform.

최근 다양한 기기에서 동일한 동작을 수행하는 응용 프로그램인 어플리케이션(Application)을 구현하기 위한 방안으로 가상 머신을 많이 활용하고 있다. 휴대전화나 Digital TV에서 많이 쓰이는 자바 가상 머신, 웹에서 Rich Internet Application을 구현한 자바 스크립트 엔진, 최근엔 구글에서 개발하여 다양한 스마트폰에 탑재되어 배포되는 안드로이드의 달빅 가상 머신까지 많은 영역에서 가상 머신이 활용되고 있다.
Recently, virtual machines have been widely used as a method for implementing applications, which are applications that perform the same operations on various devices. The virtual machine is used in many areas such as Java virtual machine, which is widely used in mobile phones and digital TVs, JavaScript engine that implements Rich Internet Application on the web, and Dalvik virtual machine of Android, which is developed by Google and distributed on various smartphones. It is becoming.

어플리케이션은 하드웨어 비종속적인 중간 코드 형태로 배포되며, 배포된 어플리케이션은 하드웨어에서 직접 수행되는 것이 아니라 소프트웨어 수행 환경인 가상 머신을 통하여 수행되기 때문에, 다양한 하드웨어 환경에서도 일관적인 수행 환경을 보장할 수 있다. 하지만 중간코드가 해석기(interpreter)를 통하여 수행되므로 어플리케이션 수행 성능이 떨어지는 문제점이 있다. 이러한 문제를 해결하기 위하여 흔히 사용되는 방법이 적시 컴파일러(Just-in-Time Compiler, JITC)이다.
The application is distributed in the form of hardware-independent intermediate code, and the distributed application is not executed directly in hardware but through a virtual machine, which is a software execution environment, thereby ensuring a consistent execution environment in various hardware environments. However, since the intermediate code is executed through an interpreter, there is a problem in that the performance of the application is reduced. A commonly used method to solve this problem is the Just-in-Time Compiler (JITC).

적시 컴파일러는 수행 중에 어플리케이션의 하드웨어 비종속적인 중간 코드를 하드웨어의 기계어 코드로 변환한다. 그리고 변환된 기계어 코드는 하드웨어에서 직접 수행할 수 있기 때문에 매우 빠르게 어플리케이션을 수행할 수 있다.
The timely compiler converts the application's hardware-independent intermediate code into hardware's machine code during execution. And because the translated machine code can be executed directly in hardware, the application can be executed very quickly.

그러나 대부분의 JITC는 수행 도중 어플리케이션이 멈추는 현상이 종종 발생한다는 문제점이 있으며, 또한 한 순간에 하나의 코드 영역만 변환하는 작업을 수행하기 때문에, 이러한 제약으로 인해 멀티코어를 제대로 활용하지 못하게 된다는 문제점이 있다. 따라서 최근에는 JITC를 새로운 스레드에서 수행하게 하여 어플리케이션 메인 스레드(Main Thread)와 함께 동작하게 하는 방법을 사용하는 경우도 있지만, 여전히 부족한 성능을 나타낸다는 문제점이 있다.However, most JITCs have a problem that an application freezes during execution, and since only one area of code is converted at a time, this limitation prevents the use of multicore. have. Therefore, in recent years, the JITC can be executed in a new thread so that it works with the main thread of the application, but there is still a problem of insufficient performance.

본 발명은 기존에 제안된 방법들의 상기와 같은 문제점들을 해결하기 위해 제안된 것으로서, 메인 스레드와 적시 컴파일러를 수행하는 스레드를 여러 개로 나누어 멀티코어를 충분히 활용할 수 있도록 함으로써, 어플리케이션이 수행되는 도중 메인 스레드가 느려지거나, 적시 컴파일러에 의해 수행이 멈추게 되거나, 또는 적시 컴파일러를 하나만 수행함에 따라 복수 개의 적시 컴파일 수행 요청을 제대로 지원하지 못하는 문제를 완벽하게 해결할 수 있는 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법을 제공하는 것을 그 목적으로 한다.The present invention has been proposed to solve the above problems of the conventionally proposed methods, by dividing the main thread and the thread that executes the timely compiler into several to make full use of the multicore, the main thread while the application is running Is an efficient way to perform timely compiles in a multicore environment that can perfectly solve the problem of slowing down, stopped by a timely compiler, or failing to properly support multiple timely compile requests by running only one timely compiler. Its purpose is to provide.

상기한 목적을 달성하기 위한 본 발명의 특징에 따른, 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법은,According to an aspect of the present invention for achieving the above object, an efficient timely compilation method in a multicore environment,

(1) 어플리케이션의 실행 중 특정 코드 영역에 대한 컴파일 요청이 있을 경우, 메인 스레드에 비해 상대적으로 낮은 우선순위를 갖는 적시 컴파일러 스레드(JITC thread)를 생성하는 단계;(1) creating a timely compiler thread (JITC thread) having a lower priority relative to the main thread when there is a compilation request for a specific code region during execution of an application;

(2) 상기 메인 스레드의 유휴시간인 경우 또는 상기 적시 컴파일러 스레드의 기계어 코드(machine code)가 반드시 필요하다고 판단되는 경우, 상기 적시 컴파일러 스레드를 수행하는 단계;(2) performing the timely compiler thread when it is determined that machine code of the timely compiler thread is necessary when it is idle time of the main thread;

(3) 상기 적시 컴파일러 스레드의 수행으로 인해 생성된 기계어 코드를 하나의 코드 캐시(code cache)에 저장하는 단계;(3) storing the machine code generated by the timely execution of the compiler thread in one code cache;

(4) 상기 적시 컴파일러 스레드에 할당된 잠금, 중앙처리장치(CPU), 메모리 자원을 모두 해제하는 단계; 및(4) releasing all locks, CPUs, and memory resources allocated to the compiler thread in a timely manner; And

(5) 상기 메인 스레드의 수행 중 메소드(method) 또는 트레이스(trace)가 수행되는 경우, 상기 코드 캐시에 상기 기계어 코드가 저장된 것이 확인된다면 상기 기계어 코드를 수행하는 단계를 포함하는 것을 그 구성상의 특징으로 한다.
(5) if a method or trace is performed during execution of the main thread, performing the machine code if it is confirmed that the machine code is stored in the code cache. It is done.

바람직하게는,Preferably,

(0) 메인 스레드(main thread)에서 어플리케이션을 실행하는 단계를 더 포함할 수 있다.
(0) The method may further include executing the application in the main thread.

바람직하게는, 상기 단계 (1)에서,Preferably, in step (1),

상기 적시 컴파일러 스레드를 복수 개 생성하는 경우, 상기 적시 컴파일러 스레드별로 상기 우선순위가 상이하도록 설정하여 멀티코어(multi-core)의 각 코어에 분산시킬 수 있다.
When generating a plurality of timely compiler threads, the priority may be set to be different for each timely compiler thread and distributed to each core of a multi-core.

바람직하게는, 상기 단계 (2)에서,Preferably, in step (2),

상기 메인 스레드의 수행 도중 컴파일 요청에 따라 즉시 상기 적시 컴파일러 스레드를 수행하고, 수행 결과를 상기 메인 스레드에 반영시킬 수 있다.
During the execution of the main thread, the compiler thread may be immediately executed according to a compilation request, and the execution result may be reflected on the main thread.

바람직하게는, 상기 단계 (2)에서,Preferably, in step (2),

상기 적시 컴파일러 스레드가 복수 개 생성되는 경우, 상기 적시 컴파일러 스레드를 동시에 수행할 수 있다.
When a plurality of timely compiler threads are generated, the timely compiler threads may be simultaneously executed.

바람직하게는, 상기 단계 (3)에서,Preferably, in step (3),

상기 적시 컴파일러 스레드가 복수 개 생성되는 경우, 상기 기계어 코드가 서로 간섭되지 않도록 상기 코드 캐시에 잠금을 걸어서 상기 기계어 코드를 저장할 수 있다.
When a plurality of timely compiler threads are generated, the machine code may be stored by locking the code cache so that the machine code does not interfere with each other.

더욱 바람직하게는, 상기 단계 (3)에서,More preferably, in step (3),

상기 코드 캐시를 하나만 사용함에 따라 데드락(deadlock)이 발생하는 것을 최소화하기 위하여, 상기 코드 캐시를 잠근 직후에 상기 기계어 코드를 사용할 수 있다.The machine code may be used immediately after the code cache is locked in order to minimize the occurrence of deadlocks by using only one code cache.

본 발명에서 제안하고 있는 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법에 따르면, 메인 스레드와 적시 컴파일러를 수행하는 스레드를 여러 개로 나누어 멀티코어를 충분히 활용할 수 있도록 함으로써, 어플리케이션이 수행되는 도중 메인 스레드가 느려지거나, 적시 컴파일러에 의해 수행이 멈추게 되거나, 또는 적시 컴파일러를 하나만 수행함에 따라 복수 개의 적시 컴파일 수행 요청을 제대로 지원하지 못하는 문제를 완벽하게 해결할 수 있다.According to the method for efficiently and timely compiling in the multicore environment proposed by the present invention, the main thread is slowed down while the application is executed by dividing the main thread and the thread executing the timely compiler into multiple threads to fully utilize the multicore. In other words, the execution is stopped by the timely compiler, or the execution of only one timely compiler completely solves the problem of not supporting multiple timely compile execution requests.

도 1은 본 발명의 일실시예에 따른 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법의 순서도.
도 2는 본 발명의 일실시예에 따른 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법의 블록도.
1 is a flowchart of a method for efficiently performing timely compilation in a multicore environment according to an embodiment of the present invention.
2 is a block diagram of a method for efficiently performing timely compilation in a multicore environment according to an embodiment of the present invention.

이하에서는 첨부된 도면을 참조하여 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자가 본 발명을 용이하게 실시할 수 있도록 바람직한 실시예를 상세히 설명한다. 다만, 본 발명의 바람직한 실시예를 상세하게 설명함에 있어, 관련된 공지 기능 또는 구성에 대한 구체적인 설명이 본 발명의 요지를 불필요하게 흐릴 수 있다고 판단되는 경우에는 그 상세한 설명을 생략한다. 또한, 유사한 기능 및 작용을 하는 부분에 대해서는 도면 전체에 걸쳐 동일 또는 유사한 부호를 사용한다.
Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the accompanying drawings so that those skilled in the art can easily carry out the present invention. However, in describing the preferred embodiment of the present invention in detail, if it is determined that the detailed description of the related known function or configuration may unnecessarily obscure the subject matter of the present invention, the detailed description thereof will be omitted. The same or similar reference numerals are used throughout the drawings for portions having similar functions and functions.

덧붙여, 명세서 전체에서, 어떤 부분이 다른 부분과 ‘연결’되어 있다고 할 때, 이는 ‘직접적으로 연결’되어 있는 경우뿐만 아니라, 그 중간에 다른 소자를 사이에 두고 ‘간접적으로 연결’되어 있는 경우도 포함한다. 또한, 어떤 구성요소를 ‘포함’한다는 것은, 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 포함할 수 있다는 것을 의미한다.
In addition, throughout the specification, when a part is 'connected' to another part, it is not only 'directly connected' but also 'indirectly connected' with another element in between. Include. In addition, the term 'comprising' of an element means that the element may further include other elements, not to exclude other elements unless specifically stated otherwise.

도 1은 본 발명의 일실시예에 따른 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법의 순서도이다. 도 1에 도시된 바와 같이, 본 발명의 일실시예에 따른 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법은, 메인 스레드(main thread)에서 어플리케이션을 실행하는 단계(S100), 어플리케이션의 실행 중 특정 코드 영역에 대한 컴파일 요청이 있을 경우, 메인 스레드에 비해 상대적으로 낮은 우선순위를 갖는 적시 컴파일러 스레드(JITC thread)를 생성하는 단계(S200), 메인 스레드의 유휴시간인 경우 또는 적시 컴파일러 스레드의 기계어 코드(machine code)가 반드시 필요하다고 판단되는 경우, 적시 컴파일러 스레드를 수행하는 단계(S300), 적시 컴파일러 스레드의 수행으로 인해 생성된 기계어 코드를 하나의 코드 캐시(code cache)에 저장하는 단계(S400), 적시 컴파일러 스레드에 할당된 잠금, 중앙처리장치(CPU), 메모리 자원을 모두 해제하는 단계(S500), 메인 스레드의 수행 중 메소드(method) 또는 트레이스(trace)가 수행되는 경우, 코드 캐시에 기계어 코드가 저장된 것이 확인된다면 기계어 코드를 수행하는 단계(S600)를 포함하여 구성될 수 있다.
1 is a flowchart of a method for efficiently performing timely compilation in a multicore environment according to an embodiment of the present invention. As shown in FIG. 1, in a multi-core environment, an efficient timely compilation method according to an embodiment of the present invention includes executing an application in a main thread (S100), and executing specific code of the application. If there is a compilation request for the region, the step of creating a timely compiler thread (JITC thread) having a lower priority relative to the main thread (S200), in the case of idle time of the main thread or timely machine code of the compiler thread ( When it is determined that the machine code is absolutely necessary, performing the timely compiler thread (S300), storing the machine code generated by the execution of the timely compiler thread in one code cache (S400), Releasing all locks, CPUs, and memory resources allocated to the compiler thread in a timely manner (S500); When a method or trace is performed during execution, if it is confirmed that the machine code is stored in the code cache, the method may include the step of performing the machine code (S600).

단계 S100에서는, 메인 스레드(main thread)에서 어플리케이션을 실행한다. 수행을 하는 도중에 또는 수행 전에 핫스팟 메소드(hot spot method)나 핫스팟 트레이스(hot spot trace)로 판단되는 코드 영역에 대해서는, 빠른 수행을 위해 적시 컴파일레이션(Just-In-Time Compilation)을 요청할 수 있다.
In step S100, the application is executed in the main thread. Just-in-time compilation may be requested for quick execution of a code region determined to be a hot spot method or a hot spot trace during or before execution.

단계 S200에서는, 어플리케이션의 실행 중 특정 코드 영역에 대한 컴파일 요청이 있을 경우, 메인 스레드에 비해 상대적으로 낮은 우선순위를 갖는 적시 컴파일러 스레드(JITC thread)를 생성한다. 적시 컴파일 수행을 요청받은 즉시 가상 머신(LLVM(Low-Level Virtual Machine; 저수준 가상 기계) 등)에서는 먼저 이전에 동일한 코드 영역에 대해서 컴파일 요청이 있었는지 여부를 확인한다. 이미 컴파일 요청이 있어서 적시 컴파일을 수행하고 있는 중이라면 아무것도 진행하지 않으며, 새로운 코드 영역을 요청하는 경우에만 적시 컴파일러를 위한 적시 컴파일러 스레드(JITC thread)를 생성한다.
In step S200, when there is a compilation request for a specific code region during execution of an application, a timely compiler thread (JITC thread) having a lower priority than a main thread is generated. As soon as a request for timely compilation is performed, the virtual machine (Low-Level Virtual Machine (LLVM), etc.) first checks whether there was a compilation request for the same code region before. If there is already a compilation request and is doing a compile timely, nothing will happen, and a JITC thread will be created for the just-in-time compiler only when a new code region is requested.

생성되는 적시 컴파일러 스레드는 메인 스레드에 영향을 주지 않기 위해서, 우선순위를 메인 스레드에 비해 상대적으로 낮게 설정할 수 있으며, 적시 컴파일러 스레드를 복수 개 생성할 경우, 요청되는 코드 영역의 중요도에 따라 적시 컴파일러 스레드별로 우선순위가 각각 상이하도록 설정하여 멀티코어(multi-core)의 각 코어에 분산시킬 수 있다. 이를 통해 본 발명은, 중요도가 높거나 신속하게 컴파일이 필요한 코드 영역에 대하여 미리 컴파일을 수행할 수 있다.
The generated timely compiler thread can be set to a lower priority than the main thread in order not to affect the main thread.When creating multiple timely compiler threads, the timely compiler thread can be set according to the importance of the requested code area. The priority may be set to be different for each core, and may be distributed to each core of a multi-core. Through this, the present invention can compile in advance on the code region of high importance or need to be compiled quickly.

단계 S300에서는, 메인 스레드의 유휴시간인 경우 또는 적시 컴파일러 스레드의 기계어 코드(machine code)가 반드시 필요하다고 판단되는 경우, 적시 컴파일러 스레드를 수행한다. 단계 S200에서 적시 컴파일러 스레드를 복수 개 생성할 경우, 적시 컴파일러 스레드를 동시에 수행할 수 있다.
In step S300, when it is determined that the machine thread of the main thread is idle or timely compiler machine code is necessary, timely compiler thread is performed. When generating a plurality of timely compiler threads in step S200, timely compiler threads can be executed simultaneously.

단계 S300에서는 메인 스레드가 유휴 시간(Idle Time)임을 확인하거나, 기계어 코드가 반드시 사용되어야 하는지 여부를 판별하여 컴파일을 수행할 수 있으나, 또는 메인 스레드의 수행 도중 컴파일 요청에 따라 즉시 상기 적시 컴파일러 스레드를 수행하고, 수행 결과를 상기 메인 스레드에 반영시킬 수도 있다. 따라서 본 발명에서 새롭게 생성된 적시 컴파일러 스레드는, 운영체제의 도움을 받아 현재 사용 중이지 않은 코어에 할당이 되어 수행될 것이므로, 수행 효율이 혁신적으로 향상될 수 있음을 알 수 있다.
In step S300, whether the main thread is idle time (Idle Time), or whether the machine code must be used to determine whether to compile, or during the execution of the main thread immediately in accordance with the compilation request, the timely compiler thread The execution result may be reflected in the main thread. Accordingly, it can be seen that the newly created timely compiler thread may be allocated to a core not currently being used with the help of an operating system, and thus, the execution efficiency may be improved.

단계 S400에서는, 적시 컴파일러 스레드의 수행으로 인해 생성된 기계어 코드를 하나의 코드 캐시(code cache)에 저장한다. 즉 적시 컴파일러를 이용하여 컴파일된 기계어 코드를 코드 캐시 영역에 저장하여 관리할 수 있다. 이때 본 발명의 단계 S400에서는 어플리케이션에 대한 기계어 코드를 하나의 코드 캐시 영역에 모두 저장하여야 하기 때문에, 단계 S200에서 생성된 적시 컴파일러 스레드가 복수 개일 경우, 복수 개의 적시 컴파일러 스레드로부터 생성된 복수 개의 기계어 코드가 서로 간섭되지 않도록, 코드 캐시에 잠금을 걸어서 기계어 코드를 저장할 수 있다.
In step S400, machine code generated by timely execution of the compiler thread is stored in one code cache. That is, timely compiler can be used to store the compiled machine code in the code cache area. In this case, since in step S400 of the present invention, all the machine code for the application must be stored in one code cache area, when there are a plurality of timely compiler threads generated in step S200, a plurality of machine code generated from a plurality of timely compiler threads The machine code can be stored by locking the code cache so that they do not interfere with each other.

또한 단계 S400에서는, 저장이 모두 끝나면 코드 캐시의 잠금을 풀고 다른 적시 컴파일러 스레드가 기계어 코드를 작성할 수 있도록 한다. 다만 이때 코드 캐시를 잠근 직후에 기계어 코드를 사용하는 것이 바람직한데, 이는 코드 캐시를 잠근 뒤에는 메인 스레드나 다른 적시 컴파일러가 수행됨에 따라 데드락(deadlock)이 발생할 수 있는 문제점이 있기 때문이다. 즉 기계어 코드를, 코드 캐시를 잠근 직후 및 코드 캐시에 저장하기 전에 사용하는 것은, 코드 캐시를 하나만 사용함에 따라 데드락이 발생하는 것을 최소화하기 위함이다.
In addition, in step S400, when the storing is completed, the code cache is unlocked and other timely compiler threads can write machine code. However, it is preferable to use machine code immediately after locking the code cache, because after locking the code cache, deadlock may occur as a main thread or other timely compiler is executed. In other words, the use of machine code, immediately after locking the code cache and before storing it in the code cache, is intended to minimize deadlocks by using only one code cache.

단계 S500에서는, 적시 컴파일러 스레드에 할당된 잠금, 중앙처리장치(CPU), 메모리 자원을 모두 해제한다. 코드 캐시에 기계어 코드를 모두 작성한 후에는 CPU, 메모리 등의 모든 자원을 해제하여 수행을 종료할 수 있다.
In step S500, timely releases all locks, CPUs, and memory resources allocated to the compiler thread. After all the machine code has been written to the code cache, all resources such as CPU and memory can be released to complete execution.

단계 S600에서는, 메인 스레드의 수행 중 메소드(method) 또는 트레이스(trace)가 수행되는 경우, 코드 캐시에 기계어 코드가 저장된 것이 확인된다면 기계어 코드를 수행한다. 어플리케이션 수행 도중 필요한 기계어 코드가 있으면, 메인 스레드가 코드 캐시에 저장된 기계어 코드를 획득하여 수행할 수 있도록 한다.
In step S600, if a method or trace is performed during execution of the main thread, the machine code is executed if it is confirmed that the machine code is stored in the code cache. If there is necessary machine code during the execution of the application, the main thread can acquire and execute the machine code stored in the code cache.

도 2는 본 발명의 일실시예에 따른 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법의 블록도이다. 도 2에 도시된 바와 같이, 본 발명의 일실시예에 따른 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법은, 적시 컴파일러 스레드를 생성하되, 적시 컴파일러 스레드의 우선순위를 메인 스레드보다 낮게 설정함으로써 메인 스레드의 수행이 느려지지 않도록 하고, 적시 컴파일러 스레드를 복수 개 생성할 경우에는 각 적시 컴파일러 스레드의 우선순위를 서로 다르게 설정하여, 복수 개의 적시 컴파일러 스레드가 원활하게 동시에 수행될 수 있도록 한다. 이때 적시 컴파일러 스레드 간의 수행 관리(Scheduling)는, 일반적인 스레드 수행 관리(Thread Scheduling)를 이용할 수 있다.
2 is a block diagram of a method for efficiently performing timely compilation in a multicore environment according to an embodiment of the present invention. As shown in FIG. 2, an efficient timely compilation method in a multicore environment according to an embodiment of the present invention generates a timely compiler thread, but sets a priority of the timely compiler thread to be lower than the main thread. In order to avoid slowing down the execution of time, and when generating a plurality of timely compiler threads, the priority of each timely compiler thread is set differently, so that a plurality of timely compiler threads can be smoothly executed simultaneously. In this case, time scheduling between compiler threads may use general thread scheduling.

이상 설명한 본 발명은 본 발명이 속한 기술분야에서 통상의 지식을 가진 자에 의하여 다양한 변형이나 응용이 가능하며, 본 발명에 따른 기술적 사상의 범위는 아래의 특허청구범위에 의하여 정해져야 할 것이다.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: 메인 스레드의 유휴시간인 경우 또는 적시 컴파일러 스레드의 기계어 코드가 반드시 필요하다고 판단되는 경우, 적시 컴파일러 스레드를 수행하는 단계
S400: 적시 컴파일러 스레드의 수행으로 인해 생성된 기계어 코드를 하나의 코드 캐시에 저장하는 단계
S500: 적시 컴파일 스레드에 할당된 잠금, 중앙처리장치, 메모리 자원을 모두 해제하는 단계
S600: 메인 스레드의 수행 중 메소드 또는 트레이스가 수행되는 경우, 코드 캐시에 기계어 코드가 저장된 것이 확인된다면 기계어 코드를 수행하는 단계
S100: step of running the application in the main thread
S200: If there is a compilation request for a specific code area while the application is running, generating a timely compiler thread having a lower priority than the main thread.
S300: when the idle time of the main thread or when it is determined that the machine code of the timely compiler thread is absolutely necessary, performing the timely compiler thread
S400: storing machine code generated by timely execution of the compiler thread in one code cache
S500: Release all locks, central processing unit, and memory resources allocated to the compilation thread in a timely manner.
S600: When the method or the trace is performed during the execution of the main thread, if it is confirmed that the machine code is stored in the code cache, the step of executing the machine code

Claims (7)

적시 컴파일 수행 방법에 있어서,
(1) 어플리케이션의 실행 중 특정 코드 영역에 대한 컴파일 요청이 있을 경우, 메인 스레드에 비해 상대적으로 낮은 우선순위를 갖는 적시 컴파일러 스레드(JITC thread)를 생성하는 단계;
(2) 상기 메인 스레드의 유휴시간인 경우 또는 상기 적시 컴파일러 스레드의 기계어 코드(machine code)가 반드시 필요하다고 판단되는 경우, 상기 적시 컴파일러 스레드를 수행하는 단계;
(3) 상기 적시 컴파일러 스레드의 수행으로 인해 생성된 기계어 코드를 하나의 코드 캐쉬(code cache)에 저장하는 단계;
(4) 상기 적시 컴파일러 스레드에 할당된 잠금, 중앙처리장치(CPU), 메모리 자원을 모두 해제하는 단계; 및
(5) 상기 메인 스레드의 수행 중 메소드(method) 또는 트레이스(trace)가 수행되는 경우, 상기 코드 캐시에 상기 기계어 코드가 저장된 것이 확인된다면 상기 기계어 코드를 수행하는 단계를 포함하는 것을 특징으로 하는 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법.
In how to perform a compile timely,
(1) creating a timely compiler thread (JITC thread) having a lower priority relative to the main thread when there is a compilation request for a specific code region during execution of an application;
(2) performing the timely compiler thread when it is determined that machine code of the timely compiler thread is necessary when it is idle time of the main thread;
(3) storing the machine code generated by the execution of the timely compiler thread in one code cache;
(4) releasing all locks, CPUs, and memory resources allocated to the compiler thread in a timely manner; And
(5) if a method or trace is performed during execution of the main thread, performing the machine code if it is confirmed that the machine code is stored in the code cache. How to perform efficient timely compilation in the core environment.
제1항에 있어서,
(0) 메인 스레드(main thread)에서 어플리케이션을 실행하는 단계를 더 포함하는 것을 특징으로 하는 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법.
The method of claim 1,
(0) A method for performing efficient timely compilation in a multicore environment, further comprising executing an application in a main thread.
제1항에 있어서, 상기 단계 (1)에서,
상기 적시 컴파일러 스레드를 복수 개 생성하는 경우, 상기 적시 컴파일러 스레드별로 상기 우선순위가 상이하도록 설정하여 멀티코어(multi-core)의 각 코어에 분산시키는 것을 특징으로 하는 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법.
The method of claim 1, wherein in step (1),
In the case of generating a plurality of timely compiler threads, efficient timely compilation is performed in a multicore environment, wherein the priority of each timely compiler thread is set to be different and distributed to each core of a multi-core. Way.
제1항에 있어서, 상기 단계 (2)에서,
상기 메인 스레드의 수행 도중 컴파일 요청에 따라 즉시 상기 적시 컴파일러 스레드를 수행하고, 수행 결과를 상기 메인 스레드에 반영시키는 것을 특징으로 하는 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법.
The method of claim 1, wherein in step (2),
And executing the timely compiler thread immediately according to a compilation request during the execution of the main thread, and reflecting the result to the main thread.
제1항에 있어서, 상기 단계 (2)에서,
상기 적시 컴파일러 스레드가 복수 개 생성되는 경우, 상기 적시 컴파일러 스레드를 동시에 수행하는 것을 특징으로 하는 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법.
The method of claim 1, wherein in step (2),
And when the plurality of timely compiler threads are generated, simultaneously executing the timely compiler threads.
제1항에 있어서, 상기 단계 (3)에서,
상기 적시 컴파일러 스레드가 복수 개 생성되는 경우, 상기 기계어 코드가 서로 간섭되지 않도록 상기 코드 캐시에 잠금을 걸어서 상기 기계어 코드를 저장하는 것을 특징으로 하는 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법.
The method of claim 1, wherein in step (3),
And when the plurality of timely compiler threads are generated, locking the code cache to store the machine code so that the machine code does not interfere with each other.
제6항에 있어서, 상기 단계 (3)에서,
상기 코드 캐시를 하나만 사용함에 따라 데드락(deadlock)이 발생하는 것을 최소화하기 위하여, 상기 코드 캐시를 잠근 직후에 상기 기계어 코드를 사용하는 것을 특징으로 하는 멀티코어 환경에서의 효율적인 적시 컴파일 수행 방법.
The method of claim 6, wherein in step (3),
And using the machine code immediately after locking the code cache in order to minimize the occurrence of deadlocks by using only one of the code caches.
KR1020100129537A 2010-12-16 2010-12-16 A method for performing effective just-in-time compile in multi-core environment KR101100439B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020100129537A KR101100439B1 (en) 2010-12-16 2010-12-16 A method for performing effective just-in-time compile in multi-core environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020100129537A KR101100439B1 (en) 2010-12-16 2010-12-16 A method for performing effective just-in-time compile in multi-core environment

Publications (1)

Publication Number Publication Date
KR101100439B1 true KR101100439B1 (en) 2011-12-30

Family

ID=45507176

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020100129537A KR101100439B1 (en) 2010-12-16 2010-12-16 A method for performing effective just-in-time compile in multi-core environment

Country Status (1)

Country Link
KR (1) KR101100439B1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20150089577A (en) * 2014-01-28 2015-08-05 한국전자통신연구원 Apparatus and method for accelerating java script engine
KR20150094166A (en) * 2014-02-10 2015-08-19 고려대학교 산학협력단 Device for executing application and method thereof
KR20210069761A (en) * 2019-12-03 2021-06-14 현대오트론 주식회사 Method for executing software in electronic device and electronic device thereof
WO2023013866A1 (en) * 2021-08-02 2023-02-09 삼성전자주식회사 Method for optimizing application and device supporting same

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090249313A1 (en) 2008-03-31 2009-10-01 Sobel William E System and Method for Prioritizing the Compilation of Bytecode Modules During Installation of a Software Application

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090249313A1 (en) 2008-03-31 2009-10-01 Sobel William E System and Method for Prioritizing the Compilation of Bytecode Modules During Installation of a Software Application

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
논문

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20150089577A (en) * 2014-01-28 2015-08-05 한국전자통신연구원 Apparatus and method for accelerating java script engine
KR101694291B1 (en) * 2014-01-28 2017-01-10 한국전자통신연구원 Apparatus and method for accelerating java script engine
KR20150094166A (en) * 2014-02-10 2015-08-19 고려대학교 산학협력단 Device for executing application and method thereof
KR101593583B1 (en) 2014-02-10 2016-02-18 고려대학교 산학협력단 Device for executing application and method thereof
KR20210069761A (en) * 2019-12-03 2021-06-14 현대오트론 주식회사 Method for executing software in electronic device and electronic device thereof
KR102289140B1 (en) 2019-12-03 2021-08-13 현대오트론 주식회사 Method for executing software in electronic device and electronic device thereof
WO2023013866A1 (en) * 2021-08-02 2023-02-09 삼성전자주식회사 Method for optimizing application and device supporting same

Similar Documents

Publication Publication Date Title
US10999214B2 (en) Secure memory with restricted access by processors
KR101778479B1 (en) Concurrent inline cache optimization in accessing dynamically typed objects
US8473935B2 (en) Just-ahead-of-time compilation
EP1912119B1 (en) Synchronization and concurrent execution of control flow and data flow at task level
US8528001B2 (en) Controlling and dynamically varying automatic parallelization
US20110307858A1 (en) Pre-compiling hosted managed code
US20130332711A1 (en) Systems and methods for efficient scheduling of concurrent applications in multithreaded processors
KR101100439B1 (en) A method for performing effective just-in-time compile in multi-core environment
RU2015145292A (en) ACCESS MANAGEMENT DURING EXECUTION OF APPLIED PROGRAMMING INTERFACES
JP2014078239A (en) Method of compiling program to be executed on multi-core processor, and task mapping method and task scheduling method of multi-core processor
Zhang et al. Mocl: an efficient OpenCL implementation for the matrix-2000 architecture
US20140196018A1 (en) Compiler optimization based on collectivity analysis
JP5389899B2 (en) Operating system fast execution command
CN101630268B (en) Synchronous optimization method and synchronous optimization equipment
Luo et al. DFCPP Runtime Library for Dataflow Programming
Mururu et al. PinIt: Influencing OS Scheduling via Compiler-Induced Affinities
Jatala et al. Scratchpad sharing in GPUs
KR20130114023A (en) Method for managing a memory in a multi processor system on chip
Zhu et al. A tool to detect performance problems of multi-threaded programs on numa systems
Duan et al. BulkCompactor: Optimized deterministic execution via conflict-aware commit of atomic blocks
Chen et al. A compiler-assisted runtime-prefetching scheme for heterogeneous platforms
Kim et al. Static function prefetching for efficient code management on scratchpad memory
Jatala et al. Scratchpad sharing in GPUs
Haidl et al. Programming gpus with C++ 14 and just-in-time compilation
You et al. A static region‐based compiler for the Dalvik virtual machine

Legal Events

Date Code Title Description
A201 Request for examination
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20141201

Year of fee payment: 4

FPAY Annual fee payment

Payment date: 20161201

Year of fee payment: 6

FPAY Annual fee payment

Payment date: 20171201

Year of fee payment: 7

FPAY Annual fee payment

Payment date: 20181203

Year of fee payment: 8

FPAY Annual fee payment

Payment date: 20191203

Year of fee payment: 9