JP2011002976A - Program execution controller - Google Patents

Program execution controller Download PDF

Info

Publication number
JP2011002976A
JP2011002976A JP2009144894A JP2009144894A JP2011002976A JP 2011002976 A JP2011002976 A JP 2011002976A JP 2009144894 A JP2009144894 A JP 2009144894A JP 2009144894 A JP2009144894 A JP 2009144894A JP 2011002976 A JP2011002976 A JP 2011002976A
Authority
JP
Japan
Prior art keywords
jit
intermediate code
jit compilation
method information
interpreter
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.)
Pending
Application number
JP2009144894A
Other languages
Japanese (ja)
Inventor
Yoshinobu Hashimoto
芳信 橋本
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic Corp
Original Assignee
Panasonic Corp
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 Panasonic Corp filed Critical Panasonic Corp
Priority to JP2009144894A priority Critical patent/JP2011002976A/en
Publication of JP2011002976A publication Critical patent/JP2011002976A/en
Pending legal-status Critical Current

Links

Images

Abstract

PROBLEM TO BE SOLVED: To provide a program execution controller reducing overhead when a method during JIT (Just In Time) compilation is called.SOLUTION: This program execution controller decides whether the method is already compiled in time of the method call, and executes a native code of the method when the method is already compiled. The program execution controller selects one of the execution of the native code of the method after waiting completion of the compilation of the method and processing of an intermediate code of the method by an interpreter when the method is not already compiled. At that time, the program execution controller selects the one expected that an execution time is shorter at that time point.

Description

本発明は、中間コード列からなるプログラムを実行するプログラム実行制御装置に関し、特に、JITコンパイラを用いたプログラム実行制御装置に関するものである。   The present invention relates to a program execution control apparatus that executes a program including an intermediate code string, and more particularly to a program execution control apparatus using a JIT compiler.

特定のプラットフォームに依存することなくプログラムを実行する、仮想計算機の代表的なものの一つとして、Java(登録商標)言語を用いる技術がある。例えば、Java(登録商標)バイトコードを解釈して実行する、JVM(Java(登録商標) Virtual Machine)が挙げられる。   One of the typical virtual machines that execute programs without depending on a specific platform is a technology using Java (registered trademark) language. For example, there is a JVM (Java (registered trademark) Virtual Machine) that interprets and executes a Java (registered trademark) bytecode.

Java(登録商標)バイトコードは、Java(登録商標)言語で記述されたソースコードをコンパイルすることにより生成される一種の中間コードである。また、JVMは、このバイトコードを逐次解釈してプロセッサに処理を実行させるいわゆるインタプリタとして機能する。   Java (registered trademark) bytecode is a kind of intermediate code generated by compiling source code written in Java (registered trademark) language. The JVM functions as a so-called interpreter that sequentially interprets the bytecode and causes the processor to execute processing.

JVMの介在により、プラットフォームに依存しないプログラム実行環境を実現できるが、その実行速度は、プロセッサが直接理解できるネイティブコードに変換されたプログラムの実行速度に比べ、一般的に遅くなる。そのため、プログラム実行時に、バイトコードをネイティブコードへコンパイルするためのJIT(Just In Time)コンパイラを備えたJVMが考案され、一般に用いられている。   Through the intervention of the JVM, a platform-independent program execution environment can be realized, but the execution speed is generally slower than the execution speed of a program converted into native code that can be directly understood by the processor. Therefore, a JVM having a JIT (Just In Time) compiler for compiling bytecode into native code at the time of program execution has been devised and used in general.

また、Java(登録商標)Scriptなどのスクリプト言語により記述されたプログラムは、スクリプトエンジンにより実行される。このスクリプトエンジンは、プラットフォームに依存しないプログラム実行環境を実現する手段として有用である。このため、スクリプトエンジンは、インタラクティブなネットワーク上のアプリケーションを実現する手段として、ブラウザなどに実装されている。   A program written in a script language such as Java (registered trademark) Script is executed by a script engine. This script engine is useful as a means for realizing a platform-independent program execution environment. For this reason, the script engine is implemented in a browser or the like as a means for realizing an application on an interactive network.

このようなスクリプト言語で記述されたプログラムは、スクリプトエンジンによって一旦中間コードに変換された後、インタプリタ処理で逐次実行されることになる。このようなスクリプトエンジンにおいても、上述のJVM同様、JITコンパイラを備えたものが知られている。   A program written in such a script language is once converted into an intermediate code by a script engine and then sequentially executed by an interpreter process. Also in such a script engine, the thing provided with the JIT compiler is known like the above-mentioned JVM.

上述のようなインタプリタとJITコンパイラを共に備えた従来のプログラム実行制御装置は、プログラム自体の構造解析や、インタプリタ処理時の、メソッドの起動回数の計数などで、当該メソッドをJITコンパイルするか否かを決定する。これは、今後も頻繁に呼び出される可能性が高く、JITコンパイルする価値のある箇所を優先的にJITコンパイルするためである。しかしながら、このように優先順位付けをしてJITコンパイルを行うとしても、プログラム実行開始当初などの一定期間にJITコンパイルが集中してしまうため、プログラムの応答性能の低下が顕著にあらわれるという課題があった。   The conventional program execution control apparatus equipped with both the interpreter and the JIT compiler as described above determines whether or not to JIT compile the method by analyzing the structure of the program itself or counting the number of times the method is activated during the interpreter process. To decide. This is because there is a high possibility that it will be frequently called in the future, and JIT compilation is preferentially performed at a place worth JIT compilation. However, even if JIT compilation is performed with priorities assigned in this way, JIT compilation is concentrated in a certain period of time such as the beginning of program execution, so that there is a problem that the response performance of the program is significantly reduced. It was.

この課題を解決するため、従来の技術では、JITコンパイルは、インタプリタ処理やネイティブコードの実行といったプログラムの実行タスクとは別の低優先度のタスクとして、並行して行うものがあった(例えば、特許分権1参照)。   In order to solve this problem, in the conventional technology, JIT compilation is performed in parallel as a low-priority task different from a program execution task such as interpreter processing or native code execution (for example, See Patent Decentralization 1).

特許文献1に開示された従来の技術では、JITコンパイル済みでないメソッドが呼び出された際は、常にインタプリタ処理で実行していた。また、JITコンパイル中であるメソッドが呼び出された場合、JITコンパイルの終了を待ってからネイティブコードを実行していた。   In the conventional technique disclosed in Patent Document 1, when a method that has not been JIT compiled is called, the method is always executed by an interpreter process. Also, when a method that is undergoing JIT compilation is called, the native code is executed after the end of JIT compilation.

特開2004−355277号公報JP 2004-355277 A

しかしながら、前記従来の技術では、JITコンパイル中であるメソッドが呼び出された際に、当該メソッドのJITコンパイルの状況に基づいて、適切に処理を切り替えることがでないという課題を有していた。   However, the conventional technique has a problem that when a method being JIT compiled is called, the process cannot be switched appropriately based on the JIT compilation status of the method.

つまり、JITコンパイルの終了を待ってからネイティブコードを実行するため、メソッドが呼び出されたとき、当該メソッドがまだJITコンパイル開始の直後であることも考えられる。この場合、JITコンパイルの終了を待つ時間が、オーバーヘッドとなる。一方、常にインタプリタ処理を行う実装の場合、メソッドが呼び出されたとき、当該メソッドのJITコンパイルが既に、終了直前にまで達していると、中間コードのインタプリタ処理での実行に要する時間が、そのままオーバーヘッドとなる。   In other words, since native code is executed after the end of JIT compilation, when a method is called, the method may still be immediately after the start of JIT compilation. In this case, the time waiting for the end of JIT compilation is an overhead. On the other hand, in the case of an implementation that always performs interpreter processing, when a method is called, if the JIT compilation of the method has already reached just before termination, the time required for execution of the intermediate code interpreter processing remains overhead. It becomes.

本発明は、前記従来の課題を解決するもので、メソッドが呼び出された際に、当該メソッドのJITコンパイルの状況に基づいて、ネイティブコード実行またはインタプリタ処理を選択するプログラム実行制御装置を提供することを目的とする。   The present invention solves the above-described conventional problems, and provides a program execution control device that selects native code execution or interpreter processing when a method is called based on the JIT compilation status of the method. With the goal.

前記従来の課題を解決するために、本発明のプログラム実行制御装置は、コンパイラと、インタプリタと、別タスクで行うJITコンパイラとを備え、ソースコードから生成した中間コードを順次読み込んで、解釈実行するプログラム実行制御装置であって、前記JITコンパイラによる前記中間コードのJITコンパイル状況をメソッド情報としてメソッド毎に保持するメソッド情報管理手段と、前記メソッド情報管理手段に保持されているメソッド情報へのアクセスを制御するメソッド情報更新手段と、前記メソッド情報管理手段に保持されているメソッド情報に基づいて、前記JITコンパイル状況が転換点に達しているか否かを判定するJITコンパイル状況判定手段と、前記インタプリタによる前記中間コードの実行がメソッドの呼び出しに達した際に、前記メソッド情報管理手段に保持されているメソッド情報を参照し、呼び出された前記メソッドがコンパイル中であって、前記JITコンパイル状況が転換点に達していない場合には、前記インタプリタにより前記中間コードを逐次解釈し実行することを選択し、転換点に達している場合には、前記JITコンパイラによるネイティブコードへの変換の終了を待ってから前記ネイティブコードを実行することを選択するプログラム制御手段を備えたことを特徴とする。   In order to solve the above-described conventional problems, a program execution control apparatus according to the present invention includes a compiler, an interpreter, and a JIT compiler that performs a separate task, and sequentially reads and interprets intermediate code generated from source code. A program execution control device, comprising: a method information management unit that holds the JIT compilation status of the intermediate code by the JIT compiler as method information for each method; and access to the method information held in the method information management unit. A method information updating means for controlling, a JIT compilation status judging means for judging whether or not the JIT compilation status has reached a turning point based on the method information held in the method information management means, and the interpreter The execution of the intermediate code is the method If the method called in the method information management means is referred to and the called method is being compiled and the JIT compilation status has not reached the turning point The intermediate code is selected to be sequentially interpreted and executed by the interpreter, and when the turning point has been reached, the native code is executed after waiting for the JIT compiler to complete the conversion to the native code. And a program control means for selecting.

本構成によって、メソッドが呼び出された際に、当該メソッドのJITコンパイルの進捗状況に基づいて、ネイティブコードを実行するか、インタプリタ処理を行うかを、選択し、適切に処理を切り替えることができる。   With this configuration, when a method is called, it is possible to select whether to execute native code or to perform interpreter processing based on the progress of JIT compilation of the method, and to appropriately switch processing.

本発明のプログラム実行制御装置によれば、呼び出されたメソッドがJITコンパイル途中である場合、当該メソッドのJITコンパイルの状況に基づいて、適切に処理を切り替えることにより、計算機システムのオーバーヘッドを削減することができる。   According to the program execution control apparatus of the present invention, when the called method is in the middle of JIT compilation, the processing system overhead is reduced by appropriately switching the processing based on the JIT compilation status of the method. Can do.

本発明の実施の形態におけるプログラム実行制御装置の構成を示す図The figure which shows the structure of the program execution control apparatus in embodiment of this invention 本発明の実施の形態におけるプログラム実行手段の構成を示す図The figure which shows the structure of the program execution means in embodiment of this invention 本発明の実施の形態におけるプログラム制御手段の動作のフローを示す図The figure which shows the flow of operation | movement of the program control means in embodiment of this invention

以下、本発明の実施の形態について、図面を参照しながら説明する。   Hereinafter, embodiments of the present invention will be described with reference to the drawings.

図1は、本発明の実施の形態におけるプログラム実行制御装置の構成の概要図である。   FIG. 1 is a schematic diagram of a configuration of a program execution control device according to an embodiment of the present invention.

図中101は、本発明のプログラム実行制御装置を示している。プログラム実行制御装置101は、それが動くCPUに固有のネイティブコードへコンパイルされたプログラムであり、メモリシステム上に常駐してソースコードを実行する。即ち、プログラム実行制御装置101は、ソースコードから中間コードへのコンパイル、中間コードの順次読み出しとインタプリタによる逐次実行、中間コードからネイティブコードへのJITコンパイル、ネイティブコードの実行、を行う。   In the figure, reference numeral 101 denotes a program execution control device of the present invention. The program execution control device 101 is a program compiled into native code unique to the CPU on which it runs, and resides on the memory system to execute the source code. That is, the program execution control apparatus 101 performs compilation from source code to intermediate code, sequential reading of intermediate code and sequential execution by an interpreter, JIT compilation from intermediate code to native code, and execution of native code.

図中102は、プログラムコードの集まりであるソースコード列を表している。ソースコード列102は、それ自体がアプリケーションプログラムのプログラムコードであり、プログラム実行制御装置101が介在することにより、任意のCPUで実行される。   In the figure, reference numeral 102 denotes a source code string that is a collection of program codes. The source code sequence 102 itself is a program code of an application program, and is executed by an arbitrary CPU through the program execution control device 101.

図中103は、中間コードの集まりである中間コード列を表している。プログラム実行制御装置101が、ソースコード列102から、中間コード列103を生成する。中間コード列103は、ソースコード列102と同様、プログラム実行制御装置101の介在により動く。   In the figure, reference numeral 103 denotes an intermediate code string that is a collection of intermediate codes. The program execution control apparatus 101 generates an intermediate code string 103 from the source code string 102. Similar to the source code sequence 102, the intermediate code sequence 103 moves by the intervention of the program execution control device 101.

図中104は、CPU固有のネイティブコードの集まりであるネイティブコード列を表している。プログラム実行制御装置101が、中間コード列103から、メソッド毎にコンパイルして、ネイティブコードを生成する。   In the figure, reference numeral 104 denotes a native code string that is a collection of native codes unique to the CPU. The program execution control apparatus 101 compiles each method from the intermediate code string 103 to generate native code.

これら、ソースコード列102、中間コード列103、ネイティブコード列104は、また、計算機システムのメモリシステム上にある。   These source code sequence 102, intermediate code sequence 103, and native code sequence 104 are also on the memory system of the computer system.

図中105は、ソースコード列102を中間コード列103へ変換するためのコンパイラである。コンパイラ105は、ソースコード列102から中間コード列103への変換を、中間コードの逐次実行に先行して、一般に一括して行う。   In the figure, reference numeral 105 denotes a compiler for converting the source code string 102 into the intermediate code string 103. The compiler 105 generally performs the conversion from the source code string 102 to the intermediate code string 103 in a lump before sequential execution of the intermediate code.

コンパイラ105は、ソースコード列102から中間コード列103へコンパイルする時に、メソッド毎の中間コードサイズを、中間コード内に付与する。中間コードサイズは、メソッド呼び出し時に、後述のメソッド情報管理表201に登録され、その後のJITコンパイル状況の判定に用いられる。   When compiling from the source code sequence 102 to the intermediate code sequence 103, the compiler 105 gives an intermediate code size for each method in the intermediate code. The intermediate code size is registered in a method information management table 201, which will be described later, when the method is called, and is used for the subsequent JIT compilation status determination.

なお、コンパイラ105は、プログラム実行制御装置101の他の部分と切り離されていてもよい。例えば、サーバサイドが、ソースコード列102から中間コード列103へのコンパイルを行う。クライアントサイドが、ネットワーク経由で、サーバサイドから中間コード列103を取得し、クライアントサイドに実装されたプログラム実行制御装置101を実行するというような構成も可能である。   The compiler 105 may be separated from other parts of the program execution control apparatus 101. For example, the server side compiles from the source code sequence 102 to the intermediate code sequence 103. A configuration in which the client side acquires the intermediate code sequence 103 from the server side via the network and executes the program execution control device 101 installed on the client side is also possible.

図中106は、プログラム実行手段であり、プログラム実行制御装置101を制御するプログラムを表している。プログラム実行手段106は、メソッドが呼び出された際に、当該メソッドのJITコンパイルの状況に基づいて、ネイティブコード実行またはインタプリタ処理を選択し、切り替える機能を有している。   In the figure, reference numeral 106 denotes program execution means, which represents a program for controlling the program execution control apparatus 101. The program execution means 106 has a function of selecting and switching native code execution or interpreter processing based on the JIT compilation status of the method when the method is called.

図中107は、プログラム実行制御装置101のインタプリタであり、プログラム実行手段106が読み込んだ中間コードを逐次解釈して実行する。   In the figure, reference numeral 107 denotes an interpreter of the program execution control apparatus 101, which sequentially interprets and executes the intermediate code read by the program execution means 106.

図中108は、プログラム実行制御装置101のJITコンパイラであり、中間コードからネイティブコードへの変換をメソッド毎に行う。   In the figure, reference numeral 108 denotes a JIT compiler of the program execution control apparatus 101, which performs conversion from intermediate code to native code for each method.

以下、プログラム実行手段106、インタプリタ107、JITコンパイラ108について説明する。   The program execution means 106, interpreter 107, and JIT compiler 108 will be described below.

プログラム実行手段106は、コンパイラ105に指示を出し、ソースコード列102から中間コード列103への変換を行う。なお、前述のように、この部分はプログラム実行制御装置101から切り離されていてもよく、プログラム実行手段106の指示で中間コード列102へのコンパイルが行われることに限定されない。   The program execution means 106 instructs the compiler 105 to convert the source code string 102 to the intermediate code string 103. As described above, this part may be separated from the program execution control apparatus 101, and is not limited to being compiled into the intermediate code string 102 according to an instruction from the program execution means 106.

次に、プログラム実行手段106は、中間コード列103を順次読み込み、インタプリタ107により処理していく。メソッドの呼び出しに達すると、プログラム実行手段106は、当該メソッドの中間コードを中間コード列103から読み込んでインタプリタ処理するか、ネイティブコード列104中の当該メソッドのネイティブコードを実行するか選択する。   Next, the program execution means 106 sequentially reads the intermediate code string 103 and processes it by the interpreter 107. When the method call is reached, the program execution means 106 selects whether to read the intermediate code of the method from the intermediate code string 103 and interpret it, or to execute the native code of the method in the native code string 104.

当該メソッドの中間コードをインタプリタ処理する場合には、インタプリタ107により逐次実行する。   When the intermediate code of the method is interpreted, it is sequentially executed by the interpreter 107.

なお、ここにおいて、中間コードをインタプリタ処理するとは、少量の処理単位で読み込んだ中間コードに対応するネイティブコードを、CPUに実行させること指している。即ち、インタプリタ107が、中間コードの種類毎に、それが読み込まれたときにどのようなネイティブコードをCPUに実行させるのかを管理している。そして、インタプリタ107が、順次読み込まれた中間コードに対応するネイティブコードを、逐次、CPUに実行させることになる。   Here, interpreting the intermediate code refers to causing the CPU to execute native code corresponding to the intermediate code read in a small amount of processing units. That is, the interpreter 107 manages, for each type of intermediate code, what native code is executed by the CPU when it is read. Then, the interpreter 107 causes the CPU to sequentially execute the native code corresponding to the intermediate code read sequentially.

他方、当該メソッドのネイティブコードを実行するとは、当該メソッドのネイティブコードがあるメモリシステムのアドレスがプログラム実行手段106で管理されている。そして、プログラム実行手段106が、そのアドレスをCPUのプログラムカウンタに設定することに相当する。   On the other hand, to execute the native code of the method, the program execution means 106 manages the address of the memory system where the native code of the method is located. This corresponds to the program execution means 106 setting the address in the program counter of the CPU.

また、プログラム実行手段106は、メソッドの呼び出し時に当該メソッドの中間コードを新規にJITコンパイルするか否かを判断する。JITコンパイルする場合には、JITコンパイラ108に当該メソッドのJITコンパイルを指示する。   Further, the program execution means 106 determines whether or not to JIT-compile the intermediate code of the method at the time of calling the method. In the case of JIT compilation, the JIT compiler 108 is instructed to perform JIT compilation of the method.

インタプリタ107は、プログラム実行手段106からの指示に従い、順次読み込まれる中間コード列103を解釈、実行する。また、インタプリタ107は、メソッド毎のインタプリタ処理時間を計測し、プログラム実行手段106に通知する。   The interpreter 107 interprets and executes the sequentially read intermediate code sequence 103 in accordance with instructions from the program execution means 106. The interpreter 107 measures the interpreter processing time for each method, and notifies the program execution means 106 of it.

JITコンパイラ108は、プログラム実行手段106からのJITコンパイル指示を受け、中間コードからCPU固有のネイティブコードへのJITコンパイルを行う。なお、プログラム実行制御装置101においては、中間コードからネイティブコードへのJITコンパイルは、インタプリタ処理や、ネイティブコードの実行といったプログラムの実行タスクとは別のタスクにおいて並行して行われる。   The JIT compiler 108 receives a JIT compilation instruction from the program execution means 106 and performs JIT compilation from the intermediate code to the native code unique to the CPU. In the program execution control apparatus 101, the JIT compilation from the intermediate code to the native code is performed in parallel with a task different from the program execution task such as interpreter processing and execution of the native code.

また、JITコンパイラ108が、中間コードのコンパイル済みサイズをプログラム実行手段106に通知し、プログラム実効手段106においてメソッド毎に更新、保持される。なお、JITコンパイラ108からの中間コードコンパイル済みサイズの通知は、一定時間が経過したタイミングや、一定サイズのJITコンパイルが終了したタイミングで行われる。   Further, the JIT compiler 108 notifies the program execution means 106 of the compiled size of the intermediate code, and the program execution means 106 updates and holds it for each method. The notification of the intermediate code compiled size from the JIT compiler 108 is performed at a timing when a certain time has passed or when a JIT compilation of a certain size has been completed.

また、JITコンパイラ108はJITコンパイル速度(中間コードの単位サイズあたりのJITコンパイル時間)を計測し、プログラム実行手段106に通知する。これは、後述するJITコンパイル状況判定手段203が、JITコンパイルの終了までに必要な残り時間を見積もるのに用いられる。なお、JITコンパイル速度は、直近のものに限らず、ある一定期間で平均値をとるなどして平滑化したものであってもよい。また、JITコンパイラ108は、JITコンパイルの終了をプログラム実行手段106に通知する。   The JIT compiler 108 measures the JIT compilation speed (JIT compilation time per unit size of intermediate code) and notifies the program execution unit 106 of it. This is used by the JIT compilation status determination unit 203 described later to estimate the remaining time required until the end of JIT compilation. The JIT compilation speed is not limited to the latest one, but may be smoothed by taking an average value for a certain period. The JIT compiler 108 notifies the program execution means 106 of the end of JIT compilation.

以下、プログラム実行手段106の構成を図2に示し、動作の詳細を説明する。   In the following, the configuration of the program execution means 106 is shown in FIG.

図中201は、メソッド情報管理表であり、中間コードの実行時に呼び出されたメソッドの情報が初回に登録され、以後、更新される。   In the figure, reference numeral 201 denotes a method information management table, in which information on the method called when the intermediate code is executed is registered for the first time, and is updated thereafter.

図中202は、メソッド情報管理表更新手段であり、メソッド情報管理表へのアクセス(読み書き)の制御を行う。   In the figure, reference numeral 202 denotes a method information management table update unit, which controls access (read / write) to the method information management table.

図中203は、JITコンパイル状況判定手段であり、メソッド情報管理表に登録されているメソッドのJITコンパイルの状況を判定する。   In the figure, reference numeral 203 denotes JIT compilation status determination means for determining the JIT compilation status of the method registered in the method information management table.

図中204は、プログラム制御手段であり、プログラム実行手段106全般の制御と、プログラム実行手段106のデータの入出力を行う。   In the figure, reference numeral 204 denotes program control means for performing overall control of the program execution means 106 and data input / output of the program execution means 106.

なお、プログラム実行手段106は、それ自体がプログラムである。また、前述のメソッド情報管理表201、メソッド情報管理表更新手段202、JITコンパイル状況判定手段203、プログラム制御手段204は、プログラム実行手段106の概要を説明するために機能毎に分類して明示した構成要素である。   The program execution means 106 is a program itself. Further, the method information management table 201, the method information management table update unit 202, the JIT compilation status determination unit 203, and the program control unit 204 described above are classified and specified for each function in order to explain the outline of the program execution unit 106 It is a component.

以下、メソッド情報管理表201、メソッド情報管理表更新手段202、JITコンパイル状況判定手段203、プログラム制御手段204の動作を説明する。   Hereinafter, operations of the method information management table 201, the method information management table update unit 202, the JIT compilation status determination unit 203, and the program control unit 204 will be described.

メソッド情報管理表201の登録の欄は、そのラインのメソッド情報が有効であるかが登録される。ここでは、1’b0が無効を、1’b1が有効を表すものとする。全ライン、初期値は1’b0であり、メソッド情報が新規に登録されると1’b1に更新される。また、そのラインのメソッド情報が破棄されると、1’b0に更新される。   The registration column of the method information management table 201 registers whether the method information of the line is valid. Here, 1'b0 represents invalidity and 1'b1 represents valid. All lines have an initial value of 1'b0 and are updated to 1'b1 when method information is newly registered. When the method information of the line is discarded, it is updated to 1'b0.

なお、メソッド情報の破棄の方法に関して、ここでは述べないが、別途メソッドの呼び出し傾向などを管理し、呼び出されなくなったメソッドから情報を破棄するなどすればよい。   Although the method information discarding method is not described here, it is only necessary to separately manage the method invocation tendency and discard information from the method that is no longer invoked.

メソッド情報管理表201のメソッドIDの欄には、メソッドを一意に識別するためのメソッドIDが、プログラム制御手段204の指示で、メソッド情報管理表更新手段202により登録される。   In the method ID column of the method information management table 201, a method ID for uniquely identifying a method is registered by the method information management table updating unit 202 according to an instruction from the program control unit 204.

以降、メソッド情報管理表の参照、更新は、直接にはメソッド情報管理表更新手段202が行うものとして説明する。   In the following description, it is assumed that the method information management table updating unit 202 directly refers to and updates the method information management table.

メソッド情報管理表201のインタプリタ処理回数の欄にはメソッド情報の新規登録時に初期値1が登録され、以後当該メソッドがインタプリタ処理されるたびにインクリメントされる。なお、インタプリタ処理の回数に閾値を設け、コンパイル開始条件に用いている場合などは、その閾値でインクリメントを停止してもよい。   In the interpreter processing count column of the method information management table 201, an initial value 1 is registered when new method information is registered, and is incremented each time the method is interpreted. In addition, when the threshold value is provided in the frequency | count of an interpreter process and it uses for a compile start condition, you may stop an increment with the threshold value.

メソッド情報管理表201のインタプリタ処理時間の欄には、インタプリタ107からプログラム制御手段204に通知されるメソッド毎のインタプリタ処理時間が登録、更新される。   In the interpreter processing time column of the method information management table 201, the interpreter processing time for each method notified from the interpreter 107 to the program control means 204 is registered and updated.

なお、インタプリタ107でのインタプリタ処理時間の計測、インタプリタ107からの処理時間の通知、インタプリタ処理時間の欄への登録、更新は、当該メソッドのJITコンパイル状況の欄が2’b01の期間のみであってもよい。これは、インタプリタ処理時間が、JITコンパイル状況判定手段203において、JITコンパイル状況を2’b01から2’b10へ遷移させるときの判定にのみ用いられるからである。また、インタプリタ処理時間は、直近の値に限らず、数回の平均値をとるなどしてある程度の平滑化がなされていてもよい。また、インタプリタ処理の数回おきに計測、更新するなどでもよく、毎回行う必要はない。   Note that the interpreter 107 measures the interpreter processing time, notifies the interpreter 107 of the processing time, registers in the interpreter processing time column, and updates only during the period in which the JIT compilation status column of the method is 2'b01. May be. This is because the interpreter processing time is used only for determination when the JIT compilation status determination unit 203 changes the JIT compilation status from 2'b01 to 2'b10. Further, the interpreter processing time is not limited to the latest value, and may be smoothed to some extent by taking an average value several times. Further, measurement and updating may be performed every several interpreter processes, and it is not necessary to perform each time.

メソッド情報管理表201の中間コードサイズの欄には、中間コード列103中に付与された値が、メソッドの呼び出し時にプログラム制御手段204によって読み取られ、メソッド情報の新規登録時に登録される。   In the intermediate code size column of the method information management table 201, a value assigned in the intermediate code string 103 is read by the program control unit 204 when a method is called and registered when method information is newly registered.

メソッド情報管理表201の中間コードコンパイル済みサイズの欄には、メソッドの新規登録時に初期値0が登録され、以後、JITコンパイラ108からプログラム制御手段204へ通知されるコンパイル済みサイズで更新される。   In the intermediate code compiled size column of the method information management table 201, an initial value of 0 is registered when a method is newly registered, and thereafter updated with the compiled size notified from the JIT compiler 108 to the program control means 204.

なお、JITコンパイラ108におけるコンパイル済みサイズの累積、コンパイル済みサイズの通知、中間コードコンパイル済みサイズの欄の更新は、当該メソッドのJITコンパイル状況の欄が2’b01の期間のみであってもよい。これは、中間コードコンパイル済みサイズは、JITコンパイル状況判定手段203において、JITコンパイル状況を2’b01から2’b10へ遷移させるときの判定にのみ用いられるからである。   The JIT compiler 108 may accumulate the compiled size, notify the compiled size, and update the intermediate code compiled size column only during the period in which the JIT compilation status column of the method is 2'b01. This is because the intermediate code compiled size is used only for determination when the JIT compilation status determination unit 203 changes the JIT compilation status from 2'b01 to 2'b10.

メソッド情報管理表201のJITコンパイル状況の欄には、メソッドの新規登録時に初期値で2’b00が登録され、以後、コンパイルが進むにつれて更新される。   In the JIT compilation status column of the method information management table 201, 2'b00 is registered as an initial value when a method is newly registered, and is updated as compilation proceeds thereafter.

なお、ここでは、JITコンパイル状況の欄の2’b00が未コンパイル状態、2’b01がコンパイル中で転換点には達していない状態、2’b10がコンパイル中で転換点に達している状態、2’b11はコンパイルが終了している状態を表している。   In this example, 2'b00 in the JIT compilation status column is in an uncompiled state, 2'b01 is being compiled and has not reached a turning point, and 2'b10 is being compiled and has reached a turning point. 2′b11 represents a state in which compilation is finished.

プログラム制御手段204が、当該メソッドのJITコンパイルの開始を決定すると、当該メソッドに対応する、メソッド情報管理表201のJITコンパイル状況欄の値が2’b00から2’b01に更新される。その後、JITコンパイルが進み、JITコンパイル状況判定手段203が転換点に達したと判定すると、JITコンパイル状況欄の値が2’b01から2’b10に更新される。その後、JITコンパイル終了時に、JITコンパイル状況欄の値が2’b10から2’b11に更新される。   When the program control unit 204 determines the start of JIT compilation of the method, the value in the JIT compilation status column of the method information management table 201 corresponding to the method is updated from 2'b00 to 2'b01. Thereafter, when JIT compilation proceeds and the JIT compilation status determination means 203 determines that the turning point has been reached, the value in the JIT compilation status column is updated from 2'b01 to 2'b10. Thereafter, at the end of JIT compilation, the value in the JIT compilation status column is updated from 2'b10 to 2'b11.

メソッド情報管理表201のネイティブコードのアドレスの欄には、JITコンパイル後のネイティブコードが格納されるメモリシステムのアドレスが、当該メソッドのJITコンパイルの開始時にプログラム制御手段204から通知され、登録される。   In the address field of the native code of the method information management table 201, the address of the memory system where the native code after JIT compilation is stored is notified from the program control means 204 at the start of JIT compilation of the method and registered. .

メソッド情報管理表更新手段202は、プログラム制御手段204からのメソッド情報管理表201へのアクセスを制御する。メソッド情報の新規登録の際は、プログラム制御手段204から、メソッドID、中間コードサイズを受け、メソッド情報管理表201の登録の欄の値が1’b0であるラインに登録する。   The method information management table update unit 202 controls access to the method information management table 201 from the program control unit 204. When new method information is registered, the method ID and intermediate code size are received from the program control means 204 and registered in the line whose value in the registration column of the method information management table 201 is 1'b0.

また、メソッド情報管理表更新手段202は、メソッド情報の新規登録の際、インタプリタ処理回数の欄の値を1に、中間コードコンパイル済みサイズの値を0に、JITコンパイル状況の値を2’b00に初期化する。   Also, the method information management table updating unit 202 sets the value of the interpreter processing count column to 1, the intermediate code compiled size value to 0, and the JIT compilation status value to 2'b00 when newly registering method information. Initialize to.

また、メソッド情報管理表更新手段202は、プログラム制御手段204からインタプリタ処理時間を適宜受け、更新する。   Further, the method information management table update unit 202 appropriately receives and updates the interpreter processing time from the program control unit 204.

また、メソッド情報管理表更新手段202は、JITコンパイル開始時にはネイティブコードのアドレスを受け、登録する。   Also, the method information management table updating unit 202 receives and registers the address of the native code at the start of JIT compilation.

なお、メソッド情報管理表201のインタプリタ処理時間の欄を更新する際に、平滑化などが行われる場合は、メソッド情報管理表更新手段202においてなされればよい。   If smoothing or the like is performed when updating the interpreter processing time column of the method information management table 201, it may be performed by the method information management table update unit 202.

また、メソッド情報管理表更新手段202は、プログラム制御手段204に対してインタプリタ処理回数を通知する。プログラム制御手段204は、インタプリタ処理回数をもとにして、当該メソッドのJITコンパイル開始を判断する。なお、インタプリタ処理回数の通知のタイミングは、プログラム制御手段204からのアクセスのタイミングで行われればよい。   The method information management table update unit 202 notifies the program control unit 204 of the number of interpreter processes. The program control unit 204 determines the start of JIT compilation of the method based on the number of interpreter processes. Note that the notification timing of the interpreter processing count may be performed at the timing of access from the program control means 204.

また、メソッド情報管理表更新手段202は、JITコンパイル状況判定手段203を用いて、JITコンパイル状況を判定する。判定は、JITコンパイル状況の欄の値が2’b01のメソッドに対してのみ行われ、JITコンパイルが転換点に達したか否かを判定する。この際、メソッド情報管理表更新手段202は、JITコンパイル状況判定手段203に、判定対象のメソッドのインタプリタ処理時間と、中間コードサイズと、中間コードコンパイル済みサイズを渡す。判定後、メソッド情報管理表更新手段202は、JITコンパイル状況判定手段203から、転換点に達していることを通知された場合、メソッド情報管理表のJITコンパイル状況を2’b01から2’b10に変更する。   Further, the method information management table updating unit 202 uses the JIT compilation status determination unit 203 to determine the JIT compilation status. The determination is made only for a method whose value in the JIT compilation status column is 2'b01, and determines whether JIT compilation has reached a turning point. At this time, the method information management table update unit 202 passes the interpreter processing time, the intermediate code size, and the intermediate code compiled size of the determination target method to the JIT compilation status determination unit 203. After the determination, the method information management table updating unit 202, when notified from the JIT compilation status determination unit 203 that the turning point has been reached, changes the JIT compilation status of the method information management table from 2′b01 to 2′b10. change.

JITコンパイル状況判定手段203は、メソッド情報管理表201の中間コードコンパイル済みサイズの更新が行われる際に、JITコンパイル状況の欄の値を2’b01から2’b10へ遷移させるか否かの判定を行う。   The JIT compilation status determination unit 203 determines whether to change the value of the JIT compilation status column from 2′b01 to 2′b10 when the intermediate code compiled size of the method information management table 201 is updated. I do.

なお、JITコンパイル状況の判定は、インタプリタ処理時間の更新に同期して行うとしてもよいし、中間コードコンパイル済みサイズの更新とインタプリタ処理時間の更新の両方に同期するとしてもよい。   The determination of the JIT compilation status may be performed in synchronization with the update of the interpreter processing time, or may be synchronized with both the update of the intermediate code compiled size and the update of the interpreter processing time.

また、JITコンパイル状況判定手段203は、JITコンパイラ108からプログラム制御手段204を介して通知されるJITコンパイル速度を保持し、JITコンパイルの終了までに必要な残り時間の見積もりに用いる。   The JIT compilation status determination unit 203 holds the JIT compilation speed notified from the JIT compiler 108 via the program control unit 204, and uses it to estimate the remaining time required until the end of JIT compilation.

以下、JITコンパイル状況判定手段203が、JITコンパイルの終了までに必要な残り時間とネイティブコードの実行時間とを見積もり、JITコンパイルが転換点に達しているか否かを判定するまでの流れを例示する。   The following is an example of a flow from when the JIT compilation status determination unit 203 estimates the remaining time required for the end of JIT compilation and the execution time of the native code to determine whether the JIT compilation has reached a turning point. .

図2に示すように、メソッド情報管理表201に登録されているメソッドIDがmethod1のメソッドでは、インタプリタ処理時間が1100[ms]である。また、中間コードサイズが10200[byte]、中間コードコンパイル済みサイズが2500[byte]である。   As shown in FIG. 2, in the method whose method ID is method1 registered in the method information management table 201, the interpreter processing time is 1100 [ms]. The intermediate code size is 10200 [bytes], and the intermediate code compiled size is 2500 [bytes].

いま、JITコンパイル状況判定手段203が保持しているコンパイル速度が0.2[ms/byte]であるとし、ネイティブコードの実行時間はインタプリタ処理時間に0.05を掛けて見積もられるものとする。   Assume that the compilation speed held by the JIT compilation status determination unit 203 is 0.2 [ms / byte], and the execution time of the native code is estimated by multiplying the interpreter processing time by 0.05.

JITコンパイル状況判定手段203は、メソッド情報管理表更新手段202から、インタプリタ処理時間、中間コードサイズ、中間コードコンパイル済みサイズを受け取り、JITコンパイル終了までに必要な残り時間を見積もる。   The JIT compilation status determination unit 203 receives the interpreter processing time, the intermediate code size, and the intermediate code compiled size from the method information management table update unit 202, and estimates the remaining time required until the end of JIT compilation.

このとき、JITコンパイルの残量は10200[byte]−2500[byte]=7700[byte]である。このため、JITコンパイル終了までに必要な残り時間は7700[byte]×0.2[ms/byte]=1540[ms]となる。   At this time, the remaining amount of JIT compilation is 10200 [bytes] -2500 [bytes] = 7700 [bytes]. For this reason, the remaining time required until the end of JIT compilation is 7700 [bytes] × 0.2 [ms / byte] = 1540 [ms].

また、JITコンパイル状況判定手段203は、ネイティブコードの実行時間を1100[ms]×0.05=55[ms]と見積もる。   Further, the JIT compilation status determination unit 203 estimates the execution time of the native code as 1100 [ms] × 0.05 = 55 [ms].

ここで、必要な残り時間は、(コンパイル終了までに必要な残り時間)+(ネイティブコード実行時間)=1540[ms]+55[ms]=1595[ms]となる。この場合、必要な残り時間は、インタプリタ処理時間1100[ms]よりも長い。   Here, the necessary remaining time is (remaining time necessary until the end of compilation) + (native code execution time) = 1540 [ms] +55 [ms] = 1595 [ms]. In this case, the necessary remaining time is longer than the interpreter processing time 1100 [ms].

ゆえに、JITコンパイル判定手段203は、コンパイル中で転換点には達していないと判定し、結果をメソッド情報管理表更新手段202に通知する。この状況で、メソッドIDがmethod1のメソッドが呼び出された場合は、プログラム制御手段204はインタプリタ107でのインタプリタ処理による実行を選択することになる。   Therefore, the JIT compilation determination unit 203 determines that the turning point has not been reached during compilation, and notifies the method information management table update unit 202 of the result. In this situation, when a method whose method ID is method1 is called, the program control unit 204 selects execution by interpreter processing in the interpreter 107.

他方、メソッド情報管理表201に登録されているメソッドIDがmethod3のメソッドでは、インタプリタ処理時間が2300[ms]であり、中間コードサイズが33240[byte]、中間コードコンパイル済みサイズが24000[byte]である。   On the other hand, in the method whose method ID is method3 registered in the method information management table 201, the interpreter processing time is 2300 [ms], the intermediate code size is 33240 [bytes], and the intermediate code compiled size is 24000 [bytes]. It is.

同様に、JITコンパイル終了までに必要な残り時間は(33240[ms]−24000[ms])×0.2=1848[ms]である。また、ネイティブコード実行時間は2300[ms]×0.05=115[ms]である。つまり、必要な残り時間は、(JITコンパイル終了までに必要な残り時間)+(ネイティブコード実行時間)=1848[ms]+115[ms]=1963[ms]となる。この場合、必要な残り時間は、インタプリタ処理時間2300[ms]よりも短い。   Similarly, the remaining time required until the end of JIT compilation is (33240 [ms] −24000 [ms]) × 0.2 = 1848 [ms]. The native code execution time is 2300 [ms] × 0.05 = 115 [ms]. That is, the necessary remaining time is (remaining time required until the end of JIT compilation) + (native code execution time) = 1848 [ms] +115 [ms] = 1963 [ms]. In this case, the necessary remaining time is shorter than the interpreter processing time 2300 [ms].

ゆえに、JITコンパイル状況判定手段203は、コンパイル中で転換点に達している状態であると判定する。結果、method3のJITコンパイル状況の欄が2’b10に更新されることになる。   Therefore, the JIT compilation status determination unit 203 determines that a turning point has been reached during compilation. As a result, the JIT compilation status column of method3 is updated to 2'b10.

JITコンパイル状況の欄を更新後、メソッドIDがmethod3のメソッドが呼びだされた場合、プログラム制御手段204は、当該メソッドのネイティブコードの実行を選択することになる。   After updating the JIT compilation status column, when a method whose method ID is method3 is called, the program control unit 204 selects execution of the native code of the method.

なお、JITコンパイル状況判定手段203がネイティブコードの実行時間を見積もる方法は、上記方法に限らず、例えば中間コードサイズに一定値を掛けるなどの他の方法で見積もるとしてもよい。あるいは、ネイティブコードの実行時間は相対的に微小な値であるため、無視するとしてもよい。   Note that the method by which the JIT compilation status determination unit 203 estimates the execution time of the native code is not limited to the above method, and may be estimated by another method such as multiplying the intermediate code size by a certain value. Alternatively, the execution time of the native code is a relatively small value and may be ignored.

また、JITコンパイルの終了を待ってからネイティブコードを実行する場合においては、JITコンパイルタスクへのCPU資源やメモリ資源の割り当てをJITコンパイル終了まで一時的に増やすような制御が考えられる。これは、実行タスクがアイドルに遷移するためである。このような場合、実際のJITコンパイル速度は、JITコンパイル状況判定手段203に保持したJITコンパイル速度よりも早くなる。そのため、JITコンパイル状況判定手段203は、保持したJITコンパイル速度に補正を施してから、コンパイル終了までに必要な残時間を見積もるなどとしてもよい。   In the case where the native code is executed after the end of JIT compilation, it is possible to control such that the allocation of CPU resources and memory resources to the JIT compilation task is temporarily increased until the end of JIT compilation. This is because the execution task transitions to idle. In such a case, the actual JIT compilation speed is faster than the JIT compilation speed held in the JIT compilation status determination unit 203. For this reason, the JIT compilation status determination unit 203 may estimate the remaining time required for completion of compilation after correcting the held JIT compilation speed.

なお、中間コードサイズが比較的小さいメソッドに関しては、インタプリタ処理時間もJITコンパイル時間も短時間であると考えられる。それゆえ、プログラム制御手段204は、中間コードサイズに閾値を設けて処理を行ってもよい。例えば、プログラム制御手段204は、閾値を超えたメソッドのみに対して前述のようにインタプリタ処理時間や中間コードコンパイル済みサイズを更新し、JITコンパイル状況判定手段203において転換点に達しているか否かを判定する。この場合、閾値以下のサイズの小さいメソッドに関しては、JITコンパイル中に呼び出された場合、インタプリタ処理で実行するか、JITコンパイルの終了を待ってネイティブコードを実行するかを固定的に決めておくなどすればよい。   For methods with a relatively small intermediate code size, the interpreter processing time and JIT compilation time are considered to be short. Therefore, the program control unit 204 may perform processing by providing a threshold value for the intermediate code size. For example, the program control unit 204 updates the interpreter processing time and the intermediate code compiled size as described above only for the method that exceeds the threshold, and determines whether the JIT compilation status determination unit 203 has reached a turning point. judge. In this case, for a method with a small size that is equal to or smaller than the threshold, when it is called during JIT compilation, it is fixedly determined whether to execute by interpreter processing or wait for the end of JIT compilation to execute native code. do it.

プログラム制御手段204は、コンパイラ105へのソースコードのコンパイル指示、中間コードの順次読み込みとインタプリタ107を用いての逐次処理、JITコンパイラ108へのJITコンパイル指示、メソッドのネイティブコードの実行といった一連のプログラム実行を制御する。   The program control means 204 is a series of programs including instructions for compiling source code to the compiler 105, sequential reading of intermediate code and sequential processing using the interpreter 107, instructions for JIT compilation to the JIT compiler 108, and execution of method native code. Control execution.

また、前述のように、プログラム制御手段204は、インタプリタ107とJITコンパイラ108から、インタプリタ処理時間やJITコンパイル速度、中間コードコンパイル済みサイズを受け取る。また、プログラム制御手段204は、受け取った情報を、メソッド情報管理表更新手段202やJITコンパイル状況判定手段203に渡す。   As described above, the program control unit 204 receives the interpreter processing time, JIT compilation speed, and intermediate code compiled size from the interpreter 107 and the JIT compiler 108. Further, the program control unit 204 passes the received information to the method information management table update unit 202 and the JIT compilation status determination unit 203.

また、プログラム制御手段204は、メソッドの呼び出しに達した際に、当該メソッドをインタプリタ処理するか、当該メソッドのネイティブコードを実行するかの判断を行う。   Further, when reaching the method call, the program control unit 204 determines whether to interpret the method or execute the native code of the method.

ここで、プログラム制御手段204の、メソッド呼び出しからの動作の流れを図3に示し、先行例に記載の従来技術のプログラム実行制御装置との差異を明らかにする。   Here, the flow of the operation of the program control means 204 from the method call is shown in FIG. 3, and the difference from the prior art program execution control device described in the preceding example is clarified.

ここでは、メソッド呼び出しは2回目以降であり、メソッド情報管理表201に当該メソッドの情報が既に登録されているものとして示す。因みに、初回のメソッド呼び出しである場合には、先ず当該メソッドの初期値の新規登録を行い、プログラム制御手段204はインタプリタ処理でのメソッド実行を選択する。なお、初回のメソッド呼び出し時は、メソッド情報管理表201に当該メソッドの情報が登録されていない状態である。   Here, the method call is the second and subsequent times, and the method information management table 201 shows that the method information has already been registered. Incidentally, in the case of the first method call, first the initial value of the method is newly registered, and the program control means 204 selects execution of the method in the interpreter process. When the method is called for the first time, the method information management table 201 is not registered with the method information.

メソッド呼び出し時、プログラム制御手段204は、メソッド情報管理表更新手段202を介して、メソッド情報管理表201を参照する(ステップS300)。   When the method is called, the program control unit 204 refers to the method information management table 201 via the method information management table update unit 202 (step S300).

メソッド情報管理表201のJITコンパイル状況の欄が2’b11で、当該メソッドがコンパイル済みであることが示されている場合には(ステップ301でYES)、当該メソッドのネイティブコードを実行する(ステップ302)。   If the JIT compilation status column of the method information management table 201 is 2'b11 and indicates that the method has been compiled (YES in step 301), the native code of the method is executed (step 302).

メソッド情報管理表201のJITコンパイル状況の欄が2’b10で、コンパイル中で転換点に達していることが示されている場合には(ステップ301でNO→ステップ303でYES→ステップ304でYES)、JITコンパイルの終了まで待機し(ステップ305)、当該メソッドのネイティブコードを実行する(ステップ302)。   If the JIT compilation status column of the method information management table 201 is 2′b10 and indicates that the turning point has been reached during compilation (NO in step 301 → YES in step 303 → YES in step 304) ), Wait until the end of JIT compilation (step 305), and execute the native code of the method (step 302).

メソッド情報管理表201のJITコンパイル状況の欄が2’b01で、コンパイル中で転換点に達していないことが示されている場合には(ステップ301でNO→ステップ303でYES→ステップ304でNO)、インタプリタ107で当該メソッドの中間コードを逐次処理することを選択する(ステップ308)。   If the JIT compilation status column of the method information management table 201 is 2′b01, indicating that the turning point has not been reached during compilation (NO in step 301 → YES in step 303 → NO in step 304) ), The interpreter 107 selects to sequentially process the intermediate code of the method (step 308).

メソッド情報管理表201のJITコンパイル状況の欄が2’b00で、未コンパイルであることが示されている場合には(ステップ301でNO→ステップ303でNO)、管理情報表201のインタプリタ処理回数の欄の値等から、当該メソッドを新規にJITコンパイルするべきか否かを判断する(ステップS306)。新規にJITコンパイルすると判断した場合には(ステップ306でYES)、JITコンパイラ108に対して当該メソッドのJITコンパイルを指示し、インタプリタ107で当該メソッドの中間コードを逐次処理することを選択する(ステップ308)。JITコンパイルしないと判断した場合には(ステップ306でNO)、インタプリタ107で当該メソッドの中間コードを逐次処理することを選択する(ステップ308)。   If the JIT compilation status column of the method information management table 201 is 2′b00, indicating that it has not been compiled (NO in step 301 → NO in step 303), the number of interpreter processes in the management information table 201 Whether or not the method should be newly JIT-compiled is determined from the value in the field of (No. S306). If it is determined that a new JIT compilation is to be performed (YES in step 306), the JIT compiler 108 is instructed to perform JIT compilation of the method, and the interpreter 107 selects to sequentially process the intermediate code of the method (step). 308). If it is determined not to perform JIT compilation (NO in step 306), the interpreter 107 selects to sequentially process the intermediate code of the method (step 308).

以上により、本発明のプログラム実行制御装置は、JITコンパイル途中のメソッドを呼び出した場合、当該メソッドのJITコンパイルの状況に基づいて、ネイティブコードを実行するか、インタプリタ処理を行うかを、適切に選択できる。この選択で、JITコンパイルの終了を待ってからネイティブコードを実行するのと、即座に中間コードのインタプリタ処理に移るのとの選択において、より実行時間の短い方を選ぶことが可能になる。これにより、どちらか一方を固定的に選択するときに発生していたオーバーヘッドを除くことが可能になる。また、中間コードのJITコンパイルを低優先度のタスクとして、実行タスクと併走させる構成が採り易く、プログラムの応答性能を保つことができる。   As described above, the program execution control apparatus according to the present invention appropriately selects whether to execute native code or perform interpreter processing based on the JIT compilation status of the method when a method during JIT compilation is called. it can. With this selection, it is possible to select a shorter execution time in selecting whether to execute the native code after waiting for the end of JIT compilation or to immediately move to the interpreter process of the intermediate code. As a result, it is possible to eliminate the overhead that has occurred when either one is fixedly selected. In addition, it is easy to adopt a configuration in which JIT compilation of intermediate code is run as a low priority task in parallel with the execution task, and the response performance of the program can be maintained.

本発明のプログラム実行制御装置は、インタプリタとJITコンパイラを備えた仮想計算機として有用である。また、この仮想計算機を組み込んだ各種の家電機器、携帯電話など通信機器、産業機器、乗用機器などの用途にも応用できる。   The program execution control device of the present invention is useful as a virtual computer including an interpreter and a JIT compiler. The present invention can also be applied to various home appliances incorporating this virtual machine, communication equipment such as mobile phones, industrial equipment, and passenger equipment.

101 プログラム実行制御装置
102 ソースコード列
103 中間コード列
104 ネイティブコード列
105 コンパイラ(ソースコード→中間コード)
106 プログラム実行手段
107 インタプリタ
108 JITコンパイラ(中間コード→ネイティブコード)
201 メソッド情報管理表
202 メソッド情報管理表更新手段
203 JITコンパイル状況判定手段
204 プログラム制御手段
101 program execution control device 102 source code sequence 103 intermediate code sequence 104 native code sequence 105 compiler (source code → intermediate code)
106 Program Execution Means 107 Interpreter 108 JIT Compiler (Intermediate Code → Native Code)
201 Method Information Management Table 202 Method Information Management Table Update Unit 203 JIT Compilation Status Determination Unit 204 Program Control Unit

Claims (5)

コンパイラと、インタプリタと、別タスクで行うJITコンパイラとを備え、ソースコードから生成した中間コードを順次読み込んで、解釈実行するプログラム実行制御装置であって、
前記JITコンパイラによる前記中間コードのJITコンパイル状況をメソッド情報としてメソッド毎に保持するメソッド情報管理手段と、
前記メソッド情報管理手段に保持されているメソッド情報へのアクセスを制御するメソッド情報更新手段と、
前記メソッド情報管理手段に保持されているメソッド情報に基づいて、前記JITコンパイル状況が転換点に達しているか否かを判定するJITコンパイル状況判定手段と、
前記インタプリタによる前記中間コードの実行がメソッドの呼び出しに達した際に、前記メソッド情報管理手段に保持されているメソッド情報を参照し、呼び出された前記メソッドがコンパイル中であって、前記JITコンパイル状況が転換点に達していない場合には、前記インタプリタにより前記中間コードを逐次解釈し実行することを選択し、転換点に達している場合には、前記JITコンパイラによるネイティブコードへの変換の終了を待ってから前記ネイティブコードを実行することを選択するプログラム制御手段を備えた
ことを特徴とするプログラム実行制御装置。
A program execution control device that includes a compiler, an interpreter, and a JIT compiler that performs separate tasks, sequentially reads intermediate code generated from source code, interprets and executes the program,
Method information management means for holding the JIT compilation status of the intermediate code by the JIT compiler as method information for each method;
Method information update means for controlling access to method information held in the method information management means;
JIT compilation status determination means for determining whether or not the JIT compilation status has reached a turning point based on the method information held in the method information management means;
When the execution of the intermediate code by the interpreter reaches a method call, the method information held in the method information management means is referred to, the called method is being compiled, and the JIT compilation status Is not reached the turning point, it is selected to sequentially interpret and execute the intermediate code by the interpreter. When the turning point has been reached, the conversion to the native code by the JIT compiler is terminated. A program execution control apparatus comprising program control means for selecting to execute the native code after waiting.
前記メソッド情報は、中間コードサイズと、中間コードコンパイル済みサイズと、インタプリタ処理時間と、JITコンパイル状況とを含むことを特徴とする請求項1に記載のプログラム実行制御装置。 The program execution control apparatus according to claim 1, wherein the method information includes an intermediate code size, an intermediate code compiled size, an interpreter processing time, and a JIT compilation status. 前記プログラム制御手段は、呼び出された前記メソッドがコンパイル済みである場合には、前記コンパイル済みのネイティブコードを実行することを選択することを特徴とする請求項1に記載のプログラム実行制御装置。 The program execution control apparatus according to claim 1, wherein the program control unit selects to execute the compiled native code when the called method is compiled. 前記JITコンパイル状況判定手段は、前記メソッド情報に含まれる前記中間コードサイズと、前記中間コードコンパイル済みサイズと、前記JITコンパイラから通知されるJITコンパイル速度とから、JITコンパイルの終了までに必要な残り時間と、ネイティブコードの実行時間とを見積もり、前記JITコンパイルの終了までに必要な残り時間と前記ネイティブコードの実行時間の合計時間が、前記インタプリタ処理時間に対して短い場合に、転換点に達していると判定し、前記合計時間が、前記インタプリタ処理時間に対して短くない場合に、転換点に達していないと判定することを特徴とする請求項2に記載のプログラム実行制御装置。 The JIT compilation status determination means determines the remaining amount necessary until the end of JIT compilation from the intermediate code size included in the method information, the intermediate code compiled size, and the JIT compilation speed notified from the JIT compiler. Estimate the time and the execution time of the native code, and if the total time of the remaining time required to complete the JIT compilation and the execution time of the native code is shorter than the interpreter processing time, the turning point is reached. 3. The program execution control device according to claim 2, wherein when the total time is not shorter than the interpreter processing time, it is determined that the turning point has not been reached. 前記コンパイラは、前記ソースコードを前記中間コードへコンパイルする際、前記メソッド毎の前記中間コードサイズを前記中間コード中に付与することを特徴とする請求項4に記載のプログラム実行制御装置。 5. The program execution control device according to claim 4, wherein when compiling the source code into the intermediate code, the compiler assigns the intermediate code size for each method in the intermediate code.
JP2009144894A 2009-06-18 2009-06-18 Program execution controller Pending JP2011002976A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009144894A JP2011002976A (en) 2009-06-18 2009-06-18 Program execution controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009144894A JP2011002976A (en) 2009-06-18 2009-06-18 Program execution controller

Publications (1)

Publication Number Publication Date
JP2011002976A true JP2011002976A (en) 2011-01-06

Family

ID=43560888

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009144894A Pending JP2011002976A (en) 2009-06-18 2009-06-18 Program execution controller

Country Status (1)

Country Link
JP (1) JP2011002976A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014504764A (en) * 2011-01-18 2014-02-24 アップル インコーポレイテッド System and method for supporting JIT in a secure system with randomly allocated memory ranges
US9170830B2 (en) 2013-03-26 2015-10-27 Fujitsu Limited Method for controlling program execution
US9389889B2 (en) 2011-11-16 2016-07-12 Fujitsu Limited Application server for optimizing timing of performing dynamic compilation

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014504764A (en) * 2011-01-18 2014-02-24 アップル インコーポレイテッド System and method for supporting JIT in a secure system with randomly allocated memory ranges
US9389889B2 (en) 2011-11-16 2016-07-12 Fujitsu Limited Application server for optimizing timing of performing dynamic compilation
US9170830B2 (en) 2013-03-26 2015-10-27 Fujitsu Limited Method for controlling program execution

Similar Documents

Publication Publication Date Title
JP3894698B2 (en) A hybrid just-in-time compiler that minimizes resource consumption
KR100589798B1 (en) Bytecode Optimization Devices and Methods During Interruption
US8527969B2 (en) Systems, methods, and computer programs for dynamic binary translation in an interpreter
WO2004107170A1 (en) Program execution control device
JP2010286898A (en) Multithread execution device, and multithread execution method
KR20120083803A (en) Extra code generating apparatus and method for virtual machine
JP2011002976A (en) Program execution controller
US8276128B2 (en) Systems, methods, and computer programs for dynamic binary translation in a master control program interpreter
JP5324050B2 (en) Mechanism to reduce detectable pauses in dynamic output generated by dynamic compilation
JP2012181578A (en) Update control device and program
US20130117757A1 (en) Method and apparatus for scheduling application programs
CN108536514B (en) Hot spot method identification method and device
EP1653355A2 (en) Information processor, information processing method, and programs therefor
JP2009009253A (en) Program execution method, program, and program execution system
KR20120064446A (en) Appratus and method for processing branch of bytecode on computing system
US10303523B2 (en) Method and apparatus to migrate stacks for thread execution
CN106325963B (en) Self-adaptive dynamic compiling and scheduling method and device
JP2017045144A (en) Information processor and control method thereof
JPH08263299A (en) Method for converting program
CN110362314B (en) Information processing method and device, computer readable medium and electronic equipment
EP2605134B1 (en) Systems, methods, and computer programs for dynamic binary translation in an interpreter
JP5021584B2 (en) Microcomputer simulator, simulation method thereof, program, and computer-readable medium
US9015720B2 (en) Efficient state transition among multiple programs on multi-threaded processors by executing cache priming program
WO2001013223A1 (en) Method and apparatus for operating virtual computer
WO2021056277A1 (en) Program execution method