JP4473626B2 - Compiler, recording medium, compiling device, communication terminal device, and compiling method - Google Patents

Compiler, recording medium, compiling device, communication terminal device, and compiling method Download PDF

Info

Publication number
JP4473626B2
JP4473626B2 JP2004112719A JP2004112719A JP4473626B2 JP 4473626 B2 JP4473626 B2 JP 4473626B2 JP 2004112719 A JP2004112719 A JP 2004112719A JP 2004112719 A JP2004112719 A JP 2004112719A JP 4473626 B2 JP4473626 B2 JP 4473626B2
Authority
JP
Japan
Prior art keywords
loop
procedure
program
source
unit
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.)
Expired - Fee Related
Application number
JP2004112719A
Other languages
Japanese (ja)
Other versions
JP2004326760A (en
Inventor
健宏 吉田
琢二 川本
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
Panasonic Holdings Corp
Original Assignee
Panasonic Corp
Matsushita Electric Industrial Co Ltd
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, Matsushita Electric Industrial Co Ltd filed Critical Panasonic Corp
Priority to JP2004112719A priority Critical patent/JP4473626B2/en
Publication of JP2004326760A publication Critical patent/JP2004326760A/en
Application granted granted Critical
Publication of JP4473626B2 publication Critical patent/JP4473626B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Description

本発明は、高級プログラム言語と称されることのあるコンパイラ言語、例えば、C言語、C++言語、Java(R)言語、FORTRAN及びCOBOL等の古典的なコンパイラ言語、或いはAPL、PL/1、ADA、Smalltalk、Lisp、アセンブラ言語、その他のあらゆるプログラム言語で記述された原始プログラムを、何等かの機械向け言語、例えばCPU(Central Processing Unit;中央演算処理装置)(但し、CPUはMPU(Micro Processing Unit;マイクロ演算処理装置)を含む)が直接実行することのできる機械語(マシン語)、機械語に変換する過程としての何等かの中間言語である目的プログラムに変換するコンパイラ、或いはこのコンパイラを記録した記録媒体、コンパイルを行うコンパイル装置、このコンパイル装置を有する通信端末装置及びコンパイルを行うコンパイル方法に関するものである。なお、上記「Java(R)」は米国Sun Microsystems社の登録商標である。本明細書において、記号(R)は登録商標を表す。   The present invention is a compiler language sometimes referred to as a high-level programming language, for example, a classic compiler language such as C language, C ++ language, Java (R) language, FORTRAN and COBOL, or APL, PL / 1, ADA. , Smalltalk, Lisp, assembler language, and any other programming language, and any language for machine such as CPU (Central Processing Unit) (where CPU is MPU (Micro Processing Unit) A machine language (machine language) that can be directly executed by a machine processor (including a microcomputer), a compiler that converts the target program, which is some intermediate language as a process of converting into a machine language, or records this compiler Recording medium, compiling device for compiling, and compiling It relates compiling method for performing a communication terminal apparatus and compiled with the location. The above "Java (R)" is a registered trademark of Sun Microsystems, Inc. In this specification, the symbol (R) represents a registered trademark.

従来の部分コンパイラとして、例えば特許文献1に記載のものが知られている。特許文献1に記載される従来の部分コンパイラは、関数呼び出し毎のインライン展開の要否の決定を可能とし、実行イメージに合ったインライン展開を行い、実用的且つ効率的なインライン展開を可能とすることを目的とするものであった。この従来技術では、そのために、制御フロー重み付け手段が、制御フロー解析手段の解析結果に基づいて制御フローを構成する各部分制御フローの実行回数を推測し、その実行回数に基づいて各部分制御フローに対する重み付けを行っている。更に、オブジェクト生成手段が、制御フロー重み付け手段による重み付けの結果を参照することにより、各関数呼び出しによって呼び出される関数のインライン展開の要否を決定し、その決定を反映したオブジェクトプログラムを生成する。
特開平6−202875号公報
As a conventional partial compiler, for example, the one described in Patent Document 1 is known. The conventional partial compiler described in Patent Document 1 makes it possible to determine the necessity of inline expansion for each function call, perform inline expansion suitable for the execution image, and enable practical and efficient inline expansion. It was intended. In this prior art, for this purpose, the control flow weighting unit estimates the number of execution times of each partial control flow constituting the control flow based on the analysis result of the control flow analysis unit, and each partial control flow is based on the number of execution times. Is weighted. Further, the object generation means determines whether or not inline expansion of the function called by each function call is necessary by referring to the result of weighting by the control flow weighting means, and generates an object program reflecting the determination.
JP-A-6-202875

特許文献1記載の従来の部分コンパイラは、コンパイル部分を決定するために実行回数を算定するに際し、他のプログラムから呼び出されるプログラム内で実行されるサブプログラムがいわゆるループの多重入れ子構造を有しているとき、このループの入れ子の多重度、即ちループの深さを考慮して実行回数を算定している。しかしながら、この部分コンパイラは、呼び出し元プログラムで実行されるサブプログラムも又、ループの多重入れ子構造を有している場合であっても、読み出し元プログラム内でのループの入れ子の多重度、即ちループの深さまでは考慮していない。   In the conventional partial compiler described in Patent Document 1, when calculating the number of executions in order to determine a compilation part, a subprogram executed in a program called from another program has a so-called multiple nested structure of loops. The number of executions is calculated in consideration of the multiplicity of the loop nesting, that is, the depth of the loop. However, this partial compiler does not allow the multiplicity of loop nesting in the read source program, that is, the loop even if the subprogram executed in the calling source program also has a loop nesting structure. It is not considered in the depth of.

そのために、特許文献1記載の従来の部分コンパイラは、呼び出し元で実行されるループの深さと呼び出し先で実行されるループの深さを併せて考慮し、トータルとして実行回数の多い部分を優先的にコンパイルすることができないという問題点を有していた。その結果、この従来技術は、プログラムの実行速度の向上とプログラムを記憶するためのメモリの記憶容量の節減とを最適化することができないという問題点を有していた。   For this reason, the conventional partial compiler described in Patent Document 1 takes into account the depth of the loop executed at the call source and the depth of the loop executed at the call destination, and gives priority to the portion with a large number of executions as a whole. Had the problem of being unable to compile. As a result, this conventional technique has a problem that it is not possible to optimize the improvement in the execution speed of the program and the reduction in the storage capacity of the memory for storing the program.

更に、特許文献1記載の従来技術は、例えば2重入れ子構造のループが存在する場合であっても、各ループの戻り先が同じアドレスであって且つ異なるラベル(すなわち、アドレスを表すシンボル・記号)が付されていない場合には、戻り先が1重のループの途中からの戻りと最後からの戻りとであるのか、2重入れ子構造のループの戻り先であるのかを、判別することができないという問題点を有していた。そのために、この従来技術は、ループの深さ或いは実行回数を精度良く算定することができないという問題点を有していた。即ちこの従来技術は、この点においても、実行回数の多い部分を良好な精度で選び出し優先的にコンパイルするということができず、実行速度の向上と使用メモリ領域の節減とを最適化することができないという問題点を有していた。   Further, in the prior art described in Patent Document 1, for example, even when a loop of a double nesting structure exists, the return destination of each loop is the same address and a different label (that is, a symbol / symbol indicating an address) ) Is not attached, it is possible to determine whether the return destination is a return from the middle of a single loop and a return from the end, or a return destination of a double nested loop. It had the problem that it was not possible. Therefore, this conventional technique has a problem that the depth of the loop or the number of executions cannot be accurately calculated. In other words, this conventional technique cannot select a part with a high number of executions with high accuracy and preferentially compile in this respect, and can optimize the improvement of the execution speed and the reduction of the memory area used. It had the problem that it was not possible.

本発明は上記の問題点に鑑みてなされたもので、原始プログラムのうち実行回数の多い部分、或いは実行回数の多い可能性の高い部分を良好な精度で選び出し優先的にコンパイルすることを可能にし、それにより、プログラムの実行速度の向上とプログラムを記憶するためのメモリの記憶容量の節減とを良好な精度で最適化することを可能にするコンパイラ、記録媒体、コンパイル装置、通信端末装置及びコンパイル方法を提供することを目的とする。   The present invention has been made in view of the above-mentioned problems, and enables a portion of a source program that has a high number of executions or a portion that has a high possibility of a high number of executions to be selected with good accuracy and preferentially compiled. And a compiler, a recording medium, a compiling device, a communication terminal device, and a compiling device, which can optimize the improvement of the execution speed of the program and the reduction of the storage capacity of the memory for storing the program with good accuracy. It aims to provide a method.

上記課題を解決し上記目的を達成するために、請求項1に記載の発明は、原始プログラムを目的プログラムに変換するコンパイラであって、前記原始プログラムに含まれる多重入れ子構造を検出する多重入れ子構造検出手順と、前記多重入れ子構造を構成する各単位ループの戻り先アドレスを検出する戻り先アドレス検出手順と、前記戻り先アドレス検出手順が検出した複数の戻り先アドレスのうちに、互いにアドレスが共通する重複戻り先アドレスがあるか否かを判定するアドレス重複判定手順と、前記アドレス重複判定手順が前記重複戻り先アドレスがあると判定した場合に、前記目的プログラムとして、前記重複戻り先アドレスを互いに異なるアドレスとした目的プログラムへ、前記原始プログラムを変換する分割手順とをコンピュータに実行させるためのものである。   In order to solve the above problems and achieve the above object, the invention described in claim 1 is a compiler for converting a source program into a target program, and detects a multiple nested structure included in the source program. Of the detection procedure, the return address detection procedure for detecting the return address of each unit loop constituting the multiple nested structure, and the plurality of return addresses detected by the return address detection procedure, the addresses are common to each other An address duplication determination procedure for determining whether or not there is a duplicate return destination address, and when the address duplication determination procedure determines that there is a duplicate return destination address, A dividing procedure for converting the source program to a target program having a different address; It is intended to be executed by the.

請求項1記載の発明によれば、分割手順が、多重入れ子構造を構成する単位ループの戻り先アドレスのうちに重複するものがある場合に、重複するアドレスを互いに異なるアドレスにするので、ループの深さの算定を正しく行うことが可能となる。それにより、実行回数の多い部分である可能性の高いループの深い部分を正しく選択して優先的にコンパイルすることが可能となる。   According to the first aspect of the present invention, when there is an overlap among the return destination addresses of the unit loops constituting the multi-nested structure, the overlapping address is made different from each other. It is possible to correctly calculate the depth. As a result, it is possible to correctly select and preferentially compile a deep part of a loop that is likely to be a part with a large number of executions.

請求項2記載の発明は、請求項1記載のコンパイラであって、前記分割手順は、前記重複戻り先アドレスの何れかに、実行に影響を与えない命令である不要命令を追加することによって前記重複戻り先アドレスを互いに異なるアドレスとする命令付加手順を備えるものである。   The invention according to claim 2 is the compiler according to claim 1, wherein the division procedure adds an unnecessary instruction that is an instruction that does not affect execution to any of the duplicate return destination addresses. An instruction addition procedure is provided in which the overlapping return destination addresses are different from each other.

請求項2記載の発明によれば、分割手順が不要命令を追加することにより重複戻り先アドレスを互いに異なるアドレスとするので、実行への影響をもたらすことなく、ループの深さを正しく算出することが可能となる。   According to the second aspect of the present invention, since the duplicate return destination addresses are made different from each other by adding unnecessary instructions in the division procedure, the loop depth can be calculated correctly without affecting the execution. Is possible.

請求項3記載の発明は、第1及び第2の原始プログラムを目的プログラムに変換するコンパイラであって、前記第1の原始プログラムに含まれ、多重又は1重入れ子構造を有する第1ループを検出する第1ループ検出手順と、前記第1ループの中から呼び出される前記第2の原始プログラムに含まれ、多重又は1重入れ子構造を有する第2ループを検出する第2ループ検出手順と、前記第1ループの入れ子数と前記第2ループの入れ子数とを加算して総入れ子数を計算するループ深さ評価手順と、前記総入れ子数が大きい第2ループを優先的にコンパイルすることにより、前記第1及び第2の原始プログラムを前記目的プログラムに変換する部分コンパイル手順とをコンピュータに実行させるためのものである。   The invention described in claim 3 is a compiler for converting the first and second source programs into a target program, and is included in the first source program, and detects a first loop having a multiple or single nested structure. A first loop detection procedure, a second loop detection procedure for detecting a second loop included in the second source program called from the first loop and having a multiple or single nested structure, A loop depth evaluation procedure for calculating a total nesting number by adding the nesting number of one loop and the nesting number of the second loop, and preferentially compiling the second loop having the large total nesting number, This is for causing a computer to execute a partial compilation procedure for converting the first and second source programs into the target program.

請求項3記載の発明によれば、一つの原始プログラムに含まれる第1ループの入れ子数だけでなく、このループの中から呼び出される別の原始プログラムに含まれる第2ループの入れ子数をも含めた総入れ子数が計算され、総入れ子数の大きい第2ループが優先的にコンパイルされる。すなわち、呼び出し元で実行されるループの深さと呼び出し先で実行されるループの深さを併せて考慮し、実行回数の多い部分である可能性の高い、トータルとして入れ子数の多いループが優先的にコンパイルされる。   According to the invention described in claim 3, not only the number of nested first loops included in one primitive program but also the number of nested second loops included in another primitive program called from within this loop is included. The total nesting number is calculated, and the second loop having a large total nesting number is preferentially compiled. In other words, considering the depth of the loop executed at the call source and the depth of the loop executed at the call destination, a loop with a high number of nesting is likely to be a part with a high number of executions. Is compiled into

請求項4記載の発明は、複数の原始プログラムを目的プログラムに変換するコンパイラであって、前記複数の原始プログラムの一つに含まれ、多重又は1重入れ子構造を有する第1ループを探索する第1ループ検出手順と、前記第1ループ検出手順が前記第1ループを検出した場合に、前記複数の原始プログラムのうち、前記第1ループの中から呼び出される別の原始プログラムに含まれ、多重又は1重入れ子構造を有する第2ループを探索する第2ループ検出手順と、前記第2ループ検出手順が前記第2ループを検出した場合に、前記第1ループ検出手段が前記第1ループを検出したものとして、前記第2ループ検出手順を再び実行する第1反復手順と、前記第1ループと前記第2ループとの何れかが検出されなかった場合に、それまでに検出したループの入れ子の総数であるループ深さを算出するループ深さ評価手順と、前記第1ループ検出手順から前記ループ深さ評価手順までを、前記第1ループが検出されなくなるまで反復する第2反復手順と、前記複数の原始プログラムのうち、ループ深さが大きいループを優先的にコンパイルすることにより、前記複数の原始プログラムを前記目的プログラムへ変換する部分コンパイル手順とをコンピュータに実行させるためのものである。   According to a fourth aspect of the present invention, there is provided a compiler for converting a plurality of source programs into a target program, wherein a first loop which is included in one of the plurality of source programs and has a multiple or single nested structure is searched. When the first loop detection procedure and the first loop detection procedure detect the first loop, the first loop detection procedure is included in another source program called from the first loop among the plurality of source programs. A second loop detection procedure for searching for a second loop having a single nested structure; and when the second loop detection procedure detects the second loop, the first loop detection means detects the first loop. As a first iterative procedure for performing the second loop detection procedure again, and if either the first loop or the second loop is not detected A loop depth evaluation procedure for calculating a loop depth which is the total number of loops nested and a loop depth evaluation procedure from the first loop detection procedure to the loop depth evaluation procedure is repeated until the first loop is not detected. In order to cause a computer to execute two iterative procedures and a partial compilation procedure for converting the plurality of source programs into the target program by preferentially compiling a loop having a large loop depth among the plurality of source programs. belongs to.

請求項4記載の発明によれば、一つの原始プログラムに含まれるループの入れ子数だけでなく、このループを起点として順次呼び出される原始プログラムに含まれるループの入れ子数をも含めた入れ子の総数が計算され、入れ子の総数の大きいループが優先的にコンパイルされる。即ち、一つの原始プログラムから順に呼び出し先となっている各原始プログラムとの間で構成される多重入れ子構造をも含めて、入れ子の総数の大きいループが優先的にコンパイルされる。従って、原始プログラムのうちの実行回数の多い部分である可能性の高い部分が、より精度良く選び出されコンパイルされる。   According to the invention described in claim 4, the total number of nestings including not only the number of nesting of loops included in one source program but also the number of nesting of loops included in the source program sequentially called from this loop is obtained. Computed loops with a large total number of nesting are preferentially compiled. In other words, a loop with a large total number of nesting is preferentially compiled, including a multiple nesting structure formed between each source program that is called from one source program in order. Therefore, a portion of the source program that is likely to be a portion with a high execution frequency is selected and compiled with higher accuracy.

請求項5記載の発明は、請求項4記載のコンパイラであって、前記部分コンパイル手順が、前記ループ深さ評価手順が算出したループ深さの最大値が予め定められた閾値に満たないときには、前記複数の原始プログラムの何れの部分をもコンパイルしないものである。   Invention of Claim 5 is the compiler of Claim 4, Comprising: When the said partial compilation procedure does not satisfy | fill the predetermined threshold value with the maximum value of the loop depth which the said loop depth evaluation procedure calculated | required, No part of the plurality of source programs is compiled.

請求項5記載の発明によれば、ループ深さの最大値が閾値に満たないときには、複数の原始プログラムの何れの部分もコンパイルされないので、実行速度の向上への寄与の低い部分を無駄にコンパイルしてメモリ領域を無駄に使用することを回避することができる。   According to the fifth aspect of the present invention, when the maximum value of the loop depth is less than the threshold value, no part of the plurality of source programs is compiled, so that the part that does not contribute to the improvement of the execution speed is wasted. Thus, useless use of the memory area can be avoided.

請求項6記載の発明は、請求項4又は5記載のコンパイラであって、前記ループ深さ評価手順が複数のループ深さを算出した場合に、前記複数のループ深さが均一であるか否かを判定する均一度評価手順を前記コンピュータに更に実行させ、前記部分コンパイル手順は、前記均一度評価手順が、前記複数のループ深さが均一であると判定した場合には、前記複数の原始プログラムの何れの部分をもコンパイルしないものである。   The invention according to claim 6 is the compiler according to claim 4 or 5, wherein, when the loop depth evaluation procedure calculates a plurality of loop depths, whether or not the plurality of loop depths are uniform. A uniformity evaluation procedure for determining whether or not the partial compilation procedure determines that the plurality of primitives are uniform when the uniformity evaluation procedure determines that the plurality of loop depths are uniform. It does not compile any part of the program.

請求項6記載の発明によれば、複数のループ深さが均一である場合には、複数の原始プログラムの何れの部分もコンパイルされないので、実行速度の向上への寄与が同等程度の部分を数多くコンパイルしてメモリ領域の有効利用を損なうことを回避することができる。   According to the sixth aspect of the present invention, when a plurality of loop depths are uniform, any part of the plurality of source programs is not compiled, so there are many parts that contribute to the improvement of the execution speed. Compiling to avoid losing effective use of the memory area can be avoided.

請求項7記載の発明は、第1及び第2の原始プログラムを目的プログラムに変換するコンパイラであって、前記第1の原始プログラムに含まれ、反復して実行される部分である第1反復実行部を検出する第1反復実行部検出手順と、前記第1反復実行部の中から呼び出される前記第2の原始プログラムに含まれ、反復して実行される部分である第2反復実行部を検出する第2反復実行部検出手順と、前記第1反復実行部の実行回数と前記第2反復実行部との実行回数とを加算して総実行回数を計算する総実行回数評価手順と、前記総実行回数が大きい第2反復実行部を優先的にコンパイルすることにより、前記第1及び第2の原始プログラムを前記目的プログラムに変換する部分コンパイル手順とをコンピュータに実行させるためのものである。   The invention according to claim 7 is a compiler that converts the first and second source programs into a target program, and is a part that is included in the first source program and executed repeatedly. A first iterative execution part detection procedure for detecting a part and a second iterative execution part that is included in the second original program called from the first iterative execution part and is repeatedly executed A second iterative execution unit detection procedure, a total execution number evaluation procedure for calculating the total number of executions by adding the number of executions of the first iterative execution unit and the number of executions of the second iterative execution unit, By preferentially compiling the second repetitive execution unit having a large number of executions, the computer executes a partial compilation procedure for converting the first and second source programs into the target program. .

請求項7記載の発明によれば、一つの原始プログラムに含まれる第1反復実行部の実行回数だけでなく、このループの中から呼び出される別の原始プログラムに含まれる第2反復実行部の実行回数をも含めた総実行回数が計算され、総実行回数の大きい第2反復実行部が優先的にコンパイルされる。すなわち、呼び出し元で実行される反復実行部の実行回数さと呼び出し先で実行される反復実行部の実行回数を併せて考慮し、トータルとして実行回数の多い反復実行部が優先的にコンパイルされる。   According to the seventh aspect of the present invention, not only the number of executions of the first iterative execution unit included in one source program but also the execution of the second iterative execution unit included in another source program called from this loop. The total number of executions including the number of times is calculated, and the second iterative execution unit having a large total number of executions is preferentially compiled. In other words, the number of executions of the iterative execution unit executed at the call source and the number of executions of the iterative execution unit executed at the call destination are considered together, and the repetitive execution unit having a large number of executions is preferentially compiled.

請求項8記載の発明は、複数の原始プログラムを目的プログラムに変換するコンパイラであって、前記複数の原始プログラムの一つに含まれ、反復して実行される部分である第1反復実行部を探索する第1反復実行部検出手順と、前記第1反復実行部検出手順が前記第1反復実行部を検出した場合に、前記複数の原始プログラムのうち、前記第1反復実行部の中から呼び出される別の原始プログラムに含まれ、反復して実行される第2反復実行部を探索する第2反復実行部検出手順と、前記第2反復実行部検出手順が前記第2反復実行部を検出した場合に、前記第1反復実行部検出手段が前記第1反復実行部を検出したものとして、前記第2反復実行部検出手順を再び実行する第1反復手順と、前記第1反復実行部と前記第2反復実行部との何れかが検出されなかった場合に、それまでに検出した反復実行部の実行回数の総和である総実行回数を算出する総実行回数評価手順と、前記第1反復実行部検出手順から前記総実行回数評価手順までを、前記第1反復実行部が検出されなくなるまで反復する第2反復手順と、前記複数の原始プログラムのうち、総実行回数が大きい反復実行部を優先的にコンパイルすることにより、前記複数の原始プログラムを前記目的プログラムへ変換する部分コンパイル手順とをコンピュータに実行させるためのものである。   The invention according to claim 8 is a compiler that converts a plurality of source programs into a target program, and includes a first iterative execution unit that is included in one of the plurality of source programs and that is repeatedly executed. A first iterative execution unit detection procedure to be searched, and when the first iterative execution unit detection procedure detects the first iterative execution unit, it is called from the first iterative execution unit among the plurality of source programs. A second iterative execution unit detecting procedure for searching for a second iterative execution unit included in another source program that is repeatedly executed, and the second iterative execution unit detecting procedure detects the second iterative execution unit. In this case, the first iterative execution unit detecting means detects the first iterative execution unit, the first iterative procedure for executing the second iterative execution unit detection procedure again, the first iterative execution unit, and the With the second iteration execution unit A total execution number evaluation procedure for calculating the total number of executions, which is the sum of the number of executions of the iterative execution units detected so far, and the total execution number from the first iterative execution unit detection procedure. By preferentially compiling a second iteration procedure that repeats up to the number evaluation procedure until the first iteration execution unit is not detected, and a repetition execution unit having a large total number of executions among the plurality of source programs, And causing a computer to execute a partial compilation procedure for converting the plurality of source programs into the target program.

請求項8記載の発明によれば、一つの原始プログラムに含まれる反復実行部の実行回数だけでなく、この反復実行部を起点として順次呼び出される原始プログラムに含まれる反復実行部の実行回数をも含めた総実行回数が計算され、総実行回数の大きい反復実行部が優先的にコンパイルされる。即ち、一つの原始プログラムから順に呼び出し先となっている各原始プログラムとの間で構成される反復実行部の多重構造をも含めて、実行回数の総数の大きい反復実行部が優先的にコンパイルされる。従って、原始プログラムのうちの実行回数の多い部分が、より精度良く選び出されコンパイルされる。   According to the eighth aspect of the present invention, not only the number of executions of the repetitive execution unit included in one source program but also the number of executions of the repetitive execution unit included in the source program sequentially called from the repetition execution unit is obtained. The total number of executions is calculated, and the repetitive execution unit having a large total number of executions is preferentially compiled. In other words, the repetitive execution part with the large total number of executions is preferentially compiled, including the multiple structure of the repetitive execution part composed between each source program that is called from one source program in order. The Therefore, the portion of the source program that is frequently executed is selected and compiled with higher accuracy.

請求項9記載の発明は、請求項8記載のコンパイラであって、前記部分コンパイル手順は、前記総実行回数評価手順が算出した総実行回数の最大値が予め定められた閾値に満たない場合には、前記複数の原始プログラムの何れの部分をもコンパイルしないものである。   The invention according to claim 9 is the compiler according to claim 8, wherein the partial compilation procedure is performed when the maximum value of the total number of executions calculated by the total execution number evaluation procedure is less than a predetermined threshold value. Does not compile any part of the plurality of source programs.

請求項9記載の発明によれば、総実行回数の最大値が閾値に満たないときには、複数の原始プログラムの何れの部分もコンパイルされないので、実行速度の向上への寄与の低い部分を無駄にコンパイルしてメモリ領域を無駄に使用することを回避することができる。   According to the ninth aspect of the present invention, when the maximum value of the total number of executions is less than the threshold value, no part of the plurality of source programs is compiled. Thus, useless use of the memory area can be avoided.

請求項10記載の発明は、請求項8又は9記載のコンパイラであって、前記総実行回数評価手順が複数の総実行回数を算出した場合に、前記複数の総実行回数が均一であるか否かを判定する均一度評価手順を前記コンピュータに更に実行させ、前記部分コンパイル手順は、前記均一度評価手順が、前記複数の総実行回数が均一であると判定した場合には、前記複数の原始プログラムの何れの部分をもコンパイルしないものである。   A tenth aspect of the invention is the compiler according to the eighth or ninth aspect, wherein, when the total number of executions evaluation step calculates a plurality of total number of executions, whether or not the plurality of total number of executions is uniform. The computer further executes a uniformity evaluation procedure for determining whether or not the partial compilation procedure determines that the plurality of primitives if the uniformity evaluation procedure determines that the plurality of total execution times are uniform. It does not compile any part of the program.

請求項10記載の発明によれば、複数の総実行回数が均一である場合には、複数の原始プログラムの何れの部分もコンパイルされないので、実行速度の向上への寄与が同等程度の部分を数多くコンパイルしてメモリ領域の有効利用を損なうことを回避することができる。   According to the tenth aspect of the present invention, when the total number of times of execution is uniform, no part of the plurality of source programs is compiled, so there are many parts that contribute to the improvement of the execution speed. Compiling to avoid losing effective use of the memory area can be avoided.

請求項11記載の発明は、第1及び第2の原始プログラムを目的プログラムに変換するコンパイラであって、前記第1の原始プログラムに含まれる多重若しくは1重入れ子構造を有するループ又は非ループである第1処理部分の中から呼び出される前記第2の原始プログラムに含まれる多重若しくは1重入れ子構造を有するループ又は非ループである第2処理部分を探索する第1呼び出し検出手順と、前記第1呼び出し検出手順が前記第2処理部分を検出した場合に、前記第2処理部分の中で呼び出されている前記第1の原始プログラムのうちの前記第1処理部分を含む処理部分である第3処理部分を探索する第2呼び出し検出手順と、前記第2呼び出し検出手順が前記処理部分を検出した場合に、前記第1及び第2原始プログラムのうち、前記第2処理部分と前記第3処理部分とをコンパイルすることにより、前記第1及び第2原始プログラムを前記目的プログラムへ変換する部分コンパイル手順とをコンピュータに実行させるためのものである。   The invention described in claim 11 is a compiler for converting the first and second source programs into a target program, and is a loop or non-loop having a multiple or single nested structure included in the first source program. A first call detection procedure for searching for a second processing part that is a loop or non-loop having a multiple or single nested structure included in the second source program called from the first processing part; and the first call A third processing portion that is a processing portion including the first processing portion of the first source program called in the second processing portion when the detection procedure detects the second processing portion. When the second call detection procedure for searching for and the second call detection procedure detects the processing part, among the first and second source programs, By compiling a serial second processing portion and said third processing section, is intended for executing a portion compilation step of converting the first and second source program into the object program in the computer.

請求項11記載の発明によれば、第1及び第2呼び出し検出手順が、第1及び第2原始プログラムの間に存在する、いわゆる再入構造を検出し、検出された再入構造を部分コンパイル手順がコンパイルする。即ち、原始プログラムのうちの実行回数の多い可能性の高い部分である再入構造が選び出されコンパイルされる。   According to the invention described in claim 11, the first and second call detection procedures detect a so-called reentry structure existing between the first and second source programs, and partially compile the detected reentry structure. The procedure compiles. That is, a reentry structure that is a portion of the source program that has a high possibility of execution is selected and compiled.

請求項12記載の発明は、原始プログラムを目的プログラムに変換するコンパイラであって、前記原始プログラムに含まれる多重入れ子構造を検出する多重入れ子構造検出手順と、前記多重入れ子構造を構成する各単位ループの戻り先アドレスを検出する戻り先アドレス検出手順と、前記戻り先アドレス検出手順が検出した複数の戻り先アドレスのうちに、実行に影響を与えない命令である不要命令を有するものがあるか否かを判定する不要命令検出手順と、前記不要命令検出手順が前記不要命令を有する戻り先アドレスを検出した場合に、前記目的プログラムとして、前記不要命令を削除した目的プログラムへ、前記原始プログラムを変換する不要命令削除手順とをコンピュータに実行させるためのものである。   The invention according to claim 12 is a compiler for converting a source program into a target program, a multiple nested structure detection procedure for detecting a multiple nested structure included in the source program, and each unit loop constituting the multiple nested structure A return destination address detecting procedure for detecting a return destination address and a plurality of return destination addresses detected by the return destination address detecting procedure include an unnecessary instruction that is an instruction that does not affect execution. And when the unnecessary instruction detection procedure detects a return address having the unnecessary instruction, the source program is converted into the target program from which the unnecessary instruction has been deleted. This is to cause the computer to execute the unnecessary instruction deletion procedure.

請求項12記載の発明によれば、不要命令削除手順が、多重入れ子構造を構成する単位ループの戻り先アドレスのうちに不要命令がある場合に、この不要命令を削除するので、不要命令による実行速度の遅れを回避することができる。即ち、実行回数の多い部分である可能性の高いループの深い部分を正しく選択して優先的にコンパイルすることを可能にする不要命令を、コンパイル後に削除することにより、メモリ領域を節減しつつ実行速度を更に高めることができる。   According to the twelfth aspect of the present invention, the unnecessary instruction deletion procedure deletes the unnecessary instruction when there is an unnecessary instruction in the return destination address of the unit loop constituting the multiple nested structure. Speed delays can be avoided. In other words, unnecessary instructions that can be preferentially compiled by correctly selecting the deep part of the loop that is likely to be executed frequently are deleted after compiling and executed while saving the memory area. The speed can be further increased.

請求項13記載の発明は、コンピュータ読み取り可能な記録媒体であって、請求項1から請求項12の何れか1項に記載のコンパイラを記録したものである。   A thirteenth aspect of the invention is a computer-readable recording medium on which the compiler according to any one of the first to twelfth aspects is recorded.

請求項13記載の発明によれば、記録媒体に本発明のコンパイラが記録されているので、当該記録媒体をコンピュータに読み込まれることにより、原始プログラムのうちの実行回数の多い部分、或いは実行回数の多い可能性の高い部分を精度良く選び出してコンパイルすることができる。   According to the thirteenth aspect of the invention, since the compiler of the present invention is recorded on the recording medium, the portion of the source program that has been executed frequently or the It is possible to select and compile a part that is highly likely to be accurate.

請求項14記載の発明は、原始プログラムを目的プログラムに変換するコンパイル装置であって、前記原始プログラムに含まれる多重入れ子構造を検出する多重入れ子構造検出手段と、前記多重入れ子構造を構成する各単位ループの戻り先アドレスを検出する戻り先アドレス検出手段と、前記戻り先アドレス検出手段が検出した複数の戻り先アドレスのうちに、互いにアドレスが共通する重複戻り先アドレスがあるか否かを判定するアドレス重複判定手段と、前記アドレス重複判定手順が前記重複戻り先アドレスがあると判定した場合に、前記目的プログラムとして、前記重複戻り先アドレスを互いに異なるアドレスとした目的プログラムへ、前記原始プログラムを変換する分割手段とを備えるものである。   The invention according to claim 14 is a compiling device for converting a source program into a target program, a multiple nested structure detecting means for detecting a multiple nested structure included in the source program, and each unit constituting the multiple nested structure It is determined whether there is a duplicate return destination address having a common address among the return destination address detecting means for detecting the return address of the loop and the plurality of return destination addresses detected by the return destination address detecting means. When the address duplication judgment means and the address duplication judgment procedure judge that there is the duplicate return destination address, the source program is converted into the target program having the duplicate return destination address different from each other as the target program. And a dividing means.

請求項14記載の発明によれば、分割手段が、多重入れ子構造を構成する単位ループの戻り先アドレスのうちに重複するものがある場合に、重複するアドレスを互いに異なるアドレスにするので、ループの深さの算定を正しく行うことが可能となる。それにより、実行回数の多い部分である可能性の高いループの深い部分を正しく選択して優先的にコンパイルすることが可能となる。   According to the fourteenth aspect of the present invention, when there is an overlap among the return destination addresses of the unit loops constituting the multiple nesting structure, the dividing means makes the overlapping addresses different from each other. It is possible to correctly calculate the depth. As a result, it is possible to correctly select and preferentially compile a deep part of a loop that is likely to be a part with a large number of executions.

請求項15記載の発明は、複数の原始プログラムを目的プログラムに変換するコンパイル装置であって、前記複数の原始プログラムのうちの一つの原始プログラムに含まれ、多重又は1重入れ子構造を有する第1ループを探索、前記第1ループを検出する毎に、前記複数の原始プログラムのうち、前記第1ループの中から呼び出される別の原始プログラムに含まれ、多重又は1重入れ子構造を有する第2ループを探索するとともに、前記第2ループを検出した場合には、前記第1ループを検出したものとして、更に前記第2ループを探索することにより、前記一つの原始プログラムと当該一つの原始プログラムから順に呼び出し先となっている各原始プログラムとの間で構成される多重入れ子構造を探索するループ検出手段と、前記ループ検出手段が前記第1ループを検出する毎に、前記第1ループの入れ子の数、または前記ループ検出手段が前記第2ループを検出した場合には、前記第1ループから各第2ループについて順に加算して得た入れ子の総数であるループ深さを算出するループ深さ評価手段と、前記複数の原始プログラムのうち、ループ深さが大きいループを優先的にコンパイルすることにより、前記複数の原始プログラムを前記目的プログラムへ変換する部分コンパイル手段とを備えるものである。 The invention according to claim 15 is a compiling device for converting a plurality of source programs into a target program, and is included in one source program among the plurality of source programs and has a multiple or single nested structure. Each time a loop is searched and the first loop is detected, the second included in another source program called from the first loop among the plurality of source programs and having a multiple or single nested structure When searching for a loop and detecting the second loop, it is assumed that the first loop has been detected, and the second loop is further searched so that the one source program and the one source program are detected. and loop detection means for searching the multiple nested comprised between each source program that is the callee in order, said loop Each time the detecting means detects the first loop, the number of nesting of the first loop, or when said loop detection means detects the second loop, the first loop in order for each of the second loop Loop depth evaluation means for calculating a loop depth which is the total number of nestings obtained by addition, and by preferentially compiling a loop having a large loop depth among the plurality of source programs, Partial compile means for converting the program into the target program.

請求項15記載の発明によれば、一つの原始プログラムに含まれるループの入れ子数だけでなく、このループを起点として順次呼び出される原始プログラムに含まれるループの入れ子数をも含めた入れ子の総数が計算され、入れ子の総数の大きいループが優先的にコンパイルされる。即ち、一つの原始プログラムから順に呼び出し先となっている各原始プログラムとの間で構成される多重入れ子構造をも含めて、入れ子の総数の大きいループが優先的にコンパイルされる。従って、原始プログラムのうちの実行回数の多い部分である可能性の高い部分が、より精度良く選び出されコンパイルされる。   According to the fifteenth aspect of the present invention, the total number of nestings including not only the number of nesting loops included in one source program but also the number of nesting loops included in the source program sequentially called from this loop is obtained. Computed loops with a large total number of nesting are preferentially compiled. In other words, a loop with a large total number of nesting is preferentially compiled, including a multiple nesting structure formed between each source program that is called from one source program in order. Therefore, a portion of the source program that is likely to be a portion with a high execution frequency is selected and compiled with higher accuracy.

請求項16記載の発明は、請求項15記載のコンパイル装置であって、前記部分コンパイル手段は、前記ループ深さ評価手段が算出したループ深さの最大値が予め定められた閾値に満たない場合には、前記複数の原始プログラムの何れの部分をもコンパイルしないものである。   The invention according to claim 16 is the compiling device according to claim 15, wherein the partial compiling means has a maximum value of the loop depth calculated by the loop depth evaluating means that is less than a predetermined threshold value. Does not compile any part of the plurality of source programs.

請求項16記載の発明によれば、ループ深さの最大値が閾値に満たないときには、複数の原始プログラムの何れの部分もコンパイルされないので、実行速度の向上への寄与の低い部分を無駄にコンパイルしてメモリ領域を無駄に使用することを回避することができる。   According to the sixteenth aspect of the present invention, when the maximum value of the loop depth is less than the threshold value, no part of the plurality of source programs is compiled, so that a part that contributes less to improving the execution speed is wasted. Thus, useless use of the memory area can be avoided.

請求項17記載の発明は、請求項15又は16記載のコンパイル装置であって、前記ループ深さ評価手段が複数のループ深さを算出した場合に、前記複数のループ深さが均一であるか否かを判定する均一度評価手段を更に備え、前記部分コンパイル手段は、前記均一度評価手段が均一であると判定した場合には、前記複数の原始プログラムの何れの部分をもコンパイルしないものである。   The invention according to claim 17 is the compiling device according to claim 15 or 16, wherein the plurality of loop depths are uniform when the loop depth evaluation means calculates a plurality of loop depths. A uniformity evaluation means for determining whether or not the partial compilation means does not compile any part of the plurality of source programs when the uniformity evaluation means determines that the uniformity is uniform. is there.

請求項17記載の発明によれば、複数のループ深さが均一である場合には、複数の原始プログラムの何れの部分もコンパイルされないので、実行速度の向上への寄与が同等程度の部分を数多くコンパイルしてメモリ領域の有効利用を損なうことを回避することができる。   According to the seventeenth aspect of the present invention, when a plurality of loop depths are uniform, any part of the plurality of source programs is not compiled, so there are many parts that contribute to an improvement in execution speed. Compiling to avoid losing effective use of the memory area can be avoided.

請求項18記載の発明は、通信端末装置であって、請求項14乃至17の何れかに記載のコンパイル装置と、前記コンパイル装置がコンパイルすべき原始プログラムを伝送媒体を通じて取得する通信手段と、前記コンパイル装置が生成した目的プログラムを実行する実行制御手段とを備えるものである。   The invention according to claim 18 is a communication terminal device, the compiling device according to any one of claims 14 to 17, communication means for acquiring a source program to be compiled by the compiling device through a transmission medium, And an execution control means for executing the target program generated by the compiling device.

請求項18記載の発明によれば、通信端末装置が通信手段を備えるので、原始プログラムを伝送媒体を通じて取得することができ、これをコンパイル装置によってコンパイルすることができる。更に、通信端末装置が実行制御手段を備えるので、コンパイルされた目的プログラムを実行することができる。即ち、このコンパイル装置によれば、伝送媒体を通じて取得した原始プログラムを実行することができる。更に、通信端末が本発明のコンパイル装置を備えるので、実行速度の向上と使用メモリ領域の節減とを良好な精度で最適化することが可能となる。   According to the invention described in claim 18, since the communication terminal device includes the communication means, the source program can be acquired through the transmission medium, and can be compiled by the compiling device. Furthermore, since the communication terminal device includes the execution control means, the compiled object program can be executed. That is, according to this compiling apparatus, the original program acquired through the transmission medium can be executed. Furthermore, since the communication terminal includes the compiling device according to the present invention, it is possible to optimize the improvement of the execution speed and the reduction of the memory area used with good accuracy.

請求項19記載の発明は、請求項18記載の通信端末装置であって、前記実行制御部は、前記コンパイル装置が処理対象とし且つその何れの部分をもコンパイルしなかった原始プログラムである非コンパイルプログラムをも実行対象とし、前記実行制御部は、前記非コンパイルプログラムの実行中に、当該目的プログラムのうちの定められた基準値を超える頻度で実行される部分である高頻度実行部分を検出する頻度検出手段と、前記頻度検出部が検出した前記高頻度実行部分をコンパイルする別の部分コンパイル手段とを備えるものである。   The invention according to claim 19 is the communication terminal device according to claim 18, wherein the execution control unit is a non-compiled program that is a source program that is processed by the compiling device and does not compile any part thereof. The execution control unit detects a high-frequency execution portion that is a portion that is executed at a frequency exceeding a predetermined reference value in the target program during execution of the non-compiled program. A frequency detection unit and another partial compilation unit that compiles the high-frequency execution part detected by the frequency detection unit are provided.

請求項19記載の発明によれば、非コンパイルプログラムの実行中に頻度検出手段により検出された高頻度実行部分が、部分コンパイル手段によりコンパイルされる。即ち、非コンパイルプログラムが、いわゆるJITによりコンパイルされる。従って、実行速度の向上とメモリ領域の節減との最適化の観点から、コンパイル装置が事前コンパイルを行うことが適切ではない場合に、それに代わってJITにより最適化を図ることができる。   According to the nineteenth aspect of the present invention, the high-frequency execution part detected by the frequency detection means during the execution of the non-compiled program is compiled by the partial compilation means. That is, the non-compiled program is compiled by so-called JIT. Therefore, from the viewpoint of optimizing the execution speed and saving the memory area, when it is not appropriate for the compiling apparatus to perform pre-compilation, optimization can be achieved by JIT instead.

請求項20記載の発明は、コンピュータが原始プログラムを目的プログラムに変換するコンパイル方法であって、前記原始プログラムに含まれる多重入れ子構造を検出する多重入れ子構造検出手順と、前記多重入れ子構造を構成する各単位ループの戻り先アドレスを検出する戻り先アドレス検出手順と、前記戻り先アドレス検出手順が検出した複数の戻り先アドレスのうちに、互いにアドレスが共通する重複戻り先アドレスがあるか否かを判定するアドレス重複判定手順と、前記アドレス重複判定手順が前記重複戻り先アドレスがあると判定した場合に、前記目的プログラムとして、前記重複戻り先アドレスを互いに異なるアドレスとした目的プログラムへ、前記原始プログラムを変換する分割手順とを備えるものである。   The invention according to claim 20 is a compiling method in which a computer converts a source program into a target program, and comprises a multi-nested structure detection procedure for detecting a multi-nested structure included in the source program, and the multi-nested structure. A return address detection procedure for detecting a return address of each unit loop and whether there are duplicate return addresses having a common address among a plurality of return addresses detected by the return address detection procedure. When the address duplication determination procedure and the address duplication determination procedure determine that there is the duplicate return destination address, the source program is changed to the target program having the duplicate return destination address different from each other as the target program. And a dividing procedure for converting.

請求項20記載の発明によれば、分割手順が、多重入れ子構造を構成する単位ループの戻り先アドレスのうちに重複するものがある場合に、重複するアドレスを互いに異なるアドレスにするので、ループの深さの算定を正しく行うことが可能となる。それにより、実行回数の多い部分である可能性の高いループの深い部分を正しく選択して優先的にコンパイルすることが可能となる。   According to the twentieth aspect of the present invention, when there is an overlap among the return destination addresses of the unit loops constituting the multi-nested structure, the overlapping address is made different from each other. It is possible to correctly calculate the depth. As a result, it is possible to correctly select and preferentially compile a deep part of a loop that is likely to be a part with a large number of executions.

以上のように本発明のコンパイラ、記録媒体、コンパイル装置、通信端末装置及びコンパイル方法によれば、原始プログラムのうちの実行回数の多い部分、或いは実行回数の多い可能性の高い部分を精度良く選び出してコンパイルすることができる。それにより、プログラムの実行速度の向上とプログラムを記憶するためのメモリの記憶容量の節減とを良好な精度で最適化することが可能となる。   As described above, according to the compiler, the recording medium, the compiling device, the communication terminal device, and the compiling method of the present invention, the portion of the original program that is frequently executed or the portion that is likely to be frequently executed is selected with high accuracy. Can be compiled. As a result, it is possible to optimize the improvement in the execution speed of the program and the reduction in the storage capacity of the memory for storing the program with good accuracy.

本発明の実施の形態について図面を参照しつつ詳細に説明する。   Embodiments of the present invention will be described in detail with reference to the drawings.

(実施の形態1)
本発明の一実施の形態によるコンパイラの開発環境の主要部の概略構成を図1に示す。この開発環境105は、本発明の一実施の形態による記録媒体、コンパイル装置、及びコンパイル方法を実施する開発環境にも該当する。開発環境105はその内部に、その一部として、例えばJava(R)プログラム言語によるプログラムを開発する環境である、Java(R)プログラム言語開発環境125を含んでいる。
(Embodiment 1)
FIG. 1 shows a schematic configuration of a main part of a compiler development environment according to an embodiment of the present invention. The development environment 105 also corresponds to a development environment that implements a recording medium, a compiling device, and a compiling method according to an embodiment of the present invention. The development environment 105 includes a Java (R) program language development environment 125, which is an environment for developing a program in, for example, the Java (R) program language.

図1では、Java(R)プログラム言語開発環境125を例示するが、使用されるプログラム言語は必ずしもJava(R)プログラム言語に限られるものではなく、何等かのいわゆる高級プログラム言語と呼ばれることのあるコンパイラ言語であればよい。例えば、C言語、C++言語、Java(R)言語、FORTRAN、及びCOBOL等の古典的なコンパイラ言語、或いはAPL、PL/1、ADA、SmalltalkやLisp、いわゆるアセンブラ言語、その他のあらゆるプログラム言語で、原始プログラムが記述されても支障がない。又、開発環境105は複数の言語を用いた開発環境を含んでいてもよく、単一の言語の開発環境のみを含むものであってもよい。   In FIG. 1, the Java (R) programming language development environment 125 is illustrated, but the programming language used is not necessarily limited to the Java (R) programming language, and may be called some so-called high-level programming language. Any language can be used. For example, in C language, C ++ language, Java (R) language, FORTRAN, COBOL, and other classic compiler languages, or APL, PL / 1, ADA, Smalltalk and Lisp, so-called assembler languages, and any other programming language, There is no problem even if the source program is described. The development environment 105 may include a development environment using a plurality of languages, or may include only a single language development environment.

Java(R)プログラム言語開発環境125によって、Java(R)プログラムコード121が開発される。Java(R)プログラムコード121は、本発明に係る原始プログラムの一実施の形態に該当する。Java(R)プログラムコードの一例を図2に示す。図2の例では、Java(R)プログラムコード121は、2重の入れ子を構成する2つの「do〜while」ループを含んでいる。即ち、Java(R)プログラムコード121は、2重入れ子構造を有している。   Java (R) program code 121 is developed by the Java (R) program language development environment 125. The Java (R) program code 121 corresponds to an embodiment of the source program according to the present invention. An example of Java (R) program code is shown in FIG. In the example of FIG. 2, Java® program code 121 includes two “do-while” loops that form a double nesting. That is, the Java (R) program code 121 has a double nesting structure.

尚、本明細書では、「多重入れ子構造」を単に「多重ループ」と適宜称する。また、単一のループ即ち1重ループと、多重入れ子構造即ち多重ループとを含めて、「ループ構造」或いは「ループ」と適宜称する。更に、多重ループを構成する個々のループを、特に区別するために、「単位ループ」と適宜称する。また、1重ループを「1重入れ子構造」とも称する。   In this specification, the “multiple nested structure” is simply referred to as “multiple loop” as appropriate. A single loop, that is, a single loop, and a multiple nested structure, that is, a multiple loop, are appropriately referred to as “loop structure” or “loop”. Furthermore, the individual loops constituting the multiple loop are appropriately referred to as “unit loops” in order to particularly distinguish them. A single loop is also referred to as a “single nested structure”.

このようなループ構造は、コンパイル部分決定部127によって解析の対象とされる。開発環境105は、不図示のコンピュータを有しており、このコンピュータが本発明の一実施形態によるコンパイラを実行することによりコンパイル部分決定部127の機能を実現する。コンパイル部分決定部127のシミュレータ137は、図2に例示するJava(R)プログラムコード121の実行をシミュレートするもので、ループ解析部131及びヘッダ分割部133を備えている。   Such a loop structure is subjected to analysis by the compile part determination unit 127. The development environment 105 has a computer (not shown), and the computer implements the function of the compile part determination unit 127 by executing a compiler according to an embodiment of the present invention. The simulator 137 of the compile part determination unit 127 simulates the execution of the Java (R) program code 121 illustrated in FIG. 2, and includes a loop analysis unit 131 and a header division unit 133.

ループ解析部131はループの解析を行うことにより、多重ループの戻り先アドレスのうち、重複した戻り先アドレスを検出する。このために、ループ解析部131は、多重入れ子構造検出部135、戻り先アドレス検出部136及びアドレス重複判定部137を有している。ヘッダ分割部133は、検出された重複した戻り先アドレスを分割し、重複した戻り先アドレスが分割されたJava(R)バイトコード129へJava(R)プログラムコード121を変換し、それを出力する。このために、ヘッダ分割部133は命令付加部138を備えている。Java(R)バイトコード129は、本発明の目的プログラムの一実施の形態に該当する。   The loop analysis unit 131 analyzes the loop to detect a duplicate return destination address among the return destination addresses of the multiple loop. For this purpose, the loop analysis unit 131 includes a multiple nesting structure detection unit 135, a return address detection unit 136, and an address duplication determination unit 137. The header dividing unit 133 divides the detected duplicate return address, converts the Java (R) program code 121 into the Java (R) byte code 129 into which the duplicate return address is divided, and outputs it. . For this purpose, the header division unit 133 includes an instruction addition unit 138. Java (R) byte code 129 corresponds to an embodiment of the object program of the present invention.

図3は、比較例としてコンパイル部分決定部127が、重複した戻り先アドレスを分割せずに出力した場合のJava(R)バイトコード129を例示する説明図である。図3が例示するJava(R)バイトコード129は、プログラムモジュール403、405、407及び409を含んでいる。図3(a)は、各モジュールの処理の流れを例示するブロックフローチャートであり、図3(b)は各モジュールに記述されているプログラムを例示している。このJava(R)バイトコード129では、2つのループの戻り先が共に、プログラムモジュール405の先頭の「15 iinc 2 1」命令である。すなわち、2重ループの戻り先アドレスが重複している。   FIG. 3 is an explanatory diagram illustrating a Java (R) byte code 129 when the compile part determination unit 127 outputs a duplicate return destination address without being divided as a comparative example. The Java® byte code 129 illustrated in FIG. 3 includes program modules 403, 405, 407, and 409. FIG. 3A is a block flowchart illustrating the processing flow of each module, and FIG. 3B illustrates a program described in each module. In this Java (R) byte code 129, the return destinations of the two loops are both the “15 iinc 2 1” instruction at the head of the program module 405. That is, the return address of the double loop is duplicated.

このように2重ループの2つの戻り先アドレスが同一である場合には、Java(R)バイトコード129に含まれる多重ループを部分コンパイルする際に、このループが途中からの戻りを含む1つのループであるのか、2重ループであるのかを判断することができない。即ち、プログラムモジュール405とプログラムモジュール407を連続して繰り返す1つのループであり、ある条件に応じてプログラムモジュール405を実行するだけで1回のループを終了する場合があるのか、それとも、プログラムモジュール405だけを繰り返す内側のループと、この内側のループに加えてプログラムモジュール407を繰り返すループとを含む、2重ループであるのかを判断することができない。   In this way, when two return destination addresses of the double loop are the same, when the multiple loop included in the Java (R) byte code 129 is partially compiled, this loop includes one return including a return from the middle. Whether it is a loop or a double loop cannot be determined. That is, it is one loop that repeats the program module 405 and the program module 407 in succession, and whether or not a single loop may be ended only by executing the program module 405 according to a certain condition, or the program module 405 It is impossible to determine whether the loop is a double loop including an inner loop that repeats only the loop and a loop that repeats the program module 407 in addition to the inner loop.

そこで、ループ解析部131は、このような多重ループの重複した戻り先アドレスを検出し、ヘッダ分割部133は、検出された重複した戻り先アドレスを分割する。即ち、図4にプログラムモジュール504として例示するように、ヘッダ分割部133は「15 nop」を挿入し、内側のループの戻りアドレスと外側のループの戻りアドレスの分割を行う。図4において、プログラムモジュール503、505、507及び509は、図3に示したプログラムモジュール403、405、407及び409とは、モジュール504が介挿された分だけアドレスがずれているのみで、それぞれ内容同一である。   Therefore, the loop analysis unit 131 detects a duplicate return address in such a multiple loop, and the header division unit 133 divides the detected duplicate return address. That is, as illustrated as the program module 504 in FIG. 4, the header dividing unit 133 inserts “15 nop” and divides the return address of the inner loop and the return address of the outer loop. In FIG. 4, program modules 503, 505, 507 and 509 are different in address from the program modules 403, 405, 407 and 409 shown in FIG. The content is the same.

このように2重ループの2つの戻り先が同一である場合、例えば前記「nop(No Operation)」のように処理上意味のない命令(本明細書では、「不要命令」と称する)を挿入して、戻り先アドレスを分割することによって、図4(a)のブロックフローチャートにその構造を示す通り、このループが2重ループであることを明確化することができる。このようにしてヘッダ分割部133によって重複する2重ループの戻りアドレスの分割が行われたJava(R)バイトコード129は、開発環境105からサーバ103に転送される。サーバ103は、転送されたJava(R)バイトコード129を、クライアント端末装置からの送信要求に備えて保存する。   In this way, when two return destinations of the double loop are the same, for example, an instruction that is meaningless in processing (referred to as an “unnecessary instruction” in this specification) such as “nop (No Operation)” is inserted. Then, by dividing the return address, it is possible to clarify that this loop is a double loop as shown in the block flowchart of FIG. The Java (R) byte code 129 that has been divided into the double loop return addresses in this way by the header division unit 133 is transferred from the development environment 105 to the server 103. The server 103 stores the transferred Java (R) byte code 129 in preparation for a transmission request from the client terminal device.

しかしこのサーバ103への転送と保存は、一例であって、必ずしも必須のものではなく、他の例では、開発環境105とサーバ103は同一装置の異なる記録部であってもよいし、同一装置の同一記録部であってもよいし、その他の構造であっても構わない。   However, the transfer and storage to the server 103 is an example and is not necessarily essential. In another example, the development environment 105 and the server 103 may be different recording units of the same device, or the same device. May be the same recording part, or may have another structure.

ここで、コンパイル部分決定部127による処理の手順について更に詳細に説明する。図5は、コンパイル部分決定部127が実行する処理の手順を示すフローチャートである。コンパイル部分決定部127は、ステップS1〜S5の処理を実行しつつ、Java(R)プログラムコード121をJava(R)バイトコード129へ変換する。コンパイル部分決定部127が処理を開始すると、初めに多重入れ子構造検出部135は、Java(R)プログラムコード121の中に多重入れ子構造を検索する(S1)。多重入れ子構造検出部135が多重入れ子構造を検出すると(S2でYes)、戻り先アドレス検出部136は、検出された多重入れ子構造を構成する各単位ループの戻り先アドレスを検出する(S3)。   Here, the procedure of the process performed by the compile part determination unit 127 will be described in more detail. FIG. 5 is a flowchart showing a procedure of processing executed by the compilation part determination unit 127. The compile part determination unit 127 converts the Java (R) program code 121 into the Java (R) byte code 129 while executing the processes of steps S1 to S5. When the compile part determining unit 127 starts processing, first, the multiple nested structure detection unit 135 searches for multiple nested structures in the Java (R) program code 121 (S1). When the multiple nested structure detection unit 135 detects the multiple nested structure (Yes in S2), the return destination address detection unit 136 detects the return destination address of each unit loop constituting the detected multiple nested structure (S3).

戻り先アドレスが重複しておれば(S4でYes)、ヘッダ分割部133の命令付加部138は、重複した戻り先アドレスの何れかにnop命令を追加することにより、重複した戻り先アドレスを分割する(S5)。一般に、N重(N≧2)の入れ子構造の各単位ループの戻り先アドレスが重複している場合には、内側のN−1個の単位ループの戻り先の各々にnop命令を挿入することにより、重複を解消することができる。その後、処理はステップS1へ戻る。一方、戻り先アドレスが重複していなければ(S4でNo)、処理はそのままステップS1へ戻る。コンパイル部分決定部127は、多重入れ子構造検出部135が多重入れ子構造を検出しなくなるまで、ステップS1〜S5の処理を反復し、多重入れ子構造が検出されなくなると(S2でNo)、処理を終了する。   If the return address is duplicated (Yes in S4), the instruction adding unit 138 of the header dividing unit 133 divides the duplicate return address by adding a nop instruction to any of the duplicated return addresses. (S5). In general, when the return address of each unit loop having an N-fold (N ≧ 2) nested structure is duplicated, a nop instruction is inserted into each of the N−1 unit loop return destinations. Thus, duplication can be eliminated. Thereafter, the process returns to step S1. On the other hand, if the return address does not overlap (No in S4), the process returns to step S1 as it is. The compile part determination unit 127 repeats the processes of steps S1 to S5 until the multi-nested structure detection unit 135 does not detect the multi-nested structure. When the multi-nested structure is not detected (No in S2), the process ends. To do.

(実施の形態2)
図6は、本発明の一実施の形態によるコンパイラを実行する端末装置の主要部の概略構成図を示すブロック図である。この端末装置205は、本発明の一実施の形態によるコンパイル装置及び通信端末装置にも該当する。更に、端末装置205は、本発明の一実施形態による記録媒体及びコンパイル方法を実施する装置にも該当する。
(Embodiment 2)
FIG. 6 is a block diagram showing a schematic configuration diagram of a main part of a terminal device that executes a compiler according to an embodiment of the present invention. The terminal device 205 also corresponds to a compiling device and a communication terminal device according to an embodiment of the present invention. Further, the terminal device 205 corresponds to a recording medium and a device that performs a compiling method according to an embodiment of the present invention.

端末装置205は図示しないコンピュータを有している。このコンピュータが本発明の一実施形態によるコンパイラを実行することにより、端末装置205が備える事前リンク部231の機能を実現する。事前リンク部231の機能を実現するコンパイラは、ROM(Read Only Memory)、フレキシブルディスク、CD−ROM等の記録媒体31を通じて供給することも、電話回線、ネットワーク等の伝送媒体33を通じて供給することも可能である。図6には、記録媒体31としてCD−ROMが描かれている。CD−ROMに記録されたコンパイラは、CD−ROM読取装置32を入出力インタフェース211に接続することにより、読み出すことができ、更に不図示のコンピュータが備えるハードディスク或いはRAM(Random Access Memory)等の記憶媒体に格納することができる。   The terminal device 205 has a computer (not shown). The computer executes the compiler according to the embodiment of the present invention, thereby realizing the function of the pre-linking unit 231 included in the terminal device 205. The compiler that realizes the function of the pre-link unit 231 may be supplied through a recording medium 31 such as a ROM (Read Only Memory), a flexible disk, or a CD-ROM, or may be supplied through a transmission medium 33 such as a telephone line or a network. Is possible. In FIG. 6, a CD-ROM is depicted as the recording medium 31. The compiler recorded on the CD-ROM can be read by connecting the CD-ROM reader 32 to the input / output interface 211, and further, a storage such as a hard disk or RAM (Random Access Memory) provided in a computer (not shown). It can be stored on a medium.

記録媒体31としてROMの形態でコンパイラが供給される場合には、当該ROMをコンピュータに搭載することにより、コンピュータはコンパイラに従った事前リンク部231の処理を実行可能となる。伝送媒体33を通じて供給されるコンパイラは、通信インタフェース210を通じて受信され、例えばハードディスク或いはRAM等の不図示の記憶媒体に格納される。伝送媒体33は、有線の伝送媒体に限らず無線の伝送媒体であっても良い。尚、実施の形態1では説明を略したが、コンパイル部分決定部127(図1)の機能を実現するコンパイラも、同様にして開発環境201が備える不図示のコンピュータに供給することができる。   When the compiler is supplied as the recording medium 31 in the form of a ROM, the computer can execute the processing of the pre-linking unit 231 according to the compiler by mounting the ROM on the computer. The compiler supplied through the transmission medium 33 is received through the communication interface 210 and stored in a storage medium (not shown) such as a hard disk or a RAM. The transmission medium 33 is not limited to a wired transmission medium and may be a wireless transmission medium. Although not described in the first embodiment, a compiler that realizes the function of the compile part determination unit 127 (FIG. 1) can be supplied to a computer (not shown) included in the development environment 201 in the same manner.

端末装置205は、サーバ103から多重ループの戻り先アドレスが分割されたJava(R)バイトコード129を、ネットワーク32及び通信インタフェース210を通じて第1のファイルシステム243に読み込む。第1のファイルシステム243に読み込まれたJava(R)バイトコード221は、端末装置205の事前リンク部231に読み込まれ、コンパイル部233が備えるコンパイル部分決定部223によって、コンパイルする部分が決定される。   The terminal device 205 reads the Java® byte code 129 obtained by dividing the return address of the multiple loop from the server 103 into the first file system 243 through the network 32 and the communication interface 210. The Java (R) byte code 221 read into the first file system 243 is read into the pre-link unit 231 of the terminal device 205, and the compile part determination unit 223 included in the compile unit 233 determines the part to be compiled. .

コンパイル部分決定部223は、複数プログラム間の呼び出し関係を考慮し、呼び出し元プログラムにおける呼び出し命令のループの深さと、呼び出し先プログラムのループの深さとを併せて考慮して、最も深さの大きいループを、最も多くの回数実行される可能性の高いループ(命令)であると判断する。更に、コンパイル部分決定部223は、優先して部分コンパイルを行うべき部分として、最も深さの大きいループ(命令)を決定する。   The compile part determination unit 223 considers the call relationship between a plurality of programs, and considers the depth of the call instruction loop in the call source program and the loop depth of the call destination program in combination with the loop having the largest depth. Is determined to be a loop (instruction) that is most likely to be executed the most times. Furthermore, the compilation part determination unit 223 determines a loop (instruction) having the largest depth as a part to be preferentially subjected to partial compilation.

ここで「ループの深さ」或いは「ループ深さ」とは、ループの多重入れ子構造又は1重入れ子構造の多重度のことを言う。例えば、1重入れ子構造のループ深さは1であり、2重入れ子構造のループ深さは2である。また一般に、ループを検出する代わりに、反復して実行される処理部分又は命令(本明細書では「反復実行部分」と称する)を検出しても良い。この意味で、ループの後に「(命令)」を付記している。反復実行部分の実行回数が、ループの深さに対応する。   Here, “loop depth” or “loop depth” refers to the multiplicity of a loop multiple nested structure or a single nested structure. For example, the loop depth of the single nested structure is 1, and the loop depth of the double nested structure is 2. In general, instead of detecting a loop, a processing part or an instruction (hereinafter referred to as “repetitive execution part”) that is executed repeatedly may be detected. In this sense, “(command)” is added after the loop. The number of executions of the repeated execution part corresponds to the depth of the loop.

例えば図7に示すように、3つのプログラム、即ちプログラム610、プログラム630、プログラム670で、順に呼び出しが行われていると仮定する。また、プログラム610はプログラムモジュール603〜607を含み、プログラム630はプログラムモジュール624〜626を含み、プログラム670はプログラムモジュール643〜649を含むものとする。更に、プログラム610のプログラムモジュール605から、プログラム630の呼び出しが行われており、プログラム630のプログラムモジュール625から、プログラム670の呼び出しが行われているものと仮定する。   For example, as shown in FIG. 7, it is assumed that calls are sequentially made by three programs, that is, a program 610, a program 630, and a program 670. The program 610 includes program modules 603 to 607, the program 630 includes program modules 624 to 626, and the program 670 includes program modules 643 to 649. Further, it is assumed that the program 630 is called from the program module 605 of the program 610 and the program 670 is called from the program module 625 of the program 630.

プログラムモジュール605はプログラム610内で深さが2のループの中にあり、プログラムモジュール625はプログラム630内で深さが1のループの中にあり、プログラムモジュール646はプログラム670内で深さが3のループの中にある。従って、プログラムモジュール646は、プログラム670単独でループの深さを考慮すると、その深さは「3」であるが、全てのプログラム間の呼び出し関係を考慮してトータルとしてループの深さを判断すると、その深さは「2+1+3=6」である。   Program module 605 is in a loop of depth 2 in program 610, program module 625 is in a loop of depth 1 in program 630, and program module 646 is 3 in depth in program 670. In the loop. Accordingly, when the program module 646 considers the depth of the loop by the program 670 alone, the depth is “3”. However, the program module 646 determines the depth of the loop as a total in consideration of the calling relationship between all programs. The depth is “2 + 1 + 3 = 6”.

これは1つの例であるが、他のプログラムとプログラムモジュールに関しても全てこのように、全プログラムを通じての呼び出し関係を考慮してトータルとしてループの深さを判断することによって、より多くの回数が実行される可能性の高いループ(命令)をより正確に検出し、その部分を部分コンパイルすることによって、より正確に実行速度の最大化を図ることができる。   This is an example, but all other programs and program modules are executed more times in this way by determining the depth of the loop as a total in consideration of the calling relationship throughout all programs. By more accurately detecting a loop (instruction) that is likely to be executed and partially compiling that portion, the execution speed can be maximized more accurately.

Java(R)バイトコード221は、開発環境105のコンパイル部分決定部127のヘッダ分割部133によって多重ループの戻り先アドレスが分割されている。従って、図3及び図4に例示したような2重ループであっても、正確に2重ループを検出し、最も多くの回数実行されるループ(命令)を精度良く判断することができる。それにより、優先的にコンパイルすべき部分を精度良く決定することができる。従って、実行時メモリ容量、即ち図6の例では端末装置205が備える第2のファイルシステム245のメモリ容量の許す限り、最も実行速度を上げることのできる部分を正確に判断して、当該部分をコンパイルすべき部分として決定することができる。   In the Java (R) byte code 221, the return address of the multiple loop is divided by the header division unit 133 of the compilation part determination unit 127 of the development environment 105. Therefore, even in the double loop as illustrated in FIGS. 3 and 4, it is possible to accurately detect the double loop and accurately determine the loop (instruction) that is executed the most times. As a result, a portion to be preferentially compiled can be determined with high accuracy. Therefore, as long as the runtime memory capacity, that is, the memory capacity of the second file system 245 provided in the terminal device 205 in the example of FIG. It can be determined as the part to be compiled.

コンパイル部233が備える部分ネイティブコンパイル部225は、コンパイル部分決定部223が決定したコンパイルすべき部分をコンパイルする。コンパイル部分決定部223によるコンパイル部分の決定は、前記の通りトータルとして考慮したループの深いものを優先し、実行メモリ容量を併せて考慮しながら、実行メモリ容量の許す限り多くの命令を事前コンパイルするように行われる。これによって実行時メモリ容量の許す限りで、実行速度を可及的に上げることができるからである。   The partial native compiling unit 225 included in the compiling unit 233 compiles the part to be compiled determined by the compiling part determining unit 223. The compile part determination unit 223 determines the compile part, preferentially compiles as many instructions as the execution memory capacity allows, giving priority to the deep part of the loop considered as a total and considering the execution memory capacity together. To be done. This is because the execution speed can be increased as much as possible as long as the runtime memory capacity permits.

実行時メモリ容量の制限から、必ずしも全ての命令を事前コンパイルすることはできないので、事前コンパイル後のプログラムには、事前コンパイルが済んだネイティブコード229の部分とJava(R)バイトコード227のまま残される部分とが併存することになる。この事前コンパイルが済んだネイティブコード229の部分とJava(R)バイトコード227のまま残される部分とが併存する実行時プログラムは、第2のファイルシステム245に記憶保存される。この第1のファイルシステム243と第2のファイルシステム245とは同一のものであってもよく、別体のものであってもよい。   Because all the instructions cannot be precompiled due to the limitation of the memory capacity at the time of execution, the precompiled program remains the part of the native code 229 and the Java (R) byte code 227 that have been precompiled. Will coexist. The runtime program in which the part of the native code 229 that has been pre-compiled and the part that remains in the Java (R) byte code 227 coexists is stored and saved in the second file system 245. The first file system 243 and the second file system 245 may be the same or different.

第2のファイルシステム245に記憶保存された実行時プログラムは、実行制御部257によって実行される。この実行時プログラムは、実行時メモリ容量の許す限りループの深い部分が優先的に事前コンパイルが行われているので、最大限実行速度を向上させることができる。   The runtime program stored and saved in the second file system 245 is executed by the execution control unit 257. Since this runtime program is precompiled preferentially at the deep part of the loop as much as the runtime memory capacity permits, the maximum execution speed can be improved.

前記の通り、コンパイル部分決定部223は、図3及び図4に例示したような2重ループがあっても、コンパイル部分決定部127のヘッダ分割部133によって2重ループの戻り先アドレスが分割されているので、正確に2重ループを検出し、最も多くの回数実行されるループ(命令)を精度良く判断して、優先的にコンパイルする部分を決定することができる。しかしながら、既に述べたように戻り先アドレスの分断は、nop命令のような処理上意味のない不要命令を挿入することによって行われている。この命令は確かに処理上の意味はないため、処理内容に関して悪影響を及ぼすことはないが、メモリ上に不要な領域を占める。又、実行制御部257がプログラムを実行する時に、この命令を解読し、例えばnop命令であることを判断するまでには不要な時間をロスすることにもなる。そこで部分ネイティブコンパイル部225は、2重ループであるか否かの判断を行ってしまえば不要となるこのような追加された命令を削除して、事前コンパイルを実行する。   As described above, the compile part determination unit 223 divides the return address of the double loop by the header division unit 133 of the compile part determination unit 127 even if there is a double loop as illustrated in FIGS. 3 and 4. Therefore, it is possible to accurately detect a double loop, accurately determine a loop (instruction) that is executed the most times, and determine a portion to be preferentially compiled. However, as described above, the return address is divided by inserting an unnecessary instruction such as a nop instruction that has no meaning in processing. Since this instruction certainly has no processing meaning, it does not adversely affect the processing contents, but occupies an unnecessary area on the memory. Further, when the execution control unit 257 executes the program, this instruction is decoded, and for example, it is necessary to lose unnecessary time until it is determined that the instruction is a nop instruction. Therefore, the partial native compiling unit 225 deletes such an added instruction which becomes unnecessary if it is determined whether or not it is a double loop, and executes pre-compilation.

次に、コンパイル部233の構成及び動作手順についてより詳細に説明する。図8は、コンパイル部233が備えるコンパイル部分決定部223及び部分ネイティブコンパイル部225の構成を示すブロック図である。コンパイル部分決定部223は、ループ検出部261、呼出し検出部262、ループ深さ評価部263、均一度評価部264、コンパイル部分判定部265及び再入構造判定部267を備えている。部分ネイティブコンパイル部225は、多重入れ子構造検出部271、戻りアドレス検出部272、不要命令検出部273及び不要命令削除部274を備えている。   Next, the configuration and operation procedure of the compiling unit 233 will be described in more detail. FIG. 8 is a block diagram illustrating a configuration of the compile part determination unit 223 and the partial native compile unit 225 included in the compile unit 233. The compile part determination unit 223 includes a loop detection unit 261, a call detection unit 262, a loop depth evaluation unit 263, a uniformity evaluation unit 264, a compile part determination unit 265, and a reentry structure determination unit 267. The partial native compilation unit 225 includes a multiple nested structure detection unit 271, a return address detection unit 272, an unnecessary instruction detection unit 273, and an unnecessary instruction deletion unit 274.

図9は、コンパイル部分決定部223及び部分ネイティブコンパイル部225が実行する処理の手順を示すフローチャートである。説明の便宜上、コンパイル部分決定部223及び部分ネイティブコンパイル部225は、図7の3つのプログラム610、630及び670を有するJava(R)バイトコード221を処理対象とするものと仮定する。コンパイル部分決定部223が処理を開始すると、初めにループ検出部261は、Java(R)バイトコード129に含まれるメインプログラム、即ち図7のプログラム610について、多重入れ子構造又は1重入れ子構造を有するループを探索する(S11)。   FIG. 9 is a flowchart illustrating a procedure of processes executed by the compiled part determining unit 223 and the partial native compiling unit 225. For convenience of explanation, it is assumed that the compiled part determining unit 223 and the partial native compiling unit 225 are intended to process the Java (R) byte code 221 having the three programs 610, 630, and 670 of FIG. When the compile part determining unit 223 starts processing, the loop detecting unit 261 first has a multiple nested structure or a single nested structure for the main program included in the Java (R) byte code 129, that is, the program 610 in FIG. A loop is searched (S11).

ループ検出部261がプログラム610に含まれるループを検出すると(S12でYes)、呼出し検出部262は、検出されたループの中から呼び出されている別のプログラムを検出する(S14)。呼出し先のプログラム、即ちプログラム630が検出されると(S14でYes)、ループ検出部261は、プログラム630について多重入れ子構造又は1重入れ子構造を有するループを探索する(S15)。   When the loop detection unit 261 detects a loop included in the program 610 (Yes in S12), the call detection unit 262 detects another program that is called from the detected loop (S14). When the called program, that is, the program 630 is detected (Yes in S14), the loop detection unit 261 searches the program 630 for a loop having a multiple nested structure or a single nested structure (S15).

ループ検出部261がプログラム630に含まれるループを検出すると(S16でYes)、呼出し検出部262は、検出されたループの中から呼び出されている更に別のプログラム検出する(S14)。呼出し先のプログラム、即ちプログラム670が検出されると(S14でYes)、ループ検出部261は、プログラム670について多重入れ子構造又は1重入れ子構造を有するループを探索する(S15)。   When the loop detection unit 261 detects a loop included in the program 630 (Yes in S16), the call detection unit 262 detects another program that is called from the detected loop (S14). When the called program, that is, the program 670 is detected (Yes in S14), the loop detection unit 261 searches the program 670 for a loop having a multiple nested structure or a single nested structure (S15).

ループ検出部261がプログラム670に含まれるループを検出すると(S16でYes)、呼出し検出部262は、検出されたループの中から呼び出されている更に別のプログラム検出する(S14)。呼出し先のプログラムは検出されないので(S14でNo)、ループ深さ評価部263は、それまでにループ検出部261で検出されたループの入れ子の総数、即ち2+1+3=6をループ深さとして算出する。即ち、ループ深さ評価部263は、呼出し関係にあるプログラム610、630及び670にわたって多重入れ子構造をなしているループの全体としての多重度を、ループ深さとして算出する(S17)。   When the loop detection unit 261 detects a loop included in the program 670 (Yes in S16), the call detection unit 262 detects another program that is called from the detected loop (S14). Since the called program is not detected (No in S14), the loop depth evaluation unit 263 calculates the total number of loop nestings detected by the loop detection unit 261 so far, that is, 2 + 1 + 3 = 6 as the loop depth. . That is, the loop depth evaluation unit 263 calculates the multiplicity of the entire loop having a multiple nested structure over the programs 610, 630, and 670 having a calling relationship as the loop depth (S17).

ループ検出部261は、プログラム610について、更にループを探索する(S11)。ループ検出部261が新たなループを検出しなければ(S12でNo)、好ましくは均一度評価部264がループ深さの間の均一度を評価する(S19)。均一度評価部264は、ループ深さ評価部263が、複数のループ深さを算出した場合には、これら複数のループ深さが定められた基準に照らして均一であるか否かを判定する。例えば、均一度評価部264は、複数のループ深さの全てが同一であれば均一であると判定し、同一でないものがあれば均一でないと判定する。或いは、均一度評価部264は、複数のループ深さの全てが定められた基準幅の中に入っておれば均一であると判定し、基準幅からはみ出すものがあれば、均一でないと判定する。均一度評価部264は、ループ深さ評価部263が、単一のループ深さのみを算出した場合には、ループ深さは均一でないと判定する。   The loop detection unit 261 searches for a loop for the program 610 (S11). If the loop detection unit 261 does not detect a new loop (No in S12), preferably the uniformity evaluation unit 264 evaluates the uniformity between the loop depths (S19). When the loop depth evaluation unit 263 calculates a plurality of loop depths, the uniformity evaluation unit 264 determines whether or not the plurality of loop depths are uniform according to a predetermined standard. . For example, the uniformity evaluation unit 264 determines that the plurality of loop depths are the same if they are all the same, and determines that they are not uniform if there are some that are not the same. Alternatively, the uniformity evaluation unit 264 determines that the loop is uniform if all of the plurality of loop depths are within the determined reference width, and determines that it is not uniform if there is anything that protrudes from the reference width. . The uniformity evaluation unit 264 determines that the loop depth is not uniform when the loop depth evaluation unit 263 calculates only a single loop depth.

均一度評価部264が、ループ深さが均一でないと判定すると(S19でNo)、コンパイル部分判定部265は、ループ深さが大きいループを優先的にコンパイルすべき部分に含める(S20)。例えば、コンパイル部分判定部265は、第2のファイルシステム245の中に割り当てられたメモリ容量の許す範囲で、可能な限り多くのループを、ループ深さの大きいものから優先的にコンパイルすべき部分に含める。別の例として、コンパイル部分判定部265は、ループ深さが最大のループのみ、或いはループ深さが大きいものから順に定められた個数以内のループをコンパイルすべき部分に含める。或いは、コンパイル部分判定部265は、ループ深さが定められた閾値を超えるループをコンパイルすべき部分に含める。   If the uniformity evaluation unit 264 determines that the loop depth is not uniform (No in S19), the compilation portion determination unit 265 includes a loop having a large loop depth in a portion to be preferentially compiled (S20). For example, the compile part determination unit 265 compiles as many loops as possible from the one with the largest loop depth within the range allowed by the memory capacity allocated in the second file system 245. Include in As another example, the compile part determination unit 265 includes, in the part to be compiled, only a loop with the maximum loop depth or a loop within a predetermined number in order from the largest loop depth. Alternatively, the compile part determination unit 265 includes a loop whose loop depth exceeds a predetermined threshold in the part to be compiled.

コンパイル部分判定部265の処理(S20)が終了すると、或いは均一度評価部264がループの深さが均一であると判定すると(S19でYes)、部分ネイティブコンパイル部225は、コンパイル部分判定部265がコンパイルすべきと決定した部分のみをコンパイルすることにより、ネイティブコード229を含むJava(R)バイトコード227を生成する(S21)。   When the process (S20) of the compile part determination unit 265 ends, or when the uniformity evaluation unit 264 determines that the depth of the loop is uniform (Yes in S19), the partial native compile unit 225 includes the compile part determination unit 265. By compiling only the part that is determined to be compiled, Java (R) byte code 227 including native code 229 is generated (S21).

このように、Java(R)バイトコード221に含まれ、互いに呼出し関係にある複数のプログラム610、630及び670の間で構成される多重入れ子構造をも含めて、入れ子の総数の大きいループが優先的にコンパイルされる。従って、Java(R)バイトコード221のうちの実行回数の多い可能性の高い部分が、より精度良く選び出されコンパイルされる。それにより、プログラムの実行速度の向上と第2のファイルシステム245のメモリ領域の節減とを、良好な精度で最適化することが可能となる。   In this way, a loop with a large total number of nesting is prioritized, including a multiple nesting structure comprised of a plurality of programs 610, 630 and 670 that are included in the Java (R) byte code 221 and have a calling relationship with each other. Compiled. Accordingly, a portion of the Java (R) byte code 221 that has a high possibility of execution is selected and compiled with higher accuracy. As a result, it is possible to optimize the improvement in the execution speed of the program and the reduction in the memory area of the second file system 245 with good accuracy.

また、ステップS20において、コンパイル部分判定部265は、ループ深さの最大値が、予め定められた閾値に満たないときには、コンパイルすべき部分がないものと決定しても良い。それにより、実行速度の向上への寄与の低い部分を無駄にコンパイルして、第2のファイルシステム245のメモリ領域を無駄に使用することを回避することができる。   In step S20, the compile part determination unit 265 may determine that there is no part to be compiled when the maximum value of the loop depth is less than a predetermined threshold value. As a result, it is possible to avoid unnecessary use of the memory area of the second file system 245 by compiling wastelessly contributing to the improvement in execution speed.

更に、ループ深さ評価部263が、ループ深さが均一であると判定した場合には(S19でYes)、コンパイル部分判定部265は、コンパイルすべき部分がないものと決定しても良い。それにより、実行速度の向上への寄与が同等程度の部分を数多くコンパイルして、第2のファイルシステム245のメモリ領域の有効利用を損なうことを回避することができる。   Furthermore, when the loop depth evaluation unit 263 determines that the loop depth is uniform (Yes in S19), the compilation part determination unit 265 may determine that there is no part to be compiled. As a result, it is possible to avoid compiling a lot of portions that contribute to the improvement of the execution speed and impairing the effective use of the memory area of the second file system 245.

コンパイル部分判定部265が、コンパイルすべき部分がないと決定した場合には、部分ネイティブコンパイル部225は、処理対象である原始プログラムとしてのJava(R)バイトコード221を、コンパイルすることなく、処理後の目的プログラムであるJava(R)バイトコード227として、そのまま出力することとなる。この場合、Java(R)バイトコード227は、望ましくは、実行制御部257によって実行に供されつつ、実行頻度の高い部分が抽出され、抽出された部分が部分コンパイルされる。すなわち、実行前に部分コンパイルされないJava(R)バイトコード227は、いわゆるJIT(Just In Time)処理に供されるのが望ましい。また、実行前に部分コンパイルされたJava(R)バイトコード227についても、実行制御部257によってJIT処理が施され、それによってより望ましい部分がコンパイルされても良い。JITを実行するための実行制御部257の構成例については後述する。   When the compile part determination unit 265 determines that there is no part to be compiled, the partial native compile unit 225 performs processing without compiling the Java (R) byte code 221 as the source program to be processed. This is output as it is as a Java (R) byte code 227 which is a later target program. In this case, the Java (R) byte code 227 is desirably subjected to execution by the execution control unit 257, and a portion with high execution frequency is extracted, and the extracted portion is partially compiled. That is, it is desirable that the Java (R) byte code 227 that is not partially compiled before execution is subjected to so-called JIT (Just In Time) processing. Further, the Java (R) byte code 227 partially compiled before execution may be subjected to JIT processing by the execution control unit 257, and thereby a more desirable part may be compiled. A configuration example of the execution control unit 257 for executing JIT will be described later.

図9において、ループ検出部261は、ループを検出する代わりに、反復して実行される部分である反復実行部分を検出しても良い。反復実行部分はループを含む。この場合には、ループ深さ評価部263は、ループ深さ即ちループの多重度の総和に代えて、反復実行部の実行回数の総和を算出するとよい。それにより、Java(R)バイトコード221のうちの実行回数の多い部分が、より精度良く選び出されコンパイルされる。その結果、プログラムの実行速度の向上と第2のファイルシステム245のメモリ領域の節減とを、良好な精度で最適化することが可能となる。   In FIG. 9, the loop detection unit 261 may detect an iterative execution part that is an iteratively executed part instead of detecting a loop. The repeated execution part includes a loop. In this case, the loop depth evaluation unit 263 may calculate the sum of the number of executions of the iterative execution unit instead of the loop depth, that is, the sum of the multiplicity of the loop. As a result, the portion of the Java (R) byte code 221 that has a large number of executions is selected and compiled with higher accuracy. As a result, it is possible to optimize the improvement of the program execution speed and the memory area of the second file system 245 with good accuracy.

図10は、部分ネイティブコンパイル部225がステップS21の前に、又はステップS21の処理と並行して実行する望ましい処理の手順を示すフローチャートである。部分ネイティブコンパイル部225は、例えばステップS51〜S55の処理を実行しつつ、Java(R)バイトコード221を、通常はネイティブコード229を含むJava(R)バイトコード227へ変換する。部分ネイティブコンパイル部225が処理を開始すると、初めに多重入れ子構造検出部271は、Java(R)バイトコード221の中に多重入れ子構造を検索する(S51)。多重入れ子構造検出部271が多重入れ子構造を検出すると(S52でYes)、戻り先アドレス検出部272は、検出された多重入れ子構造を構成する各単位ループの戻り先アドレスを検出する(S53)。   FIG. 10 is a flowchart illustrating a procedure of a desirable process executed by the partial native compiling unit 225 before step S21 or in parallel with the process of step S21. The partial native compiling unit 225 converts the Java (R) byte code 221 into a Java (R) byte code 227 that normally includes the native code 229 while executing the processing of steps S51 to S55, for example. When the partial native compiling unit 225 starts processing, the multiple nested structure detecting unit 271 first searches the Java (R) byte code 221 for multiple nested structures (S51). When the multiple nested structure detection unit 271 detects the multiple nested structure (Yes in S52), the return destination address detection unit 272 detects the return destination address of each unit loop constituting the detected multiple nested structure (S53).

次に、不要命令検出部273は、検出された戻り先アドレスのうちに不要命令を含むものがあるか否かを判定する(S54)。不要命令検出部273が、不要命令を有する戻り先アドレスを検出した場合には(S54でYes)、不要命令削除部274は、検出された戻り先アドレスから不要命令を削除する(S55)。その後、処理はステップS51へ戻る。一方、不要命令を有する戻り先アドレスが検出されなければ(S54でNo)、処理はそのままステップS51へ戻る。部分ネイティブコンパイル部225は、多重入れ子構造検出部271が多重入れ子構造を検出しなくなるまで、ステップS51〜S55の処理を反復し、多重入れ子構造が検出されなくなると(S52でNo)、不要命令を削除するための図10の処理を終了する。   Next, the unnecessary instruction detection unit 273 determines whether there is any detected return destination address that includes an unnecessary instruction (S54). If the unnecessary instruction detection unit 273 detects a return address having an unnecessary instruction (Yes in S54), the unnecessary instruction deletion unit 274 deletes the unnecessary instruction from the detected return address (S55). Thereafter, the process returns to step S51. On the other hand, if a return address having an unnecessary instruction is not detected (No in S54), the process directly returns to step S51. The partial native compiling unit 225 repeats the processing of steps S51 to S55 until the multiple nested structure detecting unit 271 does not detect the multiple nested structure. When the multiple nested structure is not detected (No in S52), an unnecessary instruction is issued. The process of FIG. 10 for deleting is terminated.

上述の通り、部分ネイティブコンパイル部225は、コンパイル部分決定部265が決定したコンパイルすべき部分を優先的にコンパイルする(S21)。部分ネイティブコンパイル部225は、例えば第2のファイルシステム245に割り当てられたメモリ領域がオーバフローした時点で、ステップS21のコンパイル処理を終了する。   As described above, the partial native compiling unit 225 preferentially compiles the part to be compiled determined by the compiling part determining unit 265 (S21). For example, when the memory area allocated to the second file system 245 overflows, the partial native compiling unit 225 ends the compiling process of step S21.

図11は、実行制御部257の構成例を示すブロック図である。図11の例では、実行制御部257は、第1実行制御部257Aと第2実行制御部257Bとを備えている。第2ファイルシステム245から読み出されたJava(R)バイトコード227がネイティブコード229を含んでいるときには、このJava(R)バイトコード227は第1実行制御部257Aによって実行される。一方、Java(R)バイトコード227がネイティブコード229を含まないときは、このJava(R)バイトコード227は、第2実行制御部257Bによって実行される。第2実行制御部257Bは、いわゆるJITを実行するものである。   FIG. 11 is a block diagram illustrating a configuration example of the execution control unit 257. In the example of FIG. 11, the execution control unit 257 includes a first execution control unit 257A and a second execution control unit 257B. When the Java (R) byte code 227 read from the second file system 245 includes the native code 229, the Java (R) byte code 227 is executed by the first execution control unit 257A. On the other hand, when the Java (R) byte code 227 does not include the native code 229, the Java (R) byte code 227 is executed by the second execution control unit 257B. The second execution control unit 257B executes what is called JIT.

第1実行制御部257Aへ入力されたネイティブコード229を含むJava(R)バイトコード227は、リンカ部281によってリンク処理が施された後、ネイティブコード229の部分はキャッシュ282へ保持され、Java(R)バイトコード227の部分はキャッシュ283へ保持される。実行処理の流れに沿って、ネイティブコード229とJava(R)バイトコード227とが切り替え部284によって選択され、選択された部分が実行部285によって実行される。Java(R)バイトコード227の全てがネイティブコード229に置き換えられている場合、即ち、コンパイル部233によってJava(R)バイトコード221の全ての部分がコンパイルされている場合にも、当該プログラムは第1実行制御部257Aによって実行される。   The Java (R) byte code 227 including the native code 229 input to the first execution control unit 257A is subjected to link processing by the linker unit 281, and then the portion of the native code 229 is held in the cache 282, and Java ( R) The part of the byte code 227 is held in the cache 283. In accordance with the flow of execution processing, the native code 229 and the Java (R) byte code 227 are selected by the switching unit 284, and the selected part is executed by the execution unit 285. Even when all of the Java (R) byte code 227 is replaced with the native code 229, that is, when all the parts of the Java (R) byte code 221 are compiled by the compiling unit 233, the program is 1 executed by the execution control unit 257A.

第2実行制御部257Bは、第1実行制御部257Aの構成に加えて、実行部分頻度検出部286及び部分ネイティブコンパイル部287を備えている。実行部分頻度検出部286は、当初においてネイティブコード229を含まないJava(R)バイトコード227を実行部285が実行している最中に、このプログラムのうちの定められた基準を超える高い頻度で実行される部分である高頻度実行部分を検出する。部分ネイティブコンパイル部287は、実行部分頻度検出部286が検出した高頻度実行部分をコンパイルする。その結果、ネイティブコード229を含むこととなったJava(R)バイトコード227は、第1実行制御部257Aと同様に、キャッシュ282及び283、並びに切り替え部284を経て、実行部285によって実行される。   The second execution control unit 257B includes an execution partial frequency detection unit 286 and a partial native compilation unit 287 in addition to the configuration of the first execution control unit 257A. The execution part frequency detection unit 286, while the execution unit 285 is executing the Java (R) byte code 227 that does not include the native code 229 at the beginning, frequently exceeds a predetermined standard of this program. Detect high-frequency execution parts that are executed. The partial native compiling unit 287 compiles the high-frequency execution part detected by the execution part frequency detection unit 286. As a result, the Java (R) byte code 227 that includes the native code 229 is executed by the execution unit 285 via the caches 282 and 283 and the switching unit 284 in the same manner as the first execution control unit 257A. .

実行制御部257Bによる実行が終了し、すでにネイティブコード229を含むこととなったJava(R)バイトコード227は、次回の実行に備えて、第2ファイルシステム245に保存することができる。保存されたJava(R)バイトコード227は、すでに部分コンパイルが行われているので、第1実行制御部257Aで実行することが可能である。   The Java (R) byte code 227 that has been executed by the execution control unit 257B and already includes the native code 229 can be stored in the second file system 245 in preparation for the next execution. Since the saved Java (R) byte code 227 has already been partially compiled, it can be executed by the first execution control unit 257A.

図11のように構成される実行制御部257によれば、コンパイル部233のコンパイル部分判定部265でコンパイルする部分がないと決定されたJava(R)バイトコード227が、いわゆるJITに供されることとなる。従って、事前コンパイルを行うことが適切でないとコンパイル部233が判定したJava(R)バイトコード227に対して、事前コンパイルに代わって、JITによって実行速度の最適化とメモリ領域の節減との最適化を図ることができる。   According to the execution control unit 257 configured as shown in FIG. 11, the Java (R) byte code 227 determined to have no part to be compiled by the compilation part determination unit 265 of the compilation unit 233 is provided for so-called JIT. It will be. Therefore, instead of pre-compilation, Java (R) byte code 227 determined by the compile unit 233 that pre-compilation is not appropriate is optimized by JIT for optimization of execution speed and memory area saving. Can be achieved.

図11は、第1実行制御部257Aと第2実行制御部257Bとが併存する形態を例示した。これに対して、実行制御部257が実行制御部257Bのみを備え、入力されるJava(R)バイトコード227がネイティブコード229を含むか否かに応じて、実行部分頻度検出部286及び部分ネイティブコンパイル部287をオン・オフ制御するように実行制御部257を構成しても良い。   FIG. 11 illustrates a form in which the first execution control unit 257A and the second execution control unit 257B coexist. On the other hand, the execution control unit 257 includes only the execution control unit 257B, and the execution partial frequency detection unit 286 and the partial native depending on whether the input Java (R) byte code 227 includes the native code 229 or not. The execution control unit 257 may be configured to control the compiling unit 287 on / off.

図8に戻って、コンパイル部分決定部223は、再入構造判定部267を動作させることにより、以下に述べるような処理をも実現する。コンパイル部分決定部223が処理対象とする原始プログラム、即ちJava(R)バイトコード221が、例えば図12に示すループ構造を有していたと仮定する。図12に例示するJava(R)バイトコード221は、プログラム710とプログラム730とを有している。プログラム710はプログラムモジュール703〜707を含んでおり、プログラム730はプログラムモジュール724〜726を含んでいる。   Returning to FIG. 8, the compile part determination unit 223 also realizes the processing described below by operating the reentry structure determination unit 267. It is assumed that the source program to be processed by the compile part determining unit 223, that is, the Java (R) byte code 221 has a loop structure shown in FIG. 12, for example. The Java® byte code 221 illustrated in FIG. 12 includes a program 710 and a program 730. The program 710 includes program modules 703 to 707, and the program 730 includes program modules 724 to 726.

呼び出し元プログラム710において2重ループを構成しているプログラムモジュール705はプログラム730に含まれるプログラムモジュール724を呼び出している。一方、プログラム730では、プログラムモジュール724に続いて実行されるプログラムモジュール725が1重のループ構造を有している。更に、このプログラムモジュール725は、呼び出し元プログラム710に含まれ、自分自身を呼び出したプログラムモジュール705の実行に至るプログラムモジュール704を呼び出している。   The program module 705 constituting a double loop in the call source program 710 calls the program module 724 included in the program 730. On the other hand, in the program 730, the program module 725 executed following the program module 724 has a single loop structure. Further, the program module 725 is included in the caller program 710 and calls the program module 704 that leads to the execution of the program module 705 that called itself.

一般にこのような構造は、「再入」構造又は「リエントラント(Re−entrant)」構造と呼ばれることがある。即ち、プログラムモジュール704、705、706、724、725及び726が、再入構造を構成する。コンパイル部分決定部223の再入構造判定部267が、コンパイル対象プログラム中に、このような再入構造を発見すると、コンパイル部分決定部233は、その部分を最優先でコンパイル部分と決定する。従って、再入構造は、部分ネイティブコンパイル部225によって優先的にコンパイルされる。Java(R)バイトコード221のうちの実行回数の多い可能性の高い部分である再入構造が優先的にコンパイルされるので、実行速度の向上と第2ファイルシステム245のメモリ領域の節減とが良好な精度で最適化される。   In general, such structures are sometimes referred to as “re-entrant” or “Re-entrant” structures. That is, the program modules 704, 705, 706, 724, 725 and 726 constitute a reentry structure. When the reentry structure determination unit 267 of the compile part determination unit 223 finds such a reentry structure in the program to be compiled, the compile part determination unit 233 determines that part as the compile part with the highest priority. Therefore, the reentry structure is preferentially compiled by the partial native compiling unit 225. Since the reentry structure, which is a portion of the Java (R) bytecode 221 that is likely to be executed frequently, is preferentially compiled, the execution speed is improved and the memory area of the second file system 245 is saved. Optimized with good accuracy.

次に、コンパイル部分決定部223の再入構造の判定に関する動作手順についてより詳細に説明する。図13は、再入構造の判定に関するコンパイル部分決定部233の動作手順を示すフローチャートである。図13の処理手順は、図9の処理手順と並行して実行することが可能である。説明の便宜のために、コンパイル部分決定部223が、図12に例示したJava(R)バイトコード221を処理対象とするものと仮定する。   Next, the operation procedure related to the determination of the reentry structure of the compiled part determination unit 223 will be described in more detail. FIG. 13 is a flowchart showing an operation procedure of the compile part determination unit 233 regarding determination of the reentry structure. The processing procedure of FIG. 13 can be executed in parallel with the processing procedure of FIG. For convenience of explanation, it is assumed that the compile part determination unit 223 targets the Java (R) byte code 221 illustrated in FIG.

コンパイル部分決定部223が図13の処理を開始すると、呼出し検出部262は、メインプログラムであるプログラム710について、別プログラムを呼出している処理部分を探索する(S31)。呼出し検出部262が、このような処理部分、即ちプログラムモジュール705を検出すると(S32でYes)、呼出し検出部262は、呼出し先であるプログラム730の中で、呼出し元プログラムであるプログラム710の中の呼出し部分(即ち、プログラムモジュール705)を含む処理部分(即ち、プログラムモジュール704、705及び706)を呼び出している処理部分(即ち、プログラムモジュール725)を探索する(S33)。   When the compile part determination unit 223 starts the process of FIG. 13, the call detection unit 262 searches for a process part that calls another program for the program 710 that is the main program (S31). When the call detection unit 262 detects such a processing part, that is, the program module 705 (Yes in S32), the call detection unit 262 includes the program 730 that is the call destination in the program 710 that is the call source program. A processing portion (ie, program module 725) that calls a processing portion (ie, program modules 704, 705, and 706) including the calling portion (ie, program module 705) is searched (S33).

呼出し検出部262が、このような処理部分、即ちプログラムモジュール725を検出すると(S34でYes)、再入構造判定部267は、呼出し先の処理(即ち、プログラムモジュール724、725及び726)と、読み出し先から逆に呼び出されている読み出し元の処理(即ち、プログラムモジュール704、705及び706)とを、再入構造であると判定する(S35)。その後、呼出し検出部262は、再びステップS33の処理を実行する。呼出し検出部262が、新たな処理部分を検出しない場合には(S34でNo)、呼出し検出部262は、再びステップS31の処理を実行する。呼出し検出部262が新たな処理部分を検出しない場合には(S32でNo)、コンパイル部分判定部265は、再入構造判定部267が再入構造であると判定した処理部分を、コンパイルすべき部分に含める(S36)。   When the call detection unit 262 detects such a processing portion, that is, the program module 725 (Yes in S34), the reentry structure determination unit 267 performs the call destination processing (ie, the program modules 724, 725, and 726), It is determined that the process of the read source (that is, the program modules 704, 705, and 706) that has been called from the read destination is the reentry structure (S35). Thereafter, the call detection unit 262 executes the process of step S33 again. When the call detection unit 262 does not detect a new processing part (No in S34), the call detection unit 262 executes the process of step S31 again. When the call detection unit 262 does not detect a new processing part (No in S32), the compilation part determination unit 265 should compile the processing part that the reentry structure determination unit 267 determines to have a reentry structure. It is included in the part (S36).

その後、コンパイル部分決定部223は、図13の処理を終了する。部分ネイティブコンパイル部225は、図9の処理によってコンパイル部分判定部265がコンパイルすべき部分と決定したループと、図13の処理によってコンパイル部分判定部265がコンパイルすべき部分と決定した再入構造とを、優先的にコンパイルすることとなる。   Thereafter, the compile part determination unit 223 ends the process of FIG. The partial native compiling unit 225 includes a loop determined by the compiling part determination unit 265 as a part to be compiled by the process of FIG. 9 and a reentry structure determined by the compiling part determination unit 265 as a part to be compiled by the process of FIG. Will be compiled preferentially.

(その他の実施の形態)
実施の形態1では、Java(R)プログラムコード121からJava(R)バイトコード129への変換が、開発環境105の中で行われる例を示した。これに対して、端末装置205が、例えば通信インタフェース210を通じてJava(R)プログラムコード121をサーバ103からダウンロードし、事前リンク部231の中で、Java(R)バイトコード129への変換を実行しても良い。
(Other embodiments)
In the first embodiment, the example in which the conversion from the Java (R) program code 121 to the Java (R) byte code 129 is performed in the development environment 105 is shown. In response to this, the terminal device 205 downloads the Java (R) program code 121 from the server 103 through the communication interface 210, for example, and executes conversion into the Java (R) byte code 129 in the pre-link unit 231. May be.

本発明のコンパイラ、記録媒体、コンパイル装置、通信端末装置及びコンパイル方法は、プログラムの実行速度の向上とプログラムを記憶するためのメモリの記憶容量の節減とを良好な精度で最適化することを可能にするので、産業上有用である。   The compiler, recording medium, compiling device, communication terminal device, and compiling method of the present invention can optimize the improvement of the execution speed of the program and the reduction of the storage capacity of the memory for storing the program with good accuracy. Therefore, it is industrially useful.

本発明の実施の形態1によるコンパイラを実行する開発環境の概略構成図。1 is a schematic configuration diagram of a development environment for executing a compiler according to a first embodiment of the present invention. 図1の開発環境によって開発されたJava(R)プログラムコードの例を示す図。The figure which shows the example of the Java (R) program code developed by the development environment of FIG. 2つのループの戻り先が重複するJava(R)バイトコードを例示する図。The figure which illustrates the Java (R) bytecode in which the return destination of two loops overlaps. 2つのループの戻り先が分割されたJava(R)バイトコードを例示する図。The figure which illustrates the Java (R) bytecode in which the return destination of two loops was divided. 重複するループの戻り先を分割するための処理手順を示す流れ図。The flowchart which shows the process sequence for dividing | segmenting the return destination of the overlapping loop. 本発明の実施の形態2による端末装置の構成を示すブロック図。The block diagram which shows the structure of the terminal device by Embodiment 2 of this invention. 3つのプログラムの間で順に呼び出しを行うJava(R)バイトコードを例示する図。The figure which illustrates the Java (R) bytecode which calls in sequence between three programs. 図6のコンパイル部の構成を示すブロック図。The block diagram which shows the structure of the compilation part of FIG. 図8のコンパイル部による処理手順を示す流れ図。The flowchart which shows the process sequence by the compilation part of FIG. 図8の部分ネイティブコンパイル部による処理手順を示す流れ図。The flowchart which shows the process sequence by the partial native compilation part of FIG. 図6の実行制御部の構成を示すブロック図。The block diagram which shows the structure of the execution control part of FIG. 再入構造を有するプログラムを例示する図。The figure which illustrates the program which has a reentry structure. 図8のコンパイル部分決定部による再入構造を優先的にコンパイルするための処理手順を示す流れ図。FIG. 9 is a flowchart showing a processing procedure for preferentially compiling a reentry structure by a compile part determining unit in FIG. 8.

符号の説明Explanation of symbols

103 サーバ 105 開発環境
121 Java(R)プログラムコード
125 Java(R)プログラム言語開発環境 127 コンパイル部分決定部
129 Java(R)バイトコード 131 ループ解析部
133 ヘッダ分割部 135 多重入れ子構造検出部
136 戻り先アドレス検出部 137 アドレス重複判定部
138 命令付加部 137 シミュレータ
205 端末装置(通信端末装置) 210 通信インタフェース(通信手段)
221 Java(R)バイトコード 223 コンパイル部分決定部
225 部分ネイティブコンパイル部(部分コンパイル手段)
227 Java(R)バイトコード 229 ネイティブコード
231 事前リンク部 233 コンパイル部(コンパイル装置)
243 第1のファイルシステム 245 第2のファイルシステム
257 実行制御部 261 ループ検出部 262 呼出し検出部
263 ループ深さ評価部 264 均一度評価部
265 コンパイル部分判定部 267 再入構造判定部
271 多重入れ子構造検出部 272 戻りアドレス検出部
273 不要命令検出部 274 不要命令削除部
286 実行部分頻度検出部
287 部分ネイティブコンパイル部(部分コンパイル手段)
403,405,407,409 プログラムモジュール
503,504,505,507,509 プログラムモジュール
603,604,605,606,607 プログラムモジュール
610,630,670 プログラム
624,625,626 プログラムモジュール
643,644,645,646,647,648,649 プログラムモジ
ュール
103 Server 105 Development environment
121 Java (R) program code 125 Java (R) program language development environment 127 Compiled part determination unit 129 Java (R) byte code 131 Loop analysis unit 133 Header division unit 135 Multiple nested structure detection unit 136 Return destination address detection unit 137 Address Duplicate determination unit 138 Instruction addition unit 137 Simulator 205 Terminal device (communication terminal device) 210 Communication interface (communication means)
221 Java (R) byte code 223 Compiled part determining part 225 Partial native compiling part (partial compiling means)
227 Java (R) byte code 229 Native code 231 Pre-link unit 233 Compile unit (compile device)
243 First file system 245 Second file system 257 Execution control unit 261 Loop detection unit 262 Call detection unit 263 Loop depth evaluation unit 264 Uniformity evaluation unit 265 Compiled part determination unit 267 Reentry structure determination unit 271 Multiple nested structure Detection unit 272 Return address detection unit 273 Unnecessary instruction detection unit 274 Unnecessary instruction deletion unit 286 Execution partial frequency detection unit 287 Partial native compilation unit (partial compilation means)
403, 405, 407, 409 Program module 503, 504, 505, 507, 509 Program module 603, 604, 605, 606, 607 Program module 610, 630, 670 Program 624, 625, 626 Program module 643, 644, 645 646, 647, 648, 649 program modules

Claims (20)

原始プログラムを目的プログラムに変換するコンパイラであって、
前記原始プログラムに含まれる多重入れ子構造を検出する多重入れ子構造検出手順と、
前記多重入れ子構造を構成する各単位ループの戻り先アドレスを検出する戻り先アドレス検出手順と、
前記戻り先アドレス検出手順が検出した複数の戻り先アドレスのうちに、互いにアドレスが共通する重複戻り先アドレスがあるか否かを判定するアドレス重複判定手順と、
前記アドレス重複判定手順が前記重複戻り先アドレスがあると判定した場合に、前記目的プログラムとして、前記重複戻り先アドレスを互いに異なるアドレスとした目的プログラムへ、前記原始プログラムを変換する分割手順とをコンピュータに実行させるためのコンパイラ。
A compiler that converts a source program into a target program,
A multiple nested structure detection procedure for detecting multiple nested structures included in the source program;
A return address detection procedure for detecting a return address of each unit loop constituting the multiple nested structure;
An address duplication determination procedure for determining whether there is a duplicate return destination address having a common address among the plurality of return destination addresses detected by the return destination address detection procedure;
When the address duplication determination procedure determines that there is the duplicate return destination address, a dividing procedure for converting the source program into a target program having the duplicate return destination address different from each other as the target program A compiler to make it run.
前記分割手順は、前記重複戻り先アドレスの何れかに、実行に影響を与えない命令である不要命令を追加することによって前記重複戻り先アドレスを互いに異なるアドレスとする命令付加手順を備える請求項1記載のコンパイラ。   2. The division procedure includes an instruction addition procedure in which an unnecessary instruction that is an instruction that does not affect execution is added to any one of the duplicate return destination addresses to make the duplicate return destination addresses different from each other. The listed compiler. 第1及び第2の原始プログラムを目的プログラムに変換するコンパイラであって、
前記第1の原始プログラムに含まれ、多重又は1重入れ子構造を有する第1ループを検出する第1ループ検出手順と、
前記第1ループの中から呼び出される前記第2の原始プログラムに含まれ、多重又は1重入れ子構造を有する第2ループを検出する第2ループ検出手順と、
前記第1ループの入れ子数と前記第2ループの入れ子数とを加算して総入れ子数を計算するループ深さ評価手順と、
前記総入れ子数が大きい第2ループを優先的にコンパイルすることにより、前記第1及び第2の原始プログラムを前記目的プログラムに変換する部分コンパイル手順とをコンピュータに実行させるためのコンパイラ。
A compiler for converting first and second source programs into a target program,
A first loop detection procedure for detecting a first loop included in the first source program and having a multiple or single nested structure;
A second loop detection procedure for detecting a second loop included in the second source program called from the first loop and having a multiple or single nested structure;
A loop depth evaluation procedure for calculating a total nesting number by adding the nesting number of the first loop and the nesting number of the second loop;
A compiler for causing a computer to execute a partial compilation procedure for converting the first and second source programs into the target program by preferentially compiling the second loop having a large total number of nestings.
複数の原始プログラムを目的プログラムに変換するコンパイラであって、
前記複数の原始プログラムの一つに含まれ、多重又は1重入れ子構造を有する第1ループを探索する第1ループ検出手順と、
前記第1ループ検出手順が前記第1ループを検出した場合に、前記複数の原始プログラムのうち、前記第1ループの中から呼び出される別の原始プログラムに含まれ、多重又は1重入れ子構造を有する第2ループを探索する第2ループ検出手順と、
前記第2ループ検出手順が前記第2ループを検出した場合に、前記第1ループ検出手段が前記第1ループを検出したものとして、前記第2ループ検出手順を再び実行する第1反復手順と、
前記第1ループと前記第2ループとの何れかが検出されなかった場合に、それまでに検出したループの入れ子の総数であるループ深さを算出するループ深さ評価手順と、
前記第1ループ検出手順から前記ループ深さ評価手順までを、前記第1ループが検出されなくなるまで反復する第2反復手順と、
前記複数の原始プログラムのうち、ループ深さが大きいループを優先的にコンパイルすることにより、前記複数の原始プログラムを前記目的プログラムへ変換する部分コンパイル手順とをコンピュータに実行させるためのコンパイラ。
A compiler for converting a plurality of source programs into a target program,
A first loop detection procedure for searching for a first loop included in one of the plurality of source programs and having a multiple or single nested structure;
When the first loop detection procedure detects the first loop, it is included in another source program that is called from the first loop among the plurality of source programs and has a multiple or single nested structure A second loop detection procedure for searching the second loop;
A first iterative procedure for performing the second loop detection procedure again, assuming that the first loop detection means detects the first loop when the second loop detection procedure detects the second loop;
A loop depth evaluation procedure for calculating a loop depth, which is the total number of loop nestings detected so far, when either the first loop or the second loop is not detected;
A second iteration procedure for iterating from the first loop detection procedure to the loop depth evaluation procedure until the first loop is no longer detected;
A compiler for causing a computer to execute a partial compilation procedure for converting the plurality of source programs into the target program by preferentially compiling a loop having a large loop depth among the plurality of source programs.
前記部分コンパイル手順は、前記ループ深さ評価手順が算出したループ深さの最大値が予め定められた閾値に満たないときには、前記複数の原始プログラムの何れの部分をもコンパイルしない請求項4記載のコンパイラ。   5. The partial compile procedure does not compile any portion of the plurality of source programs when the maximum value of the loop depth calculated by the loop depth evaluation procedure is less than a predetermined threshold. compiler. 前記ループ深さ評価手順が複数のループ深さを算出した場合に、前記複数のループ深さが均一であるか否かを判定する均一度評価手順を前記コンピュータに更に実行させ、
前記部分コンパイル手順は、前記均一度評価手順が、前記複数のループ深さが均一であると判定した場合には、前記複数の原始プログラムの何れの部分をもコンパイルしない請求項4又は5記載のコンパイラ。
When the loop depth evaluation procedure calculates a plurality of loop depths, the computer further executes a uniformity evaluation procedure for determining whether or not the plurality of loop depths are uniform,
6. The partial compilation procedure according to claim 4 or 5, wherein when the uniformity evaluation procedure determines that the plurality of loop depths are uniform, no portion of the plurality of source programs is compiled. compiler.
第1及び第2の原始プログラムを目的プログラムに変換するコンパイラであって、
前記第1の原始プログラムに含まれ、反復して実行される部分である第1反復実行部を検出する第1反復実行部検出手順と、
前記第1反復実行部の中から呼び出される前記第2の原始プログラムに含まれ、反復して実行される部分である第2反復実行部を検出する第2反復実行部検出手順と、
前記第1反復実行部の実行回数と前記第2反復実行部との実行回数とを加算して総実行回数を計算する総実行回数評価手順と、
前記総実行回数が大きい第2反復実行部を優先的にコンパイルすることにより、前記第1及び第2の原始プログラムを前記目的プログラムに変換する部分コンパイル手順とをコンピュータに実行させるためのコンパイラ。
A compiler for converting first and second source programs into a target program,
A first iterative execution unit detection procedure for detecting a first iterative execution unit that is included in the first source program and is executed repeatedly;
A second iterative execution unit detecting procedure for detecting a second iterative execution unit that is included in the second original program called from the first iterative execution unit and is repeatedly executed;
A total execution number evaluation procedure for calculating the total number of executions by adding the number of executions of the first iteration execution unit and the number of executions of the second iteration execution unit;
A compiler for causing a computer to execute a partial compilation procedure for converting the first and second source programs into the target program by preferentially compiling the second repetitive execution unit having a large total number of executions.
複数の原始プログラムを目的プログラムに変換するコンパイラであって、
前記複数の原始プログラムの一つに含まれ、反復して実行される部分である第1反復実行部を探索する第1反復実行部検出手順と、
前記第1反復実行部検出手順が前記第1反復実行部を検出した場合に、前記複数の原始プログラムのうち、前記第1反復実行部の中から呼び出される別の原始プログラムに含まれ、反復して実行される第2反復実行部を探索する第2反復実行部検出手順と、
前記第2反復実行部検出手順が前記第2反復実行部を検出した場合に、前記第1反復実行部検出手段が前記第1反復実行部を検出したものとして、前記第2反復実行部検出手順を再び実行する第1反復手順と、
前記第1反復実行部と前記第2反復実行部との何れかが検出されなかった場合に、それまでに検出した反復実行部の実行回数の総和である総実行回数を算出する総実行回数評価手順と、
前記第1反復実行部検出手順から前記総実行回数評価手順までを、前記第1反復実行部が検出されなくなるまで反復する第2反復手順と、
前記複数の原始プログラムのうち、総実行回数が大きい反復実行部を優先的にコンパイルすることにより、前記複数の原始プログラムを前記目的プログラムへ変換する部分コンパイル手順とをコンピュータに実行させるためのコンパイラ。
A compiler for converting a plurality of source programs into a target program,
A first iterative execution unit detection procedure for searching for a first iterative execution unit that is included in one of the plurality of source programs and is executed repeatedly;
When the first iterative execution unit detection procedure detects the first iterative execution unit, it is included in another source program called from the first iterative execution unit among the plurality of source programs, and is repeatedly executed. A second iterative execution unit detection procedure for searching for a second iterative execution unit to be executed;
When the second iterative execution unit detection procedure detects the second iterative execution unit, it is assumed that the first iterative execution unit detection means has detected the first iterative execution unit, and the second iterative execution unit detection procedure is detected. A first iterative procedure for performing again;
Total number of executions evaluation that calculates the total number of executions, which is the sum of the number of executions of the repeated execution units detected so far, when either the first iteration execution unit or the second iteration execution unit is not detected Procedure and
A second iterative procedure that iterates from the first iterative execution unit detection procedure to the total execution number evaluation procedure until the first iterative execution unit is not detected;
A compiler for causing a computer to execute a partial compilation procedure for converting the plurality of source programs into the target program by preferentially compiling an iterative execution unit having a large total number of executions among the plurality of source programs.
前記部分コンパイル手順は、前記総実行回数評価手順が算出した総実行回数の最大値が予め定められた閾値に満たない場合には、前記複数の原始プログラムの何れの部分をもコンパイルしない請求項8記載のコンパイラ。   9. The partial compilation procedure does not compile any part of the plurality of source programs when the maximum value of the total execution number calculated by the total execution number evaluation procedure is less than a predetermined threshold value. The listed compiler. 前記総実行回数評価手順が複数の総実行回数を算出した場合に、前記複数の総実行回数が均一であるか否かを判定する均一度評価手順を前記コンピュータに更に実行させ、
前記部分コンパイル手順は、前記均一度評価手順が、前記複数の総実行回数が均一であると判定した場合には、前記複数の原始プログラムの何れの部分をもコンパイルしない請求項8又は9記載のコンパイラ。
When the total execution count evaluation procedure calculates a plurality of total execution counts, the computer further executes a uniformity evaluation procedure for determining whether the plurality of total execution counts are uniform,
10. The partial compilation procedure according to claim 8 or 9, wherein the uniformity evaluation procedure does not compile any portion of the plurality of source programs when the plurality of total execution times are determined to be uniform. compiler.
第1及び第2の原始プログラムを目的プログラムに変換するコンパイラであって、
前記第1の原始プログラムに含まれる多重若しくは1重入れ子構造を有するループ又は非ループである第1処理部分の中から呼び出される前記第2の原始プログラムに含まれる多重若しくは1重入れ子構造を有するループ又は非ループである第2処理部分を探索する第1呼び出し検出手順と、
前記第1呼び出し検出手順が前記第2処理部分を検出した場合に、前記第2処理部分の中で呼び出されている前記第1の原始プログラムのうちの前記第1処理部分を含む処理部分である第3処理部分を探索する第2呼び出し検出手順と、
前記第2呼び出し検出手順が前記第3処理部分を検出した場合に、前記第1及び第2原始プログラムのうち、前記第2処理部分と前記第3処理部分とをコンパイルすることにより、前記第1及び第2原始プログラムを前記目的プログラムへ変換する部分コンパイル手順とをコンピュータに実行させるためのコンパイラ。
A compiler for converting first and second source programs into a target program,
A loop having a multiple or single nested structure included in the first source program, or a loop having a multiple or single nested structure included in the second source program called from the first processing part that is a non-loop. Or a first call detection procedure for searching for a second processing part that is non-loop;
A processing portion including the first processing portion of the first source program called in the second processing portion when the first calling detection procedure detects the second processing portion; A second call detection procedure for searching for a third processing part;
When the second call detection procedure detects the third processing portion, the first processing portion is compiled by compiling the second processing portion and the third processing portion of the first and second source programs. And a compiler for causing a computer to execute a partial compilation procedure for converting the second source program into the target program.
原始プログラムを目的プログラムに変換するコンパイラであって、
前記原始プログラムに含まれる多重入れ子構造を検出する多重入れ子構造検出手順と、
前記多重入れ子構造を構成する各単位ループの戻り先アドレスを検出する戻り先アドレス検出手順と、
前記戻り先アドレス検出手順が検出した複数の戻り先アドレスのうちに、実行に影響を与えない命令である不要命令を有するものがあるか否かを判定する不要命令検出手順と、
前記不要命令検出手順が前記不要命令を有する戻り先アドレスを検出した場合に、前記目的プログラムとして、前記不要命令を削除した目的プログラムへ、前記原始プログラムを変換する不要命令削除手順とをコンピュータに実行させるためのコンパイラ。
A compiler that converts a source program into a target program,
A multiple nested structure detection procedure for detecting multiple nested structures included in the source program;
A return address detection procedure for detecting a return address of each unit loop constituting the multiple nested structure;
An unnecessary instruction detection procedure for determining whether or not there is an unnecessary instruction that is an instruction that does not affect execution among a plurality of return destination addresses detected by the return address detection procedure;
When the unnecessary instruction detection procedure detects a return address having the unnecessary instruction, the target program executes an unnecessary instruction deletion procedure for converting the source program to the target program from which the unnecessary instruction has been deleted. Compiler to let you do.
コンピュータ読み取り可能な記録媒体であって、
請求項1から請求項12の何れか1項に記載のコンパイラを記録した記録媒体。
A computer-readable recording medium,
A recording medium on which the compiler according to any one of claims 1 to 12 is recorded.
原始プログラムを目的プログラムに変換するコンパイル装置であって、
前記原始プログラムに含まれる多重入れ子構造を検出する多重入れ子構造検出手段と、
前記多重入れ子構造を構成する各単位ループの戻り先アドレスを検出する戻り先アドレス検出手段と、
前記戻り先アドレス検出手段が検出した複数の戻り先アドレスのうちに、互いにアドレスが共通する重複戻り先アドレスがあるか否かを判定するアドレス重複判定手段と、
前記アドレス重複判定手順が前記重複戻り先アドレスがあると判定した場合に、前記目的プログラムとして、前記重複戻り先アドレスを互いに異なるアドレスとした目的プログラムへ、前記原始プログラムを変換する分割手段とを備えるコンパイル装置。
A compiling device for converting a source program into a target program,
Multiple nested structure detecting means for detecting multiple nested structures included in the source program;
Return address detecting means for detecting a return address of each unit loop constituting the multiple nested structure;
Address duplication determination means for determining whether there is a duplicate return destination address having a common address among the plurality of return destination addresses detected by the return destination address detection means;
When the address duplication determination procedure determines that there is the duplicate return destination address, the target program includes a dividing unit that converts the source program into a target program having the duplicate return destination addresses different from each other. Compile device.
複数の原始プログラムを目的プログラムに変換するコンパイル装置であって、
前記複数の原始プログラムのうちの一つの原始プログラムに含まれ、多重又は1重入れ子構造を有する第1ループを探索、前記第1ループを検出する毎に、前記複数の原始プログラムのうち、前記第1ループの中から呼び出される別の原始プログラムに含まれ、多重又は1重入れ子構造を有する第2ループを探索するとともに、前記第2ループを検出した場合には、前記第1ループを検出したものとして、更に前記第2ループを探索することにより、前記一つの原始プログラムと当該一つの原始プログラムから順に呼び出し先となっている各原始プログラムとの間で構成される多重入れ子構造を探索するループ検出手段と、
前記ループ検出手段が前記第1ループを検出する毎に、前記第1ループの入れ子の数、または前記ループ検出手段が前記第2ループを検出した場合には、前記第1ループから各第2ループについて順に加算して得た入れ子の総数であるループ深さを算出するループ深さ評価手段と、
前記複数の原始プログラムのうち、ループ深さが大きいループを優先的にコンパイルすることにより、前記複数の原始プログラムを前記目的プログラムへ変換する部分コンパイル手段とを備えるコンパイル装置。
A compiling device for converting a plurality of source programs into a target program,
Included in one source program in the plurality of source program searches the first loop having multiple or singlet nested structure, each for detecting said first loop, the plurality of source program, the The second loop included in another primitive program called from the first loop and having a multiple or single nested structure is searched, and when the second loop is detected, the first loop is detected. as things loop further by searching the second loop to search for multiple nested comprised between each source program that is the callee in order from the one of the source program and the one source program Detection means ;
Each time the loop detection means detects the first loop, the number of nestings of the first loop, or each second loop from the first loop when the loop detection means detects the second loop. Loop depth evaluation means for calculating the loop depth, which is the total number of nestings obtained by adding in order,
A compiling device comprising: a partial compiling unit that preferentially compiles a loop having a large loop depth among the plurality of source programs to convert the plurality of source programs into the target program.
前記部分コンパイル手段は、前記ループ深さ評価手段が算出したループ深さの最大値が予め定められた閾値に満たない場合には、前記複数の原始プログラムの何れの部分をもコンパイルしない請求項15記載のコンパイル装置。   The partial compiling means does not compile any part of the plurality of source programs when the maximum value of the loop depth calculated by the loop depth evaluation means is less than a predetermined threshold. The compiling device described. 前記ループ深さ評価手段が複数のループ深さを算出した場合に、前記複数のループ深さが均一であるか否かを判定する均一度評価手段を更に備え、
前記部分コンパイル手段は、前記均一度評価手段が均一であると判定した場合には、前記複数の原始プログラムの何れの部分をもコンパイルしない請求項15又は16記載のコンパイル装置。
When the loop depth evaluation means calculates a plurality of loop depths, it further comprises a uniformity evaluation means for determining whether or not the plurality of loop depths are uniform,
The compiling device according to claim 15 or 16, wherein the partial compiling means does not compile any part of the plurality of source programs when the uniformity evaluation means determines that they are uniform.
請求項14乃至17の何れかに記載のコンパイル装置と、
前記コンパイル装置がコンパイルすべき原始プログラムを伝送媒体を通じて取得する通信手段と、
前記コンパイル装置が生成した目的プログラムを実行する実行制御手段とを備える通信端末装置。
A compiling device according to any one of claims 14 to 17,
A communication means for acquiring a source program to be compiled by the compiling device through a transmission medium;
A communication terminal device comprising execution control means for executing a target program generated by the compiling device.
前記実行制御部は、前記コンパイル装置が処理対象とし且つその何れの部分をもコンパイルしなかった原始プログラムである非コンパイルプログラムをも実行対象とし、
前記実行制御部は、
前記非コンパイルプログラムの実行中に、当該目的プログラムのうちの定められた基準値を超える頻度で実行される部分である高頻度実行部分を検出する頻度検出手段と、
前記頻度検出部が検出した前記高頻度実行部分をコンパイルする別の部分コンパイル手段とを備える請求項18記載の通信端末装置。
The execution control unit is also a non-compiled program that is a source program that has been compiled by the compiling device and has not been compiled in any part thereof,
The execution control unit
A frequency detection means for detecting a high-frequency execution part that is a part executed at a frequency exceeding a predetermined reference value in the target program during the execution of the non-compiled program;
The communication terminal device according to claim 18, further comprising: another partial compiling unit that compiles the high-frequency execution part detected by the frequency detection unit.
コンピュータが原始プログラムを目的プログラムに変換するコンパイル方法であって、
前記原始プログラムに含まれる多重入れ子構造を検出する多重入れ子構造検出手順と、
前記多重入れ子構造を構成する各単位ループの戻り先アドレスを検出する戻り先アドレス検出手順と、
前記戻り先アドレス検出手順が検出した複数の戻り先アドレスのうちに、互いにアドレスが共通する重複戻り先アドレスがあるか否かを判定するアドレス重複判定手順と、
前記アドレス重複判定手順が前記重複戻り先アドレスがあると判定した場合に、前記目的プログラムとして、前記重複戻り先アドレスを互いに異なるアドレスとした目的プログラムへ、前記原始プログラムを変換する分割手順とを備えるコンパイル方法。
A compiling method in which a computer converts a source program into a target program,
A multiple nested structure detection procedure for detecting multiple nested structures included in the source program;
A return address detection procedure for detecting a return address of each unit loop constituting the multiple nested structure;
An address duplication determination procedure for determining whether there is a duplicate return destination address having a common address among the plurality of return destination addresses detected by the return destination address detection procedure;
When the address duplication determination procedure determines that there is the duplicate return destination address, the target program includes a division procedure for converting the source program into a target program having the duplicate return destination address different from each other. Compilation method.
JP2004112719A 2003-04-10 2004-04-07 Compiler, recording medium, compiling device, communication terminal device, and compiling method Expired - Fee Related JP4473626B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004112719A JP4473626B2 (en) 2003-04-10 2004-04-07 Compiler, recording medium, compiling device, communication terminal device, and compiling method

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2003106413 2003-04-10
JP2004112719A JP4473626B2 (en) 2003-04-10 2004-04-07 Compiler, recording medium, compiling device, communication terminal device, and compiling method

Publications (2)

Publication Number Publication Date
JP2004326760A JP2004326760A (en) 2004-11-18
JP4473626B2 true JP4473626B2 (en) 2010-06-02

Family

ID=33513038

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004112719A Expired - Fee Related JP4473626B2 (en) 2003-04-10 2004-04-07 Compiler, recording medium, compiling device, communication terminal device, and compiling method

Country Status (1)

Country Link
JP (1) JP4473626B2 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011233155A (en) * 2011-06-16 2011-11-17 Nippon Telegr & Teleph Corp <Ntt> Data processing device
JP6127639B2 (en) 2013-03-26 2017-05-17 富士通株式会社 Program execution control program and program execution control method
US10534691B2 (en) 2017-01-27 2020-01-14 Fujitsu Limited Apparatus and method to improve accuracy of performance measurement for loop processing in a program code
JP7225859B2 (en) * 2019-02-04 2023-02-21 富士通株式会社 Information processing device, information processing program, and information processing method
CN112084013B (en) * 2019-06-13 2024-04-05 武汉杰开科技有限公司 Program calling method, chip and computer storage medium

Also Published As

Publication number Publication date
JP2004326760A (en) 2004-11-18

Similar Documents

Publication Publication Date Title
JP4844971B2 (en) Method and apparatus for performing interpreter optimization during program code conversion
US5966537A (en) Method and apparatus for dynamically optimizing an executable computer program using input data
US7536682B2 (en) Method and apparatus for performing interpreter optimizations during program code conversion
US6412105B1 (en) Computer method and apparatus for compilation of multi-way decisions
JP5583514B2 (en) Compiling method for optimizing binary code, compiler system thereof, and computer program
US7376941B2 (en) Inferring function calls in an ambiguous language computer program
US5946491A (en) Register allocation method and apparatus for gernerating spill code as a function of register pressure compared to dual thresholds
US20060161908A1 (en) Software tool with modeling of asynchronous program flow
WO2004095263A2 (en) Partial dead code elimination optimizations for program code conversion
JP2000222220A (en) Dynamically compiling time setting method, byte code executing mode selecting method and computer
JP2010026851A (en) Complier-based optimization method
EP0529049B1 (en) Multilanguage optimizing compiler using templates in multiple pass code generation
KR19990072721A (en) Program transformation method and program transformation system
US20040015918A1 (en) Program optimization method and compiler using the program optimization method
US7624387B2 (en) Compiler, program product, compilation device, communication terminal device, and compilation method
US7555748B2 (en) Method and apparatus for improving data cache performance using inter-procedural strength reduction of global objects
JP3356742B2 (en) Program execution method
JP2004362216A (en) Compiler apparatus, compiling method, compiler program, and recording medium
JP5048949B2 (en) Software tools including asynchronous program flow modeling
JP4473626B2 (en) Compiler, recording medium, compiling device, communication terminal device, and compiling method
US20140157248A1 (en) Conversion apparatus, method of converting, and non-transient computer-readable recording medium having conversion program stored thereon
US7689976B2 (en) Compiler apparatus and linker apparatus
US6625806B1 (en) Language processing method and language processing system improving use efficiency of cache memory
US20050144605A1 (en) Information processing system and code generation method
Dean et al. Training compilers for better inlining decisions

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20061025

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20090216

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20091208

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100119

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20100209

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20100305

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130312

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Ref document number: 4473626

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130312

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140312

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees