JP5042487B2 - Computer operating method, program, computer - Google Patents

Computer operating method, program, computer Download PDF

Info

Publication number
JP5042487B2
JP5042487B2 JP2005337258A JP2005337258A JP5042487B2 JP 5042487 B2 JP5042487 B2 JP 5042487B2 JP 2005337258 A JP2005337258 A JP 2005337258A JP 2005337258 A JP2005337258 A JP 2005337258A JP 5042487 B2 JP5042487 B2 JP 5042487B2
Authority
JP
Japan
Prior art keywords
execution
program
executed
interpreter
program part
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
JP2005337258A
Other languages
Japanese (ja)
Other versions
JP2007141153A (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.)
Hitachi Solutions Ltd
Original Assignee
Hitachi Solutions 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 Hitachi Solutions Ltd filed Critical Hitachi Solutions Ltd
Priority to JP2005337258A priority Critical patent/JP5042487B2/en
Publication of JP2007141153A publication Critical patent/JP2007141153A/en
Application granted granted Critical
Publication of JP5042487B2 publication Critical patent/JP5042487B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Devices For Executing Special Programs (AREA)

Description

本発明は、ソースプログラムや中間言語で記述されたプログラムを解釈して実行するインタプリタに関し、特に、ソースプログラム用言語や中間言語を逐次最適化されたオブジェクトプログラム用言語に解釈して実行する方式と、コンピュータのハードウェア側に備えられた直接実行機構を利用してプログラムを実行する方式とを併用した最適化手法により、インタプリタの実行速度を向上する技術に関するものである。   The present invention relates to an interpreter that interprets and executes a program written in a source program or an intermediate language, and in particular, a method for interpreting and executing a source program language or an intermediate language into a sequentially optimized object program language, and The present invention relates to a technique for improving the execution speed of an interpreter by an optimization method using a method of executing a program by using a direct execution mechanism provided on the hardware side of a computer.

以下において、ソースプログラム用言語と機械語との中間に位置するインタプリタで解釈可能な中間言語のことを「IR」(Internal Representative)という。
ソースプログラム用言語(高級言語)やIRの列からなるコンピュータプログラムの実行に際して、このソースプログラム用言語やIRを、逐次、最適化されたオブジェクトプログラム用言語(機械語等)に翻訳して実行する方式のことを「JIT」(Just In Time Compiler)という。
一方で、ソースプログラム用言語やIRによるプログラムを直接的に実行するコンピュータ内蔵のハードウェア機構のことを「HAE」(Hardware Accelerate Execution)という。
Hereinafter, an intermediate language that can be interpreted by an interpreter positioned between the source program language and the machine language is referred to as “IR” (Internal Representative).
When executing a computer program comprising a source program language (high-level language) and an IR sequence, the source program language and IR are sequentially translated into an optimized object program language (machine language, etc.) and executed. The system is called “JIT” (Just In Time Compiler).
On the other hand, a hardware mechanism built in a computer that directly executes a source program language or IR program is referred to as “HAE” (Hardware Accelerate Execution).

従来、インタプリタを使用するプログラマーが、コンピュータプログラムを作成する時には、インタプリタ用言語(より具体的には、ソースプログラム用言語や、該言語と機械語との中間に位置するIR)の列(並び)として書き下ろす。インタプリタは、このインタプリタ用言語を逐次解釈して実行する(逐次、機械語に通訳して実行する)。即ち、本来、インタプリタ系は、ソースプログラム用の言語自体、若しくは、この言語が機械語に変換される一歩手前のIRを、逐次解釈しながら実行するように構成されている。   Conventionally, when a programmer using an interpreter creates a computer program, an interpreter language (more specifically, a source program language or an IR positioned between the language and the machine language) is arranged. Write down as The interpreter sequentially interprets and executes the interpreter language (sequentially interprets and executes the machine language). In other words, the interpreter system is originally configured to execute the source program language itself or the IR one step before the language is converted into a machine language while sequentially interpreting it.

しかしながら、インタプリタ系を、通常のコンパイラ言語をコンパイル(翻訳)して実行するコンパイラ系と比較すると、インタプリタ系には、実時間での実行が可能である等のインタプリタ系に特有の利点が多々備わってはいるものの、多くのデメリットも有している。これらデメリットの最たるものは、逐次解釈(通訳)する方式の宿命として、実行速度が遅いことである。   However, comparing the interpreter system with a compiler system that compiles (translates) and executes an ordinary compiler language, the interpreter system has many advantages specific to the interpreter system, such as being able to execute in real time. However, it has many disadvantages. The greatest of these disadvantages is the slow execution speed as the fate of the sequential interpretation (interpretation) method.

そこで、実時間での実行が可能というインタプリタ系の有利さを残した上で、しかも、その実行速度の高速化を図るために、前述のJIT方式と、前述のHAEを内蔵したインタプリタの方式(以下、「HAE方式」と略称する)の2つの方式が開発され、今日まで、両方式は、それぞれに発展してきている。   Therefore, in order to increase the execution speed while leaving the advantage of the interpreter system that can be executed in real time, the above-mentioned JIT method and the above-described interpreter method incorporating the HAE ( The following two methods have been developed, and to date, both methods have been developed individually.

しかしながら、これらの方式には、やはりそれぞれ一長一短があり、満足できるシステムとは成っていなかった。以下、JIT方式とHAE方式について、その一般的なメリットとデメリットとを纏める。   However, each of these methods has advantages and disadvantages, and has not been a satisfactory system. The general advantages and disadvantages of the JIT method and the HAE method will be summarized below.

まず、前述のJIT方式のメリットとして、高い頻度で実行されるループや、繰り返し処理が存在する処理ステップに対して非常に大きな効果があることが挙げられる。   First, as a merit of the above-mentioned JIT method, it can be mentioned that it has a very great effect on a loop executed frequently and a processing step in which repeated processing exists.

しかしながら、JIT方式のデメリットとして、実行時に通訳(コンパイラの翻訳に相当)してマイコン等のコンピュータが実行可能なオブジェクトプログラムに変換する処理ステップが存在するため、通訳のための処理時間が実時間で必要となる。このため、特に、実行プログラムの開始直後は、未通訳の実行ステップが多数存在するために、実行速度が遅くなる。   However, as a disadvantage of the JIT method, there is a processing step in which an interpreter (corresponding to compiler translation) is converted into an object program that can be executed by a computer such as a microcomputer at the time of execution. Necessary. For this reason, in particular, immediately after the execution program is started, there are many uninterpreted execution steps, so the execution speed becomes slow.

また、ソースプログラムを格納するためのメモリに加えて、変換されたオブジェクトプログラム(一般には機械語形式の実行プログラム)を格納するためのメモリも余計に必要になる。一般に、このオブジェクトプログラムの大きさは、高速性能を引き出すためにインタプリタが用意している手段(以下、「最適化手段」と呼称する)が高度になればなる程、また、この最適化手段の対象となるプログラム部分が多ければ多い程、大きくなる傾向がある。   Further, in addition to the memory for storing the source program, an extra memory for storing the converted object program (generally an execution program in a machine language format) is required. In general, the size of the object program increases as the means (hereinafter referred to as “optimization means”) prepared by the interpreter for extracting high-speed performance becomes more sophisticated. The more program parts that are targeted, the larger the tendency.

さらに、最低限の最適化手段を実施する場合であっても、より効果的な最適化を行って速度性能を向上しようとすると、インタプリタ用言語で書かれたプログラムにおいて、最適化手段の対象が偏在している部分(即ち、最適化手段の対象となる一連の階層的な処理手続きが集中的に多数存在し、かつ、この処理手続きが反復して実行される回数も多い部分であり、以下、「Hotspot」と呼称する)を見つけ出す必要があり、このHotspotの発見と確定のためにも、プログラムの実行時に、或る程度の処理時間を要することになる。   Furthermore, even if the minimum optimization means is implemented, if the optimization is performed more effectively to improve the speed performance, the target of the optimization means in the program written in the interpreter language An unevenly distributed part (that is, a part where a series of hierarchical processing procedures targeted by the optimization means are concentrated and many times are repeatedly executed, (Referred to as “Hotspot”), and for the discovery and determination of this Hotspot, a certain amount of processing time is required when executing the program.

一方、前述のHAE方式のメリットとしては、JIT方式と比較して、一般には消費電力が少なくて済むことが知られている。また、初期投資(即ちJIT方式を実現するための通訳処理の実行)が不要であることから、プログラムの実行開始直後から、平均的に高い実行速度が得られることが期待できる。さらに、ソースプログラムやIRだけで直接的に実行することが可能であり、よって、JIT方式の場合のようなオブジェクトプログラムが不要となるので、オブジェクトプログラムを格納するためのメモリ量も不要となる。   On the other hand, as a merit of the above-mentioned HAE method, it is known that generally less power is required than the JIT method. In addition, since initial investment (that is, execution of interpretation processing for realizing the JIT system) is unnecessary, it can be expected that an average high execution speed can be obtained immediately after the start of execution of the program. Further, it can be executed directly only by a source program or IR, and therefore, an object program as in the case of the JIT method is not required, and therefore an amount of memory for storing the object program is also unnecessary.

しかしながら、HAE方式のデメリットとしては、マイコン等のコンピュータのハードウェアに追加の機構が必要になり、その分だけ設備コストが掛かる。よって、通常は、ソースプログラム用言語やIRの全部が直接的に実行されるものではなく、その一部が直接的に実行される段階に留まっている。   However, as a demerit of the HAE method, an additional mechanism is required for computer hardware such as a microcomputer, and the equipment cost is increased accordingly. Therefore, normally, not all of the source program language and IR are directly executed, but only a part of them is still executed directly.

ソースプログラムやIRをミクロ単位に見た場合(より具体的には命令単位で見た場合)のピーク性能としてはJIT方式を上回ることができるが、HAE方式では、グローバルな最適化も可能なJIT方式とは違って、プログラムステップの一連の流れを最適化の対象とすることができていないので、特に、プログラム全体の実行速度性能を左右する高負荷プログラム部分についてはJIT方式の方が勝っている。また、ソフト的な処理が途中で入ると、ハードウェア機構による実行を停止させて、ソフトウェア(即ちインタプリタのプログラム)による実行に戻す必要がある。このようなソフト的な処理とは、例えばガーベージコレクション(GC)、割り込み処理、例外処理等が挙げられる。   The peak performance when the source program and IR are viewed in micro units (more specifically, when viewed in instruction units) can exceed the JIT method, but the HAE method can also be optimized globally. Unlike the method, the sequence of program steps cannot be targeted for optimization, so the JIT method is better especially for high-load program parts that affect the overall execution speed performance of the program. Yes. Further, if software processing is entered midway, it is necessary to stop execution by the hardware mechanism and return to execution by software (ie, interpreter program). Examples of such software processing include garbage collection (GC), interrupt processing, and exception processing.

なお、従来のインタプリタに関して、特許文献1には、デバッグ情報の生成に伴う速度性能の低下とメモリ消費量の増大とを最小限に抑えながら、ユーザがデバッグ情報を効果的に取得できる方法及び装置が開示されている。   Regarding a conventional interpreter, Patent Document 1 discloses a method and apparatus that allows a user to effectively acquire debug information while minimizing a decrease in speed performance and an increase in memory consumption accompanying generation of debug information. Is disclosed.

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

上記背景技術で述べた従来のインタプリタにあっては、例えば、JIT方式によるインタプリタ(一般には最適化処理を備えている)の場合、ソースプログラムまたはIRの全体をオブジェクトプログラムに変換しようとすると、非現実的なメモリ空間と通訳処理の能力が必要になり、かつ性能面への効果も期待した程は上がらないので、この点を向上して、前述のHotspotだけに絞って最適化手段を適用しようとすると、今度は、このHotspotを見つけ出すことに多大の処理時間を要してしまうという問題点があった。   In the conventional interpreter described in the background art, for example, in the case of an interpreter based on the JIT method (generally equipped with an optimization process), if an attempt is made to convert the entire source program or IR into an object program, Improve this point and apply optimization methods only to the above-mentioned Hotspot, as realistic memory space and interpreting processing capability are required and the performance effect will not increase as expected. This time, there was a problem that it took a lot of processing time to find this Hotspot.

ともかく、前述のHotspotを見つけ出すことさえできれば、インタプリタは、それが最小限の通訳対象であっても最大の効果を発揮することができる。しかしながら、このHotspotを見つけ出すためには、インタプリタのプログラムは、まずJIT方式の効果が有りそうなプログラム構造を静的に見つけ出し、次に、或る程度プログラムを動かした結果を見て、動的にそれを確定する手段しか持っていない。つまり、JIT方式の効果が有りそうなソースプログラム構造を有する或る処理手続きが、頻繁に呼び出される処理手続きであることが静的に確認できれば、この処理手続きを、一応は最適化手段が適用されるべきHotspotの候補であるとみなすことが可能となり、さらに、この処理手続きの動作頻度の高さが実行時に検証されれば、この処理手続きを最適化手段が適用されるべきHotspotの有力候補であると確定してよいことになる。例えば、幾重にも階層的に重なっているループ構造のループ回数が、動的にしか分からないものであり、或る程度プログラムを動かした結果として、このループ構造の実行が、十分多くの回数で繰り返されることが分かる場合がある。   Anyway, as long as the hotspot mentioned above can be found, the interpreter can exert its maximum effect even if it is the minimum interpretation target. However, in order to find this Hotspot, the interpreter program must first statically find the program structure that is likely to have the effect of the JIT method, and then look at the result of moving the program to some extent and dynamically I only have the means to confirm it. In other words, if it can be statically confirmed that a certain processing procedure having a source program structure that is likely to have the effect of the JIT method is a processing procedure that is frequently called, this processing procedure is temporarily optimized. If the frequency of operation of this processing procedure is verified at the time of execution, this processing procedure can be considered as a hot candidate for Hotspot to which optimization means should be applied. If there is, it can be confirmed. For example, the number of loops in a loop structure that is layered in layers is only known dynamically, and as a result of running a program to some extent, the execution of this loop structure can be performed a sufficiently large number of times. May be repeated.

さて、このようにして見つかった最適化手段が適用されるべきHotspotの候補には、インタプリタの最適化手段が適用されてオブジェクト化され、次回の実行からは当該オブジェクトが実行されることになって、実行速度の高速化が実現する。しかしながら、最適化手段を適用して、速度性能を向上させたオブジェクトプログラムで実行させるには、当然ながら、一連の処理手続きが最適化手段が適用されるべきHotspotの候補であるか否かを判断するための処理時間が必要となり、即ち、本来のプログラム動作とは関係のない余分な評価判断等の処理をしなければならなくなるので、この点も、従来のインタプリタの問題点であった。   The Hotspot candidates to which the optimization means found in this way should be applied are converted into objects by applying the optimization means of the interpreter, and the object is executed from the next execution. Realizes faster execution speed. However, to execute an object program with improved speed performance by applying optimization means, of course, it is determined whether a series of processing procedures is a Hotspot candidate to which optimization means should be applied. This requires another processing time, that is, it is necessary to carry out processing such as extra evaluation and judgment unrelated to the original program operation. This is also a problem of the conventional interpreter.

さらに、上記で明らかなように、前記判断により、最適化手段の適用対象であるHotspotの候補として確定されなかった処理手続き(例えば、階層構造が複雑でない処理手続き)については、実際にはある程度の実行頻度を有していたとしても、メモリ空間の効率的な使用のために、最適化手段が適用されることはなく、このような部分については、性能の出ないオブジェクトプログラムとして実行されることになる。   Further, as is clear from the above, with respect to processing procedures (for example, processing procedures with a non-complex hierarchical structure) that have not been determined as Hotspot candidates to which the optimization means are applied based on the above determination, there is actually some degree. Even if it has an execution frequency, the optimization means is not applied for efficient use of the memory space, and such a part is executed as an object program having no performance. become.

一方、HAE方式については、その技術がハードウェア設計に関わるものであるので、一概には述べることができないが、一般的には、前述のとおりのデメリットを有していた。つまり、ハードウェアの設備コストが余分に掛かることはもとより、その速度性能についても、処理手続きが複雑な階層構造を有し、かつ該処理手続きの反復処理回数(ループ回数)が多い場合などは、最適化手段を備えたJIT方式のインタプリタの速度性能を上回ることはできていない。さらに、タスクの実行中に、ソフトウェア側での処理が必要な途中割り込み等が発生すると、当然のことながらハードウェア機構だけでは実行を継続することができなくなるので、ハードウェア側によるタスクの継続実行を一旦停止して、ソフト側に制御の流れを委ねなければならなくなる。   On the other hand, the HAE method cannot be generally described because the technology is related to hardware design, but generally has the disadvantages described above. In other words, in addition to the extra hardware cost, the speed performance also has a complicated hierarchical structure, and the processing procedure has a large number of iterations (the number of loops). The speed performance of the JIT interpreter provided with the optimization means cannot be exceeded. Furthermore, if an interrupt or the like that requires processing on the software side occurs during task execution, it is naturally impossible to continue execution with the hardware mechanism alone, so continued execution of the task by the hardware side Must be stopped and the control flow left to the software side.

なお、使用していないオブジェクトプログラムやデータによって占められているメモリ領域を再利用するために回収する処理(即ち、ガーベージコレクション)を実行するには、全スレッドを止めなければならず、これについてはソフトウェア側またはハードウェア側のいずれでタスクを実行している場合であっても例外ではない。しかしながら、ハードウェア側で実行している場合は、ハードウェア側には、ことさらHAEの実行開始/停止命令があるため、停止のための処理コストがソフトウェア側で実行している場合よりも多く要してしまう。このため、実行中に高頻度でガーベージコレクションが発生する傾向が有る処理手続きを実行する場合には、ソフトウェア側での実行(即ちJIT方式ないしは最適化手段を有しない一般的なインタプリタによる実行)に任せた方が良い場合があり得る。   Note that in order to execute the process of collecting the memory area occupied by unused object programs and data (that is, garbage collection), all threads must be stopped. It is no exception whether the task is executed on the software side or the hardware side. However, when executing on the hardware side, since there is a HAE execution start / stop instruction on the hardware side, the processing cost for stopping is higher than when executing on the software side. Resulting in. For this reason, when executing a processing procedure that tends to generate garbage collection at a high frequency during execution, execution on the software side (that is, execution by a general interpreter having no JIT method or optimization means) It may be better to leave it up.

また、外部からの割り込みが発生した場合には、タスクに振り向けた制御の流れを奪って、割り込み処理ルーチンに制御の流れを移さなければならない場合がある。   When an external interrupt occurs, it may be necessary to take control flow directed to the task and transfer the control flow to the interrupt processing routine.

さらに、HAE方式では、一般に、任意のタスクを高速に動作させることができるが、今、或るタスクが、高頻度で割り込みを発生させるような性質の処理手続きを有するタスクである場合は、やはり、前記と同様に、このタスク全体ないしは前記処理手続きの実行をソフトウェア側に任せたほうが良い場合がある。従来のHAE方式のインタプリタによってプログラムが実行される場合には、この辺りの判断がうまくフィードバックされていなかった。   In addition, in the HAE method, an arbitrary task can generally be operated at a high speed. However, if a certain task is a task having a processing procedure of a nature that frequently generates an interrupt, As described above, there are cases where it is better to leave the entire task or execution of the processing procedure to the software side. In the case where a program is executed by a conventional HAE interpreter, the judgment around this is not fed back well.

本発明は、上記従来の問題点に鑑みてなされたものであって、最適化に必要な情報を静的及び動的に収集することにより、最適化手段を備えたインタプリタ(JIT方式)と、ハードウェアによる直接実行方式(HAE方式)との長所だけを取り入れると共に、個別のアプリケーションの特徴的な処理(割り込み処理手続き等)にも考慮することにより、実行速度を向上させることができるインタプリタを提供することを目的としている。   The present invention has been made in view of the above-described conventional problems, and by interpreting information necessary for optimization statically and dynamically, an interpreter (JIT system) provided with optimization means, Provide an interpreter that can improve the execution speed by incorporating only the advantages of the hardware direct execution method (HAE method) and taking into account the characteristic processing of individual applications (interrupt processing procedures, etc.) The purpose is to do.

本発明の他の目的は、最適化に必要な情報を静的及び動的に収集することにより、最適化手段を備えたインタプリタ(JIT方式)と、ハードウェアによる直接実行方式(HAE方式)との長所だけを取り入れると共に、個別のアプリケーションの特徴的な処理(割り込み処理手続き等)にも考慮することにより、実行速度を向上させることができるインタプリタの実行速度向上技術を提供することにある。   Another object of the present invention is to collect information necessary for the optimization statically and dynamically, so that an interpreter provided with optimization means (JIT method), a hardware direct execution method (HAE method), and It is an object of the present invention to provide an interpreter execution speed improvement technique capable of improving the execution speed by taking into account only the advantages of the above and taking into consideration the characteristic processing (interrupt processing procedures, etc.) of individual applications.

本発明は、上記した従来のインタプリタの課題に鑑みてなされたものであり、高級言語又は中間言語で記述されたプログラムを、部分的に順次取り込んで、前記取り込まれたプログラム部分を機械語の並びに変換しながら実行させる逐次的実行手段を備えると共に、前記プログラムの処理を、前記言語の一部を直接的に実行できるハードウェア機構が追加されたコンピュータによって実行させるインタプリタであって、前記取り込まれたプログラム部分を、実行速度の面で最適化された機械語の並びに変換することができる最適化手段と、前記プログラム部分の実行系として、前記逐次的実行手段、または前記最適化手段を介した前記逐次的実行手段、若しくは前記ハードウェア機構、のいずれか1つを選択する実行系選択手段と、前記取り込まれたプログラム部分を、前記実行系選択手段により選択された実行系により実行する実行手段と、を備えたことを特徴とするインタプリタを提供するものである。   The present invention has been made in view of the above-described problems of the conventional interpreter. A program written in a high-level language or an intermediate language is partially fetched sequentially, and the fetched program portion is arranged in a machine language sequence. An interpreter that includes a sequential execution unit that is executed while being converted, and that is executed by a computer to which a hardware mechanism capable of directly executing a part of the language is added. Optimization means capable of converting a program portion into a sequence of machine languages optimized in terms of execution speed, and the sequential execution means or the optimization means via the optimization means as an execution system of the program portion Execution system selection means for selecting one of sequential execution means or the hardware mechanism; and The Mareta program portion, there is provided an interpreter, characterized in that it and a means for executing the selected executing by said execution system selection means.

また、前記インタプリタは、前記部分的に取り込まれたプログラム部分に、前記ハードウェア機構によって実行できない命令が所定数よりも多く含まれているか否かを判定する適用除外判定手段と、前記適用除外判定手段により、前記プログラム部分が、前記ハードウェア機構によって実行できない命令を所定数よりも多く含むと判定された場合は、当該プログラム部分を前記逐次的実行手段によって実行させる第1の実行手段と、前記適用除外判定手段により、前記プログラム部分が、前記ハードウェア機構によって実行できない命令を所定数よりも多くは含まないと判定された場合は、当該プログラム部分を前記ハードウェア機構によって実行させる第2の実行手段と、前記実行後に、前記部分的に取り込まれたプログラム部分に対する前記最適化手段による最適化によって、所定基準を超える効果が得られたかどうかを判定する最適化判定手段と、前記最適化判定手段により、前記最適化手段による最適化によって所定基準を超える効果が得られたと判定された前記プログラム部分については、次回以降の実行時に前記プログラム部分を前記最適化手段を介した前記逐次的実行手段によって実行させる第3の実行手段とを備えたことを特徴とする。   Further, the interpreter includes an application exclusion determination unit that determines whether or not the partially fetched program part includes more than a predetermined number of instructions that cannot be executed by the hardware mechanism; and the application exclusion determination Means for causing the program part to be executed by the sequential execution means when it is determined that the program part includes more than a predetermined number of instructions that cannot be executed by the hardware mechanism; and Second execution for causing the program part to be executed by the hardware mechanism when the application exclusion determining unit determines that the program part does not include more than a predetermined number of instructions that cannot be executed by the hardware mechanism. And means for said partially captured program part after said execution The optimization determining means for determining whether or not the optimization means has achieved an effect that exceeds a predetermined standard, and the optimization determination means provides an effect that exceeds the predetermined standard by the optimization means. The program part determined to have been executed is provided with third execution means for executing the program part by the sequential execution means via the optimization means at the next and subsequent executions.

また、前記インタプリタは、前記プログラム部分の実行回数が所定回数に達した時点で、前記プログラム部分が、ハードウェアによって実行できない命令の実行を所定回数よりも多く発生させるものであるか否かを検証する適用除外検証手段と、前記適用除外検証手段により、前記プログラム部分が、ハードウェアによって実行できない命令の実行を所定回数よりも多く発生させるものである場合には、前記所定回数を超える実行時に前記プログラム部分を前記逐次的実行手段によって実行させる第4の実行手段とを、さらに備えたことを特徴とする。   Further, the interpreter verifies whether or not the program part generates more executions of instructions that cannot be executed by hardware when the number of executions of the program part reaches a predetermined number. If the program part causes the execution of an instruction that cannot be executed by hardware more than a predetermined number of times by the application exclusion verification means and the application exclusion verification means, And fourth execution means for causing the program part to be executed by the sequential execution means.

また、前記インタプリタは、前記所定回数を超える実行に際しては、前記システムから、前記適用除外判定手段、前記最適化判定手段、及び前記適用除外検証手段による処理を省略して実行することを特徴とする。   Further, the interpreter executes the processing by the system excluding the application exclusion determination unit, the optimization determination unit, and the application exclusion verification unit from the system when the execution exceeds the predetermined number of times. .

また、前記最適化手段により、前記最適化の効果が検証されるプログラム部分は、内部のループの回数が所定数以上である部分、または所定深さを超えるネスト構造を含んでいる部分であることを特徴とする。ここで、ネスト構造とは、条件分岐(if文)、一定回数の繰り返し(for文)、条件つき繰り返し(while文)等を含んだプログラム構造のことを言うものとする。   In addition, the program portion whose effectiveness of the optimization is verified by the optimization means is a portion in which the number of internal loops is a predetermined number or more, or a portion including a nested structure exceeding a predetermined depth. It is characterized by. Here, the nested structure refers to a program structure including conditional branching (if statement), a certain number of repetitions (for statement), conditional repetition (while statement), and the like.

また、前記インタプリタにおいて、前記最適化判定手段は、ユーザが望む省電力の程度に応じて、前記最適化手段による最適化の効果の見積もりを補正することを特徴とする。例えば、前記省電力の程度が所定レベルよりも大きい場合は、前記最適化手段による最適化の効果を実際よりも少なく見積もる。   In the interpreter, the optimization determination unit corrects the estimation of the optimization effect by the optimization unit according to the degree of power saving desired by the user. For example, when the degree of power saving is greater than a predetermined level, the optimization effect by the optimization means is estimated to be less than actual.

また本発明は、高級言語又は中間言語で記述されたプログラムの一部を直接的に実行できるハードウェア機構を備えたコンピュータにおいて、前記プログラムを部分的に順次取り込んで、前記取り込まれたプログラム部分を機械語の並びに変換しながら実行させる逐次的実行手段を備えるインタプリタの動作方法であって、前記取り込まれたプログラム部分を、実行速度の面で最適化された機械語の並びに変換することができる最適化ステップと、前記プログラム部分の実行系として、前記逐次的実行ステップ、または前記最適化ステップを介した前記逐次的実行ステップ、若しくは前記ハードウェア機構、のいずれか1つを選択する実行系選択ステップと、前記取り込まれたプログラム部分を、前記実行系選択ステップにより選択された実行系により実行させる実行ステップと、を有することを特徴とするインタプリタの動作方法を提供するものである。   Further, the present invention provides a computer having a hardware mechanism capable of directly executing a part of a program written in a high-level language or an intermediate language. An operation method of an interpreter comprising sequential execution means for execution while converting a machine language sequence, wherein the fetched program portion is optimized to convert a machine language sequence optimized in terms of execution speed And an execution system selection step of selecting one of the sequential execution step, the sequential execution step via the optimization step, or the hardware mechanism as an execution system of the program part And the captured program part is selected by the execution system selection step. There is provided a method of operating an interpreter, characterized in that it has a an execution step of executing the system.

また、前記インタプリタの動作方法において、前記部分的に取り込まれたプログラム部分に、前記ハードウェア機構によって実行できない命令が所定数よりも多く含まれているか否かを判定し、前記プログラム部分が、前記ハードウェア機構によって実行できない命令を所定数よりも多く含むと判定された場合は、当該プログラム部分を前記逐次的実行手段によって実行させ、前記プログラム部分が、前記ハードウェア機構によって実行できない命令を所定数よりも多くは含まないと判定された場合は、当該プログラム部分を前記ハードウェア機構によって実行させ、前記実行後に、前記部分的に取り込まれたプログラム部分に対する前記最適化ステップにおける最適化によって、所定基準を超える効果が得られたかどうかを判定し、前記最適化ステップにおける最適化によって所定基準を超える効果が得られたと判定された前記プログラム部分については、次回以降の実行時に前記プログラム部分を前記最適化ステップを介した前記逐次的実行手段によって実行させることを特徴とする。   Further, in the operation method of the interpreter, it is determined whether the partially fetched program part includes more than a predetermined number of instructions that cannot be executed by the hardware mechanism, and the program part includes If it is determined that the number of instructions that cannot be executed by the hardware mechanism is greater than a predetermined number, the sequential execution means executes the program part, and the program part has a predetermined number of instructions that cannot be executed by the hardware mechanism. If it is determined that the program part is not included, the program part is executed by the hardware mechanism, and after the execution, the optimization is performed in the optimization step for the partly taken-in program part. To determine whether an effect exceeding For the program part determined to have achieved the effect exceeding the predetermined standard by the optimization in the optimization step, the program part is executed by the sequential execution means through the optimization step at the next and subsequent executions. Features.

また、前記インタプリタの動作方法において、前記プログラム部分の実行回数が所定回数に達した時点で、前記プログラム部分が、ハードウェアによって実行できない命令の実行を所定回数よりも多く発生させるものであるか否かを検証し、前記プログラム部分が、ハードウェアによって実行できない命令の実行を所定回数よりも多く発生させるものである場合には、前記所定回数を超える実行時に前記プログラム部分を前記逐次的実行手段によって実行させることを特徴とする。   Further, in the operating method of the interpreter, when the number of executions of the program part reaches a predetermined number, the program part generates more than a predetermined number of instructions that cannot be executed by hardware. And when the program part causes the execution of instructions that cannot be executed by hardware more than a predetermined number of times, the program part is executed by the sequential execution means during execution exceeding the predetermined number of times. It is made to perform.

また、前記インタプリタの動作方法において、前記所定回数を超える実行に際しては、前記適用除外判定ステップ、前記最適化判定ステップ、及び前記適用除外検証ステップによる処理を省略して実行することを特徴とする。   In the operation method of the interpreter, when the execution exceeds the predetermined number of times, the processing by the application exclusion determination step, the optimization determination step, and the application exclusion verification step is omitted.

また、前記インタプリタの動作方法において、前記最適化ステップにおいて、前記最適化の効果が検証されるプログラム部分は、内部のループの回数が所定数以上である部分、または所定深さを超えるネスト構造を含んでいる部分であることを特徴とする。ここで、ネスト構造とは、条件分岐(if文)、一定回数の繰り返し(for文)、条件つき繰り返し(while文)等を含んだプログラム構造のことを言うものとする。   Further, in the interpreter operating method, in the optimization step, the program portion whose effectiveness of the optimization is verified has a portion in which the number of internal loops is a predetermined number or more, or a nested structure exceeding a predetermined depth. It is the part which contains. Here, the nested structure refers to a program structure including conditional branching (if statement), a certain number of repetitions (for statement), conditional repetition (while statement), and the like.

また、前記インタプリタの動作方法において、前記最適化判定ステップでは、ユーザが予め設定した省電力の程度を参照し、前記省電力の程度に応じて、前記最適化手段による最適化の効果の見積もりを補正することを特徴とする。   In the operation method of the interpreter, the optimization determination step refers to a power saving level set in advance by a user, and estimates an optimization effect by the optimization unit according to the power saving level. It is characterized by correcting.

以上説明したように、本発明のインタプリタによれば、プログラムをメソッド単位に取り込むと共に、取り込まれたメソッドにはHAE方式を適用することを基本としながらも、HAEでは処理できない命令を多く含むメソッドについてはHAE方式の適用を除外し、さらに、初回の実行によって、Hotspotが発見されたメソッドについては、次回の実行からは最適化手段を有するJIT方式を適用するので、実行速度の大きいインタプリタを提供することができる。   As described above, according to the interpreter of the present invention, a program is fetched in units of methods, and a method that includes many instructions that cannot be processed by HAE, while applying the HAE method to the fetched method. Excludes the application of the HAE method, and for the method in which Hotspot is found by the first execution, the JIT method having the optimization means is applied from the next execution, so that an interpreter with a high execution speed is provided. be able to.

また、HAEでは処理できない命令を多く含むメソッドについては、HAE方式の適用を除外すると共に、十分な実行回数の実行の後、ハードウェアだけでは処理できない命令の実行を多発させた事実が判明したメソッドについては、HAE方式の適用を除外するので、HAE方式を適用しても実行速度が低下してしまう現象の発生を抑制できるインタプリタを提供することができる。   For methods that include many instructions that cannot be processed by HAE, the method that has been found to have caused the execution of instructions that cannot be processed by hardware alone after executing a sufficient number of executions, while excluding the application of the HAE method. Since the application of the HAE method is excluded, it is possible to provide an interpreter that can suppress the occurrence of a phenomenon that the execution speed decreases even when the HAE method is applied.

また、十分な実行回数の実行の後は、最適化手段等のための統計処理のプログラムステップが除去されるので、オーバーヘッドが無くなり、実行速度が速く、かつ必要メモリ量の少ないインタプリタを提供することができる。   Also, after execution of a sufficient number of executions, statistical processing program steps for optimization means, etc. are removed, so that an overhead is eliminated, an execution speed is high, and an interpreter with a small amount of required memory is provided. Can do.

さらに、ユーザが希望する省電力の程度が大きい場合は、前記JIT方式の適用が除外されるので、モバイル機器等において消費電力量の節約が可能なインタプリタを提供することができる。   Further, when the degree of power saving desired by the user is large, the application of the JIT method is excluded, so that it is possible to provide an interpreter capable of saving power consumption in a mobile device or the like.

以下、添付図面を参照しながら、本発明のインタプリタを実施するための最良の形態を詳細に説明する。図1〜図7は、本発明の実施の形態を例示する図であり、これらの図において、同一の符号を付した部分は同一物を表わし、基本的な構成及び動作は同様であるものとする。   The best mode for carrying out the interpreter of the present invention will be described below in detail with reference to the accompanying drawings. 1 to 7 are diagrams illustrating embodiments of the present invention. In these drawings, the same reference numerals denote the same components, and the basic configuration and operation are the same. To do.

まず、本発明のインタプリタによる実行性能向上の原理を以下で説明する。   First, the principle of improving execution performance by the interpreter of the present invention will be described below.

本発明の課題は、前述のように、JIT方式インタプリタとHAE方式インタプリタの各々の弱点を補い合い、かつ個別のアプリケーションの傾向も加味して実行速度を高速化させることにある。プログラム構造のマクロな解析によって、纏まりを有する一定の処理手順(以下、「メソッド」と呼称する)中に、JIT方式の適用が有効と判断される一連の処理手順(即ち、Hotspot)が存在するメソッドについては、命令単位の処理速度向上しか果たせないHAE方式よりも実行速度を向上させることができると仮定できるので、本発明に係るインタプリタでは、メソッド中の一連の処理手順がJIT方式の適用が可能なHotspotであるか否かの判断処理を最優先する。以下では、このような判断を「Hotspot判断」と呼称する。   As described above, an object of the present invention is to compensate for the weak points of each of the JIT interpreter and the HAE interpreter and increase the execution speed in consideration of the tendency of individual applications. By a macro analysis of the program structure, there is a series of processing procedures (that is, Hotspot) in which the application of the JIT method is determined to be effective in a certain processing procedure (hereinafter referred to as “method”) having a group. As for the method, it can be assumed that the execution speed can be improved as compared with the HAE method which can only improve the processing speed in units of instructions. Therefore, in the interpreter according to the present invention, the JIT method is applied to a series of processing procedures in the method. The highest priority is given to determining whether a hotspot is possible. Hereinafter, such a determination is referred to as “Hotspot determination”.

また、本発明のインタプリタでは、或る通訳対象のメソッドにおいて、JIT方式の適用から除外された一連の処理手順ないしはJIT方式の適用が可能か否かの判断途中にある一連の処理手順については、全てHAE方式での実行対象として扱う。但し、HAE方式で実行できるIR命令は限られている場合が多く、実行できないIR命令を多く含む処理手順の内にはインタプリタで通訳しながら実行した方が良いものが出て来る。以下では、このような例外を「IR要因によるHAE除外判断」と呼称する。   In the interpreter of the present invention, for a method to be interpreted, a series of processing procedures excluded from the application of the JIT method or a series of processing procedures in the middle of determining whether the JIT method can be applied, All are treated as execution targets in the HAE method. However, there are many cases where IR instructions that can be executed by the HAE method are limited, and among the processing procedures that include many IR instructions that cannot be executed, there are some instructions that should be executed while interpreting with an interpreter. Hereinafter, such an exception is referred to as “HAE exclusion determination by IR factor”.

さらに、本発明のインタプリタでは、実行時に、ガーベージコレクション、例外処理、割り込み処理等が頻繁に発生する処理手順を統計的に収集し、インタプリタで通訳しながら実行したほうが良いものを選択する。勿論、このようなガーベージコレクション等の処理は不規則的に発生するので、前記の選択すべき処理手順を発見するための法則性が無いことも考えられるし、割込み処理が特定の処理手順において発生するような構造であることもある。しかしながら、本発明のインタプリタでは、あくまでも統計的な手法を用いて前記の選択すべき処理手順を発見するものとする。以下これを「割込み要因によるHAE除外判断」と呼称する。   Furthermore, in the interpreter of the present invention, at the time of execution, processing procedures in which garbage collection, exception processing, interrupt processing, etc. frequently occur are statistically collected, and those that should be executed while being interpreted by the interpreter are selected. Of course, since such garbage collection processing occurs irregularly, it is possible that there is no law to find the processing procedure to be selected, and interrupt processing occurs in a specific processing procedure. It may be a structure to do. However, in the interpreter of the present invention, it is assumed that the processing procedure to be selected is found by using a statistical method. Hereinafter, this is referred to as “HAE exclusion determination by an interrupt factor”.

これらの判断に加えて、さらに、他の1つのパラメタを考慮する必要がある。それはプログラムを実行するユーザがどの程度の省電力を求めているかである。前述のとおり、一般には、HAE方式の方が、JIT方式よりも消費電力が少なくて済む。このことは、インタプリタが実行されるコンピュータがモバイル機器である場合などでは重要な判断材料(性能指標)となる。この判断材料をどのくらい重要視するかは、調整の余地をユーザに残さなければならないが、本発明のインタプリタでは、ユーザが希望する省電力の程度を実行時のパラメタとしてユーザに入力して貰うこととし、その程度を示すレベル値を、例えば1から10の数値にしてJIT方式における前記Hotspotの判断を緩和化する方向ないしは厳密化する方向へシフトさせるための要因係数として使用する。以下、このような要因係数となる省電力強度のことを「省電力係数」と呼称する。   In addition to these determinations, one other parameter needs to be considered. That is how much power the user who executes the program requires. As described above, the HAE method generally requires less power consumption than the JIT method. This is an important judgment material (performance index) when the computer on which the interpreter is executed is a mobile device. How much importance is attached to this judgment material, it is necessary to leave the room for adjustment to the user, but the interpreter of the present invention allows the user to input the degree of power saving desired by the user as a parameter at the time of execution. The level value indicating the degree is used as a factor coefficient for shifting in a direction of relaxing or strictening the Hotspot judgment in the JIT method, for example, with a numerical value of 1 to 10. Hereinafter, the power saving intensity that becomes such a factor coefficient is referred to as a “power saving coefficient”.

本発明のインタプリタでは、これらの「Hotspot判断」、「IR要因によるHAE除外判断」、及び「割込み要因によるHAE除外判断」等の処理、さらには前記の「省電力係数」を使用して、実行対象プログラムに含まれる処理手順毎のフィードバック系を形成させる。実行が繰り返されるにつれて、このような統計的手法による判断は正確度を増し、十分な回数の実行が行われた後には、ユーザのプログラムの実行形態として、最適のものを選択することが可能となることから、このプログラムは、極めて最適化された状態で実行されることになる。以下、このような状態を「最適化実行状態」と呼称する。「最適化実行状態」に達した場合、当該プログラムに対する前述の4つの判断を行う処理系、及びその結果をフィードバックさせる処理系は不要になるので、当該プログラムの最終的な実行形態として、当該プログラムを、ステップ数の少ないスリムな実行系として実行することができる。また、当該プログラムの実行速度も、余計な判断処理を省いた実行系への移行によって、一層高速化させることが可能となる。   In the interpreter of the present invention, these “Hotspot judgment”, “HAE exclusion judgment by IR factor”, “HAE exclusion judgment by interrupt factor”, and the like, and further using the above “power saving coefficient” are executed. A feedback system for each processing procedure included in the target program is formed. As execution is repeated, the determination by such statistical methods increases in accuracy, and after a sufficient number of executions, it is possible to select the optimum execution form of the user program. Thus, this program is executed in a highly optimized state. Hereinafter, such a state is referred to as an “optimized execution state”. When the “optimized execution state” is reached, the processing system for performing the above-mentioned four determinations for the program and the processing system for feeding back the result are not necessary. Can be executed as a slim execution system with a small number of steps. Also, the execution speed of the program can be further increased by shifting to an execution system that eliminates unnecessary judgment processing.

以下、本実施形態のインタプリタをマイコン用の回路基板に設定し、動作を確認するためのシステムについて説明する。図1は、本発明の実施形態に係るインタプリタをマイコン用の回路基板に設定し、動作を確認するシステムの全体構成を示す構成図である。   Hereinafter, a system for setting the interpreter of this embodiment on a circuit board for a microcomputer and confirming the operation will be described. FIG. 1 is a configuration diagram showing the overall configuration of a system for setting an interpreter according to an embodiment of the present invention on a circuit board for a microcomputer and confirming the operation.

同図において、本実施形態のインタプリタ(以下、単に「インタプリタ」と略称する)をマイコン用の回路基板に設定し、動作を確認するシステムは、インタプリタが設定される回路基板100と、インタプリタが実行されるHAE内蔵マイコン110と、後述のディスプレイ140上で入力すべき座標位置を確定するマウス120と、インタプリタ及びアプリケーションプログラム(以下、「アプリケーション」と略記する)に指令やデータを入力するためのキーボード130と、インタプリタまたはアプリケーションが出力する情報を表示するディスプレイ140と、インタプリタ及びアプリケーションを起動するホストPC(パーソナルコンピュータ)150と、インタプリタ及びアプリケーションが格納されたファイルシステムを記憶するファイルシステム内蔵コンパクトフラッシュ(メモリ)160と、インタプリタ及びアプリケーションの実行領域となるメモリ(RAM)170と、を備える。HAEを内蔵したマイコン110を搭載する回路基板100には、少なくともファイルシステムを内蔵したファイルシステム内蔵コンパクトフラッシュ160と、そのディスケット(図示は省略)と、RAMで構成されたメモリ170とが搭載されていなければならない。   In the figure, an interpreter of this embodiment (hereinafter simply referred to as “interpreter”) is set on a circuit board for a microcomputer, and a system for confirming the operation is executed by the circuit board 100 on which the interpreter is set and the interpreter. HAE built-in microcomputer 110, a mouse 120 for determining a coordinate position to be input on a display 140, which will be described later, and a keyboard for inputting commands and data to an interpreter and an application program (hereinafter abbreviated as "application"). 130, a display 140 that displays information output by the interpreter or application, a host PC (personal computer) 150 that starts the interpreter and application, and a file system that stores the interpreter and application. Includes a file system built compact flash (memory) 160 that includes a memory (RAM) 170 serving as an interpreter and an application execution region. On the circuit board 100 on which the microcomputer 110 incorporating the HAE is mounted, there is mounted at least a compact flash 160 with a built-in file system, its diskette (not shown), and a memory 170 composed of RAM. There must be.

以下、本実施形態のインタプリタをマイコン用の回路基板に設定し、動作を確認するためのシステムの機能について説明する。インタプリタ及びアプリケーション(IR等)が動作するプラットフォームは、前述のHAEを内蔵したマイコン110を搭載した回路基板100であり、この基板はさまざまな機器(モバイル機器等)に組込まれるデバイスとなる。   Hereinafter, the function of the system for setting the interpreter of this embodiment to the circuit board for microcomputers and confirming the operation will be described. The platform on which the interpreter and application (such as IR) operate is the circuit board 100 on which the microcomputer 110 incorporating the above-described HAE is mounted, and this board is a device that is incorporated into various devices (such as mobile devices).

インタプリタと、インタプリタで実行されるアプリケーションとは、ファイルシステム内蔵コンパクトフラッシュ160が記憶するファイルシステム(以下、単に「ファイルシステム」と略記する)に格納されており、ホストPC150により起動がかけられて実行開始される。勿論、前述の機器に組み込まれた後は、ホストPC150ではなく、この機器から起動される。より具体的には、前記機器が備えるハード的なスイッチによって、ないしはパワーオンによって実行開始されるようになる。この実行開始したインタプリタは、まず前記ファイルシステムからメモリ170にロードされ、自分自身の実行準備を行った後に、実行対象のアプリケーションを、同じくファイルシステム160からメモリ170にロードしてくる。   The interpreter and the application executed by the interpreter are stored in a file system (hereinafter simply abbreviated as “file system”) stored in the compact flash 160 with a built-in file system, and are started and executed by the host PC 150. Be started. Of course, after being incorporated into the above-described device, the device is started from this device instead of the host PC 150. More specifically, the execution is started by a hardware switch provided in the device or by power-on. The interpreter that has started execution is first loaded from the file system into the memory 170, and after preparing itself for execution, the execution target application is also loaded from the file system 160 into the memory 170.

アプリケーションによっては入出力機能を備えるものがあり、それらは例えばキーボード130でテキスト入力を、マウス120で座標情報を受け付けて実行される。またグラフィック的な出力がある場合は、回路基板100から、例えばVGA(Video Graphic Array)等のグラフィックシステムを介してディスプレイ140に描画される。これらの動作は、全てアプリケーションがインタプリタ側の機能を使用して行うものである。   Some applications have an input / output function, which is executed by receiving text input with the keyboard 130 and coordinate information with the mouse 120, for example. When there is a graphic output, it is drawn on the display 140 from the circuit board 100 via a graphic system such as a VGA (Video Graphic Array). All of these operations are performed by the application using functions on the interpreter side.

図2は、インタプリタの動作に必要なソフトウェアを含むメモリシステムの領域マップの1例を示したものである。但し、HAE210はソフトウェアではなく、ハードウェア機構である(HAE内蔵マイコン110は、前述のHAE210を内蔵しており、HAE開始命令が有り次第、IR命令の並びをHAE210に送り込んで、高速実行できるよう待機している)。   FIG. 2 shows an example of an area map of a memory system including software necessary for the operation of the interpreter. However, the HAE 210 is not a software but a hardware mechanism (the HAE built-in microcomputer 110 incorporates the above-described HAE 210, and as soon as there is a HAE start instruction, an array of IR instructions is sent to the HAE 210 so that it can be executed at high speed. Waiting).

図2に示すメモリシステムが記憶しているソフトウェアは、ソフトウェアのインターフェースがハードウェア側に近い順序で、下位(ハードウェア側に最も近い)から順に、オペレーティングシステムを担うリアルタイムOS220と、ファイルシステム、グラフィック、及びネットワークから成るミドルウェア群221と、JIT231を含むインタプリタ230と、IRの並びで構成されたインタプリタ用ライブラリ240と、IRで書かれたアプリケーションプログラム250と、で構成される。性能的な理由によりインタプリタでは実行できないプログラムは、従来のようにコンパイラ言語で実現しなければならず、それは通常のネイティブプログラム260として、インタプリタとそのプログラムと並列に並べて配されている。前述のシステムの開始と共にリアルタイムOS220が立ち上がる。このOSは通常ミドルウェア群221も備えており、ミドルウェア群221も、このOSと同時に使用可能な状態になる。   The software stored in the memory system shown in FIG. 2 includes the real-time OS 220 that handles the operating system, the file system, and the graphics in the order that the software interface is closer to the hardware side, in order from the lower level (closest to the hardware side). And a network middleware group 221, an interpreter 230 including a JIT 231, an interpreter library 240 composed of an array of IRs, and an application program 250 written in IR. A program that cannot be executed by an interpreter for performance reasons must be realized in a compiler language as in the prior art, and is arranged as a normal native program 260 in parallel with the interpreter and the program. The real-time OS 220 starts up with the start of the system. This OS also includes a middleware group 221. The middleware group 221 can be used simultaneously with the OS.

次に、インタプリタ用ライブラリ240を伴ったJIT231を内蔵するインタプリタ230がメモリ170上にロードされ、前述のようにアプリケーション250をロードする。この状態になって、はじめてアプリケーション250の入り口から実行が開始され得ることになる。インタプリタ用言語も一連の処理手順(以下、「メソッド」と呼称する)毎に纏められて記述されているのが通常なので、インタプリタはメソッド単位で実行を開始する。   Next, an interpreter 230 incorporating a JIT 231 with an interpreter library 240 is loaded onto the memory 170, and the application 250 is loaded as described above. Only in this state, execution can be started from the entrance of the application 250. Since the interpreter language is usually described in a series of processing procedures (hereinafter referred to as “methods”), the interpreter starts executing in units of methods.

以下、実行方式を選択する説明を行うが、基本的にはこのメソッド単位で、下記の3つの実行方式のいずれかを選択させてゆく(実行系選択手段)。この3つの実行方式とは、即ち、最適化手段を有さない通常のインタプリタによる実行方式(逐次的実行手段)と、最適化手段を有するJIT方式のインタプリタによる実行方式(最適化手段+逐次的実行手段)と、HAE(ハードウェア機構)による実行方式である。   In the following description, an execution method is selected. Basically, one of the following three execution methods is selected for each method (execution system selection means). The three execution methods are an execution method using a normal interpreter that does not have an optimization means (sequential execution means) and an execution method using a JIT interpreter that has optimization means (optimization means + sequentially). Execution means) and HAE (hardware mechanism).

図3は、本実施の形態に係るインタプリタの実行方式を選択する処理の流れを示すフローチャートである。ここでは、前記3方式の選択方法を示す概念的なフローチャートを示している。図3に示す前記3方式の選択方法では、HAEによる実行を基本として、実行時に情報収集しながら徐々にHAEの適用除外の判断を行っていくものである。つまり、実行方式が未分化の状態からアプリケーションの構造に沿って最適化された状態に進む。   FIG. 3 is a flowchart showing a flow of processing for selecting an execution method of the interpreter according to the present embodiment. Here, a conceptual flowchart showing the selection method of the three methods is shown. In the selection method of the three methods shown in FIG. 3, based on the execution by the HAE, the HAE application exclusion is gradually determined while collecting information at the time of execution. That is, the execution method proceeds from an undifferentiated state to an optimized state along the structure of the application.

まず、JIT方式のインタプリタを適用すると効果が上がるHotspotの有無を判断する(ステップS300)。
前述のように、このHotspotはプログラム全体を見渡した時に処理が偏在しているプログラム部分であるから、或るメソッドが集中的に呼ばれているならば、このメソッドはHotspotの有力候補である。あるいはまた、呼ばれる回数がそれほどでもないが、内部のループの回数が多いか、ないしはネストが深く、実行時間が多く掛かる部分であるとしたら、このような部分もHotspotの有力候補である。いずれにしても、或るメソッドが高速になればプログラム全体が高速になることが予見される場合には、このメソッドはHotspotであると見なすことができるのであり、JIT方式のインタプリタによる実行は、このようなHotspotを有するメソッドを適用対象にする時に最も効果が上がる。
First, it is determined whether or not there is a Hotspot that is effective when a JIT interpreter is applied (step S300).
As described above, since this Hotspot is a program part in which processing is unevenly distributed when the entire program is looked at, if a certain method is called intensively, this method is a promising candidate for Hotspot. Alternatively, if the number of calls is not so high, but the number of internal loops is large, or the nesting is deep and the execution time is long, such a part is also a strong candidate for Hotspot. In any case, if it is predicted that if a certain method becomes faster, the whole program will be faster, this method can be regarded as a Hotspot, and the execution by the JIT interpreter is This is most effective when a method having such a Hotspot is applied.

或るプログラム部分が、このようなHotspotであるか否かの判断を行うためには、前述のプログラム部分に関する構造分析の結果としてのデータが必要となるので、Hotspotの判断ステップ(ステップS300)においては、過去の実行時にこのような構造分析を行って得られたデータを纏めて成る実行時の分析・フィードバックデータ320を参照しなければならない。参照される他の1つの要因データは省電力係数310である。一般に、JIT方式のインタプリタを実行すると実行命令数が多くなるので、HAEによる実行の方が電力を消費しない。ユーザがどの程度の省電力を望むかは、パラメタとして外部(例えば、キーボード130(図1))から指定してもらう。Hotspotの判断ステップ(ステップS300)においては、このパラメタを参照して対応する係数に変換し、この係数を用いて前述のHotspotであるか否かの判断を調整する。より具体的には、省電力をユーザが強く望んでいる場合(即ち、前記係数が大きい場合)は、Hotspotであるとする判断を厳しくし、厳選したメソッドだけをJIT実行(ステップS340)の対象とするようにする。上記の判断をステップS330で集約する。   In order to determine whether or not a certain program part is such a Hotspot, data as a result of the structural analysis related to the above-described program part is required. Therefore, in the Hotspot determination step (step S300) Must refer to the analysis / feedback data 320 at the time of execution, which is a collection of data obtained by performing such a structural analysis at the time of the past execution. Another factor data to be referred to is a power saving coefficient 310. In general, when a JIT interpreter is executed, the number of execution instructions increases, so that execution by HAE does not consume power. The degree of power saving desired by the user is specified from the outside (for example, the keyboard 130 (FIG. 1)) as a parameter. In the Hotspot determination step (step S300), this parameter is referred to convert to a corresponding coefficient, and the determination as to whether or not it is the aforementioned Hotspot is adjusted using this coefficient. More specifically, when the user strongly desires power saving (that is, when the coefficient is large), the judgment that it is a Hotspot is made strict, and only the selected method is subject to JIT execution (step S340). And so on. The above judgments are collected in step S330.

次に、割込み要因によるHAEの除外を行う(ステップS350)。
割り込み要因が頻繁に発生するメソッドは、HAEで実行している最中にソフト実行に戻さなければならず、その切り替えにコストが掛かる。もしも、或るメソッドの実行時に頻繁に外部割込みが掛かることが予見されるならば、このメソッドはHAEで実行する対象から除外した方が高速性能を維持できる可能性が高い。このような判断を、やはり実行時の分析・フィードバックデータ320を参照して行う。除外すべきと判断されたメソッドはインタプリタ実行(ステップS400)での実行に廻す。また、IR要因によるHAE除外判断(ステップS380)において、IR要因によってHAEによる実行対象から除外すべきメソッドであるか否かを検証し、ステップS390にて、この検証結果を判断して、メソッドにHAEで実行できるIR命令が所定の割合以下にしか含まれていない場合は、当該メソッドをインタプリタ実行(ステップS400)での実行に廻す。HAEで実行できるIR命令が含まれている上記の割合は、IRを静的に分析した結果を纏めて成るIRの静的な分析データ370を参照すれば可能となるので、実行時における分析は必要がない。このようにして残ったメソッドはHAEで実行される(ステップS410)。
Next, HAE is excluded due to an interrupt factor (step S350).
A method in which an interrupt factor frequently occurs must be returned to software execution while it is being executed in HAE, and switching is expensive. If it is predicted that external interrupts will frequently occur during execution of a certain method, it is more likely that this method can maintain high-speed performance if it is excluded from the target to be executed by HAE. Such a determination is also made with reference to the analysis / feedback data 320 at the time of execution. The method determined to be excluded is sent to the interpreter execution (step S400). In addition, in the HAE exclusion determination based on the IR factor (step S380), it is verified whether the method should be excluded from the execution target by the HAE based on the IR factor. In step S390, the verification result is determined, and If the IR instruction that can be executed by the HAE is included only in a predetermined ratio or less, the method is sent to the interpreter execution (step S400). The above-mentioned ratio including IR instructions that can be executed by the HAE can be obtained by referring to the static analysis data 370 of the IR, which is a summary of the results of static analysis of the IR. There is no need. The method remaining in this way is executed by HAE (step S410).

図4は、本実施の形態に係るインタプリタによる最適な実行形態を示すフローチャートである。同図では、これまで述べてきたような静的な分析や実行時における分析結果のフィードバックによって、或るアプリケーションの実行プログラムが完全に最適化されて、3つの実行方式が、このアプリケーションの実行形態がメソッド毎に決定されている時のインタプリタによる実行フローを示している。   FIG. 4 is a flowchart showing an optimum execution form by the interpreter according to this embodiment. In the figure, the execution program of a certain application is completely optimized by the static analysis as described above and the feedback of the analysis result at the time of execution. Shows the execution flow by the interpreter when is determined for each method.

まず、メソッドの実行を開始する処理(ステップS500)の直後に、実行方法を示したテーブル520の参照を行い、このテーブルに書かれた今まさに実行開始しようとしているメソッドの実行方式を取得する(ステップS510)。次に、ステップS530において、当該メソッドに関する実行方法として、前記テーブルに、例えば“J”と書かれている場合は、ステップS540において、当該メソッドをJIT方式により実行(繰返し部分を含む)し、ステップS570にて処理を終了する。但し、このタイミングでJIT方式で実行する時には、既に何回もJIT方式による実行が繰り返された後なので、JIT方式インタプリタが通訳して出力したオブジェクトプログラムは、既にメモリ上にあり、よって、このオブジェクトプログラムを実行するだけでよい。   First, immediately after the process for starting the execution of the method (step S500), the table 520 showing the execution method is referred to, and the execution method of the method that is written in this table and is about to start executing is acquired ( Step S510). Next, in step S530, as an execution method related to the method, if “J” is written in the table, for example, in step S540, the method is executed by the JIT method (including a repetitive part). The process ends in S570. However, when executing in the JIT system at this timing, since the execution by the JIT system has already been repeated many times, the object program that has been interpreted and output by the JIT system interpreter is already in the memory. Just run the program.

ステップS530において、当該メソッドに関する実行方法として、前記テーブルに、例えば“H”と書かれている場合は、ステップS550において、当該メソッドをHAEにより実行(繰返し部分を含む)し、ステップS570にて処理を終了する。但し、このHAEによる実行途中で、ソフトウェア側での実行に切り換えざるを得ない場合があり、このような場合には、途中で、通常のインタプリタにより実行(繰返し部分を含む)するステップS560に遷移する場合が当然ある。この遷移後に、ソフトウェア側での実行が終了すると、制御の流れを再びハードウェア側に戻して、HAEにより実行(繰返し部分を含む)を行うことができる。   If, for example, “H” is written in the table as an execution method related to the method in step S530, the method is executed by HAE (including a repetitive part) in step S550, and the process is performed in step S570. Exit. However, there is a case where it is necessary to switch to execution on the software side during execution by this HAE. In such a case, the process proceeds to step S560 where execution is performed by a normal interpreter (including repetitive parts) in the middle. Of course there is a case to do. When the execution on the software side is completed after this transition, the control flow can be returned to the hardware side again, and the execution (including the repetitive part) can be performed by the HAE.

ステップS530において、当該メソッドに関する実行方法として、前記テーブルに、例えば“I”と書かれている場合は、ステップS560において通常のインタプリタにより実行(繰返し部分を含む)し、ステップS570にて処理を終了する。但し、この場合も、当該メソッドに関し、既に通常のインタプリタによる実行が繰り返された後であれば、このインタプリタが通訳して出力したオブジェクトプログラムを使用することができる。前述のステップS570に達するのは、メソッドが完了した場合とは限らず、途中で他のメソッドの呼び出しが有った場合も含まれる。このプログラムが呼び出されて実行される場合のステップS570における戻り方は処理系による。   In step S530, if “I” is written in the table as an execution method related to the method, execution is performed by a normal interpreter (including repetitive parts) in step S560, and the process ends in step S570. To do. However, in this case as well, the object program that has been interpreted and output by the interpreter can be used after the execution by the normal interpreter has already been repeated. Reaching step S570 described above is not limited to the case where the method is completed, but also includes the case where another method is called on the way. When this program is called and executed, the return method in step S570 depends on the processing system.

図5は、本発明の実施の形態に係るインタプリタが動的最適化処理のためにフィードバックする情報の1例としての一覧を示す説明図である。同図では、メソッド単位にフィードバックされる情報を示している。同図で一覧表示される情報項目は、「メソッド名」600、「実行方法」610、「実行回数」620、「Hotspot」630、「HAE実行不可IR数」640、「IR全体数」650、「GC(ガーベージコレクション)発生回数」660、「割込み発生回数」670、及び「例外発生回数」680、である。なお、図5に示す情報の使用方法については後述する(図7参照)。   FIG. 5 is an explanatory view showing a list as an example of information fed back for dynamic optimization processing by the interpreter according to the embodiment of the present invention. In the figure, information fed back in units of methods is shown. The information items displayed in a list in the figure are “method name” 600, “execution method” 610, “execution count” 620, “Hotspot” 630, “HAE non-executable IR count” 640, “total IR count” 650, “GC (garbage collection) occurrence count” 660, “interrupt occurrence count” 670, and “exception occurrence count” 680. A method of using the information shown in FIG. 5 will be described later (see FIG. 7).

図6は、本発明の実施の形態に係るインタプリタが最適化処理のための1パラメタとする省電力係数を1例として示す説明図である。同図では、省電力実行を行うか否かを選択させる「省電力係数実行時パラメタ」700と、数値1〜10で示される省電力係数を記載する「省電力係数」710とを示している。なお、図6に示す情報の使用方法については後述する(図7参照)。   FIG. 6 is an explanatory diagram showing, as an example, a power saving coefficient that is one parameter for optimization processing by the interpreter according to the embodiment of the present invention. In the figure, a “power saving coefficient execution parameter” 700 for selecting whether or not to execute power saving is shown, and a “power saving coefficient” 710 for describing the power saving coefficient indicated by numerical values 1 to 10 is shown. . A method of using the information shown in FIG. 6 will be described later (see FIG. 7).

図7は、本発明の実施の形態に係るインタプリタが動的最適化処理を行うと共に最適な実行形態を選択しながら実行する場合の処理手順を示すフローチャートである。同図に示す処理フローは、本発明の実施の形態に係るインタプリタが、図4に示す最適化されたインタプリタに達する以前の実行形態を示すものであり、ここでは、動的最適化処理を行うと共に最適な実行形態を選択しながら実行する実行形態であるものとする。図中、テーブル820は、図5で示したフィードバック情報の1例としての具体例を示すものである。   FIG. 7 is a flowchart showing a processing procedure when the interpreter according to the embodiment of the present invention executes the dynamic optimization process and selects the optimal execution form. The processing flow shown in the figure shows an execution form before the interpreter according to the embodiment of the present invention reaches the optimized interpreter shown in FIG. 4, and here, dynamic optimization processing is performed. In addition, it is assumed that the execution form is executed while selecting the optimum execution form. In the figure, a table 820 shows a specific example as an example of the feedback information shown in FIG.

まず、メソッドの実行を開始する処理(ステップS800)の直後に、テーブル820中の当該メソッドに対応するエントリを探し、これが無ければ当該メソッドに対応するエントリを新設する(ステップS810)。次に、前記メソッドが呼ばれた訳であるから、このメソッドの実行回数をカウントアップ(即ち、+1)して、テーブル820の該当フィールド(「実行回数」)を更新する(ステップS830)。次に、テーブル820の「実行方法」フィールドを参照して、実行方法が既に決められているメソッドであるか否かを検証し、実行方法が既に決められているメソッドである場合は、ステップS890に移り、実行方法が未だ決められていないメソッドである場合は、ステップS880に進む(ステップS840)。   First, immediately after the process for starting the execution of the method (step S800), an entry corresponding to the method in the table 820 is searched, and if there is no entry, an entry corresponding to the method is newly established (step S810). Next, since the method is called, the number of executions of this method is counted up (ie, +1), and the corresponding field (“execution number”) in the table 820 is updated (step S830). Next, with reference to the “execution method” field of the table 820, whether or not the execution method is already determined is verified. If the execution method is already determined, step S890 is executed. If the method has not been determined yet, the process proceeds to step S880 (step S840).

ステップ890では、図4のフローチャートに示す最適な実行形態の場合とほぼ同様に、テーブル820の「実行方法」フィールドに記載された3種類の実行方法を参照して当該メソッドの実行方式を確定し、この実行方式に応じて、ステップS900、ステップS910、ステップS920のいずれかを実行し、その後、ステップS930に進む。   In step 890, the execution method of the method is determined by referring to the three execution methods described in the “Execution method” field of the table 820, as in the case of the optimal execution mode shown in the flowchart of FIG. Depending on the execution method, one of step S900, step S910, and step S920 is executed, and then the process proceeds to step S930.

ステップS850では、実行方法が未だ決めていない場合であるので、テーブル820の「IR全体数」、「HAE実行不可IR数」を参照し、これらの設定が未だなされていない場合は、この実行により新規設定し、ステップS860に進む。   In step S850, since the execution method has not yet been determined, the “total number of IRs” and the “number of non-HAE executable IRs” in the table 820 are referred to. If these settings have not yet been made, New setting is made, and the process proceeds to step S860.

ステップS860では、HARの実行が不可能なIRの個数のパーセンテージが所定の閾値を超えているか否かを判断し(適用除外判定手段)、もしも前記IR数が前記閾値を超えている場合は、ステップS870にて、「実行方法はインタプリタである」ことを確定(即ち、テーブル820の「実行方法」のフィールドに「I」を記載)した後、ステップS890に移り(第1の実行手段)、また、前記IR数が前記閾値を超えていない場合はステップS880に移る。   In step S860, it is determined whether or not the percentage of the number of IRs that cannot perform HAR exceeds a predetermined threshold (application exclusion determination unit). If the number of IRs exceeds the threshold, In step S870, after confirming that “the execution method is an interpreter” (that is, “I” is described in the “execution method” field of the table 820), the process proceeds to step S890 (first execution means). If the IR number does not exceed the threshold value, the process proceeds to step S880.

ステップ880では、「実行方法はHAEである」ことを確定(即ち、テーブル820の「実行方法」のフィールドに「H」を記載)した後、ステップS890に移る(第2の実行手段)。   In step 880, after confirming that “the execution method is HAE” (that is, “H” is described in the “execution method” field of the table 820), the process proceeds to step S890 (second execution means).

なお、ステップS890以下の流れは、図4のフローチャートに示す最適な実行形態の場合とほぼ同様であるが、唯一異なる点は、Hotspotを判断する処理ステップ(ステップS930)と、例外によるHAE実行の調整処理(ステップS940)が追加されていることである。   The flow after step S890 is almost the same as in the optimal execution mode shown in the flowchart of FIG. 4, except for the processing step (step S930) for determining Hotspot and the HAE execution by exception. An adjustment process (step S940) is added.

ステップS930では、直前までの処理の流れを検証して、Hotspotが存在するか否かの判断を行う(最適化判定手段)。このHotspotの存在を判断するための具体的な処理内容については、周知の技術であるので、ここでは述べないが、Hotspotの定義は前述のとおりである。当該メソッドについて、前述のHotspotを発見できた場合は、このステップで、テーブル820の「Hotspot」のフィールドに「ON」を記載すると共に、実行方法はJIT方式のインタプリタであることを確定(即ち、テーブル820の「実行方法」のフィールドに「J」を上書き)することになる(第3の実行手段)。   In step S930, the process flow up to immediately before is verified to determine whether or not a Hotspot exists (optimization determination means). Since the specific processing content for determining the presence of this Hotspot is a well-known technique, it is not described here, but the definition of Hotspot is as described above. If the above-mentioned Hotspot can be found for this method, at this step, “ON” is entered in the “Hotspot” field of the table 820 and the execution method is determined to be a JIT interpreter (ie, In this case, “J” is overwritten in the “execution method” field of the table 820 (third execution means).

次に、ステップS940では、前述の割込み要因(GC(ガーベージコレクション)、割込み、例外処理)に起因する割込みが、このメソッドで頻発していないかという判断を行うが、このような判断は、実行回数が十分な回数に達した時に初めて判断できるものである。このような割込み要因による割込みの発生回数は、現在までの実行時にカウントされて、割込み要因毎に、テーブル820の該当するフィールドに数値として記録されているので、テーブル820の「実行回数」フィールドに十分な実行回数が示されていて、かつ前記割込み要因による割込みの発生回数が所定の閾値を超えている場合は、インタプリタで実行した方が有利と判断し、テーブル820の「実行方法」のフィールドに「I」を上書きして実行方法はインタプリタであることを示すことになる(第4の実行手段)。この割込み要因発生回数のカウントは、図7に示すように、別個にアクションルーチン(960,970,980)が設けられており、実行中のメソッドが何であったかを見て、当該フィールドの回数をカウントアップしている。   Next, in step S940, it is determined whether or not an interrupt caused by the above-described interrupt factor (GC (garbage collection), interrupt, exception processing) has occurred frequently in this method. It can be judged only when the number of times reaches a sufficient number. The number of occurrences of interrupts due to such interrupt factors is counted at the time of execution up to the present, and is recorded as a numerical value in the corresponding field of the table 820 for each interrupt factor. If the sufficient number of executions is indicated and the number of occurrences of the interrupt due to the interrupt factor exceeds a predetermined threshold, it is determined that execution by the interpreter is advantageous, and the “execution method” field of the table 820 "I" is overwritten to indicate that the execution method is an interpreter (fourth execution means). As shown in FIG. 7, an interrupt routine (960, 970, 980) is separately provided for counting the number of interrupt factor occurrences. The number of times of the corresponding field is counted by looking at what method is being executed. Is up.

なお、図7に示す実行形態で実行している状態で、十分長い時間を掛けて実行された後には、テーブル820の実行方法は統計的に確定したと見なせる状態に至る。この時は、ステップS830〜S880の処理、及びステップS930,S940、ステップS960〜S980の処理は取り外すことができる。   In addition, after executing for a sufficiently long time in the state of execution in the execution mode shown in FIG. 7, the execution method of the table 820 reaches a state where it can be regarded as statistically determined. At this time, the processes of steps S830 to S880 and the processes of steps S930 and S940 and steps S960 to S980 can be removed.

このアルゴリズムは処理系に依存するが、十分長い時間を掛けて実行された後で、全てのメソッドのテーブル820上の実行方法のフィールドが書き換わらなかった時に、テーブル820の実行方法は統計的に確定したと判断できることになり、このような処理を追加することは容易である。   Although this algorithm depends on the processing system, the execution method of the table 820 is statistically determined when the execution method field on the table 820 of all methods is not rewritten after being executed for a sufficiently long time. Since it can be determined that it has been confirmed, it is easy to add such processing.

以上、本発明のインタプリタについて、具体的な実施の形態を示して説明したが、本発明はこれらに限定されるものではない。当業者であれば、本発明の要旨を逸脱しない範囲内において、上記各実施形態又は他の実施形態にかかる発明の構成及び機能に様々な変更・改良を加えることが可能である。   The interpreter of the present invention has been described above with specific embodiments, but the present invention is not limited to these. A person skilled in the art can make various changes and improvements to the configurations and functions of the invention according to the above-described embodiments or other embodiments without departing from the gist of the present invention.

本発明は、コンピュータと使用者(プログラマー)との間を取り持つプログラミング用の言語で書かれたコンピュータプログラムを、一旦全て翻訳することなく、部分的に順次に通訳しながら直ちに実行するシステム、特に、最適化手段を有するインタプリタに適用することができる。   The present invention is a system for immediately executing a computer program written in a programming language between a computer and a user (programmer), without partial translation, and partially interpreting the program immediately. It can be applied to an interpreter having optimization means.

本発明の実施形態に係るインタプリタをマイコン用の回路基板に設定し、動作を確認するシステムの全体構成を示す構成図である。It is a block diagram which shows the whole structure of the system which sets the interpreter which concerns on embodiment of this invention to the circuit board for microcomputers, and confirms operation | movement. インタプリタの動作に必要なソフトウェアを含むメモリシステムの領域マップの1例を示したものである。An example of an area map of a memory system including software necessary for the operation of the interpreter is shown. 本実施の形態に係るインタプリタの実行方式を選択する処理の流れを示すフローチャートである。It is a flowchart which shows the flow of the process which selects the execution system of the interpreter which concerns on this Embodiment. 本実施の形態に係るインタプリタによる最適な実行形態を示すフローチャートである。It is a flowchart which shows the optimal execution form by the interpreter which concerns on this Embodiment. 本発明の実施の形態に係るインタプリタが動的最適化処理のためにフィードバックする情報の1例としての一覧を示す説明図である。It is explanatory drawing which shows the list as an example of the information which the interpreter which concerns on embodiment of this invention feeds back for dynamic optimization processing. 本発明の実施の形態に係るインタプリタが最適化処理のための1パラメタとする省電力係数を1例として示す説明図である。It is explanatory drawing which shows the power saving coefficient made into 1 parameter for the optimization process by the interpreter which concerns on embodiment of this invention as an example. 本発明の実施の形態に係るインタプリタが動的最適化処理を行うと共に最適な実行形態を選択しながら実行する場合の処理手順を示すフローチャートである。It is a flowchart which shows the process sequence in the case of performing, while selecting the optimal execution form while the interpreter which concerns on embodiment of this invention performs a dynamic optimization process.

符号の説明Explanation of symbols

110 HAE内蔵マイコン
120 マウス
130 キーボード
140 ディスプレイ
150 ホストPC(パーソナルコンピュータ)
160 ファイルシステム内蔵コンパクトフラッシュ(メモリ)
170 メモリ(RAM)
220 リアルタイムOS(オペレーティングシステム)
221 ミドルウェア群
230 インタプリタ(JIT方式)
240 インタプリタ用ライブラリ
250 アプリケーションプログラム(中間言語IR使用)
600 「メソッド名」(以下、鍵括弧は項目名を示す)
610 「実行方法」
620 「実行回数」
630 「Hotspot」(最適化処理対象)
640 「HAE実行不可IR数」
650 「IR全体数」
660 「GC(ガーベージコレクション)発生回数」
670 「割込み発生回数」
680 「例外発生回数」
700 「省電力係数実行時パラメタ」
710 「省電力係数」
110 HAE built-in microcomputer 120 mouse 130 keyboard 140 display 150 host PC (personal computer)
160 Compact Flash with built-in file system (memory)
170 Memory (RAM)
220 Real-time OS (Operating System)
221 Middleware 230 Interpreter (JIT method)
240 Library for interpreter 250 Application program (using intermediate language IR)
600 “Method Name” (Hereinafter, brackets indicate item names)
610 “Execution Method”
620 “Number of executions”
630 “Hotspot” (optimization target)
640 “Number of non-HAE executable IRs”
650 “Total number of IRs”
660 “Number of GC (garbage collection) occurrences”
670 “Number of interrupt occurrences”
680 “Number of exception occurrences”
700 “Power-saving coefficient runtime parameters”
710 “Power Saving Factor”

Claims (7)

高級言語又は中間言語で記述されたプログラムの一部の命令を直接的に実行できるハードウェア機構と、プログラム部分ごとにその実行方法を記載したテーブルを格納した記憶装置とを備えたコンピュータの動作方法であって、
前記プログラム部分に、前記ハードウェア機構によって実行できない命令が所定数よりも多く含まれているか否かを判定する適用除外判定ステップと、
前記プログラム部分に対してJIT方式を適用可能であるか否かを判定する最適化判定ステップと、
を有する実行方法判定ステップであって、
前記適用除外判定ステップにおいて、前記プログラム部分が、前記ハードウェア機構によって実行できない命令を所定数よりも多く含むと判定された場合には、前記プログラム部分を機械語の並びに変換しながら逐次的に実行するように前記テーブルの前記プログラム部分の実行方法を設定し、前記プログラム部分を逐次的に実行し、
前記適用除外判定ステップにおいて、前記プログラム部分が、前記ハードウェア機構によって実行できない命令を所定数よりも多くは含まないと判定された場合は、前記プログラム部分のうち、前記ハードウェア機構によって実行できる部分を前記ハードウェア機構によって実行し前記ハードウェア機構によって実行できない部分を機械語の並びに変換しながら逐次的に実行するように前記テーブルの前記プログラム部分の実行方法を設定し、前記プログラム部分のうち、前記ハードウェア機構によって実行できる部分を前記ハードウェア機構によって実行させ、前記ハードウェア機構によって実行できない部分を機械語の並びに変換しながら逐次的に実行し、
前記最適化判定ステップにおいて、前記プログラム部分に対してJIT方式を適用可能であると判定された場合には、前記適用除外判定ステップにおける判定結果に関わらず、前記プログラム部分を実行速度の面で最適化されたオブジェクトプログラムに変換して実行するように前記テーブルの前記プログラム部分の実行方法を設定し、前記プログラム部分を前記最適化されたオブジェクトプログラムに変換して実行する、前記実行方法判定ステップと、
前記実行方法判定ステップによる前記プログラム部分の実行を繰り返し実施した結果、前記テーブル内の各プログラム部分の実行方法が不変となったか否かを判定する実行方法確定ステップと、
を有し、
前記実行方法確定ステップにおいて、前記テーブル内の各プログラム部分の実行方法が不変となったと判定した場合には、前記テーブルに格納された実行方法にしたがって前記プログラムを実行する
ことを特徴とする動作方法。
Method of operating a computer comprising a hardware mechanism capable of directly executing a part of instructions of a program written in a high-level language or an intermediate language, and a storage device storing a table describing the execution method for each program part Because
An application exclusion determination step for determining whether or not the program portion includes more than a predetermined number of instructions that cannot be executed by the hardware mechanism;
An optimization determination step for determining whether a JIT method can be applied to the program portion;
An execution method determination step comprising:
In the application exclusion determination step, when it is determined that the program part includes more than a predetermined number of instructions that cannot be executed by the hardware mechanism, the program part is sequentially executed while converting the machine language. Set the execution method of the program part of the table to sequentially execute the program part,
In the application exclusion determination step, when it is determined that the program part does not include more than a predetermined number of instructions that cannot be executed by the hardware mechanism, a part of the program part that can be executed by the hardware mechanism Is executed by the hardware mechanism and sets the execution method of the program part of the table so that the part that cannot be executed by the hardware mechanism is sequentially executed while converting the sequence of machine language. A portion that can be executed by the hardware mechanism is executed by the hardware mechanism, and a portion that cannot be executed by the hardware mechanism is sequentially executed while converting a sequence of machine language;
If it is determined in the optimization determination step that the JIT method can be applied to the program part, the program part is optimized in terms of execution speed regardless of the determination result in the application exclusion determination step. An execution method determination step, wherein an execution method of the program part of the table is set so as to be converted into an optimized object program and executed, and the program part is converted into the optimized object program and executed. ,
An execution method determination step for determining whether or not the execution method of each program part in the table is unchanged as a result of repeatedly executing the program part by the execution method determination step;
Have
In the execution method determination step, when it is determined that the execution method of each program portion in the table has not changed, the program is executed according to the execution method stored in the table. .
前記実行方法判定ステップは、前記プログラム部分の実行回数が所定回数に達した時点で、前記プログラム部分が、ハードウェアによって実行できない命令の実行を所定回数よりも多く発生させるものであるか否かを検証する適用除外検証ステップをさらに有し、
前記実行方法判定ステップでは、
前記適用除外検証ステップにおいて、前記プログラム部分が、ハードウェアによって実行できない命令の実行を所定回数よりも多く発生させるものであると判定された場合には、前記プログラム部分を機械語の並びに変換しながら逐次的に実行するように前記テーブルの前記プログラム部分の実行方法を設定し、前記所定回数を超える実行時に前記プログラム部分を機械語の並びに変換しながら逐次的に実行することを特徴とする請求項1に記載の動作方法。
In the execution method determination step, it is determined whether or not the program part causes execution of an instruction that cannot be executed by hardware more than the predetermined number of times when the execution number of the program part reaches a predetermined number of times. And further comprising an exemption verification step to verify,
In the execution method determination step,
In the application exclusion verification step, when it is determined that the program part generates more than a predetermined number of instructions that cannot be executed by hardware, the program part is converted into a sequence of machine languages. The execution method of the program portion of the table is set so as to be executed sequentially, and the program portion is executed sequentially while converting the sequence of machine language at the time of execution exceeding the predetermined number of times. 2. The operation method according to 1.
前記最適化判定ステップでは、内部のループの回数が所定数以上であるプログラム部分、または所定深さを超えるネスト構造を含んでいるプログラム部分に対してJIT方式を適用可能であると判定することを特徴とする請求項1または2に記載の動作方法。   In the optimization determination step, it is determined that the JIT method can be applied to a program part in which the number of internal loops is a predetermined number or more, or a program part including a nested structure exceeding a predetermined depth. The operation method according to claim 1, wherein the operation method is characterized. 前記最適化判定ステップでは、ユーザが予め設定した省電力の程度を表す値を参照し、前記値に応じた前記所定数または前記所定深さを用いて前記判定を行うことを特徴とする請求項3に記載の動作方法。   The optimization determination step refers to a value representing a degree of power saving preset by a user, and performs the determination using the predetermined number or the predetermined depth according to the value. 3. The operation method according to 3. 請求項1から4のいずれか1項記載の動作方法を前記コンピュータに実行させるためのプログラム。 The program for making the said computer perform the operation | movement method of any one of Claim 1 to 4. 請求項5記載のプログラムを前記記憶装置に格納し前記コンピュータ。 The computer stored in said storage device according to claim 5, wherein the program. 請求項1から4のいずれか1項記載の動作方法にしたがって動作する前記コンピュータ。 5. The computer that operates according to the operation method according to claim 1.
JP2005337258A 2005-11-22 2005-11-22 Computer operating method, program, computer Expired - Fee Related JP5042487B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005337258A JP5042487B2 (en) 2005-11-22 2005-11-22 Computer operating method, program, computer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005337258A JP5042487B2 (en) 2005-11-22 2005-11-22 Computer operating method, program, computer

Publications (2)

Publication Number Publication Date
JP2007141153A JP2007141153A (en) 2007-06-07
JP5042487B2 true JP5042487B2 (en) 2012-10-03

Family

ID=38203902

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005337258A Expired - Fee Related JP5042487B2 (en) 2005-11-22 2005-11-22 Computer operating method, program, computer

Country Status (1)

Country Link
JP (1) JP5042487B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010191734A (en) * 2009-02-19 2010-09-02 Hitachi Software Eng Co Ltd Image reproduction apparatus and method of executing intermediate language program
JP5505522B2 (en) 2011-02-01 2014-05-28 富士通株式会社 Program execution method
CN105653244B (en) * 2014-11-10 2019-04-19 华为数字技术(苏州)有限公司 A kind of optimization method for software and device

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6324687B1 (en) * 1998-12-03 2001-11-27 International Business Machines Corporation Method and apparatus to selectively control processing of a method in a java virtual machine
JP3470948B2 (en) * 1999-01-28 2003-11-25 インターナショナル・ビジネス・マシーンズ・コーポレーション Dynamic compilation timing determination method, bytecode execution mode selection method, and computer
JP2003022194A (en) * 2001-07-09 2003-01-24 Japan Science & Technology Corp Queue virtual machine system
JP4234976B2 (en) * 2001-10-31 2009-03-04 株式会社アプリックス Intermediate code execution system
JP3642772B2 (en) * 2002-09-25 2005-04-27 三菱電機株式会社 Computer apparatus and program execution method
JP4093484B2 (en) * 2004-01-28 2008-06-04 インターナショナル・ビジネス・マシーンズ・コーポレーション Compiler, compilation method, compilation program, and recording medium
JP2005284729A (en) * 2004-03-30 2005-10-13 Fujitsu Ltd Virtual machine compiling byte code into native code

Also Published As

Publication number Publication date
JP2007141153A (en) 2007-06-07

Similar Documents

Publication Publication Date Title
US8970607B2 (en) Run-time allocation of functions to a hardware accelerator
US7739530B2 (en) Method and program for generating execution code for performing parallel processing
US9361078B2 (en) Compiler method of exploiting data value locality for computation reuse
US20160334854A1 (en) Scheduling method, system design support method, and system
US7330962B2 (en) Dynamic instruction sequence selection during scheduling
US9250848B2 (en) Dynamically adjusting the complexity of worker tasks in a multi-threaded application
KR101845328B1 (en) Terminal and method for performing application thereof
EP2963547A1 (en) Compiling device, compiling method, and storage medium storing compiler program
JP5042487B2 (en) Computer operating method, program, computer
US20110161935A1 (en) Method for managing hardware resources within a simultaneous multi-threaded processing system
AU2013260722A1 (en) Scheduling interpreting and rasterising tasks in a multi-threaded RIP
US7739672B2 (en) Information processor, information processing method, and programs therefor
US20150089149A1 (en) Arithmetic processing device and control method for arithmetic processing device
JP2007334497A (en) Power saving method, program, and program execution system of information processor
JP2004118367A (en) Computer device and program execution method
Borin et al. Lar-cc: Large atomic regions with conditional commits
KR101126177B1 (en) Method and Apparatus for dynamic scheduling based on usage history, and Recording medium thereof
US9286196B1 (en) Program execution optimization using uniform variable identification
US8549508B2 (en) Mechanism for performing instruction scheduling based on register pressure sensitivity
US11144428B2 (en) Efficient calculation of performance data for a computer
Chuang et al. Dynamic profile driven code version selection
TWI512458B (en) Performance analysis of software executing in different sessions
US20130007763A1 (en) Generating method, scheduling method, computer product, generating apparatus, and information processing apparatus
US11853193B2 (en) Inverse performance driven program analysis
Li et al. Energy minimization on thread-level speculation in multicore systems

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20080701

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20100727

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110607

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110726

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20120321

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120420

A911 Transfer to examiner for re-examination before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20120521

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120605

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120615

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: 20120703

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: 20120711

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20150720

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees