JP2000047879A - Method and device for compilation, executing method, and program executing device - Google Patents

Method and device for compilation, executing method, and program executing device

Info

Publication number
JP2000047879A
JP2000047879A JP10190325A JP19032598A JP2000047879A JP 2000047879 A JP2000047879 A JP 2000047879A JP 10190325 A JP10190325 A JP 10190325A JP 19032598 A JP19032598 A JP 19032598A JP 2000047879 A JP2000047879 A JP 2000047879A
Authority
JP
Japan
Prior art keywords
code
program
execution state
generating
execution
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
JP10190325A
Other languages
Japanese (ja)
Inventor
Toshiaki Yasue
俊明 安江
Hideaki Komatsu
秀昭 小松
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.)
International Business Machines Corp
Original Assignee
International Business Machines 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 International Business Machines Corp filed Critical International Business Machines Corp
Priority to JP10190325A priority Critical patent/JP2000047879A/en
Publication of JP2000047879A publication Critical patent/JP2000047879A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PROBLEM TO BE SOLVED: To suppress an increase in code size in a code versioning optimization process by generating a code for a part of a program in a 1st execution state and profile information used in case of transition to a 2nd execution state and generating a code for activating a code generating process in case of the transition to the 2nd execution state. SOLUTION: At the compilation, parts of the program which can be classified into at least the 1st and 2nd execution states are selected under given conditions. A check code for the classification of the execution states generated and a code for the part of the program in the 1st execution state is generated. The profile information used in case of the transition to the 2nd execution state is generated. A code for activating the code generating process needed in case of the transition to the 2nd execution state is generated. Then the profile information, etc., are further put together by using the address where the code for activation is generated as an identification number to generate a table.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、コンパイラに関
し、より詳しくはJava(Sun Microsystems 社の商
標)のジャストインタイム・コンパイラ(Just In Tim
e:JIT)等において、少なくとも第1及び第2の実行状
態に分類可能なプログラムの部分の第1の実行状態に対
する実行可能コード(executable code)を生成し、第
2の実行状態に対する実行可能コードを必要に応じて生
成する方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a compiler, and more particularly, to a Java (trademark of Sun Microsystems) just-in-time compiler.
e: JIT) or the like, generates an executable code (executable code) for the first execution state of at least a portion of the program that can be classified into the first and second execution states, and executes the executable code for the second execution state. As needed.

【0002】[0002]

【従来の技術】従来のJITコンパイラでは、コンパイル
する単位は実行されるメソッドとなる。このためメソッ
ド中にほとんど実行されないパス(部分プログラム)が
存在していても、それらをすべてコンパイルしてコード
生成する。このようなコード生成を実施すると、コード
サイズが大きくなったり、コンパイル時間が長くなった
りする欠点があった。
2. Description of the Related Art In a conventional JIT compiler, a unit to be compiled is a method to be executed. Therefore, even if there are paths (partial programs) that are hardly executed in the method, they are all compiled and code is generated. When such code generation is performed, there are disadvantages that the code size increases and the compile time increases.

【0003】[0003]

【発明が解決しようとする課題】本発明の目的は、コー
ドのバージョニング最適化処理(コンパイル時に、メソ
ッド中の部分プログラムに対してそのコードが実行され
る状態をいくつかに分類し、その状態を分類するための
チェック・コードと、それぞれの状態に対する実行コー
ドを生成する処理。)においてコードサイズの増加を抑
制するとともに、ホットスポット(Hotspot:ここでは
多数回繰り返されるような実行時間がかかる処理)であ
ると判断できる部分に対して最適化レベルを上げたコン
パイルを動的に実施することである。
SUMMARY OF THE INVENTION An object of the present invention is to provide a code versioning optimizing process (at the time of compiling, classifying a state in which the code is executed with respect to a partial program in a method, and classifying the state into several states. The process of generating a check code for classification and an execution code for each state.) Suppresses an increase in code size, and a hotspot (a process that takes an execution time that is repeated many times here) That is, dynamically compiling a portion at which the optimization level is raised for a portion that can be determined as.

【0004】また、バージョニングにより実行頻度の少
ないほうのコードを実際にそのコードが必要とされるま
で生成しないことで実行コードのサイズを小さくするこ
とである。さらに、ホットスポットとなるコードを動的
に検出し、そのような状態になったときに初めて時間の
かかる、より効果的な最適化処理を実施することで、ホ
ットスポット以外のコードのコンパイル時間を小さく押
さえることを可能にすることである。
Another object of the present invention is to reduce the size of an execution code by not generating a code having a lower execution frequency by versioning until the code is actually required. Furthermore, by dynamically detecting code that becomes a hot spot and performing a more effective optimization process that takes time only when such a condition occurs, the compile time of code other than the hot spot is reduced. It is to be able to hold down.

【0005】[0005]

【課題を解決するための手段】本発明は、コンパイル中
のメソッドに含まれる部分プログラムに対して、現在の
コンパイル処理中ではなく、そのコードが実際に必要と
なったときにその部分プログラムに対するコンパイル
(遅延コンパイル)を行ってコード生成する手法であ
る。これにより、コードのバージョニング最適化処理に
おいてコードサイズの増加を抑制するとともに、ホット
スポットであると判断できる部分に対して最適化レベル
を上げたコンパイルを動的に実施することができる。な
お本発明が対象とするバージョニング最適化処理にはル
ープ・バージョニングやバーチャル呼び出しバージョニ
ングなどがある。
SUMMARY OF THE INVENTION The present invention relates to a method for compiling a partial program included in a method being compiled, not when the code is actually being compiled but when the code is actually needed. (Delayed compilation) to generate code. This makes it possible to suppress an increase in the code size in the code versioning optimizing process and dynamically execute a compilation with an increased optimization level for a portion that can be determined to be a hot spot. Note that the versioning optimization processing targeted by the present invention includes loop versioning and virtual call versioning.

【0006】以下必要な処理をまとめる。コンパイル時
には、少なくとも第1及び第2の実行状態に分類可能な
プログラムの部分を、所定の条件に従って選択する選択
ステップと、実行状態の分類のためのチェック・コード
を生成するステップと、第1の実行状態におけるプログ
ラムの部分に対するコードを生成するステップと、第2
の実行状態に遷移した場合に用いるプロファイル情報を
生成するステップと、第2の実行状態に遷移した場合に
必要となるコードを生成する処理を起動するためのコー
ドを生成するステップと、を実行する。
The necessary processing will be summarized below. At the time of compiling, a selecting step of selecting at least a part of the program that can be classified into the first and second execution states according to a predetermined condition; a step of generating a check code for classification of the execution state; Generating code for a portion of the program in an executing state;
Generating the profile information to be used in the case of transition to the second execution state, and generating the code for starting the process of generating the code required in the case of transition to the second execution state. .

【0007】上の所定の条件は、第1の実行状態で実行
される可能性が第2の実行状態で実行される可能性に比
して大きい場合が考えられる。このようにすると、遅延
コンパイルを実施する頻度が低くなり、コンパイル+実
行時間が短くなる。この所定の条件は、例えば、プログ
ラムの部分が、ループ処理であって配列アクセスを含む
場合、又は、プログラムの部分が、バーチャル呼び出し
される再起メソッドである場合、又は、プログラムの部
分が、メソッド実行に使用されるオブジェクトであるデ
ィス・オブジェクトを用いたバーチャル呼び出しを含む
場合、又は、プログラムの部分が、最適化処理を複数の
段階で実施可能なループ処理である場合、又は、プログ
ラムの部分が、定数インデックスによる配列アクセスを
含む場合等が考えられる。
[0007] The above predetermined condition may be such that the possibility of being executed in the first execution state is greater than the possibility of being executed in the second execution state. By doing so, the frequency of performing the delayed compilation is reduced, and the compilation + execution time is shortened. This predetermined condition may be, for example, when the part of the program is a loop process and includes an array access, or when the part of the program is a recursive method that is virtually called, or when the part of the program is a method execution. If a virtual call using a dis object, which is an object used for, is included, or if a part of the program is a loop processing capable of performing optimization processing in a plurality of stages, or a part of the program, There may be a case where array access by a constant index is included.

【0008】また、先の選択ステップは、プログラムの
部分を特定するための情報を生成するステップを含む場
合がある。例えば、プログラムの部分の上端アドレス及
び下端アドレスにより特定する。そして、第2の実行状
態に遷移した場合に必要となるコードを生成する処理を
起動するためのコードと合わせて格納しておくとよい。
In some cases, the selection step includes a step of generating information for specifying a part of the program. For example, it is specified by the upper end address and the lower end address of the program portion. Then, it may be stored together with a code for starting a process for generating a code required when the state transits to the second execution state.

【0009】さらに、プロファイル情報は、第2の実行
状態に遷移した場合に必要となるコードの条件を含むよ
うにすることも考えられる。例えば、プログラムの部分
がどのような処理を行っているものかを表すデータや、
ホットスポットの場合には、最適化の程度を指定する。
Further, it is conceivable that the profile information includes a code condition required when the state transits to the second execution state. For example, data indicating what processing is being performed by the program part,
For hotspots, specify the degree of optimization.

【0010】また、第2の実行状態に遷移した場合に必
要となるコードを、他のコードにリンクするための情報
を生成するステップをさらに含む場合もある。リンクす
るための情報は実行環境によっては不要な場合もある。
[0010] In some cases, the method further includes a step of generating information for linking a code necessary for transitioning to the second execution state to another code. Information for linking may not be required depending on the execution environment.

【0011】以上のようなコード及び情報が生成された
が、チェック・コードによって、プログラムの部分を第
2の実行状態で実行しなければならない場合には、プロ
ファイル情報を用いて第2の実行状態において実行する
必要のあるコードを生成するステップと、生成されたコ
ードを他のコードにリンクするステップと、生成された
コードを実行するステップとを実行する。このような処
理を実行すると処理時間は長くなってしまうが、先に述
べたような「所定の条件」を適切に設定すれば、本処理
を実施せずとも済む可能性が高い。
[0011] When the code and information as described above have been generated, but the check code requires the program part to be executed in the second execution state, the second execution state is determined using the profile information. Performing the steps of generating the code that needs to be executed at, linking the generated code to other codes, and executing the generated code. When such processing is performed, the processing time becomes longer. However, if the “predetermined conditions” as described above are appropriately set, there is a high possibility that the processing need not be performed.

【0012】プロファイル情報を用いて第2の実行状態
において実行する必要のあるコードを生成する処理を一
度に単一のスレッドにより実行されるように設定するス
テップと、前記リンクするステップ後に、当該設定を解
除するステップとをさらに含むようにする場合もある。
マルチスレッドの場合にはロックを必要とする。
Setting a process of generating a code that needs to be executed in the second execution state by using the profile information so that the process is executed by a single thread at a time; May be further included.
Locks are required for multi-threading.

【0013】以上、本発明を処理フローとして説明した
が、本発明の処理を実行する装置を実施すること、プロ
グラムとして実施することもできる。なお、プログラム
により実施する場合には、当該プログラムは、フロッピ
ー・ディスクやCD−ROM、ハードディスク等の記憶
媒体に記憶される。
Although the present invention has been described as a processing flow, the present invention can be embodied as an apparatus for executing the processing of the present invention or as a program. When the program is executed, the program is stored in a storage medium such as a floppy disk, a CD-ROM, or a hard disk.

【0014】[0014]

【発明の実施の形態】以下、本発明に必要な処理を順番
に説明していく。
DESCRIPTION OF THE PREFERRED EMBODIMENTS The processing required for the present invention will be described below in order.

【0015】A.コンパイル時の処理 (1)JITコンパイラ又は通常のコンパイラによりメソ
ッドをコンパイルする際に、遅延コンパイルによりコー
ドを生成する部分プログラムを選択する。本発明を実施
する上では遅延コンパイル対象とする部分プログラムの
決定自体には制約はない。しかしながら有効性や効果の
観点からは、ホットスポットの候補となる部分か、また
はバージョニングなどによる実行頻度が極端に少ないと
保証できる部分であることが重要である。
A. Compile Processing (1) When compiling a method using a JIT compiler or a normal compiler, select a partial program that generates code by delayed compilation. In practicing the present invention, there is no restriction on the determination itself of the partial program to be subjected to delayed compilation. However, from the viewpoint of effectiveness and effect, it is important that the portion is a candidate for a hot spot or a portion that can be guaranteed that the frequency of execution by versioning or the like is extremely low.

【0016】より具体的には、以下のような場合が考え
られる。なお、バージョニングについて最初に説明して
おく。バージョニングとは、コンパイル時に、メソッド
中の部分プログラムに対してそのコードが実行される状
態をいくつかに分類し、その状態を分類するためのチェ
ック・コードと、それぞれの状態に対する実行コードを
生成する処理である。Javaで記述した例を表1及び
表2に示す。表1中にはループ変数iにより繰り返され
るループが1つ存在している。Javaでは配列のアク
セスに対して、配列変数自体がNULLかどうかのテストと
配列インデックスが配列の範囲内に収まっているかどう
かのチェックを実行時に行うことが要求される。このル
ープに対して、配列変数aがnullではなく且つループ変
数iの変化範囲が配列aの範囲内に収まるかどうかで、収
まる場合と収まらない場合の2つ場合に分類し、チェッ
ク・コードとともに生成されたコードが表2のようにな
る。このバージョニングにより、配列変数がnullではな
く且つループ変数iが配列の範囲内に収まる場合に対す
るコード(then側のコード)では、配列アクセスにおける
テストは必ず成功することが自明なのでこれらを除去で
きる。一方、配列変数aがnullかまたはループ変数iが配
列の範囲外をアクセスする可能性がある場合に対するコ
ード(else側のコード)では、a[i]の配列アクセスに対
して、aがnullであるか、またはループ変数iが配列の範
囲外をアクセスする可能性があるのでそれぞれに対する
チェックを行うコードを生成する。
More specifically, the following cases can be considered. Versioning will be described first. Versioning divides, at compile time, the state in which the code is executed for a partial program in a method into several states, and generates check code for classifying the state and execution code for each state. Processing. Tables 1 and 2 show examples described in Java. In Table 1, there is one loop repeated by the loop variable i. In Java, when accessing an array, it is required to perform a test of whether an array variable itself is NULL and a check of whether an array index falls within the range of the array at the time of execution. For this loop, if the array variable a is not null and the change range of the loop variable i falls within the range of the array a, it is classified into two cases, one that fits and the other that does not fit, and a check code Table 2 shows the generated code. By this versioning, the code for the case where the array variable is not null and the loop variable i falls within the range of the array (then-side code) can be removed because the test in array access is obvious to always succeed. On the other hand, in the code for the case where the array variable a is null or the loop variable i may access outside the range of the array (else side code), for the array access of a [i], a is null There is a possibility that the loop variable i may access outside the range of the array.

【表1】 [Table 1]

【表2】 public void f( int a[], int n ) { int i; if ( a != null && n <= a.length ){ // iが配列aの範囲内かどうかのチェック // i が配列aの範囲内のみをアクセスする場合 for ( i=0; i<n; i++ ) { a[i] = a[i] * i; // a[i]のnullテストと範囲テストは不要 } }else{ // i が配列aの範囲外をアクセスする場合が存在する場合 for ( i=0; i<n; i++ ) { // check( a != null ); // check( i >= 0 ); // check( i < a.length ); a[i] = a[i] * i; // a[i]のnullテストと範囲テストが必要 } } }[Table 2] public void f (int a [], int n) {int i; if (a! = Null && n <= a.length) {// Check if i is within the range of array a // If i accesses only the range of array a for (i = 0; i <n; i ++) {a [i] = a [i] * i; // null test and range test of a [i] are Unnecessary}} else {// If i accesses outside the range of array a for (i = 0; i <n; i ++) {// check (a! = Null); // check (i > = 0); // check (i <a.length); a [i] = a [i] * i; // requires null and range tests for a [i]}}}

【0017】a.ループ配列チェックに対するバージョ
ニング Javaなどのように言語仕様として配列範囲チェック
をもつ言語では、実行時にこれらの範囲チェックを利用
してプログラムを書くことができる。例えば、表3のよ
うに配列の初期化処理を記述するのに無限ループで配列
の各要素を初期化し、配列の範囲を超えたところで処理
を終了するように書くことができる。しかしながら、一
般の多くのプログラムではこのような記述は特殊なケー
スであり、多くのプログラムでは表4のようにループ変
数を配列範囲内で変化させて初期化するように記述され
る。このような状況において、例えばループ・バージョ
ニング最適化処理によりループ変数の変化範囲を用いて
配列アクセス範囲をチェックし、配列の範囲チェックを
するループとチェックしないループにバージョニングし
たとすると、多くの場合は範囲チェックをしないループ
が実行されることになる。従って本発明を利用してチェ
ックを行うコードをそれが実行される場合になってから
生成することにより、最初に生成されるコードはチェッ
クをしないループ1つになるため、バージョニング最適
化によるコード増加を無くすことができる。
A. Versioning for Loop Array Check In a language such as Java that has an array range check as a language specification, a program can be written at runtime using these range checks. For example, to describe the initialization processing of the array as shown in Table 3, it is possible to write such that each element of the array is initialized in an infinite loop, and the processing is terminated when the array exceeds the range of the array. However, such a description is a special case in many general programs, and is described in many programs as changing a loop variable within an array range and initializing as shown in Table 4. In such a situation, for example, if the array access range is checked using the change range of the loop variable by the loop versioning optimization process, and the version is checked into a loop that checks the range of the array and a loop that does not check, in many cases, A loop without range checking will be executed. Therefore, by generating the code to be checked using the present invention after it is executed, the code generated first becomes one unchecked loop, so that the code increase by versioning optimization is performed. Can be eliminated.

【表3】 [Table 3]

【表4】 [Table 4]

【0018】このように、本例では、ループ変数の変化
範囲を計算して各配列アクセスが配列範囲内に収まるか
をチェックするチェック・コードを生成し、(イ)範囲
内に収まる場合の各配列アクセスにテスト・コードを生
成しないループと、(ロ)収まらない場合の各配列アク
セスにテスト・コードを生成するループを作成する。こ
のうち(ロ)のコードを本発明により遅延コンパイル対
象とする。すなわち、(ロ)のコードを初めは生成しな
い。
As described above, in this example, a change code of the loop variable is calculated to generate a check code for checking whether each array access falls within the array range. Create a loop that does not generate test code for array access and a loop that generates test code for each array access that does not fit (ii). Of these, the code in (b) is the subject of delayed compilation according to the present invention. That is, the code in (b) is not initially generated.

【0019】表5のような部分プログラムは、表6のよ
うにバージョニングされる。
The partial programs shown in Table 5 are versioned as shown in Table 6.

【表5】 [Table 5]

【表6】 if (a != NULL && b != NULL && S>=0 && E<a.length && E<b.length ){ /* 配列アクセスがすべて配列範囲内の場合のバージョン */ for (i=S; i<E; i++ ) { a[i] = a[i] + b[i]; /* a[i], b[i]は配列の範囲チェックをしない */ } }else{ /* 配列アクセスが配列範囲外となる可能性のある場合のバージョン */ for (i=S; i<E; i++ ) { a[i] = a[i] + b[i]; /* a[i], b[i]は配列の範囲チェックを行う */ } } else以降の部分が遅延コンパイルされる。[Table 6] if (a! = NULL && b! = NULL && S> = 0 && E <a.length && E <b.length) {/ * Version when all array accesses are within the array range * / for (i = S; i <E; i ++) {a [i] = a [i] + b [i]; / * a [i] and b [i] do not perform array range check * /}} else {/ * Version when array access may be out of array range * / for (i = S; i <E; i ++) {a [i] = a [i] + b [i]; / * a [i] and b [i] perform array range check * /}} The part after else is delayed compiled.

【0020】b.バーチャル・メソッドの再帰呼び出し
のバージョニング 例えば表7に示すコードにおいては、呼び出し(1)は
一見すると再帰呼び出しのように見える。しかし、元の
呼び出しが例えば表8の呼び出し(2)のような派生ク
ラス中のメソッドからのスーパー(super)呼び出しで
あった場合は、呼び出し(1)により実行されるのはク
ラスbのメソッドrとなり、呼び出し(1)は自己再帰
呼び出しとはならない。しかしながら、一般に再帰呼び
出しの形態で記述されているプログラムでは、ほとんど
の場合は自己再帰となる。よって表9のelse以降のコー
ドが遅延コンパイルにより後に生成されるコードとな
る。
B. Versioning of Recursive Calls of Virtual Methods For example, in the code shown in Table 7, call (1) looks like a recursive call at first glance. However, if the original call is a super call from a method in a derived class, for example, call (2) in Table 8, the call (1) executes the method r of class b. And call (1) is not a self-recursive call. However, in most cases, programs written in a recursive call form are self-recursive. Therefore, the code after else in Table 9 is a code generated later by the delayed compilation.

【表7】 [Table 7]

【表8】 [Table 8]

【表9】 class a { public void r( int r ){ if ( this.r == クラスaのメソッドr ){ // 自己再帰メソッドとなる場合のバージョン ..... // 自己再帰に対する最適化処理を実施したコード }else{ // 自己再帰メソッドとならない場合のバージョン if ( i == 0 ) return 0; else return i+r(i-1); } } }[Table 9] class a {public void r (int r) {if (this.r == method r of class a) {// Version in case of self-recursive method ..... // Optimal for self-recursive } Else {// version without self-recursive method if (i == 0) return 0; else return i + r (i-1);}}}

【0021】このように、バーチャル呼び出しされる再
帰メソッドに対して、呼び出しに使用するオブジェクト
による同名のメソッドの呼び出しが自分自身への再帰呼
び出しとなるかどうかをチェックするチェック・コード
を生成し、(イ)再帰呼び出しとなる場合のテイル・リ
カージョン(Tail Recursion)最適化や再帰呼び出しの
1段アンローリングなどを施したコードと、(ロ)再帰
呼び出しにならない場合のそのままのコードを生成す
る。このうち(ロ)のコードを本発明の手法により遅延
コンパイル対象とする。すなわち、(ロ)のコードを初
めは生成しない。
In this way, for a recursive method that is virtually called, a check code is generated to check whether or not a call to a method of the same name by an object used for the call is a recursive call to itself. B) Generate tail recursion optimization for recursive calls and one-stage unrolling of recursive calls, and (b) generate unmodified codes for non-recursive calls. Of these, the code in (b) is subjected to delayed compilation by the method of the present invention. That is, the code in (b) is not initially generated.

【0022】なお、再帰呼び出しの1段アンローリング
とは、再帰呼び出しメソッド中にある再帰呼び出しに対
して、その再帰呼び出しメソッドのコードをインライニ
ングすることである。Javaにより記述された例を表
10及び表11に示す。表10が元の再帰呼び出しメソ
ッドである。表11は1段アンローリングした結果であ
る。
The one-stage unrolling of the recursive call is to inline the code of the recursive call method in the recursive call in the recursive call method. Tables 10 and 11 show examples described by Java. Table 10 shows the original recursive call method. Table 11 shows the result of one-stage unrolling.

【表10】 [Table 10]

【表11】 [Table 11]

【0023】c.ディス(this)オブジェクトを使った
バーチャル呼び出しのバージョニング ここでいうthisオブジェクトは、メソッド実行に使用さ
れるオブジェクトを指す。オブジェクト指向言語では、
バーチャル呼び出しを実行する際に必ずオブジェクトを
指定し、これがthisオブジェクトとなる。
C. Versioning Virtual Calls Using This (this) Object The "this" object here refers to the object used to execute the method. In object-oriented languages,
When executing a virtual call, always specify an object, and this will be this object.

【0024】ここでは、thisオブジェクトを用いたバー
チャル呼び出しに対して、thisがコンパイル中のメソッ
ドの属するクラスのインスタンスかどうかをチェックす
るチェック・コードを生成し、(イ)thisオブジェクト
によるバーチャル呼び出しがコンパイル時に解決(reso
lve:リゾルブ)されたメソッドでインライン処理された
コードと、(ロ)thisオブジェクトによるバーチャル呼
び出しをそのままにしたコードを生成する。このうち
(ロ)のコードを本発明により遅延コンパイル対象とす
る。すなわち、(ロ)のコードは最初に生成しない。
Here, for a virtual call using this object, a check code for checking whether this is an instance of the class to which the method being compiled belongs is generated, and (a) the virtual call by this object is compiled. Sometimes solved (reso
lve: Generates code inlined by the resolved method and (b) the code that leaves the virtual call by this object as it is. Of these, the code in (b) is the subject of delayed compilation according to the present invention. That is, the code in (b) is not generated first.

【0025】バーチャル・メソッド中に含まれるthisオ
ブジェクトを使用したバーチャル・メソッド呼び出しに
対して、thisオブジェクトのクラスがコンパイル中のメ
ソッドの属するクラスかどうかによりメソッドのコード
全体をバージョニングする例を以下に示す。このバージ
ョニング処理の利点は、バージョニングによりコンパイ
ル時にthisのクラスを特定できるバージョンのコードに
対しては、thisによるバーチャル呼び出しで実際に実行
されるメソッドも特定できる点にある。つまりこれらの
メソッドに対してはインライニングなどの最適化を行う
ことが可能となる。Javaで記述した例を表12及び
表13に示す。表12のメソッドfを考える。メソッドf
中には、thisオブジェクトによるバーチャル呼び出しg
が存在する。クラスa自体はfinal属性が設定されていな
いので派生クラスを定義されている可能性がある。この
メソッドfに対して、fが実行されたときのthisのオブジ
ェクトが、メソッドfの属するクラスa自身のインスタン
スかどうかをチェックしてバージョニング処理する。こ
れにより、thisがクラスaのインスタンスである場合は
メソッド呼び出しgがクラスa中のgであると一意に特定
できるので、表13のthen側のコードのようにgをイン
ライン処理することができる。一方、thisがクラスa自
体のインスタンスでない場合のコードには元のコードを
生成している。
An example of versioning the entire method code in response to a virtual method call using this object included in a virtual method depending on whether the class of this object belongs to the class to which the method being compiled belongs is shown below. . The advantage of this versioning process is that, for a version of code that can specify the class of this at compile time by versioning, the method actually executed by the virtual call by this can also be specified. In other words, optimization such as inlining can be performed on these methods. Tables 12 and 13 show examples described in Java. Consider method f in Table 12. Method f
Inside, a virtual call g by this object
Exists. Since the final attribute is not set for class a itself, a derived class may be defined. For this method f, versioning processing is performed by checking whether the object of this when f is executed is an instance of the class a to which the method f belongs. Thus, when this is an instance of the class a, the method invocation g can be uniquely specified as g in the class a, so that g can be inline-processed as in the then-side code in Table 13. On the other hand, if this is not an instance of the class a itself, the original code is generated.

【0026】[0026]

【表12】 [Table 12]

【表13】 class a { public void f() { if ( thisのクラス == a ) { // thisオブジェクトのクラスがaの場合 int x; x = 1 + 2; // メソッドgは必ずクラスaのgを呼ぶことが一意に定まるため return x; }else{ // thisオブジェクトのクラスがaではない場合 int x; x = g( 1, 2 ); // メソッドgの呼び出しで実際に実行されるコードは不明 return x; } } public int g( i, j ) { return i + j; } }[Table 13] class a {public void f () {if (this class == a) {// If the class of this object is a int x; x = 1 + 2; // Method g must be class a Return x;} else {// If the class of this object is not a int x; x = g (1, 2); // Actually executed by calling method g Return x;}} public int g (i, j) {return i + j;}}

【0027】d.ホットスポットの最適化のためのバー
ジョニング 例えば表14に示すループに対して、ループの繰り返し
数によるバージョニング処理を行うことで、表15のよ
うなコードになる。このうち、斜体下線を付したコード
はループの繰り返し回数が既定値である"hotspot_thres
hold_number"以上であることから、最大限の最適化処理
を行うことによりかかるコンパイル時間よりも最大限の
最適化により生成されたコードによる実行時間の短縮分
のほうが大きい場合に実行されるコードとなる。
D. Versioning for Optimizing Hot Spots For example, a loop shown in Table 14 is subjected to versioning processing based on the number of repetitions of the loop, to obtain a code as shown in Table 15. Of these, the code underlined in italics has the default value of "hotspot_thres
hold_number "or more, the code will be executed when the reduction in the execution time by the code generated by the maximum optimization is greater than the compile time by performing the maximum optimization. .

【表14】 [Table 14]

【表15】 if ( n < hotspot_threshold_number ) { // あまり時間のかからない最適化のみ実施する for (i = 0;i < n; i++) { dy[iy +dy_off] += da*dx[ix +dx_off]; ix += incx; iy += incy; } }else{ // 次のループに対して最大限の最適化処理を行う for (i = 0;i < n; i++) { dy[iy +dy_off] += da*dx[ix +dx_off]; ix += incx; iy += incy; } }[Table 15] if (n <hotspot_threshold_number) {// Execute only optimization that does not take much time for (i = 0; i <n; i ++) {dy [iy + dy_off] + = da * dx [ix + dx_off ]; ix + = incx; iy + = incy;}} else {// Perform maximal optimization for the next loop for (i = 0; i <n; i ++) {dy [iy + dy_off ] + = da * dx [ix + dx_off]; ix + = incx; iy + = incy;}}

【0028】このように、ループ変数の変化範囲を計算
して、あらかじめ設定してある設定値と比較するチェッ
ク・コードを生成し、(イ)あまり時間のかからない最
適化処理のみを実施したループのコードと、(ロ)時間
のかかるより効果のある最適化処理を実施したループの
コードを生成する。このうち(ロ)のコードを本発明に
より遅延コンパイル対象とする。すなわち、(ロ)のコ
ードは最初生成されない。また(イ)のコードは上記
a.の処理と組み合わせることも可能である。
As described above, the change range of the loop variable is calculated, a check code for comparison with a preset set value is generated, and (a) a loop in which only the optimization process that does not take much time is performed And (2) generate a code for a loop that has been subjected to (b) a more time-consuming and more effective optimization process. Of these, the code in (b) is the subject of delayed compilation according to the present invention. That is, the code in (b) is not generated first. Further, the code (a) can be combined with the processing of the above a.

【0029】e.配列の定数インデックスのためのバー
ジョニング 数値計算アルゴリズムで頻繁に使用される方法に、あら
かじめメソッド内不変変数で与えられた配列の特定領域
を係数行列などに使用する場合がある。例えば表16に
示すループに対して、変数kがループ変数iの変化範囲に
含まれるかどうかによるバージョニング処理を行うこと
で、表17のようなコードになる。このうち、else以降
のコードはa[i]とa[k]の要素は必ず異なることがわかる
のでa[k]の値をループ外でキャッシュするコードを生成
することができる。
E. Versioning for Constant Indexing of Arrays A frequently used method in numerical calculation algorithms is to use a specific region of an array given in advance as a constant matrix in a method for a coefficient matrix or the like. For example, by performing versioning processing on the loop shown in Table 16 depending on whether the variable k is included in the change range of the loop variable i, a code as shown in Table 17 is obtained. Of these, it is known that the code after the else always has different elements of a [i] and a [k], so it is possible to generate a code for caching the value of a [k] outside the loop.

【表16】 [Table 16]

【表17】 [Table 17]

【0030】上のように、不変変数の値が他の配列アク
セス範囲に含まれるかどうかをテストするチェック・コ
ードを生成し、(イ)含まれない場合に対して他の配列
アクセスとは依存関係なしとして最適化処理をしたコー
ドと、(ロ)含まれる場合に対しての配列アクセスと依
存関係があるとして最適化処理したコードを生成する。
このうち(ロ)のコードを本発明により遅延コンパイル
対象とする。すなわち、(ロ)のコードは最初生成され
ない。
As described above, a check code for testing whether or not the value of an invariant variable is included in another array access range is generated. A code that has been subjected to the optimization processing as having no relation and a code that has been subjected to the optimization processing assuming that (b) there is a dependency relationship with the array access when it is included are generated.
Of these, the code in (b) is the subject of delayed compilation according to the present invention. That is, the code in (b) is not generated first.

【0031】以上のような条件にて、部分プログラムを
選択する。なお、上の処理の説明中に述べたが、バージ
ョニングで必要となる分類のチェック・コード及び部分
プログラムの(イ)のコードは生成する必要がある。
Under the above conditions, a partial program is selected. As described in the above description of the processing, it is necessary to generate the check code of the classification required in versioning and the code (a) of the partial program.

【0032】(2)部分ソースコードのプログラム情報
を生成する。遅延コンパイルの対象となる部分プログラ
ムのプログラム情報を、遅延コンパイル時に取得できる
場所に生成する。
(2) Generate program information of a partial source code. The program information of the partial program to be subjected to the delayed compilation is generated at a location that can be obtained at the time of the delayed compilation.

【0033】部分プログラムのプログラム情報として
は、本例では元のJavaバイトコード情報がそのまま
残されているとして、そのバイトコード上の位置とし
て、部分プログラムの上端と下端の値として生成する。
この上下端の情報に以下の(5)で生成される遅延コン
パイル時処理を起動するコードが生成されたアドレスを
識別番号とし、さらに(3)で生成されるプロファイル
情報と(4)で生成されるリンク情報と共にメソッド中
のすべての遅延コンパイル対象部分をまとめて、図1の
ようなテーブルを作成し、現在コンパイル中のメソッド
ブロックから取得できるように配置する(リンク情報は
Javaの実行環境では不要なため、図示していな
い。)。なおメソッドブロックmb自体は実行コードアド
レスから取得することができるものとする。メソッドブ
ロックとは、Java実行環境において使用されている
各メソッド固有の情報をもつ構造体である。
In this example, as the program information of the partial program, the original Java bytecode information is left as it is, and the position on the bytecode is generated as the values of the upper and lower ends of the partial program.
The address at which the code for activating the delayed compile processing generated in the following (5) is generated as the identification number in the information at the upper and lower ends, and the profile information generated in (3) and the profile information generated in (4) are further generated. A table as shown in FIG. 1 is created by putting together all the parts to be deferred compiled in the method together with the link information to be obtained and placed so that it can be obtained from the method block currently being compiled (link information is not required in the Java execution environment). (Not shown). It is assumed that the method block mb itself can be obtained from the execution code address. The method block is a structure having information unique to each method used in the Java execution environment.

【0034】(3)部分プログラムを遅延コンパイルす
る際に利用するためのプロファイル情報を生成する。こ
のプロファイル情報は、部分プログラムの属性をあらわ
す値であって、遅延コンパイルするときの付加情報とし
て使用される。選択される部分プログラムの条件が上に
述べたa乃至eの場合には、そのいずれであるかの情報
を含む。これを、遅延コンパイル実行時に取得できる場
所(例えば図1)に生成する。また、ホットスポットに
よるバージョニングの場合には、最適化の程度等も含
む。
(3) Generate profile information to be used when delay compiling the partial program. This profile information is a value representing the attribute of the partial program, and is used as additional information when performing delayed compilation. In the case where the conditions of the selected partial program are a to e described above, information on which one of them is included. This is generated in a location (for example, FIG. 1) that can be obtained at the time of executing the delayed compilation. In the case of versioning using a hot spot, the degree of optimization is also included.

【0035】(4)部分プログラムを他の部分のコード
とリンクするための情報を生成する。スタックのアドレ
ス等のメソッドに関する情報など、プログラムをリンク
するために必要な情報を、遅延コンパイル実行時に取得
できる場所に生成する。図1のテーブルに含めることが
できる。
(4) Generate information for linking a partial program with a code of another part. Information necessary for linking a program, such as information on a method such as a stack address, is generated at a location where it can be obtained at the time of executing delayed compilation. It can be included in the table of FIG.

【0036】但し、Javaの実行環境においては、リ
ンクに必要となるのはリンク元のアドレスのみであり、
その情報は遅延コンパイル処理内でスタックから取得で
きるのでリンク情報としては何も生成しない。
However, in the Java execution environment, only the link source address is required for the link.
Since that information can be obtained from the stack in the delayed compilation process, nothing is generated as link information.

【0037】(5)生成されていない部分プログラムの
実行状態に対応するコードに実行が移行した場合に、遅
延コンパイル処理を起動するためのコードを生成する。
遅延コンパイル対象の部分プログラムが本来生成される
位置に、前処理コード、以下で述べる遅延コンパイル処
理を起動するコード、後処理コードを生成する。
(5) When the execution shifts to the code corresponding to the execution state of the partial program that has not been generated, the code for starting the delayed compilation processing is generated.
A pre-processing code, a code for activating a delayed compilation process described below, and a post-processing code are generated at a position where the partial program to be delayed compiled is originally generated.

【0038】前処理コードとして、必要に応じてレジス
タにキャッシュされているローカル変数とスタックの値
をメモリに書き出す処理を生成する。起動コードとして
は、プログラムカウンタの値をスタックにプッシュ(PU
SH)する命令と、起動コードルーチンへのジャンプ(jm
p)命令を生成する。後処理コードとしては、必要に応
じてレジスタにローカル変数とスタックの値をキャッシ
ュする処理を生成する。
As the pre-processing code, a process for writing a local variable and a stack value cached in a register to a memory as necessary is generated. The startup code is to push the value of the program counter onto the stack (PU
SH) and jump to the activation code routine (jm
p) Generate instructions. The post-processing code generates a process of caching a local variable and a stack value in a register as needed.

【0039】以上が、コンパイル時に必要とされる処理
である。
The above is the processing required at the time of compiling.

【0040】B.遅延コンパイル処理が起動された場合
の処理 (1)遅延コンパイル処理が複数の実行コンテクストに
より重複して実行されないための処理を行う。マルチス
レッド環境などで、複数のスレッドなどの実行コンテク
ストが同時に遅延コンパイル処理を実行する状況が発生
する可能性がある場合は、そのような状況が発生した時
にそれらのコンテクストうちの一つのみが遅延コンパイ
ル処理を実行し、他のコンテクストはロック機構などを
用いてその終了を待つための処理を行う。なお複数の実
行コンテクストが動作しない環境ではこの処理は必要な
い。
B. Processing when delayed compilation processing is started (1) Processing to prevent the delayed compilation processing from being repeatedly executed by a plurality of execution contexts. In situations such as in a multi-threaded environment where there is a possibility that multiple execution contexts, such as multiple threads, may simultaneously perform deferred compilation, only one of those contexts will be delayed when such a situation occurs. The compiling process is executed, and the other contexts use a lock mechanism or the like to perform a process for waiting for the completion. This process is not necessary in an environment where a plurality of execution contexts do not operate.

【0041】(2)部分プログラムのプログラム情報と
プロファイル情報を使用してJITコンパイラを起動して
コンパイルする。プログラム情報とプロファイル情報を
取得し、その情報を用いてJITコンパイラを起動して実
行コードを生成する。
(2) The JIT compiler is activated and compiled using the program information and profile information of the partial program. Obtains program information and profile information, and invokes the JIT compiler using that information to generate executable code.

【0042】(3)リンク情報を用いて生成したコード
を生成済のコードにリンクする。生成されたコードを遅
延コンパイル処理の呼び出しコードと置き換える処理を
行う。
(3) The code generated using the link information is linked to the generated code. A process for replacing the generated code with a call code for the delayed compilation process is performed.

【0043】(4)遅延コンパイル処理が重複して実行
されないための処理で他の実行コンテクストが遅延コン
パイルの終了を待っている場合は、それらに対して生成
されたコードを実行するように処理する。(1)の処理
により他のコンテクストが待ち状態にある場合は、それ
らのコンテクストに対して順次生成されたコードを実行
するように処理を行う。なお複数の実行コンテクストが
動作しない環境ではこの処理は必要ない。
(4) If other execution contexts are waiting for the end of the delayed compilation in the processing for preventing the delayed compilation processing from being repeatedly executed, the processing is executed so that the generated code is executed for them. . If other contexts are in a waiting state by the process (1), the process is performed so that the codes generated sequentially for those contexts are executed. This process is not necessary in an environment where a plurality of execution contexts do not operate.

【0044】(5)生成したコードの実行を開始する。(5) Execution of the generated code is started.

【0045】表18に遅延コンパイル処理コードを共通
の処理ルーチンとして扱うコードを示す。(1.1)はイン
プリメントを簡単にするため、グローバルロックを取得
する。このロックにより、ロックを取得できたスレッド
のみが後続の処理を行うことになる。なお、グローバル
ロックとしたことで異なる遅延コンパイルに対するスレ
ッドもロックが影響してしまうが、本例では元々遅延コ
ンパイルの発生頻度が少ないものを扱っているので実行
上は問題ないと思われる。(1.2)では、元の遅延コンパ
イル処理ルーチンへのJUMP命令があったアドレスの命令
を調べている。既に他のスレッドによってコンパイルが
行われている場合には、(3)の処理によりコンパイルコ
ードへのJUMP命令に書き換えられているので、後続する
コンパイル処理をスキップするためのチェックである。
(2.1)はプログラム情報とプロファイル情報を取得処理
である。(2.2)はJITコンパイラを起動してコードをコン
パイル処理である。(3)は元の遅延コンパイル処理ルー
チンへのJUMP命令をコンパイルコードへのJUMP命令に書
き換える処理である。この処理により、これ以降このア
ドレスが実行されると遅延コンパイル処理ではなくコン
パイルされたコードが実行されるようになる。(4)では
ロックを解除する処理である。これにより(1.1)のロッ
クでウエイトしていたスレッドが順に実行される。前に
も述べたとおり、これらのスレッドは(1.2)のチェック
によりコンパイル処理をスキップする。(5)はコンパイ
ルコードを実行するために、op_addrのアドレスにジャ
ンプする処理である。
Table 18 shows codes for handling the delayed compilation processing code as a common processing routine. (1.1) acquires a global lock to simplify the implementation. With this lock, only the thread that can acquire the lock performs subsequent processing. Note that the use of the global lock also affects threads for different delayed compilations. However, in this example, it is considered that there is no problem in execution because a thread whose delay compilation frequency is low is originally used. In (1.2), the instruction at the address where the JUMP instruction to the original delayed compilation processing routine was found is examined. If the compilation has already been performed by another thread, since it has been rewritten to the JUMP instruction to the compiled code by the process (3), this is a check to skip the subsequent compilation process.
(2.1) is a process of acquiring program information and profile information. (2.2) is a process of compiling the code by starting the JIT compiler. (3) is a process for rewriting a JUMP instruction to the original delayed compilation processing routine to a JUMP instruction to the compiled code. By this processing, when this address is subsequently executed, the compiled code is executed instead of the delayed compilation processing. In (4), the lock is released. As a result, the threads that have been waiting with the lock of (1.1) are executed in order. As mentioned earlier, these threads skip the compilation process according to the check in (1.2). (5) is processing for jumping to the address of op_addr in order to execute the compiled code.

【0046】[0046]

【表18】 LOCK_IN(); // (1.1)ロックをかけるコード op_addr = スタックから遅延コンパイル処理ルーチンを呼び出した アドレスを取得する。 if ( *op_addr == 遅延コンパイル処理ルーチンへのJUMP命令 ) // (1.2)コード生成済かどうかを調べるコード { op_addrからmbを取得する。 mbから遅延コンパイル情報テーブルを取得する。 // (2.1) ソースプログラム情報とプロファイル情報を取得する。 JITにより部分プログラムをコンパイルする。 // (2.2) JITによりコンパイルする。 // 戻りアドレスはop_addrから計算した位置とする。 op_addrの命令を生成されたコードの先頭アドレスへのJUMP命令に書き換える 。 // (3) 生成されたコードを元のコードにリンクする。 } LOCK_OUT(); // (4)ロックをはずす処理 op_addrにjumpする。 // (5) op_addrにジャンプすることで、部分プログラムのコードを実行する。[Table 18] LOCK_IN (); // (1.1) Code for locking op_addr = Obtain the address where the delayed compilation processing routine was called from the stack. if (* op_addr == JUMP instruction to delay compilation routine) // (1.2) Code to check whether code has been generated {Obtain mb from op_addr Get delayed compilation information table from mb. // (2.1) Get source program information and profile information. Compile the partial program by JIT. // (2.2) Compile by JIT. // The return address is the position calculated from op_addr. Rewrite the op_addr instruction to a JUMP instruction for the start address of the generated code. // (3) Link the generated code to the original code. } LOCK_OUT (); // (4) Unlocking process Jump to op_addr. // (5) Execute the code of the partial program by jumping to op_addr.

【0047】[0047]

【効果】コードのバージョニング最適化処理においてコ
ードサイズの増加を抑制することができた。
[Effect] An increase in code size can be suppressed in the code versioning optimization processing.

【0048】ホットスポットであると判断できる部分に
対して最適化レベルを上げたコンパイルを動的に実施す
ることもできた。
It was also possible to dynamically compile a part which can be determined as a hot spot with an increased optimization level.

【0049】また、バージョニングにより実行頻度の少
ないほうのコードを実際にそのコードが必要とされるま
で生成しないことで実行コードのサイズを小さくするこ
ともできた。
Further, the code of the less frequently executed code is not generated by versioning until the code is actually required, so that the size of the executed code can be reduced.

【0050】さらに、ホットスポットとなるコードを動
的に検出し、そのような状態になったときに始めて時間
のかかるより効果的な最適化処理を実施することで、ホ
ットスポット以外のコードのコンパイル時間を小さく押
さえることが可能にできた。
Further, by dynamically detecting a code that becomes a hot spot and performing a more effective optimization process that takes time only when such a condition occurs, the code other than the hot spot is compiled. The time can be kept small.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明の実施例で用いられるテーブルの一例で
ある。
FIG. 1 is an example of a table used in an embodiment of the present invention.

【符号の説明】 なし[Explanation of symbols] None

───────────────────────────────────────────────────── フロントページの続き (72)発明者 安江 俊明 神奈川県大和市下鶴間1623番地14 日本ア イ・ビー・エム株式会社 東京基礎研究所 内 (72)発明者 小松 秀昭 神奈川県大和市下鶴間1623番地14 日本ア イ・ビー・エム株式会社 東京基礎研究所 内 Fターム(参考) 5B081 AA09 CC21  ──────────────────────────────────────────────────の Continuing from the front page (72) Inventor Toshiaki Yasue 1623-14 Shimotsuruma, Yamato-shi, Kanagawa Japan IBM Japan, Ltd.Tokyo Basic Research Laboratory (72) Inventor Hideaki Komatsu Shimotsuruma, Yamato-shi, Kanagawa 1623-14 F-term (reference) 5B081 AA09 CC21, Tokyo Research Laboratory, IBM Japan, Ltd.

Claims (12)

【特許請求の範囲】[Claims] 【請求項1】少なくとも第1及び第2の実行状態に分類
可能なプログラムの部分を、所定の条件に従って選択す
る選択ステップと、 前記実行状態の分類のためのチェック・コードを生成す
るステップと、 前記第1の実行状態における前記プログラムの部分に対
するコードを生成するステップと、 前記第2の実行状態に遷移した場合に用いるプロファイ
ル情報を生成するステップと、 前記第2の実行状態に遷移した場合に必要となるコード
を生成する処理を起動するためのコードを生成するステ
ップと、 を含むコンパイル方法。
A step of selecting at least a part of a program that can be classified into a first and a second execution state according to a predetermined condition; and a step of generating a check code for classifying the execution state. A step of generating a code for the portion of the program in the first execution state; a step of generating profile information to be used when transitioning to the second execution state; and a step of transitioning to the second execution state. Generating code for initiating a process of generating required code.
【請求項2】前記所定の条件が、 前記第1の実行状態で実行される可能性が前記第2の実
行状態で実行される可能性に比して大きいことである請
求項1記載のコンパイル方法。
2. The compilation according to claim 1, wherein the predetermined condition is that the possibility of being executed in the first execution state is greater than the possibility of being executed in the second execution state. Method.
【請求項3】前記所定の条件が、 前記プログラムの部分が、ループ処理であって配列アク
セスを含む場合、又は、 前記プログラムの部分が、バーチャル呼び出しされる再
起メソッドである場合、又は、 前記プログラムの部分が、メソッド実行に使用されるオ
ブジェクトであるディス・オブジェクトを用いたバーチ
ャル呼び出しを含む場合、又は、 前記プログラムの部分が、最適化処理を複数の段階で実
施可能なループ処理である場合、又は、 前記プログラムの部分が、定数インデックスによる配列
アクセスを含む場合、 を含む請求項1記載のコンパイル方法。
3. The program according to claim 1, wherein the predetermined condition is that the part of the program is a loop process and includes an array access, or that the part of the program is a recursive method that is virtually called, or If the part includes a virtual call using a dis object that is an object used for method execution, or if the part of the program is a loop processing that can perform optimization processing in multiple stages, 2. The compiling method according to claim 1, further comprising: when the part of the program includes an array access by a constant index.
【請求項4】前記選択ステップが、 前記プログラムの部分を特定するための情報を生成する
ステップを含む請求項1記載のコンパイル方法。
4. The compiling method according to claim 1, wherein said selecting step includes a step of generating information for specifying a part of said program.
【請求項5】前記プロファイル情報が、 前記第2の実行状態に遷移した場合に必要となるコード
の条件を含む請求項1記載のコンパイル方法。
5. The compiling method according to claim 1, wherein the profile information includes a code condition required when the state changes to the second execution state.
【請求項6】前記第2の実行状態に遷移した場合に必要
となるコードを、他のコードにリンクするための情報を
生成するステップをさらに含む請求項1記載のコンパイ
ル方法。
6. The compiling method according to claim 1, further comprising the step of generating information for linking a code required when the transition to the second execution state is made to another code.
【請求項7】少なくとも第1及び第2の実行状態に分類
可能なプログラムの部分について、前記第2の実行状態
において必要なコードを生成せずに前記第2の実行状態
に遷移した場合に用いるプロファイル情報を生成した場
合、前記プログラムの部分を前記第2の実行状態で実行
する方法であって、 前記プロファイル情報を用いて前記第2の実行状態にお
いて実行する必要のあるコードを生成するステップと、 生成されたコードを他のコードにリンクするステップ
と、 前記生成されたコードを実行するステップと、 を含む実行方法。
7. A program which is used when at least a part of a program that can be classified into the first and second execution states is transited to the second execution state without generating necessary code in the second execution state. A method for executing a portion of the program in the second execution state when generating profile information, the method including: using the profile information to generate a code that needs to be executed in the second execution state. Linking the generated code to another code; and executing the generated code.
【請求項8】前記プロファイル情報を用いて前記第2の
実行状態において実行する必要のあるコードを生成する
処理を一度に単一のスレッドにより実行されるように設
定するステップと、 前記リンクするステップ後に、前記設定を解除するステ
ップとをさらに含む請求項7記載の実行方法。
8. A step of setting a process for generating a code that needs to be executed in the second execution state using the profile information so that the process is executed by a single thread at a time, and the linking step. 8. The execution method according to claim 7, further comprising a step of releasing the setting later.
【請求項9】少なくとも第1及び第2の実行状態に分類
可能なプログラムの部分を、所定の条件に従って選択す
る選択手段と、 前記実行状態の分類のためのチェック・コードを生成す
る手段と、 前記第1の実行状態における前記プログラムの部分に対
するコードを生成する手段と、 前記第2の実行状態に遷移した場合に用いるプロファイ
ル情報を生成する手段と、 前記第2の実行状態に遷移した場合に必要となるコード
を生成する処理を起動するためのコードを生成する手段
と、 を有するコンパイル装置。
9. A means for selecting at least a portion of a program that can be classified into first and second execution states according to a predetermined condition; a means for generating a check code for classifying the execution states; Means for generating a code for the portion of the program in the first execution state; means for generating profile information used when transitioning to the second execution state; and when transitioning to the second execution state. Means for generating code for initiating a process for generating necessary code.
【請求項10】前記選択手段が、前記プログラムの部分
を特定するための情報を生成する処理を実施する、請求
項9記載のコンパイル装置。
10. The compiling device according to claim 9, wherein said selecting means executes a process of generating information for specifying a portion of said program.
【請求項11】少なくとも第1及び第2の実行状態に分
類可能なプログラムの部分について、前記第2の実行状
態において必要なコードを生成せずに前記第2の実行状
態に遷移した場合に用いるプロファイル情報を生成した
場合、前記プログラムの部分を前記第2の実行状態で実
行するプログラム実行装置であって、 前記プロファイル情報を用いて前記第2の実行状態にお
いて実行する必要のあるコードを生成するコンパイラ
と、 生成されたコードを他のコードにリンクする手段と、 前記生成されたコードの実行を開始させる手段と、 を有するプログラム実行装置。
11. A program which is used when at least a portion of a program that can be classified into the first and second execution states transitions to the second execution state without generating necessary code in the second execution state. A program execution device that executes a part of the program in the second execution state when the profile information is generated, and generates a code that needs to be executed in the second execution state using the profile information. A program execution device, comprising: a compiler; means for linking generated code to another code; and means for starting execution of the generated code.
【請求項12】コンパイラを格納した記憶媒体であっ
て、 前記コンパイラはコンピュータに、 少なくとも第1及び第2の実行状態に分類可能なプログ
ラムの部分を、所定の条件に従って選択する選択ステッ
プと、 前記実行状態の分類のためのチェック・コードを生成す
るステップと、 前記第1の実行状態における前記プログラムの部分に対
するコードを生成するステップと、 前記第2の実行状態に遷移した場合に用いるプロファイ
ル情報を生成するステップと、 前記第2の実行状態に遷移した場合に必要となるコード
を生成する処理を起動するためのコードを生成するステ
ップと、 を実行させる、記憶媒体。
12. A storage medium storing a compiler, the compiler causing a computer to select at least a portion of a program that can be classified into a first and a second execution state according to a predetermined condition; Generating a check code for classifying an execution state; generating code for a portion of the program in the first execution state; and using profile information used when the state transits to the second execution state. Generating a code for activating a process of generating a code required when the state transitions to the second execution state.
JP10190325A 1998-07-06 1998-07-06 Method and device for compilation, executing method, and program executing device Pending JP2000047879A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP10190325A JP2000047879A (en) 1998-07-06 1998-07-06 Method and device for compilation, executing method, and program executing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP10190325A JP2000047879A (en) 1998-07-06 1998-07-06 Method and device for compilation, executing method, and program executing device

Publications (1)

Publication Number Publication Date
JP2000047879A true JP2000047879A (en) 2000-02-18

Family

ID=16256313

Family Applications (1)

Application Number Title Priority Date Filing Date
JP10190325A Pending JP2000047879A (en) 1998-07-06 1998-07-06 Method and device for compilation, executing method, and program executing device

Country Status (1)

Country Link
JP (1) JP2000047879A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7941807B2 (en) 2004-04-30 2011-05-10 International Business Machines Corporation Transitional resolution in a just in time environment
JP2011133919A (en) * 2009-12-22 2011-07-07 Internatl Business Mach Corp <Ibm> Method and program for recording object generation site
JP2016510919A (en) * 2013-03-06 2016-04-11 クゥアルコム・インコーポレイテッドQualcomm Incorporated Reduce excessive compilation time
CN106325964A (en) * 2015-06-18 2017-01-11 龙芯中科技术有限公司 Dynamic compiling and scheduling method and device
US9996325B2 (en) 2013-03-06 2018-06-12 Qualcomm Incorporated Dynamic reconfigurable compiler

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7941807B2 (en) 2004-04-30 2011-05-10 International Business Machines Corporation Transitional resolution in a just in time environment
JP2011133919A (en) * 2009-12-22 2011-07-07 Internatl Business Mach Corp <Ibm> Method and program for recording object generation site
US8495647B2 (en) 2009-12-22 2013-07-23 International Business Machines Corporation Method and program for recording object allocation site
JP2016510919A (en) * 2013-03-06 2016-04-11 クゥアルコム・インコーポレイテッドQualcomm Incorporated Reduce excessive compilation time
US9996325B2 (en) 2013-03-06 2018-06-12 Qualcomm Incorporated Dynamic reconfigurable compiler
CN106325964A (en) * 2015-06-18 2017-01-11 龙芯中科技术有限公司 Dynamic compiling and scheduling method and device
CN106325964B (en) * 2015-06-18 2019-09-27 龙芯中科技术有限公司 On-the-flier compiler dispatching method and device

Similar Documents

Publication Publication Date Title
JP5284103B2 (en) Software transactional memory optimization
US6721944B2 (en) Marking memory elements based upon usage of accessed information during speculative execution
US7366880B2 (en) Facilitating value prediction to support speculative program execution
US7542977B2 (en) Transactional memory with automatic object versioning
US9720708B2 (en) Data layout transformation for workload distribution
US7921407B2 (en) System and method for supporting multiple alternative methods for executing transactions
US6353881B1 (en) Supporting space-time dimensional program execution by selectively versioning memory updates
US7574588B2 (en) Time-multiplexed speculative multi-threading to support single-threaded applications
US20070156780A1 (en) Protecting shared variables in a software transactional memory system
US6704862B1 (en) Method and apparatus for facilitating exception handling using a conditional trap instruction
US6247027B1 (en) Facilitating garbage collection during object versioning for space and time dimensional computing
JPH04225431A (en) Method for compiling computer instruction for increasing instruction-cache efficiency
US7168076B2 (en) Facilitating efficient join operations between a head thread and a speculative thread
US7086044B2 (en) Method, article of manufacture and apparatus for performing automatic intermodule call linkage optimization
US6382846B1 (en) Intermediate instruction execution processor which resolves symbolic references without modifying intermediate instruction code
US6453463B1 (en) Method and apparatus for providing finer marking granularity for fields within objects
JP2000047879A (en) Method and device for compilation, executing method, and program executing device
JPH11134198A (en) Processor and method for compilation, device and method for program execution, and program storage medium
KR20070050625A (en) Method for supporting application using dynamic linking library and system using the method
Nagarajan et al. Relaxed Memory Consistency
WO2009095917A1 (en) A system and method for responding to virtual memory addresses
JP2003256267A (en) Data processing method, memory region search system using the same, and program
JP2004510249A (en) System and method for low overhead boundary checking of JAVA arrays
JP2000035891A (en) Dynamic analysis method for incorporated software