JP2003202995A - Intermediate code preprocessing apparatus, intermediate code execution system, intermediate code preprocessing program and intermediate code execution program - Google Patents

Intermediate code preprocessing apparatus, intermediate code execution system, intermediate code preprocessing program and intermediate code execution program

Info

Publication number
JP2003202995A
JP2003202995A JP2002314986A JP2002314986A JP2003202995A JP 2003202995 A JP2003202995 A JP 2003202995A JP 2002314986 A JP2002314986 A JP 2002314986A JP 2002314986 A JP2002314986 A JP 2002314986A JP 2003202995 A JP2003202995 A JP 2003202995A
Authority
JP
Japan
Prior art keywords
intermediate code
instruction
executing
preprocessing
subsystem
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.)
Granted
Application number
JP2002314986A
Other languages
Japanese (ja)
Other versions
JP4234976B2 (en
Inventor
Tetsuyuki Kobayashi
哲之 小林
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.)
Aplix Corp
Original Assignee
Aplix Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Aplix Corp filed Critical Aplix Corp
Priority to JP2002314986A priority Critical patent/JP4234976B2/en
Publication of JP2003202995A publication Critical patent/JP2003202995A/en
Application granted granted Critical
Publication of JP4234976B2 publication Critical patent/JP4234976B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Abstract

<P>PROBLEM TO BE SOLVED: To provide an intermediate code execution system, etc., for fast processing an intermediate code. <P>SOLUTION: This intermediate code execution system has a first subsystem 308 having a first interpreter 309 which corresponds to an instruction set generated during compilation and sequentially interprets and executes instructions included in an intermediate code, a second subsystem 310 having a preprocessing section 311 which applies to the intermediate code preprocessing to substitute an instruction pattern consisting of a plurality of instructions of with an alternative instruction, and a second interpreter 312 which corresponds to an instruction set including the alternative instruction and sequentially interprets and executes an instruction code included in the preprocessed intermediate code, and a method analysis section 308 which selects either processing to execute the intermediate code by the first interpreter or processing to apply preprocessing to the intermediate code by the preprocessing section and then executes the intermediate code by the second interpreter 312. <P>COPYRIGHT: (C)2003,JPO

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】本発明は、中間コードに前処
理を施す中間コード前処理装置、中間コードを実行する
中間コード実行システム、および、これらのコンピュー
タプログラムに関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an intermediate code preprocessing device for preprocessing intermediate code, an intermediate code execution system for executing intermediate code, and computer programs thereof.

【0002】[0002]

【従来の技術】ハードウェアやOSといった、コンピュ
ータのプラットフォームに依存しないプログラムを提供
することを目的として、各プラットフォーム上にソフト
ウェア的な手法またはハードウェア的な手法により仮想
機械(VM; Virtual Machine)を構築し、この仮想機
械上でソースコードとオブジェクトコードとの間の中間
的なコード(以下、中間コードという)を実行する方法
が提案されている。このような方法を採用したプログラ
ム言語の一つとしては、クラスファイルと呼ばれる中間
コードの形式を採用したJava(R)が挙げられる。
なお、以下ではハードウェアと当該ハードウェア上に構
築された仮想機械とを一体的に、中間コード実行システ
ムと呼称する場合がある。
2. Description of the Related Art For the purpose of providing a program that does not depend on a computer platform such as hardware or OS, a virtual machine (VM) is created on each platform by a software method or a hardware method. A method of constructing and executing intermediate code between source code and object code (hereinafter referred to as intermediate code) on this virtual machine has been proposed. As one of the programming languages adopting such a method, there is Java (R) which adopts an intermediate code format called a class file.
In the following, the hardware and the virtual machine constructed on the hardware may be collectively referred to as an intermediate code execution system.

【0003】上記の方法によれば、単一のプログラムコ
ードを種々のプラットフォームに供給して実行すること
が可能となるため、個々のプラットフォームでしか実行
できないオブジェクトコードを準備する必要がなくな
る。これにより、プログラムの配信を簡潔化することが
できるばかりでなく、ソフトウェア開発を効率化するこ
とも可能である。このため、種々のコンピュータのプラ
ットフォームにおいて仮想機械を構築することが行われ
ている。さらに、近時ではプロセッサを搭載した種々の
電子機器(以下、組込み機器という)においても、プロ
セッサ上に仮想計算機を構築することが行われはじめて
いる。
According to the above method, since a single program code can be supplied to various platforms and executed, it is not necessary to prepare an object code that can be executed only on each platform. As a result, not only can the distribution of the program be simplified, but also the software development can be made efficient. Therefore, virtual machines are being constructed on various computer platforms. Furthermore, recently, in various electronic devices (hereinafter referred to as embedded devices) equipped with a processor, a virtual computer is starting to be built on the processor.

【0004】ここで、仮想計算機としては、プラットフ
ォーム上にソフトウェア的に構築され、クラスファイル
に含まれるバイトコード命令を逐次的に解釈して実行す
るインタープリター方式のものが知られている。
Here, as a virtual computer, an interpreter system is known which is constructed on a platform by software and sequentially interprets and executes bytecode instructions contained in a class file.

【0005】しかしながら、インタープリター方式の仮
想計算機は、クラスファイルから一つ一つバイトコード
命令を取り出してはその内容を解釈するというプロセス
が必要であり、このプロセスがシステムのオーバーヘッ
ドとなる場合がある。このようなオーバーヘッドを軽減
してパフォーマンスを向上するために、クラスファイル
を各ハードウェアに固有のネイティブコードにコンパイ
ルしてから実行するJITコンパイラ(Just In Time C
ompiler)方式や、AOTコンパイラ(Ahead Of Time C
ompiler)方式等が提案されている。さらに、バイトコ
ード命令を直接実行することができるように特別に設計
されたJava(R)チップのように、仮想計算機をハ
ードウェア的に構築することも試みられている。
However, the interpreter type virtual machine requires a process of extracting each bytecode instruction from the class file and interpreting its contents, and this process may become an overhead of the system. . To reduce such overhead and improve performance, a JIT compiler (Just In Time C) that compiles class files into native code specific to each hardware and then executes them.
ompiler) method and AOT compiler (Ahead Of Time C)
ompiler) method has been proposed. Further, it has been attempted to construct a virtual machine in hardware, such as a Java (R) chip specially designed to directly execute bytecode instructions.

【0006】上記のJITやAOT等のコンパイラ方式
ではプロセッサのネイティブコードを実行することにな
るので、命令実行の速度だけを見ればインタープリター
方式よりも優れている。しかしながら、コンパイラ方式
では、コンパイルの作業自体に必要なワークメモリや、
クラスファイルに比べてサイズが4〜10倍と大きいネ
イティブコードを保存する領域も必要となるため、イン
タープリター方式よりも大量のメモリが必要となるとい
う問題がある。
Since the compiler system such as JIT or AOT described above executes the native code of the processor, it is superior to the interpreter system only in terms of instruction execution speed. However, in the compiler method, the work memory necessary for the compilation work itself,
There is a problem in that a larger amount of memory is required than in the interpreter method because an area for storing a native code that is 4 to 10 times larger than the class file is required.

【0007】このような問題は、特に通常のコンピュー
タよりもハードウェア資源の制約が厳しい組み込み機器
において顕著となる。また、クラスファイルの実行を指
示してからコンパイルを開始する場合には、コンパイル
の作業がオーバーヘッドとなって十分なパフォーマンス
が得られないという可能性もある。
[0007] Such a problem becomes remarkable especially in an embedded device in which hardware resources are more restricted than in an ordinary computer. In addition, when starting the compilation after instructing the execution of the class file, there is a possibility that the compilation work becomes an overhead and sufficient performance cannot be obtained.

【0008】また、上記のJava(R)チップによれ
ば、コンパイルすることもなく高パフォーマンスでクラ
スファイルを実行することが可能であるが、このような
専用チップの開発には高額の開発費を要し、チップ自体
の高コスト化を免れることはできない。また、技術の進
歩や市場のニーズに応じた言語仕様のバージョンアップ
や修正が適宜行われることを鑑みると、仮想機械をハー
ドウェア的に構成することは必ずしも好適ではないとい
う一面もある。特に、組み込み機器における仮想機械に
は、低コスト化に対する強い要請と短サイクルで仕様が
バージョンアップされることとが相俟って、Java
(R)チップの採用は現実的ではない。
According to the above Java (R) chip, it is possible to execute a class file with high performance without compiling. However, a large amount of development cost is required for developing such a dedicated chip. That is, the cost of the chip itself cannot be avoided. Further, in view of the fact that the version of the language specification is appropriately upgraded or modified according to technological progress and market needs, it is not always preferable to configure the virtual machine as hardware. In particular, for virtual machines in embedded devices, due to the strong demand for cost reduction and the specification upgrade in a short cycle, Java
The adoption of (R) chips is not practical.

【0009】以上説明したように、コンパイラ方式やJ
ava(R)チップ等の技術は、コストおよび要求ハー
ドウェア資源等の点で問題があり、特に、これらの制限
が厳しい組み込み機器に適用することは難しい。このた
め、組み込み機器に適用することを視野に入れて、別の
方法により仮想機械ないし中間コード実行システムのパ
フォーマンスを向上することが望まれている。
As described above, the compiler method and J
The technology of the ava (R) chip and the like has problems in terms of cost, required hardware resources, etc., and it is particularly difficult to apply them to embedded devices with severe restrictions. Therefore, it is desired to improve the performance of the virtual machine or the intermediate code execution system by another method in view of the application to the embedded device.

【0010】[0010]

【発明が解決しようとする課題】本発明は、上記事情に
鑑みてなされたものであって、前処理を施すことにより
中間コード実行時のパフォーマンスを向上することがで
きる中間コード前処理装置、かかる前処理が組み込まれ
た中間コード実行システム、および、これらのプログラ
ムを提供することを目的とする。
SUMMARY OF THE INVENTION The present invention has been made in view of the above circumstances, and an intermediate code preprocessing device capable of improving the performance during execution of intermediate code by performing preprocessing. It is an object of the present invention to provide an intermediate code execution system incorporating preprocessing and these programs.

【0011】[0011]

【課題を解決するための手段】上記課題を解決するため
に、本発明の第1の観点では、所定のプログラム言語で
作成されたソースコードをコンパイルして得られた中間
コードに前処理を施す中間コード前処理装置において、
前記中間コードを格納する記憶手段と、前記記憶手段に
格納された中間コードに含まれる複数の命令からなる特
定の命令パターンを、予め前記特定の命令パターンと関
連付けられた代替命令に置換する処理手段とを具備する
ことを特徴とする中間コード前処理装置が提供される。
In order to solve the above problems, according to a first aspect of the present invention, an intermediate code obtained by compiling a source code created in a predetermined programming language is preprocessed. In the intermediate code preprocessor,
A storage unit that stores the intermediate code, and a processing unit that replaces a specific instruction pattern including a plurality of instructions included in the intermediate code stored in the storage unit with an alternative instruction that is associated with the specific instruction pattern in advance. An intermediate code preprocessor is provided which comprises:

【0012】本発明の第8の観点では、所定のプログラ
ム言語で作成されたソースコードをコンパイルして得ら
れた中間コードに前処理を施す中間コード前処理プログ
ラムであって、処理手段に、前記中間コードに含まれる
特定の命令パターンを、予め前記特定の命令パターンと
関連付けられた代替命令に置換する処理を実行させるこ
とを特徴とする中間コード前処理プログラムが提供され
る。
According to an eighth aspect of the present invention, there is provided an intermediate code preprocessing program for preprocessing an intermediate code obtained by compiling a source code created in a predetermined programming language, wherein the processing means includes: There is provided an intermediate code preprocessing program characterized by executing a process of replacing a specific instruction pattern included in the intermediate code with an alternative instruction previously associated with the specific instruction pattern.

【0013】上記本発明の第1,第2の観点によれば、
中間コードに含まれる複数の命令からなる特定の命令パ
ターンを、その命令パターンと予め関連付けられた代替
命令に置換するので、中間コードの実行時に処理すべき
命令の個数を少なくすることができ、かつ、特定の命令
パターンにおける命令間の冗長な処理を省くことができ
るから、このような前処理を施すことで中間コード実行
時のパフォーマンスを向上することができる。しかも、
この前処理では中間コードのサイズが大きくなることは
なく、かつ、かかる前処理自体は単純な置換処理にすぎ
ないので低オーバーヘッドで実行可能である。
According to the first and second aspects of the present invention,
Since a specific instruction pattern composed of a plurality of instructions included in the intermediate code is replaced with an alternative instruction that is associated with the instruction pattern in advance, it is possible to reduce the number of instructions to be processed when executing the intermediate code, and Since it is possible to omit redundant processing between instructions in a specific instruction pattern, it is possible to improve performance during execution of intermediate code by performing such preprocessing. Moreover,
In this preprocessing, the size of the intermediate code does not increase, and the preprocessing itself is a simple replacement process, so that it can be executed with low overhead.

【0014】本発明の第3の観点では、所定のプログラ
ム言語で作成されたソースコードをコンパイルして得ら
れた中間コードを実行する中間コード実行システムであ
って、前記中間コードを格納する記憶手段と、処理手段
とを具備し、前記処理手段が、a)前記記憶手段に格納
された中間コードに含まれる複数の命令からなる特定の
命令パターンを、予め前記特定の命令パターンと関連付
けられた代替命令に置換する処理と、b)前記特定の命
令パターンが前記代替命令に置換された中間コードを逐
次的に解釈して実行するにあたり、前記代替命令を前記
特定の命令パターンと実質的に同等の処理に解釈して実
行する処理とを実行することを特徴とする中間コード実
行システムが提供される。
According to a third aspect of the present invention, there is provided an intermediate code execution system for executing an intermediate code obtained by compiling a source code created in a predetermined programming language, and storing means for storing the intermediate code. And a processing unit, wherein the processing unit a) substitutes a specific command pattern composed of a plurality of commands included in the intermediate code stored in the storage unit in advance with the specific command pattern. A process of substituting with an instruction, and b) in sequentially interpreting and executing the intermediate code in which the specific instruction pattern is replaced with the alternative instruction, the alternative instruction is substantially equivalent to the specific instruction pattern. There is provided an intermediate code execution system characterized by executing a process that is interpreted and executed.

【0015】本発明の第4の観点では、所定のプログラ
ム言語で作成されたソースコードをコンパイルして得ら
れた中間コードを実行する中間コード実行プログラムで
あって、処理手段に、a)中間コードに含まれる複数の
命令からなる特定の命令パターンを、予め前記特定の命
令パターンと関連付けられた代替命令に置換する処理
と、b)前記特定の命令パターンが前記代替命令に置換
された中間コードを解釈して実行するにあたり、前記代
替命令を前記特定の命令パターンと実質的に同等の処理
に解釈して実行する処理とを実行させることを特徴とす
る中間コード実行プログラムが提供される。
According to a fourth aspect of the present invention, an intermediate code execution program for executing an intermediate code obtained by compiling a source code created in a predetermined programming language, wherein the processing means includes: a) intermediate code A process of replacing a specific instruction pattern composed of a plurality of instructions included in the above with an alternative instruction previously associated with the specific instruction pattern; and b) an intermediate code in which the specific instruction pattern is replaced with the alternative instruction. In interpreting and executing, an intermediate code execution program is provided, which executes a process of interpreting and executing the alternative command into a process substantially equivalent to the specific command pattern.

【0016】上記本発明の第3,第4の観点によれば、
中間コードに含まれる複数の命令からなる特定の命令パ
ターンを代替命令に置換する前処理を行い、代替命令を
置換前の命令パターンと実質的に同等の処理に解釈しな
がら、前処理を施した中間コードを逐次的に解釈して実
行するので、中間コードの命令数を削減しつつ、特定の
命令パターンにおける命令間の冗長な処理を省略しなが
ら中間コードを実行することができ、これにより中間コ
ード実行時のパフォーマンスを向上することができる。
According to the third and fourth aspects of the present invention,
Preprocessing is performed by replacing a specific instruction pattern consisting of multiple instructions included in the intermediate code with an alternative instruction, and the preprocessing is performed while interpreting the alternative instruction as a process substantially equivalent to the instruction pattern before replacement. Since the intermediate code is sequentially interpreted and executed, the intermediate code can be executed while reducing the number of instructions of the intermediate code and omitting redundant processing between instructions in a specific instruction pattern. You can improve performance when code is executed.

【0017】本発明の第5の観点では、所定のプログラ
ム言語で作成されたソースコードをコンパイルして得ら
れた中間コードを実行する中間コード実行システムにお
いて、前記中間コードを実行する複数の中間コード実行
手段と、前記中間コードを記憶すると共に、当該中間コ
ードに含まれる命令と当該命令の効率的実行に適切な前
記中間コード実行手段との対応関係を記憶した記憶手段
と、中間コード解析手段とを具備し、前記中間コード解
析手段が、a)前記記憶手段に格納された中間コードに
含まれる命令を特定する処理と、b)特定された命令と
前記対応関係とに基づいて、前記中間コードの効率的実
行に適切な中間コード実行手段を特定する処理と、c)
前記中間コードと特定された中間コード実行手段との関
係を記録する処理とを実行することを特徴とする中間コ
ード実行システムが提供される。
According to a fifth aspect of the present invention, in an intermediate code execution system for executing an intermediate code obtained by compiling a source code created in a predetermined programming language, a plurality of intermediate codes executing the intermediate code. An executing unit, a storing unit that stores the intermediate code, stores a correspondence relationship between an instruction included in the intermediate code and the intermediate code executing unit suitable for efficient execution of the instruction, and an intermediate code analyzing unit. The intermediate code analyzing unit includes: a) a process of specifying an instruction included in the intermediate code stored in the storage unit; and b) the intermediate code based on the specified command and the correspondence relationship. A process for identifying an intermediate code execution means suitable for efficient execution of
An intermediate code execution system is provided, which executes a process of recording a relationship between the intermediate code and the specified intermediate code execution means.

【0016】本発明の第5の観点によれば、中間コード
実行システムに複数の中間コード実行手段を設け、中間
コードに含まれる命令とその効率的実行に適切な前記中
間コード実行手段との対応関係を記憶手段に記憶してお
き、中間コード解析手段により中間コードを解析し、記
憶手段に記憶してある対応関係に基づいて、当該中間コ
ードの効率的実行に適切な中間コード実行手段を特定し
て記録するので、中間コード実行システムは個々の中間
コードに対して最適な中間コード実行手段を識別できる
ようになる。したがって、実行する中間コードに適した
中間コード実行手段を用いて中間コードを実行すること
が可能となり、これにより複数設けられた中間コード実
行手段のそれぞれを活用して、中間コード実行時のパフ
ォーマンスを向上することができる。
According to a fifth aspect of the present invention, the intermediate code execution system is provided with a plurality of intermediate code execution means, and the instructions included in the intermediate code correspond to the intermediate code execution means suitable for efficient execution thereof. The relationship is stored in the storage means, the intermediate code analysis means analyzes the intermediate code, and the intermediate code execution means suitable for efficient execution of the intermediate code is specified based on the correspondence relationship stored in the storage means. The intermediate code execution system can identify the optimum intermediate code execution means for each intermediate code. Therefore, it becomes possible to execute the intermediate code by using the intermediate code executing means suitable for the intermediate code to be executed, and by utilizing each of the plurality of intermediate code executing means, the performance at the time of executing the intermediate code can be improved. Can be improved.

【0017】本発明の第5の観点においては、前記記憶
手段における命令と当該命令の効率的実行に適切な中間
コード実行手段との対応関係は、各命令を前記中間コー
ド実行手段のそれぞれで実行した場合の処理効率度のス
コアテーブルを含み、前記b)の処理は、b1)前記ス
コアテーブルに基づいて、特定された命令を前記中間コ
ード実行手段のそれぞれで実行した場合の処理効率度の
スコアを取得する処理と、b2)取得されたスコアを中
間コード実行手段ごとに合計する処理と、b3)中間コ
ード実行手段ごとに合計されたスコアに基づいて、前記
中間コードの実行に用いる前記中間コード実行手段を特
定する処理とを含む構成とすることができる。
In a fifth aspect of the present invention, the correspondence between the instruction in the storage means and the intermediate code execution means suitable for efficient execution of the instruction is such that each instruction is executed by each of the intermediate code execution means. And a processing efficiency score table, and b) the processing efficiency score when the specified instruction is executed by each of the intermediate code executing means based on the score table. And b3) a process of summing the acquired scores for each intermediate code execution unit, and b3) a process of summing the acquired scores for each intermediate code execution unit. It may be configured to include a process of specifying an executing unit.

【0018】また、前記記憶手段における命令と当該命
令の効率的実行に適切な中間コード実行手段との対応関
係は、各命令に割り当てられたポイントの値と、前記中
間コード実行手段のそれぞれに対応した前記ポイントの
合計値の範囲とを含み、前記b)の処理は、b1)前記
対応関係に基づいて、特定された命令のポイントを取得
する処理と、b2)取得されたポイントの合計値を求め
る処理と、b3)前記対応関係および求められた合計値
に基づいて、前記中間コードの実行に用いる前記中間コ
ード実行手段を特定する処理とを含む構成としてもよ
い。
The correspondence between the instruction in the storage means and the intermediate code executing means suitable for efficient execution of the instruction corresponds to the value of the point assigned to each instruction and the intermediate code executing means. And the range of the total value of the points, the process of b) includes b1) a process of acquiring the point of the specified instruction based on the correspondence, and b2) a total value of the acquired points. It may be configured to include a process for obtaining and b3) a process for identifying the intermediate code executing means used for executing the intermediate code based on the correspondence relationship and the obtained total value.

【0019】本発明の第6の観点では、所定のプログラ
ム言語で作成されたソースコードをコンパイルして得ら
れた中間コードを実行する中間コード実行システムにお
いて、全ての命令を実行可能な一般中間コード実行手段
と、一部の命令のみを実行可能な特殊中間コード実行手
段と、中間コードが格納された記憶手段と、中間コード
解析手段とを具備し、前記中間コード解析手段が、a)
前記記憶手段に格納された中間コードを解析し、前記中
間コードに含まれる命令に前記特殊中間コード実行手段
が実行不能な命令が含まれないかを判定する処理と、
b)前記実行不能な命令が含まれないと判定したときに
は、前記中間コードを前記特殊中間コード実行手段で実
行すべきことを記録し、前記実行不能な命令が含まれる
と判定したときには、前記中間コードを前記一般中間コ
ード実行手段で実行すべきことを記録する処理とを実行
することを特徴とする中間コード実行システムが提供さ
れる。
According to a sixth aspect of the present invention, a general intermediate code capable of executing all instructions in an intermediate code execution system for executing an intermediate code obtained by compiling a source code created in a predetermined programming language. The intermediate code analyzing means comprises an executing means, a special intermediate code executing means capable of executing only a part of instructions, a storing means in which the intermediate code is stored, and an intermediate code analyzing means.
A process of analyzing the intermediate code stored in the storage means, and determining whether the instruction included in the intermediate code includes an instruction that the special intermediate code execution means cannot execute;
b) When it is determined that the unexecutable instruction is not included, it is recorded that the intermediate code is to be executed by the special intermediate code executing means, and when it is determined that the unexecutable instruction is included, the intermediate There is provided an intermediate code execution system characterized by executing processing for recording that code should be executed by the general intermediate code execution means.

【0020】本発明の第6の観点によれば、全ての命令
を実行可能な一般中間コード実行手段と、一部の命令の
みを実行可能な特殊中間コード実行手段とを備えた中間
コード実行システムにおいて、実行する中間コードに特
殊中間コード実行手段で実行可能な命令が含まれている
か否かに応じて、一般中間コード実行手段と特殊中間コ
ード実行手段とのいずれで実行すべきかが記録される。
したがって、一部の命令のみに特化した特殊中間コード
実行手段の追加された中間コード実行システムにおい
て、一般中間コード実行手段と特殊中間コード実行手段
とを使い分けることが可能となり、これにより中間コー
ド実行時のパフォーマンスを向上することができる。
According to a sixth aspect of the present invention, an intermediate code execution system comprising general intermediate code execution means capable of executing all instructions and special intermediate code execution means capable of executing only some instructions. In, whether the general intermediate code executing means or the special intermediate code executing means should execute is recorded depending on whether or not the intermediate code to be executed includes an instruction executable by the special intermediate code executing means. .
Therefore, in the intermediate code execution system to which the special intermediate code execution means specialized only for some instructions is added, it becomes possible to use the general intermediate code execution means and the special intermediate code execution means properly. Time performance can be improved.

【0021】本発明の第7の観点では、所定のプログラ
ム言語で作成されたソースコードをコンパイルして得ら
れた中間コードをインタープリタ方式で実行する中間コ
ード実行システムにおいて、中間コードが格納された記
憶手段と、前記記憶手段に格納された中間コードに、当
該中間コードに含まれる特定の命令パターンを、予め前
記特定の命令パターンと関連付けられた代替命令に置換
する処理を施す前処理手段と、前記代替命令を解釈して
実行することができない第1のインタープリタと、前記
代替命令を置換前の命令パターンと同等の内容に解釈し
て実行することができる第2のインタープリタと、前記
前処理手段により処理された中間コードを解析し、当該
中間コードに前記代替命令が含まれているか否かを判定
し、前記代替命令が含まれている場合には当該中間コー
ドを前記第1のインタープリタで実行すべきことを記録
し、前記代替命令が含まれていない場合には当該中間コ
ードを前記第2のインタープリタで実行すべきことを記
録する中間コード解析手段とを具備することを特徴とす
る中間コード実行システムが提供される。
According to a seventh aspect of the present invention, in an intermediate code execution system for executing an intermediate code obtained by compiling a source code created in a predetermined programming language by an interpreter system, a memory storing the intermediate code. A preprocessing means for performing, on the intermediate code stored in the storage means, a process of replacing a specific instruction pattern included in the intermediate code with an alternative instruction previously associated with the specific instruction pattern; A first interpreter that cannot interpret and execute the alternative instruction; a second interpreter that can interpret and execute the alternative instruction with a content equivalent to the instruction pattern before replacement; and the preprocessing means. The processed intermediate code is analyzed to determine whether or not the intermediate code includes the alternative instruction, and the alternative instruction If included, record that the intermediate code should be executed by the first interpreter, and if the alternative instruction is not included, execute the intermediate code by the second interpreter. An intermediate code execution system is provided, which comprises:

【0022】本発明の第7の観点によれば、特定の命令
パターンを代替命令に置換する前処理を行う前処理手段
と、代替命令に対応した第1のインタープリタと、代替
命令に対応していない第2のインタープリタと、中間コ
ード解析手段とを備えた構成において、中間コード解析
手段によって前処理後の中間コードを解析し、前処理で
特定の命令パターンが代替命令に置換された中間コード
については第1のインタープリタで実行すべきことを記
録し、前処理を施しても置換が行われなかった中間コー
ドについては第2のインタープリタで実行すべきことを
記録する。したがって、前処理手段と、第1のインター
プリタと、第2のインタープリタとを備えた構成を有効
に活用して中間コードを高いパフォーマンスで実行する
ことができる。
According to a seventh aspect of the present invention, a preprocessing means for performing preprocessing for replacing a specific instruction pattern with an alternative instruction, a first interpreter corresponding to the alternative instruction, and an alternative instruction are provided. An intermediate code in which the intermediate code after the preprocessing is analyzed by the intermediate code analysis means and the specific instruction pattern is replaced by the alternative instruction in the preprocessing in the configuration including the second interpreter which does not exist and the intermediate code analysis means Records what should be executed by the first interpreter, and records what should be executed by the second interpreter for the intermediate code that has not been replaced even if preprocessing is performed. Therefore, the intermediate code can be executed with high performance by effectively utilizing the configuration including the preprocessing unit, the first interpreter, and the second interpreter.

【0023】本発明の第8の観点では、所定のプログラ
ム言語で作成されたソースコードをコンパイルして得ら
れた中間コードをインタープリタ方式で実行する中間コ
ード実行システムにおいて、コンパイルにより生成され
る命令の全てを解釈して実行することができる第1のイ
ンタープリタを有する第1のサブシステムと、中間コー
ドに含まれる複数の命令からなる命令パターンを代替命
令に置換する前処理を施す前処理部と、当該代替命令を
置換前の命令コードと実質的に同等の内容に解釈して実
行することができる第2のインタープリタと、を有する
第2のサブシステムと、実行する中間コードに応じて、
前記第1のサブシステムにおいて前記第1のインタープ
リタにより中間コードを実行する処理と、前記第2のサ
ブシステムにおいて前記前処理部により中間コードに前
処理を施してから前記第2のインタープリタで実行する
処理とのいずれか一方を選択する選択部とを具備するこ
とを特徴とする中間コード実行システムが提供される。
According to an eighth aspect of the present invention, in an intermediate code execution system for executing an intermediate code obtained by compiling a source code created in a predetermined programming language by an interpreter method, the instructions generated by the compilation are A first subsystem having a first interpreter capable of interpreting and executing everything; a pre-processing unit for performing pre-processing for replacing an instruction pattern consisting of a plurality of instructions included in an intermediate code with an alternative instruction; A second subsystem having a second interpreter capable of interpreting and executing the alternative instruction with substantially the same content as the instruction code before replacement, and, depending on the intermediate code to be executed,
A process of executing the intermediate code by the first interpreter in the first subsystem, and a process of preprocessing the intermediate code by the preprocessing unit in the second subsystem and then executing the process by the second interpreter. An intermediate code execution system is provided, comprising: a selection unit that selects either one of processing and processing.

【0024】本発明の第8の観点によれば、通常のイン
タープリタを有する第1のサブシステムと、特定の命令
パターンを代替命令に置換する前処理手段および当該前
処理手段によって前処理の施された中間コードの実行に
特化した第2のインタープリタを有する第2のサブシス
テムとを、実行する中間コードに応じて使い分けること
により、中間コード実行時のパフォーマンスを向上する
ことができる。
According to an eighth aspect of the present invention, a first subsystem having a normal interpreter, preprocessing means for replacing a specific instruction pattern with an alternative instruction, and preprocessing by the preprocessing means. The performance at the time of executing the intermediate code can be improved by properly using the second subsystem having the second interpreter specialized for executing the intermediate code according to the intermediate code to be executed.

【0025】本発明の第8の観点においては、前記第2
のサブシステムは、前記第1のサブシステムにおいて特
定の命令が割り付けられているオペコードに代替命令を
割り付けており、前記選択部は、実行する中間コードに
前記特定の命令が含まれている場合には前記第1のサブ
システムによる処理を選択し、実行する中間コードに前
記特定の命令が含まれていない場合には前記第2のサブ
システムによる処理を選択する構成とすることができ
る。
According to an eighth aspect of the present invention, the second
The subsystem assigns an alternative instruction to the operation code to which the specific instruction is assigned in the first subsystem, and the selection unit determines whether the intermediate code to be executed includes the specific instruction. May select a process by the first subsystem, and select a process by the second subsystem when the intermediate code to be executed does not include the specific instruction.

【0026】本発明の第9の観点では、所定のプログラ
ム言語で作成されたソースコードをコンパイルして得ら
れた中間コードを実行する中間コード実行システムであ
って、中間コードに含まれる複数の命令からなる第1の
命令パターンを第1の代替命令に置換する前処理を施す
前処理部と、当該第1の代替命令を置換前の命令コード
と実質的に同等の内容に解釈して実行することができる
第1のインタープリタとを有する第1のサブシステム
と、中間コードに含まれる第2の命令パターンを第2の
代替命令に置換する前処理を施す前処理部と、当該第2
の代替命令を置換前の命令コードと実質的に同等の内容
に解釈して実行することができる第2のインタープリタ
とを有する第2のサブシステムと、実行する中間コード
に応じて、前記第1のサブシステムにおいて前記第1の
インタープリタにより中間コードを実行する処理と、前
記第2のサブシステムにおいて前記前処理部により中間
コードに前処理を施してから前記第2のインタープリタ
で実行する処理とのいずれか一方を選択する選択部とを
具備することを特徴とする中間コード実行システムが提
供される。
A ninth aspect of the present invention is an intermediate code execution system for executing an intermediate code obtained by compiling a source code created in a predetermined programming language, the plurality of instructions included in the intermediate code. And a pre-processing unit that performs pre-processing for replacing the first instruction pattern with the first alternative instruction, and interprets and executes the first alternative instruction with substantially the same content as the instruction code before replacement. A first subsystem having a first interpreter capable of performing the preprocessing, a preprocessing unit that performs a preprocessing for replacing a second instruction pattern included in the intermediate code with a second alternative instruction, and the second subsystem.
A second subsystem having a second interpreter capable of interpreting and executing the alternative instruction of the above-described instruction code with substantially the same content as the instruction code before replacement, and the first subsystem according to the intermediate code to be executed. In the subsystem of executing the intermediate code by the first interpreter, and in the second subsystem of preprocessing the intermediate code by the preprocessor, and then executing the second interpreter. An intermediate code execution system is provided, which comprises: a selection unit that selects either one.

【0027】本発明の第9の観点によれば、特定の命令
パターンを代替命令に置換する前処理手段および当該前
処理手段によって前処理の施された中間コードの実行に
特化したインタープリタを有するサブシステムを、互い
に異なる命令パターンおよび代替命令について2系統備
えた中間コード実行システムにおいて、2系統のサブシ
ステムを実行する中間コードに応じて使い分けることに
より、中間コード実行時のパフォーマンスを向上するこ
とができる、
According to a ninth aspect of the present invention, there is provided preprocessing means for replacing a specific instruction pattern with an alternative instruction and an interpreter specialized for executing intermediate code preprocessed by the preprocessing means. In an intermediate code execution system having two systems for different instruction patterns and alternative instructions, the subsystem can be used properly according to the intermediate code that executes the two subsystems, thereby improving the performance during execution of the intermediate code. it can,

【0028】本発明の第9の観点においては、前記第1
のサブシステムは前記第1の代替命令を第1のオペコー
ドに割り付けており、前記第2のサブシステムは前記第
2の代替命令を第2のオペコードに割り付けており、上
記選択部は、実行する中間コードが第1のオペコードに
係る命令を含んでいる場合には第2のサブシステムによ
る処理を選択し、実行する中間コードが第2のオペコー
ドに係る命令を含んでいる場合には第1のサブシステム
による処理を選択する構成とすることができる。
In a ninth aspect of the present invention, the first aspect
Subsystem assigns the first alternative instruction to a first opcode, the second subsystem assigns the second alternative instruction to a second opcode, and the selector executes When the intermediate code includes the instruction related to the first opcode, the process by the second subsystem is selected, and when the intermediate code to be executed includes the instruction related to the second opcode, the first code is selected. The processing by the subsystem can be selected.

【0029】尚、上記各観点において、「命令パター
ン」とは、所定の命令の一連の集合である。また、「代
替命令」とは、前記命令パターンに置換される命令をい
い、当該命令パターンよりも短いコードで表現され、代
替命令に対応した実行環境において実行される独自の命
令である。
In each of the above aspects, the "command pattern" is a series of predetermined commands. The “alternative instruction” means an instruction that is replaced with the instruction pattern, and is an original instruction that is expressed by a code shorter than the instruction pattern and that is executed in an execution environment corresponding to the alternative instruction.

【0030】[0030]

【発明の実施の形態】以下、図面を参照して本発明の実
施形態について説明する。 [第1実施形態]先ず、図1から4を参照して、本発明
の第1実施形態に係る中間コード前処理装置について詳
細に説明する。図1は、中間コードとしてJava
(R)のクラスファイルを前処理する第1実施形態に係
る中間コード前処理装置1のハードウェア的な構成を示
している。
BEST MODE FOR CARRYING OUT THE INVENTION Embodiments of the present invention will be described below with reference to the drawings. [First Embodiment] First, with reference to FIGS. 1 to 4, an intermediate code preprocessing device according to a first embodiment of the present invention will be described in detail. FIG. 1 shows Java as an intermediate code.
1 shows a hardware configuration of an intermediate code preprocessing device 1 according to a first embodiment for preprocessing a (R) class file.

【0031】この中間コード前処理装置1は、記憶部1
01、処理部102、および入力部103を備えてい
る。処理部102は、MPUやマイクロコントローラ等
の演算装置である。この処理部102は、1つに限られ
るものではなく、複数のMPUや複数種類の演算装置に
より分散処理を可能とした構成としてもよい。
The intermediate code preprocessing device 1 includes a storage unit 1
01, a processing unit 102, and an input unit 103. The processing unit 102 is an arithmetic unit such as an MPU or a microcontroller. The number of processing units 102 is not limited to one, and may be a configuration that enables distributed processing by a plurality of MPUs and a plurality of types of arithmetic devices.

【0032】入力部103は、この中間コード前処理装
置1にクラスファイル等を入力するものである。この入
力部103から入力されたクラスファイルは記憶部10
1に格納される。記憶部101は、例えばRAMやRO
M等のメモリからなる。ここでは、説明の便宜上、1つ
の記憶部101のみを記載しているが、複数の記憶部を
分散配置した構成としてもよい。
The input unit 103 inputs a class file or the like to the intermediate code preprocessing device 1. The class file input from the input unit 103 is stored in the storage unit 10.
It is stored in 1. The storage unit 101 is, for example, a RAM or RO.
It consists of a memory such as M. Here, for convenience of description, only one storage unit 101 is described, but a configuration in which a plurality of storage units are dispersedly arranged may be used.

【0033】上記記憶部101の所定の領域には、複数
の命令からなる命令パターン101aと代替命令101
bとが関連付けられたテーブルが格納されており、さら
にはクラスファイル101cが格納されている。ここで
命令パターン101aは、複数のバイトコード命令から
なるパターンのことである。
In a predetermined area of the storage unit 101, an instruction pattern 101a composed of a plurality of instructions and an alternative instruction 101
A table associated with b is stored, and a class file 101c is also stored. Here, the instruction pattern 101a is a pattern composed of a plurality of bytecode instructions.

【0034】以下、例えば整数同士の加算を行う場合を
例に挙げて説明する。この場合には、Java(R)の
クラスファイルに含まれるメソッドには、例えばFI
G.3に示されるように、「iload」、「iloa
d」、「iadd」という命令パターンが頻出すること
がある。そこで、第1実施形態に係る中間コード前処理
装置1では、このように頻出する命令パターンを、当該
命令パターンと同様の処理を行う代替命令、例えば「v
_v_iadd」と関連付けたテーブルを記憶部101
に格納する。ここで、「iload」は、ローカル変数
の値をオペランドスタックにプッシュする2バイトから
なる中間コードをニーモニック表記したものである。ま
た、「iadd」は、オペランドスタックから値を2つ
ポップし加算して、その結果をオペランドスタックにプ
ッシュする1バイトの中間コードをニーモニック表記し
たものである。
Hereinafter, a case where integers are added will be described as an example. In this case, the method included in the Java (R) class file may be, for example, FI.
G. As shown in 3, "iload", "iloa"
The command patterns "d" and "iadd" may frequently appear. Therefore, in the intermediate code preprocessing device 1 according to the first embodiment, such an instruction pattern that frequently appears is replaced with an alternative instruction such as “v
The table associated with “_v_iadd” is stored in the storage unit 101.
To store. Here, "iload" is a mnemonic notation of an intermediate code consisting of 2 bytes that pushes the value of the local variable onto the operand stack. “Iadd” is a mnemonic notation of a 1-byte intermediate code that pops two values from the operand stack, adds them, and pushes the result to the operand stack.

【0035】前記代替命令101bは、代替命令101
bを実行可能な環境下において、前記命令パターン10
1aと同様の処理に解釈される命令である。逆に言え
ば、本実施形態は、代替命令101bを置換前の命令パ
ターンと実質的に同等に解釈して実行することができる
中間コード実行システムの存在を前提としたものであ
る。そのような中間コード実行システムは、例えば上記
の場合、代替命令「v_v_iadd」を上記「ilo
ad」、「iload」、「iadd」という命令パタ
ーンと同様の処理に解釈して実行する。なお、かかる代
替命令の実行に際しては、メモリアクセスの頻発防止、
冗長な処理の省略、レジスタの活用等により、命令実行
にあたってのオーバーヘッド要因を最低減とすることが
望ましい。
The alternative instruction 101b is the alternative instruction 101.
In an environment where b can be executed, the instruction pattern 10
It is an instruction that is interpreted in the same processing as 1a. In other words, the present embodiment is premised on the existence of an intermediate code execution system capable of interpreting and executing the alternative instruction 101b substantially equivalent to the instruction pattern before replacement. Such an intermediate code execution system may, for example, in the above case, replace the alternative instruction “v_v_iadd” with the above “ilo”.
It is interpreted and executed in the same process as the command patterns "ad", "iload", and "iadd". When executing such alternative instructions, prevent frequent access to memory,
It is desirable to minimize the overhead factor in executing instructions by omitting redundant processing and utilizing registers.

【0036】また、代替命令101bは、前記命令パタ
ーン101aと比してコード長が短くなっている。例え
ば、前記代替命令「v_v_iadd」は3バイトのコ
ード長であり、置換前のコード長である5バイトよりも
短くなっている。
The code length of the alternative instruction 101b is shorter than that of the instruction pattern 101a. For example, the alternative instruction “v_v_iadd” has a code length of 3 bytes, which is shorter than the code length of 5 bytes before replacement.

【0037】したがって、このような前処理によれば、
クラスファイル101cのサイズを小さくすることも可
能である。
Therefore, according to such pre-processing,
It is also possible to reduce the size of the class file 101c.

【0038】なお、本実施形態は、主として請求項1ま
たは15に記載の発明に対応しており、前記記憶部等1
01は当該発明における記憶手段に相当し、前記処理部
102は処理手段に相当している。
The present embodiment mainly corresponds to the invention described in claim 1 or 15, and the storage unit etc. 1
01 corresponds to the storage means in the present invention, and the processing unit 102 corresponds to the processing means.

【0039】以上のような構成において、処理部102
により一連のソフトウェアプログラムを実行することに
より、中間コード前処理装置1の各機能が実現され、ク
ラスファイル101cに以下に述べるような前処理が施
される。
In the above configuration, the processing section 102
By executing a series of software programs, each function of the intermediate code preprocessing device 1 is realized, and the class file 101c is preprocessed as described below.

【0040】図2は、本実施形態における前処理の手順
を説明するためのフローチャートである。ここでは、予
め、入力部103からクラスファイル101cが中間コ
ード前処理装置1に入力され、記憶部101に格納され
ていることが前提となっている。この前提の下に、以下
の如き手順で処理を行う。
FIG. 2 is a flow chart for explaining the procedure of preprocessing in this embodiment. Here, it is assumed that the class file 101c is input to the intermediate code preprocessing device 1 from the input unit 103 in advance and stored in the storage unit 101. Under this premise, processing is performed by the following procedure.

【0041】即ち、先ず中間コード前処理を開始すると
(S101)、処理部102は記憶部101から互いに
関連付けられた命令パターン101aおよび代替命令1
01bのテーブルを読み出す(S102)。次いで、処
理部102は、クラスファイル101cを検索して命令
パターン101aを特定する(S103)。即ち、例え
ば、図3および図4に示すように、「iload」、
「iload」、「iadd」の一連の命令パターン1
01aをクラスファイル101cの中で特定する。こう
して命令パターンを特定すると、処理部102は、特定
したクラスファイル101c中の命令パターン101a
を、当該命令パターン101aに関連付けられた代替命
令101bに置換する(S104)。
That is, first, when the intermediate code preprocessing is started (S101), the processing section 102 causes the storage section 101 to associate the instruction pattern 101a and the alternative instruction 1 with each other.
The table of 01b is read (S102). Next, the processing unit 102 searches the class file 101c and specifies the instruction pattern 101a (S103). That is, for example, as shown in FIGS. 3 and 4, “iload”,
A series of instruction patterns 1 for "iload" and "iadd"
01a is specified in the class file 101c. When the instruction pattern is specified in this way, the processing unit 102 determines the instruction pattern 101a in the specified class file 101c.
Is replaced with the alternative instruction 101b associated with the instruction pattern 101a (S104).

【0042】図4は、S104における処理の一例を具
体的に説明するための図である。この例では、特定した
命令パターンに含まれる「iload 8」、「ilo
ad9」、「iadd」は、まず、「nop」、「no
p」、「v_v_iadd8,9」に変換される(第1
段階)。ここで、「nop」は、何も行わない命令であ
る。このように、「v_v_iadd 8,9」の前に
複数の「nop」を挿入したのは、変換されるクラスフ
ァイルのサイズを変更させず、クラスファイルに含まれ
る条件分岐の飛び先等を変更させないためである。この
第1段階の処理を施した後に、条件分岐の飛び先等を変
更しつつ「nop」を削除する処理を行う(第2段
階)。これにより、S104の処理は完了する。
FIG. 4 is a diagram for specifically explaining an example of the processing in S104. In this example, “iload 8”, “ilo 8” included in the specified instruction pattern
First, "ad9" and "iadd" are "nop" and "no".
p ”and“ v_v_iadd8,9 ”(first
Stage). Here, "nop" is an instruction that does nothing. In this way, inserting a plurality of "nops" before "v_v_iadd 8, 9" does not change the size of the converted class file and does not change the jump destination of the conditional branch included in the class file. This is because. After performing the process of the first step, the process of deleting "nop" is performed while changing the jump destination of the conditional branch and the like (second step). This completes the process of S104.

【0043】以上のようにして、中間コードの前処理は
終了する(S105)。
As described above, the preprocessing of the intermediate code is completed (S105).

【0044】この第1実施形態に係る中間コード前処理
装置によれば、前述した一連の処理により、実行される
コードの長さが「iload」、「iload」、「i
add」の合計5バイトコードから、「v_v_iad
d」の3バイトの1命令に短縮される。したがって、実
行すべき命令の個数を少なくして命令間の冗長な処理を
省することができるとともに、クラスファイルのサイズ
を低減することができる
According to the intermediate code preprocessing device of the first embodiment, the length of the code to be executed is "iload", "iload", "i" by the series of processes described above.
From the total 5 byte code of "add", "v_v_iad"
It is shortened to one instruction of 3 bytes "d". Therefore, the number of instructions to be executed can be reduced, redundant processing between instructions can be omitted, and the size of the class file can be reduced.

【0045】このようにして得られた中間コードは、
「v_v_iadd」のような代替命令101bに対応
した実行環境において、代替命令101bを置換前の命
令パターン101aと同等かつメモリアクセス等のオー
バーヘッド要因を最小とした処理に解釈して実行するこ
とにより、高速に実行することができる。また、以上の
ような中間コードの前処理は、単なるコードの置換であ
るため低オーバーヘッドで実行することができ、かつ、
ネイティブコードにコンパイルする場合のようにクラス
ファイルのサイズを増大させることもないので、中間コ
ード実行のパフォーマンスを有為に向上させることがで
きる。
The intermediate code thus obtained is
In the execution environment corresponding to the alternative instruction 101b such as “v_v_iadd”, by interpreting and executing the alternative instruction 101b as a processing that is equivalent to the instruction pattern 101a before replacement and minimizes an overhead factor such as memory access, high speed Can be run to. In addition, the preprocessing of the intermediate code as described above can be executed with low overhead because it is merely code replacement, and
Since the size of the class file is not increased unlike the case of compiling to native code, the performance of intermediate code execution can be significantly improved.

【0046】例えば、第1実施形態を携帯電話等の組込
み機器に適用する場合には、当該組み込み機器に上述の
代替命令101bを実行可能な実行環境を搭載し、中間
コード前処理装置1により前処理済みのクラスファイル
を当該組み込み機器にプリインストールまたは配信する
ようにしてもよい。このようにすることで、組み込み機
器上で実行されるJava(R)アプリケーションのパ
フォーマンスを向上することができる。
For example, when the first embodiment is applied to a built-in device such as a mobile phone, the built-in device is equipped with an execution environment capable of executing the above-mentioned alternative instruction 101b, and the intermediate code preprocessor 1 is used to perform The processed class file may be preinstalled or distributed to the embedded device. By doing so, the performance of the Java (R) application executed on the embedded device can be improved.

【0047】また、当該組み込み機器に上述した前処理
装置1および代替命令101bを実行可能な実行環境を
搭載し、携帯電話上でクラスファイルの前処理と、前処
理されたクラスファイルの実行との双方を行うようにし
てもよい。
Further, the built-in equipment is equipped with an execution environment capable of executing the above-mentioned preprocessing device 1 and the alternative instruction 101b, and performs preprocessing of the class file and execution of the preprocessed class file on the mobile phone. Both may be performed.

【0048】なお、第1実施形態では、命令パターン1
01aと代替命令101bとが関連付けられたテーブル
を記憶部101に格納することとしているが、このよう
なテーブルは前処理を行うためのソフトウェアプログラ
ムの中に埋め込んだ形態としてもよいし、前処理を行う
ためのソフトウェアプログラムから独立して設けても構
わない。
In the first embodiment, the instruction pattern 1
Although a table in which 01a and the alternative instruction 101b are associated is stored in the storage unit 101, such a table may be embedded in a software program for performing preprocessing, or preprocessing may be performed. It may be provided independently of the software program for performing it.

【0049】また、上述した前処理の手順において、S
104における処理は図4に示したものに限られない。
例えば、図4に示した第1段階の処理の後、第2段階の
処理を行わず、「nop」を削除しなくても構わない。
このような場合には、「nop」を含んだ中間コードを
そのまま実行環境において実行してもよいし、実行環境
にて「nop」の削除および条件分岐の飛び先変更等を
行いつつクラスファイルを実行してもよい。特に、後者
の場合には、実行環境がアイドル時間を利用する等して
上述の前処理を行うことが好適である。
In the above-mentioned pre-processing procedure, S
The processing in 104 is not limited to that shown in FIG.
For example, after the first stage process shown in FIG. 4, the second stage process may not be performed and “nop” may not be deleted.
In such a case, the intermediate code including “nop” may be executed as it is in the execution environment, or the class file may be deleted while deleting “nop” and changing the jump destination of the conditional branch in the execution environment. You may execute. Especially in the latter case, it is preferable to perform the above-mentioned preprocessing by utilizing the idle time in the execution environment.

【0050】[第2実施形態]次に、図5,6を参照し
て、本発明の第2実施形態に係る中間コード実行システ
ムについて詳細に説明する。図5は、中間コードとして
Java(R)のクラスファイルを実行する本発明の第
2実施形態に係る中間コード実行システム2のハードウ
ェア的な構成を示している。中間コード実行システム2
は、記憶部201、処理部202、および入力部203
を備えている。尚、これら記憶部201、処理部20
2、および入力部203は、第1実施形態に係る中間コ
ード前処理装置1の記憶部101、処理部102、およ
び入力部103と略同様である。また、記憶部201に
格納される、命令パターン201a、代替命令201b
およびクラスファイル201cは、第1実施形態に係る
中間コード前処理装置1の記憶部101に格納される、
命令パターン101a、代替命令101b、およびクラ
スファイル101cと略同様である。従って、ここで
は、これらについての重複した説明は省略する。
[Second Embodiment] Next, an intermediate code execution system according to a second embodiment of the present invention will be described in detail with reference to FIGS. FIG. 5 shows a hardware configuration of an intermediate code execution system 2 according to the second embodiment of the present invention that executes a Java (R) class file as intermediate code. Intermediate code execution system 2
Is a storage unit 201, a processing unit 202, and an input unit 203.
Is equipped with. Incidentally, these storage unit 201 and processing unit 20
2 and the input unit 203 are substantially the same as the storage unit 101, the processing unit 102, and the input unit 103 of the intermediate code preprocessing device 1 according to the first embodiment. Further, the instruction pattern 201a and the alternative instruction 201b stored in the storage unit 201.
The class file 201c is stored in the storage unit 101 of the intermediate code preprocessing device 1 according to the first embodiment.
It is substantially the same as the instruction pattern 101a, the alternative instruction 101b, and the class file 101c. Therefore, duplicated description thereof will be omitted here.

【0051】なお、本実施形態は、主として請求項3ま
たは17に記載の発明に対応しており、前記記憶部等2
01は当該発明における記憶手段に相当し、前記処理部
202は処理手段に相当している。
The present embodiment mainly corresponds to the invention described in claim 3 or 17, and the storage unit etc. 2
01 corresponds to the storage means in the present invention, and the processing unit 202 corresponds to the processing means.

【0052】以上のような構成において、処理部202
により一連のソフトウェアプログラムを実行することに
より、中間コード実行システム2の各機能が実現され、
以下に述べるようにしてクラスファイル201cに前処
理が施され、前処理の施されたクラスファイル201c
が実行される。
In the configuration as described above, the processing section 202
Each function of the intermediate code execution system 2 is realized by executing a series of software programs by
The class file 201c is preprocessed as described below, and the preprocessed class file 201c
Is executed.

【0053】図6は、本実施形態におけるクラスファイ
ル201cの前処理および実行の手順を説明するための
フローチャートである。この手順は、上記第1実施形態
と同様に、予め入力部203から入力されたクラスファ
イル201cが記憶部201に格納されていることを前
提としている。
FIG. 6 is a flow chart for explaining the procedure of preprocessing and execution of the class file 201c in this embodiment. This procedure is based on the premise that the class file 201c previously input from the input unit 203 is stored in the storage unit 201, as in the first embodiment.

【0054】まず、中間コードの前処理が開始され(S
201)、処理部202は記憶部201から互いに関連
付けられた命令パターン201aおよび代替命令201
bのテーブルを読み出す(S202)。次いで、処理部
202はクラスファイル201cを検索して命令パター
ン201aを特定する(S203)。そして、処理部2
02は特定された命令パターン201aを代替命令20
1bに置換し(S204)、中間コードの前処理は終了
する(S205)。以上の処理は、第1実施形態におけ
る前処理と同様の手順であるため、詳細な説明は省略す
る。
First, the preprocessing of the intermediate code is started (S
201), the processing unit 202 stores the instruction pattern 201a and the alternative instruction 201 associated with each other from the storage unit 201.
The table of b is read (S202). Next, the processing unit 202 searches the class file 201c and specifies the command pattern 201a (S203). And the processing unit 2
02 designates the specified instruction pattern 201a as an alternative instruction 20
1b is replaced (S204), and the preprocessing of the intermediate code ends (S205). The above-mentioned processing is the same procedure as the pre-processing in the first embodiment, so detailed description will be omitted.

【0055】次いで、以上のようにして前処理の施され
たクラスファイル201cを実行する。ここでは、代替
命令201bを命令パターン201aと同等の内容に解
釈して実行することができるインタープリタをなすソフ
トウェアプログラムが実行され、これにより処理部20
2は記憶部201に格納されたクラスファイル201c
から命令を取り出し(S206)、取り出された命令に
相当する処理が処理部202により実行される(S20
7)。
Next, the class file 201c which has been preprocessed as described above is executed. Here, a software program that is an interpreter capable of interpreting and executing the alternative instruction 201b with the same content as the instruction pattern 201a is executed, whereby the processing unit 20 is executed.
2 is a class file 201c stored in the storage unit 201
The instruction corresponding to the extracted instruction is executed by the processing unit 202 (S206) (S20).
7).

【0056】第2実施形態に係る中間コード実行システ
ム2によれば、以上のような手順により、クラスファイ
ル201cに命令パターン201aを代替命令201b
に置換する前処理を施し、この前処理の施された中間コ
ードを実行することができる。よって、クラスファイル
201cのコード長を短縮し、かつ、命令間の冗長な処
理を省略した中間コードを実行することができ、これに
より中間コード実行時のパフォーマンスを向上すること
ができる。さらに、前処理後の中間コードを実行するに
あたり、代替命令をメモリアクセス等のオーバーヘッド
要因を最小とした処理に解釈して実行することにより、
中間コード実行時のパフォーマンスを一層向上すること
も可能である。
According to the intermediate code execution system 2 according to the second embodiment, the instruction pattern 201a is replaced with the alternative instruction 201b in the class file 201c by the above procedure.
It is possible to perform a pre-processing for replacing with, and execute the pre-processed intermediate code. Therefore, the code length of the class file 201c can be shortened, and the intermediate code in which redundant processing between instructions is omitted can be executed, whereby the performance at the time of executing the intermediate code can be improved. Furthermore, when executing the intermediate code after pre-processing, by interpreting and executing the alternative instruction as processing that minimizes overhead factors such as memory access,
It is also possible to further improve the performance when executing the intermediate code.

【0057】なお、図6に示した手順では、前処理とク
ラスファイルの実行とを連続して行う場合を示したが、
前処理とクラスファイルの実行とは必ずしも連続してい
なくてもよく、予めクラスファイルに前処理を施してお
き、時間をおいてから前処理を施したクラスファイルを
実行するようにしても構わない。
Although the procedure shown in FIG. 6 shows the case where the preprocessing and the execution of the class file are continuously performed,
The preprocessing and the execution of the class file may not necessarily be continuous, and the class file may be preprocessed in advance and the preprocessed class file may be executed after a while. .

【0058】また、代替命令201bの関連づけられた
命令パターン201aは1種に限られるものではなく、
2種以上であってもよい。このような場合に、図6に示
したような手順で前処理とクラスファイルの実行とを連
続して行う際には、前処理のオーバーヘッドをできるだ
け小さくしてクラスファイルの実行を開始するために、
代替命令201bの関連づけられた命令パターン201
aのうち一部の命令パターンについてのみ代替命令と置
換する前処理を行うようにしてもよい。
The instruction pattern 201a associated with the alternative instruction 201b is not limited to one type,
Two or more kinds may be used. In such a case, in order to start the execution of the class file with the overhead of the preprocessing as small as possible when the preprocessing and the execution of the class file are continuously performed by the procedure as shown in FIG. ,
Command pattern 201 associated with alternative command 201b
It is also possible to perform the pre-processing for replacing a part of the command pattern of a with the alternative command.

【0059】さらに、中間コード実行システム2が搭載
される機器によって処理部202をなすMPUやマイク
ロコントローラの性能は様々であり、また、状況に応じ
て前処理にかけられる時間的な余裕や機器システムの処
理能力にも変化がある。したがって、代替命令の関連付
けられた複数の命令パターンがある場合には、どれだけ
の命令パターンを置換するかを機器の特性や状況に応じ
て静的に調整するようにしてもよい。このようにするこ
とで、中間コード実行システム2が搭載される機器の特
性や状況に応じた前処理を実現することができる。例え
ば、本発明の中間コード実行システム2を携帯電話に搭
載した場合、携帯電話にダウンロードしたクラスファイ
ルを直ちに実行する際には一部の命令パターンだけを置
換するようにし、直ちに実行しない場合には全命令パタ
ーンを置換するように調整するようにしてもよい。この
ようにすることで、携帯電話上にて、状況に応じた前処
理を施しつつクラスファイルを実行することが可能とな
る。
Furthermore, the performance of the MPU and the microcontroller that form the processing unit 202 varies depending on the equipment in which the intermediate code execution system 2 is mounted, and the time margin for preprocessing and the equipment system depend on the situation. There is also a change in processing capacity. Therefore, when there are a plurality of command patterns associated with alternative commands, how many command patterns are to be replaced may be statically adjusted according to the characteristics and conditions of the device. By doing so, it is possible to realize the preprocessing according to the characteristics and the situation of the device in which the intermediate code execution system 2 is mounted. For example, when the intermediate code execution system 2 of the present invention is installed in a mobile phone, when a class file downloaded to the mobile phone is immediately executed, only some command patterns are replaced, and when the class file is not immediately executed. Adjustment may be made so that all instruction patterns are replaced. By doing so, it becomes possible to execute the class file on the mobile phone while performing preprocessing according to the situation.

【0060】[第3実施形態]次に、図7から9を参照
して、本発明の第3実施形態に係る中間コード実行シス
テムについて詳細に説明する。図7は、中間コードとし
てJava(R)のクラスファイルを実行する本発明の
第3実施形態に係る中間コード実行システム100を概
略的に示す図面である。この中間コード実行システム1
00は、MPUないしマイクロコントローラを含んだ演
算部5と、前記演算部5に接続された記憶部10とを有
している。
[Third Embodiment] Next, an intermediate code execution system according to a third embodiment of the present invention will be described in detail with reference to FIGS. FIG. 7 is a diagram schematically showing an intermediate code execution system 100 according to a third embodiment of the present invention that executes a Java (R) class file as intermediate code. This intermediate code execution system 1
00 has an arithmetic unit 5 including an MPU or a microcontroller, and a storage unit 10 connected to the arithmetic unit 5.

【0061】演算部5は、所定のソフトウェアプログラ
ムを実行することにより、中間コード解析部20と、中
間コード実行部30A,30B,30Cとを構成する。
そのようなソフトウェアプログラムは記憶部10に格納
してもよいし、別の記憶部に格納するようにしても構わ
ない。
The arithmetic section 5 constitutes an intermediate code analysis section 20 and intermediate code execution sections 30A, 30B and 30C by executing a predetermined software program.
Such a software program may be stored in the storage unit 10 or may be stored in another storage unit.

【0062】上記中間コード実行部30A,30B,3
0Cは、それぞれ中間コードを逐次的に解釈して実行す
るインタープリタとして機能する。そして、これらの中
間コード実行部30A,30B,30Cは、それぞれの
処理特性が互いに異なるタイプとなっている。例えば、
中間コード実行部30Aはバイトコード命令Fの処理は
速いがバイトコード命令Gの処理は遅く、中間コード実
行部Bはバイトコード命令Gの処理は速いがバイトコー
ド命令Fの処理は遅く、中間コード実行部Cはいずれの
バイトコード命令においても平均的な処理速度となって
いるが如くである。
Intermediate code execution units 30A, 30B, 3
0C functions as an interpreter that sequentially interprets and executes the intermediate code. The intermediate code execution units 30A, 30B, 30C are of types having different processing characteristics. For example,
The intermediate code execution unit 30A is fast in processing the bytecode instructions F but slow in processing the bytecode instructions G, and the intermediate code execution unit B is fast in processing the bytecode instructions G but slow in processing the bytecode instructions F. It seems that the execution unit C has an average processing speed for any bytecode instruction.

【0063】さらに、中間コード解析部20は、記憶部
10に記憶されたクラスファイル12に含まれるメソッ
ドの性質を解析し、その性質に応じた中間コード実行部
30を選択し、当該メソッドと選択された中間コード実
行部30との組み合わせを記録する処理を行う。この中
間コード解析部20が行う処理については、後に詳細に
説明する。
Further, the intermediate code analysis unit 20 analyzes the property of the method included in the class file 12 stored in the storage unit 10, selects the intermediate code execution unit 30 according to the property, and selects the method. The processing of recording the combination with the intermediate code execution unit 30 that has been performed is performed. The processing performed by the intermediate code analysis unit 20 will be described in detail later.

【0064】記憶部10は、RAMやROM等を有し、
クラスファイル12と、対応関係データベース13とを
格納している。記憶部10は、物理的に単一の構成とし
てもよいし、複数からなる構成としても構わない。
The storage unit 10 has a RAM and a ROM,
A class file 12 and a correspondence database 13 are stored. The storage unit 10 may have a physically single configuration or a plurality of configurations.

【0065】クラスファイル12は、Java(R)言
語により作成されたソースコードファイルをコンパイル
して生成されたものであり、1以上のメソッドが含まれ
ている。このメソッドは、特定の処理を実現するために
複数のバイトコード命令が集合したものである。上記対
応関係データベース13は、上記中間コード実行部30
A,B,Cのそれぞれにおける各バイトコード命令の処
理効率度のスコアを管理するデータベースである。
The class file 12 is generated by compiling a source code file created in the Java (R) language, and includes one or more methods. This method is a set of a plurality of bytecode instructions for realizing a specific process. The correspondence database 13 is the intermediate code execution unit 30.
It is a database that manages the score of the processing efficiency of each bytecode instruction in each of A, B, and C.

【0066】なお、本実施形態は、主として請求項4に
記載の発明に対応しており、前記中間コード実行部30
A,30B,30Cは当該発明における中間コード実行
手段に相当し、前記記憶部10は記憶手段に相当し、前
記中間コード解析部20は中間コード解析手段に相当し
ている。
The present embodiment mainly corresponds to the invention described in claim 4, and the intermediate code execution unit 30 is used.
A, 30B and 30C correspond to the intermediate code executing means in the present invention, the storage section 10 corresponds to the storing means, and the intermediate code analyzing section 20 corresponds to the intermediate code analyzing means.

【0067】図8は、対応関係データベース13の具体
的内容の一例を示したデータ構造図である。図8に示さ
れるように、対応関係データベース13は、中間コード
実行部30A,30B,30Cのそれぞれにおける各バ
イトコード命令の処理効率度のスコアを記憶している。
ここで、処理効率度のスコアとは当該バイトコード命令
をどの程度効率的に実行することができるかを数値化し
た値であり、このようなスコアは各中間コード実行部の
40A,30B,30Cの仕様に応じて予め定義してお
くことが好ましい。なお、図8に示したデータ構造は、
主として請求項5に記載の発明に対応したものである。
FIG. 8 is a data structure diagram showing an example of specific contents of the correspondence database 13. As shown in FIG. 8, the correspondence database 13 stores the score of the processing efficiency of each bytecode instruction in each of the intermediate code execution units 30A, 30B, 30C.
Here, the processing efficiency score is a numerical value indicating how efficiently the bytecode instruction can be executed, and such a score is obtained by the intermediate code executing units 40A, 30B and 30C. It is preferable to define in advance according to the specifications of. The data structure shown in FIG. 8 is
The invention mainly corresponds to the invention described in claim 5.

【0068】例えば、図8の最上段では、バイトコード
命令aの中間コード実行部30A,30B,30Cのそ
れぞれにおける処理効率度のスコアが定義されている。
詳細には、バイトコード命令aの中間コード実行部30
Aにおける処理効率度のスコアは90、中間コード実行
部30Bにおける処理効率度のスコアは10、中間コー
ド実行部30Cにおける処理効率度のスコアは10と定
義されている(ここでは、数値が高いほど効率がよいも
のとする)。従って、このような対応関係データベース
13によれば、バイトコード命令aについては中間コー
ド実行部30Aにより実行されるのが最も効率的である
ことが分かる。これと同様に、バイトコード命令b,
c、さらには他の全てのバイトコード命令について各中
間コード実行部30A、30B,30Cのそれぞれにお
ける処理効率度スコアが、対応関係データベース13に
定義されている。なお、請求項5に記載の処理効率度の
スコアテーブルは、この対応関係データベース13に蓄
積されている。
For example, in the uppermost row of FIG. 8, the scores of the processing efficiency in each of the intermediate code execution units 30A, 30B, 30C of the bytecode instruction a are defined.
Specifically, the intermediate code execution unit 30 of the bytecode instruction a
The processing efficiency score in A is 90, the processing efficiency score in the intermediate code executing unit 30B is 10, and the processing efficiency score in the intermediate code executing unit 30C is 10 (here, the higher the numerical value, the higher the numerical value). Be efficient). Therefore, according to such a correspondence database 13, it is understood that the bytecode instruction a is most efficiently executed by the intermediate code execution unit 30A. Similarly, the bytecode instruction b,
c, and the processing efficiency score in each of the intermediate code execution units 30A, 30B, and 30C for all other bytecode instructions are defined in the correspondence relationship database 13. The score table of the processing efficiency according to claim 5 is stored in the correspondence database 13.

【0069】以下、図9のフローチャートを参照して、
第3実施形態に係る中間コード実行システム100の中
間コード解析部20が実行する処理の手順を説明する。
まず、中間コード解析部20は、記憶部10のクラスフ
ァイル12からメソッドを読み出す(S301)。次
に、中間コード解析部20は、当該読み出したメソッド
を解析し、メソッドに含まれるバイトコード命令を特定
する(S302)。一つのメソッドには、複数のバイト
コード命令が含まれているので、中間コード解析部20
はメソッドに含まれる複数のバイトコード命令を、個々
に特定する手順を繰り返す。
Hereinafter, with reference to the flowchart of FIG.
A procedure of processing executed by the intermediate code analysis unit 20 of the intermediate code execution system 100 according to the third embodiment will be described.
First, the intermediate code analysis unit 20 reads a method from the class file 12 of the storage unit 10 (S301). Next, the intermediate code analysis unit 20 analyzes the read method and identifies the bytecode instruction included in the method (S302). Since one method includes a plurality of bytecode instructions, the intermediate code analysis unit 20
Repeats the procedure of individually specifying a plurality of bytecode instructions included in the method.

【0070】次いで、中間コード解析部20は、記憶部
10における対応関係データベース13に問い合わせ、
上記S102において特定した各バイトコード命令に対
応する処理効率度のスコアを取得し、それらを合計する
(S303)。
Next, the intermediate code analysis unit 20 makes an inquiry to the correspondence database 13 in the storage unit 10,
The processing efficiency score corresponding to each bytecode instruction specified in S102 is acquired and summed (S303).

【0071】その後、中間コード解析部20は、S30
3にて得られた中間コード実行部30A,30B,30
Cのそれぞれにおける処理効率度の合計スコアに基づい
て、クラスファイル12を最も効率よく実行することが
できる中間コード実行部を特定する(S304)。具体
的には、中間コード解析部20にて中間コード実行部ご
との合計スコアを比較し、最も合計スコアの高いものを
当該メソッドの実行に利用する中間コード実行部として
特定するようにしてもよい。
Thereafter, the intermediate code analysis unit 20 determines S30.
Intermediate code execution units 30A, 30B, 30 obtained in No. 3
An intermediate code execution unit capable of executing the class file 12 most efficiently is specified based on the total score of the processing efficiency in each C (S304). Specifically, the intermediate code analysis unit 20 may compare the total scores of the intermediate code execution units, and specify the one having the highest total score as the intermediate code execution unit used for executing the method. .

【0072】最後に、中間コード解析部20は、当該メ
ソッドをS304において特定した中間コード実行部3
0で実行すべきことを記録する(S305)。具体的に
は、例えば、メソッド毎に保有されている管理情報に、
実行すべき中間コード実行部30の種別を記録しておく
ようにしてもよいし、メソッドに実行すべき中間コード
実行部30の種別をマークしておくようにしてもよい。
以上の動作をクラスファイル12に含まれる全てのメソ
ッドについて実行し、中間コード解析部20は処理を終
了する。
Finally, the intermediate code analysis unit 20 determines that the method is specified in S304.
It records what is to be executed with 0 (S305). Specifically, for example, in the management information held for each method,
The type of the intermediate code execution unit 30 to be executed may be recorded, or the type of the intermediate code execution unit 30 to be executed may be marked in the method.
The above operation is executed for all the methods included in the class file 12, and the intermediate code analysis unit 20 ends the process.

【0073】以下、図8に示した対応関係データベース
13を例に、上記S303および上記S304における
処理の内容をより具体的に説明する。メソッドにバイト
コード命令a,dが含まれていた場合を想定すると、中
間コード解析部20は、バイトコード命令aの中間コー
ド実行部30Aにおける処理効率度のスコアである9
0、中間コード実行部30Bにおける処理効率度のスコ
アである10、中間コード実行部30Cにおける処理効
率度のスコアである10をそれぞれ取得する。次いで、
中間コード解析部20は、バイトコード命令dの中間コ
ード実行部30Aにおける処理効率度スコアである5
0、中間コード実行部30Bにおける処理効率度スコア
である40、中間コード実行部30Cにおける処理効率
度スコアである90をそれぞれ取得し、バイトコード命
令aのスコアに加算する。
The contents of the processing in S303 and S304 will be described more specifically below by taking the correspondence database 13 shown in FIG. 8 as an example. Assuming that the method includes bytecode instructions a and d, the intermediate code analysis unit 20 is a score of the processing efficiency of the intermediate code execution unit 30A of the bytecode instruction a.
0, 10 which is the score of the processing efficiency in the intermediate code execution unit 30B, and 10 which is the score of the processing efficiency in the intermediate code execution unit 30C are acquired. Then
The intermediate code analysis unit 20 is a processing efficiency score of 5 in the intermediate code execution unit 30A of the bytecode instruction d.
0, 40 that is the processing efficiency score in the intermediate code execution unit 30B, and 90 that is the processing efficiency score in the intermediate code execution unit 30C are acquired and added to the score of the bytecode instruction a.

【0074】この場合には、中間コード実行部30Aに
おける処理効率度の合計スコアは140、中間コード実
行部30Bにおける合計スコアは50、中間コード実行
部30Cにおける合計スコアは100となる。従って、
中間コード解析部20は、中間コード実行部30Aを当
該メソッドの実行に利用するものとして特定する。以上
のような処理を行うことにより、中間コード実行システ
ム100は、クラスファイル12に含まれるメソッドを
実行する際に、中間コード解析部20にて記録した内容
に基づいて、メソッドに含まれるバイトコード命令に応
じて決定された最も効率的な中間コード実行部30A,
30Bまたは30Cを用いることが可能となる。したが
って、第3実施形態によれば、特性の異なる中間コード
実行部30A,30B,30Cを活用して、クラスファ
イル12に含まれるメソッドの実行を効率よく行うこと
ができるので、パフォーマンスの高い中間コード実行シ
ステム100が提供される。
In this case, the total score of the processing efficiency in the intermediate code execution unit 30A is 140, the total score in the intermediate code execution unit 30B is 50, and the total score in the intermediate code execution unit 30C is 100. Therefore,
The intermediate code analysis unit 20 identifies the intermediate code execution unit 30A as the one used for executing the method. By performing the above-described processing, the intermediate code execution system 100 executes the method included in the class file 12 based on the contents recorded by the intermediate code analysis unit 20 and executes the bytecode included in the method. The most efficient intermediate code execution unit 30A determined according to the instruction,
It becomes possible to use 30B or 30C. Therefore, according to the third embodiment, it is possible to efficiently execute the method included in the class file 12 by utilizing the intermediate code execution units 30A, 30B, and 30C having different characteristics. An execution system 100 is provided.

【0075】[第4実施形態]次に、図10,11を参
照して、本発明の第4実施形態に係る中間コード実行シ
ステムについて詳細に説明する。第4実施形態に係る中
間コード実行システムは、その基本構成は第3実施形態
と同様である。ただし、第4実施形態に係る中間コード
実行システムは、中間コード解析部20において、メソ
ッドに含まれる各バイトコード命令に対して一意に定め
られたスコアの合計値を求め、その合計値のランクに応
じて中間コード実行部30A,30b、30Cのいずれ
かを特定する点で第3実施形態と相違する。なお、本実
施形態は主として請求項6に記載の発明に対応したもの
である。
[Fourth Embodiment] Next, an intermediate code execution system according to a fourth embodiment of the present invention will be described in detail with reference to FIGS. The intermediate code execution system according to the fourth embodiment has the same basic configuration as that of the third embodiment. However, in the intermediate code execution system according to the fourth embodiment, the intermediate code analysis unit 20 obtains the total value of the scores uniquely determined for each bytecode instruction included in the method, and ranks the total value. The third embodiment is different from the third embodiment in that one of the intermediate code execution units 30A, 30b, and 30C is specified accordingly. The present embodiment mainly corresponds to the invention described in claim 6.

【0076】以下、この点について詳細に説明する。中
間コード解析部20において、上記のような特定方法を
実現するために、第4実施形態における対応関係データ
ベース13は、図10に示すような各バイトコード命令
と当該各バイトコード命令のスコアとの対応関係を定義
するテーブルと、図11に示すような合計スコアの範囲
と中間コード実行部30A,30B,30Cとの対応関
係を定義するテーブルとを含んでいる。
Hereinafter, this point will be described in detail. In order to realize the above-mentioned identification method in the intermediate code analysis unit 20, the correspondence relationship database 13 in the fourth embodiment stores each bytecode instruction and the score of each bytecode instruction as shown in FIG. It includes a table that defines the correspondence relationship and a table that defines the correspondence relationship between the total score range and the intermediate code execution units 30A, 30B, 30C as shown in FIG.

【0077】このうち、前者について図10の例に基づ
いて説明すると、図10の左側は各バイトコード命令を
示しており、図10の右側はそれに対応して設定された
スコアの値を示している。ここでは、バイトコード命令
aのスコアは40、バイトコード命令bのスコアは9
0、バイトコード命令cのスコアは55と一意に設定さ
れている。また、後者について図11の例に基づいて説
明すると、図11の左側は合計スコアの範囲を示してお
り、この図11の右側は当該合計スコアの範囲に対応し
て特定される中間コード実行部30A,30B,30C
のいずれかを示している。ここでは、あるメソッドに含
まれるバイトコード命令に対応する合計スコアが201
未満の範囲に属するときには中間コード実行部30Aが
特定される。同様に、スコアの総計が201以上401
未満のときには中間コード実行部30Bが、401以上
のときは中間コード実行部30Cが、それぞれ特定され
るように設定されている。
Of these, the former will be described based on the example of FIG. 10. The left side of FIG. 10 shows each bytecode instruction, and the right side of FIG. 10 shows the value of the score set corresponding to it. There is. Here, the bytecode instruction a has a score of 40, and the bytecode instruction b has a score of 9
The score of 0 and the bytecode instruction c is uniquely set to 55. When the latter is explained based on the example of FIG. 11, the left side of FIG. 11 shows the range of the total score, and the right side of FIG. 11 is the intermediate code execution unit specified corresponding to the range of the total score. 30A, 30B, 30C
Indicates either. Here, the total score corresponding to a bytecode instruction included in a method is 201
When it belongs to the range below, the intermediate code execution unit 30A is specified. Similarly, the total score is 201 or more 401
It is set so that the intermediate code execution unit 30B is specified when the number is less than the above, and the intermediate code execution unit 30C is specified when the number is at least 401.

【0078】第4実施形態において中間コード解析部2
0が実行する処理の基本手順は第3実施形態とほぼ同様
である。すなわち、図7に示したように、中間コード解
析部20は記憶部10のクラスファイル12からメソッ
ドを読み出し(S101)、メソッドに含まれるバイト
コード命令を特定し(S102)、対応関係データベー
ス13に問い合わせて特定した各バイトコード命令に対
応するスコアを取得し、合計する(S103)。その
後、再度対応関係データベース13に問い合わせて合計
スコアに応じた中間コード実行部を特定し(S10
4)、当該メソッドを特定した中間コード実行部で実行
すべきことを記録し(S105)、処理を終了する。
Intermediate code analysis unit 2 in the fourth embodiment
The basic procedure of the process executed by 0 is almost the same as that of the third embodiment. That is, as shown in FIG. 7, the intermediate code analysis unit 20 reads a method from the class file 12 of the storage unit 10 (S101), identifies a bytecode instruction included in the method (S102), and stores it in the correspondence relation database 13. Scores corresponding to each bytecode instruction identified by inquiry are acquired and summed (S103). After that, the correspondence relation database 13 is again inquired to specify the intermediate code execution unit corresponding to the total score (S10).
4) Then, record that the intermediate code execution unit that specified the method should be executed (S105), and terminate the process.

【0079】以下、図10および図11に示した対応関
係データベース13を例に、上記S103および上記S
104における処理の内容を具体的に説明する。メソッ
ドにバイトコード命令a,cが含まれていた場合を想定
すると、中間コード解析部20は、バイトコード命令a
のスコアである40と、バイトコード命令cのスコアで
ある55とを取得し、その合計値は95となる(ST1
03)。中間コード解析部20は、この合計値とFi
g.11のテーブルとから、中間コード実行部30Aを
当該メソッドの実行に利用するものとして特定する。
Hereinafter, taking the correspondence relation database 13 shown in FIGS. 10 and 11 as an example, the above S103 and S
The contents of the processing in 104 will be specifically described. Assuming that the method includes bytecode instructions a and c, the intermediate code analysis unit 20 determines that the bytecode instruction a
Of 40 and the score of bytecode instruction c of 55 are obtained, and the total value is 95 (ST1
03). The intermediate code analysis unit 20 calculates the total value and Fi
g. From the table of 11, the intermediate code execution unit 30A is specified as the one used for executing the method.

【0080】以上のような処理を行う第4実施形態にお
いても、第3実施形態と同様に、メソッドに含まれるバ
イトコード命令に応じて決定された最も効率的な中間コ
ード実行部30A,30Bまたは30Cを用いることが
可能となるので、極めてパフォーマンスの高い中間コー
ド実行システム100が提供される。
Also in the fourth embodiment for performing the above-mentioned processing, the most efficient intermediate code execution units 30A, 30B determined in accordance with the bytecode instructions included in the method or in the same manner as the third embodiment. Since 30C can be used, an extremely high performance intermediate code execution system 100 is provided.

【0081】[第5実施形態]次に、図12,13を参
照して、本発明の第5実施形態に係る中間コード実行シ
ステムについて詳細に説明する。図12は、本発明の第
5実施形態に係る中間コード実行システム200を概略
的に示す図面である。この中間コード実行システム20
0は、その基本構成は第3および第4実施形態と同様で
あるが、一般中間コード実行部31と特殊中間コード実
行部32とを有する点で第3および第4実施形態と相違
している。
[Fifth Embodiment] Next, an intermediate code execution system according to a fifth embodiment of the present invention will be described in detail with reference to FIGS. FIG. 12 is a diagram schematically showing an intermediate code execution system 200 according to the fifth embodiment of the present invention. This intermediate code execution system 20
0 has the same basic configuration as the third and fourth embodiments, but differs from the third and fourth embodiments in that it has a general intermediate code executing unit 31 and a special intermediate code executing unit 32. .

【0082】この中間コード実行システムは、一般中間
コード実行部31と特殊中間コード実行部32とにより
クラスファイル12を実行する。一般中間コード実行部
31は、クラスファイルを逐次的に解釈して実行するイ
ンタープリタであり、全てのバイトコード命令を実行す
る通常の機能を有している。これに対して、特殊中間コ
ード実行部32は、特定のバイトコード命令を一般中間
コード実行部31よりも高速に実行することができる
が、一部の命令(例えば、浮動小数点演算に関するバイ
トコード命令)を実行することができない特殊なインタ
ープリタである。
In this intermediate code execution system, the general intermediate code execution unit 31 and the special intermediate code execution unit 32 execute the class file 12. The general intermediate code execution unit 31 is an interpreter that sequentially interprets and executes a class file, and has a normal function of executing all bytecode instructions. On the other hand, the special intermediate code execution unit 32 can execute a specific bytecode instruction at a higher speed than the general intermediate code execution unit 31, but some instructions (for example, a bytecode instruction relating to floating-point arithmetic). ) Is a special interpreter that cannot execute.

【0083】また、第5実施形態における対応関係デー
タベース13は、各バイトコード命令について、当該バ
イトコード命令が上記特殊中間コード実行部32によっ
て実行可能であるか否かを識別するためのデータ構造と
なっている。
Further, the correspondence relation database 13 in the fifth embodiment has a data structure for identifying, for each bytecode instruction, whether or not the bytecode instruction can be executed by the special intermediate code executing section 32. Has become.

【0084】なお、本実施形態は、主として請求項7に
記載の発明に対応しており、前記特殊中間コード実行部
32は当該発明における特殊中間コード実行手段に相当
し、前記一般中間コード実行部31は一般中間コード実
行手段に相当し、記憶部10は記憶手段に相当し、中間
コード解析部20は中間コード解析手段に相当してい
る。
The present embodiment mainly corresponds to the invention described in claim 7, the special intermediate code executing section 32 corresponds to the special intermediate code executing means in the present invention, and the general intermediate code executing section Reference numeral 31 corresponds to general intermediate code execution means, storage unit 10 corresponds to storage means, and intermediate code analysis unit 20 corresponds to intermediate code analysis means.

【0085】以下、図13のフローチャートを参照し
て、第5実施形態に係る中間コード実行システム200
の中間コード解析部20が実行する処理の手順を説明す
る。先ず、中間コード解析部20は、記憶部10のクラ
スファイル12からメソッドを読み出す(S201)。
次に、中間コード解析部20は、当該読み出したメソッ
ドを解析し、メソッドに含まれるバイトコード命令を特
定し(S202)、当該特定したバイトコード命令が特
殊中間コード実行部32では実行不能なバイトコード命
令か否かを対応関係データベース13の内容に基づいて
判定する(S203)。このS203において、特殊中
間コード実行部32では実行不能なバイトコード命令が
含まれないと判定された場合には、中間コード解析部2
0は当該メソッドを特殊中間コード実行部32で実行す
べきことを記録する(S204)。一方、S203にお
いて、特殊中間コード実行部32では実行不能なバイト
コード命令が含まれると判定したとき、中間コード解析
部20は当該メソッドを一般中間コード実行部31で実
行すべきことを記録する(S205)。なお、記録の方
法は第3および第4実施形態と同様でよい。以上の動作
をクラスファイル12に含まれる全てのメソッドについ
て実行し、中間コード解析部20は処理を終了する。
Hereinafter, with reference to the flowchart of FIG. 13, the intermediate code execution system 200 according to the fifth embodiment.
The procedure of the process executed by the intermediate code analysis unit 20 will be described. First, the intermediate code analysis unit 20 reads a method from the class file 12 of the storage unit 10 (S201).
Next, the intermediate code analysis unit 20 analyzes the read method and identifies a bytecode instruction included in the method (S202), and the identified bytecode instruction cannot be executed by the special intermediate code execution unit 32. Whether or not it is a code instruction is determined based on the contents of the correspondence database 13 (S203). If it is determined in S203 that the special intermediate code execution unit 32 does not include an inexecutable bytecode instruction, the intermediate code analysis unit 2
0 records that the method should be executed by the special intermediate code execution unit 32 (S204). On the other hand, when it is determined in S203 that the special intermediate code execution unit 32 includes a bytecode instruction that cannot be executed, the intermediate code analysis unit 20 records that the general intermediate code execution unit 31 should execute the method ( S205). The recording method may be the same as in the third and fourth embodiments. The above operation is executed for all the methods included in the class file 12, and the intermediate code analysis unit 20 ends the process.

【0086】以上のような第5実施形態によれば、特定
のバイトコード命令を高速に実行することができるが一
部のバイトコード命令を実行不能な特殊中間コード実行
部32と、全ての命令を実行することができる一般中間
コード実行部31とを、メソッド毎に使い分けることに
より、特定のバイトコード命令を高速に実行することが
できるとともに、全てのバイトコード命令を実行するこ
との可能な中間コード実行システム200が提供され
る。
According to the fifth embodiment as described above, the special intermediate code executing section 32 which can execute a specific bytecode instruction at high speed but cannot execute a part of the bytecode instruction, and all the instructions. By using the general intermediate code execution unit 31 capable of executing the following, for each method, it is possible to execute a specific bytecode instruction at high speed and to execute all the intermediate bytecode instructions. A code execution system 200 is provided.

【0087】[第6実施形態]次に、図14を参照し
て、本発明の第6実施形態に係る中間コード実行システ
ムについて詳細に説明する。第6実施形態に係る中間コ
ード実行システム300は、中間コードとしてJava
(R)のクラスファイルを実行するものである。そし
て、図14に示すように、この中間コード実行システム
300は、主としてクラスファイル302を格納した記
憶部301と、不図示の処理部により所定のプログラム
を実行することで仮想的に構成されるメソッド解析部3
07、第1のサブシステム308および第2のサブシス
テム310とから構成されている。
[Sixth Embodiment] The intermediate code execution system according to the sixth embodiment of the present invention will be described in detail with reference to FIG. The intermediate code execution system 300 according to the sixth embodiment uses Java as the intermediate code.
The class file of (R) is executed. Then, as shown in FIG. 14, the intermediate code execution system 300 includes a storage unit 301 that mainly stores a class file 302, and a method virtually configured by executing a predetermined program by a processing unit (not shown). Analysis unit 3
07, a first subsystem 308 and a second subsystem 310.

【0088】上記記憶部301に格納されたクラスファ
イル302は、Java(R)言語により作成されたソ
ースコードをコンパイルすることにより得られるもので
ある。このクラスファイル302は、メソッド303〜
305を含んでいる。
The class file 302 stored in the storage unit 301 is obtained by compiling the source code created in the Java (R) language. This class file 302 includes methods 303 to
Includes 305.

【0089】クラスファイル302は圧縮されたjar
ファイルの状態で配信され、中間コード実行システム3
00により伸張される場合もある。尚、このjarファ
イルとは、Java(R)プログラムを動作させるため
に必要なクラスファイルを一つにまとめたアーカイブ・
ファイルである。但し、図14では、既にクラスファイ
ルの状態で記憶部301に格納されている。
The class file 302 is a compressed jar
It is delivered in the form of a file, and the intermediate code execution system 3
It may be extended by 00. Note that this jar file is an archive file that combines the class files required for operating Java (R) programs.
It is a file. However, in FIG. 14, the class file is already stored in the storage unit 301.

【0090】第1のサブシステム308は、第1のイン
タープリタ309を有している。そして、この第1のイ
ンタープリタ309によりJava(R)のクラスファ
イルに含まれるバイトコード命令を逐次的に解釈して実
行することが可能である。この第1のインタープリタ3
09は、コンパイル時に生成される命令コードセット、
即ち、ここではJava(R)言語により作成されたソ
ースコードをコンパイルすることで生成されるバイトコ
ード命令の全てに対応した通常のインタープリタであ
る。
The first subsystem 308 has a first interpreter 309. The first interpreter 309 can sequentially interpret and execute the bytecode instructions included in the Java (R) class file. This first interpreter 3
09 is an instruction code set generated at compile time,
That is, here, it is an ordinary interpreter that supports all bytecode instructions generated by compiling a source code created in the Java (R) language.

【0091】一方、上記第2のサブシステム310は、
前述の中間コード前処理装置と略同様の構成と機能とを
有する前処理部311と、第2のインタープリタ312
とを有している。前処理部311は、前述の通り、例え
ば「iload」、「iload」、「iadd」とい
う命令パターンを「v_v_iadd」と置換するよう
に、特定のバイトコード命令のパターンを対応する代替
命令に置換する処理をクラスファイル302の各メソッ
ドに施す。また、第2のインタープリタ312は、この
ように処理を施されたメソッドに対応するために、置換
後にメソッドに追加される代替命令を解釈して実行する
ことができるように構成されている。
On the other hand, the second subsystem 310 is
A preprocessing unit 311 having substantially the same configuration and function as the intermediate code preprocessing device described above, and a second interpreter 312.
And have. As described above, the preprocessing unit 311 replaces a specific bytecode command pattern with a corresponding alternative command so that the command patterns “iload”, “iload”, and “iadd” are replaced with “v_v_iadd”, for example. Processing is applied to each method of the class file 302. Further, the second interpreter 312 is configured to be able to interpret and execute an alternative instruction added to the method after the replacement in order to correspond to the method processed in this way.

【0092】より具体的には、前処理部311において
特定の命令パターンを代替命令に置換することは、特定
の命令パターンをなすオペコードおよびオペランドの組
み合わせを、新たに定義した代替命令のオペコードおよ
びオペランドのセットに置換するということを意味して
いる。尚、オペコードは命令の動作を表しており、オペ
ランドは命令の対象となるスタックやレジスタ等を表し
ている。
More specifically, substituting a specific instruction pattern with an alternative instruction in the preprocessing unit 311 means that a combination of an opcode and an operand forming a specific instruction pattern is converted into an opcode and an operand of a newly defined alternative instruction. Means to replace it with the set. Incidentally, the operation code represents the operation of the instruction, and the operand represents the stack, register or the like which is the target of the instruction.

【0093】しかしながら、Java(R)の場合に
は、オペコード長は1バイトと限られているためオペコ
ードの種類を自由に増やすことはできない。そこで、第
6実施形態では、通常は別の命令が割り付けられている
オペコードに代替命令を割り当て、実行時には当該オペ
コードを代替命令として解釈し、置換前の命令パターン
がなすものと実質的に同様の手順を実行するようにす
る。
However, in the case of Java (R), since the opcode length is limited to 1 byte, the types of opcode cannot be freely increased. Therefore, in the sixth embodiment, an alternative instruction is normally assigned to an operation code to which another instruction is assigned, and the operation code is interpreted as an alternative instruction at the time of execution, and is substantially the same as the instruction pattern before replacement. Make sure you follow the steps.

【0094】すなわち、第6実施形態では、例えば、通
常のバイトコード命令において浮動小数点演算の命令が
割り付けられているオペコードに代替命令を割り付け
る。そして、第2のインタープリタ312において、当
該オペコードを代替命令に置換する前の命令パターンと
同様の手順に解釈して実行する。
That is, in the sixth embodiment, for example, the alternative instruction is assigned to the operation code to which the instruction of the floating point operation is assigned in the normal bytecode instruction. Then, in the second interpreter 312, the operation code is interpreted and executed in the same procedure as the instruction pattern before being replaced with the alternative instruction.

【0085】以上のようにすることで、第2のサブシス
テム310において、メソッドを前処理部311で前処
理してから第2のインタープリタ312で実行すること
が可能となる。但し、前述した例では、第2のサブシス
テム310で浮動小数点演算の命令を含むメソッドを実
行することはできなくなる。
As described above, in the second subsystem 310, the method can be preprocessed by the preprocessing unit 311 and then executed by the second interpreter 312. However, in the above-described example, it becomes impossible for the second subsystem 310 to execute the method including the instruction of the floating point arithmetic.

【0086】上記メソッド解析部307は、実行される
メソッドに含まれる命令を解析しそれに応じてメソッド
を第1のサブシステム308と第2のサブシステム31
0とのいずれで実行するかを選択する。そして、その結
果を当該メソッドにマークする。即ち、第6実施形態に
おけるメソッド解析部307の機能は、第5実施形態に
おける中間コード解析部20の機能に対応している。
The method analysis unit 307 analyzes the instructions included in the method to be executed, and accordingly determines the method as the first subsystem 308 and the second subsystem 31.
Select whether to execute 0 or 0. Then, the result is marked on the method. That is, the function of the method analysis unit 307 in the sixth embodiment corresponds to the function of the intermediate code analysis unit 20 in the fifth embodiment.

【0087】なお、本実施形態は主として請求項9ない
し14に記載の発明に対応しており、前記記憶部301
は当該発明における記憶手段に相当し、前記前処理部3
11は前処理手段に相当し、前記第1および第2のイン
タープリタ309,310は第1および第2のインター
プリタに相当し、メソッド解析部307は中間コード解
析手段または選択部に相当している。
The present embodiment mainly corresponds to the invention described in claims 9 to 14, and the storage unit 301
Corresponds to the storage means in the present invention, and the pre-processing unit 3
Reference numeral 11 corresponds to preprocessing means, the first and second interpreters 309 and 310 correspond to first and second interpreters, and the method analysis unit 307 corresponds to intermediate code analysis means or a selection unit.

【0088】次に、以上のような構成の中間コード実行
システム300により、クラスファイル312に含まれ
るメソッド303を実行する手順について説明する。先
ずメソッド解析部307によりメソッド303に含まれ
る命令を解析する。例えば、上述のように第2のサブシ
ステム310において代替命令のオペコードを浮動小数
点演算命令のオペコードに割り付けている場合には、メ
ソッド303が浮動小数点演算の命令を含むか否かを判
断する。そして、その結果からメソッド303を実行に
用いるべきサブシステムをメソッド303の所定位置3
06にマークする。すsなわち、メソッド303が浮動
小数点演算の命令を含むと判断した場合には、第1のサ
ブシステム309で実行することを選択する。そして、
メソッド303が浮動小数点演算の命令を含まないと判
断した場合には、第2のサブシステム310で実行する
ことを選択する。
Next, a procedure for executing the method 303 included in the class file 312 by the intermediate code execution system 300 having the above configuration will be described. First, the method analysis unit 307 analyzes an instruction included in the method 303. For example, when the operation code of the alternative instruction is assigned to the operation code of the floating point operation instruction in the second subsystem 310 as described above, it is determined whether the method 303 includes the instruction of the floating point operation. Then, from the result, the subsystem to be used for executing the method 303 is determined to be the predetermined position 3 of the method 303.
Mark 06. That is, when it is determined that the method 303 includes a floating-point operation instruction, it is selected to be executed by the first subsystem 309. And
When it is determined that the method 303 does not include a floating point operation instruction, the second subsystem 310 is selected to execute it.

【0089】第1のサブシステム309で実行すること
を選択した時には、メソッド303をそのまま第1のイ
ンタープリタ309で逐次的に解釈して実行する。
When the execution by the first subsystem 309 is selected, the method 303 is sequentially interpreted and executed by the first interpreter 309 as it is.

【0090】一方、第2のサブシステム310で実行す
ることを選択した時には、前処理部311によりメソッ
ド303に前処理を施して、メソッド303に含まれる
複数の命令がなす一定のパターンを代替命令に置換す
る。そして、この後、当該代替命令に対応した第2のイ
ンタープリタ312で逐次的に解釈して実行する。
On the other hand, when it is selected to be executed by the second subsystem 310, the method 303 is preprocessed by the preprocessor 311 to substitute a fixed pattern formed by a plurality of instructions included in the method 303 as an alternative instruction. Replace with. Then, after this, the second interpreter 312 corresponding to the substitute instruction sequentially interprets and executes the instruction.

【0091】そして、以上のようにしてメソッド303
の実行を終了したら、クラスファイル302の内容に応
じて、メソッド303〜305のいずれかを逐次実行す
ることをプログラムを終了するまで続けることになる。
Then, as described above, the method 303
When the execution of the method is completed, the method 303 to 305 is successively executed according to the content of the class file 302 until the program is completed.

【0092】第6実施形態に係る中間コード実行システ
ム300の構成およびメソッド実行の手順によれば、一
部の命令を実行することができないものの、メソッドに
含まれる特定の命令パターンを代替命令に置換して実行
することにより、命令間の冗長な処理を省いてメソッド
を高速に実行することができる第2のサブシステム31
0と、メソッド実行の高速化は図られていないものの、
全命令を実行することができる第1のサブシステム30
8とを有効に運用し、優れたパフォーマンスでクラスフ
ァイルを実行することができる。
According to the configuration of the intermediate code execution system 300 and the procedure of method execution according to the sixth embodiment, some instructions cannot be executed, but a specific instruction pattern included in the method is replaced with an alternative instruction. The second subsystem 31 that can execute the method at high speed by omitting redundant processing between instructions
0, although the method execution speed has not been increased,
First subsystem 30 capable of executing all instructions
8 can be effectively operated, and the class file can be executed with excellent performance.

【0093】なお、上記第1から第6実施形態は、種々
変形が可能である。例えば、上記第1および第2実施形
態では、クラスファイル単位で前処理を施す場合を示し
たが、これらの実施形態でも第6実施形態と同様にメソ
ッド単位で前処理を施すようにしても構わない。また、
第3および第4実施形態における対応関係データベース
13内のデータ構造や、そこでのスコア設定についても
上記に限られるものではない。
The first to sixth embodiments can be variously modified. For example, in the above-described first and second embodiments, the case where preprocessing is performed in class file units is shown, but in these embodiments, preprocessing may be performed in method units as in the sixth embodiment. Absent. Also,
The data structure in the correspondence database 13 in the third and fourth embodiments and the score setting therein are not limited to those described above.

【0094】また、第6実施形態における第1のサブシ
ステム309および第2のサブシステムの組み合わせに
替えて、いずれも特定の命令パターンを代替命令に置換
する前処理部および代替命令を実行可能なインタープリ
タを有する2つのサブシステムを用いてもよい。このよ
うなサブシステムの組み合わせを用いる場合、両サブシ
ステムで互いに異なるオペコードに代替命令を割り付け
ることで、両サブシステムの使い分けが可能となる。サ
ブシステムの数が3以上であってもよい。
Further, in place of the combination of the first subsystem 309 and the second subsystem in the sixth embodiment, it is possible to execute the preprocessor and the alternative instruction for replacing the specific instruction pattern with the alternative instruction. Two subsystems with an interpreter may be used. When such a combination of subsystems is used, it is possible to selectively use the two subsystems by assigning alternative instructions to different opcodes in the two subsystems. The number of subsystems may be three or more.

【0095】さらに、第6実施形態では、第2のサブシ
ステム310においてメソッドの実行時に前処理を施す
場合を示したが、1度実行したメソッドについては前処
理後のメソッドを記憶部301に保持することにより前
処理を省略するようにしてもよい。また、クラスロード
の際に全メソッドをメソッド解析部307により解析
し、第2のサブシステム310で実行するものとされた
メソッドについて予め前処理を施しておいてもよい。さ
らに、コンパイル時に前処理を施してもよい。
Further, in the sixth embodiment, the case where the preprocessing is performed at the time of executing the method in the second subsystem 310 is shown, but for the method executed once, the preprocessed method is stored in the storage unit 301. By doing so, the preprocessing may be omitted. Further, all methods may be analyzed by the method analysis unit 307 at the time of class loading, and preprocessing may be performed in advance for the method to be executed by the second subsystem 310. Furthermore, preprocessing may be performed at the time of compiling.

【0096】また、メソッド解析部307による解析
や、前処理部311による前処理でのメモリ消費やオー
バーヘッド等を許容し難い状況においては、これらを省
略して第1のサブシステム308においてメソッドを実
行する構成としてもよい。さらにまた、第6実施形態で
は、一例として浮動小数点演算の命令を割り付けられた
オペコードに代替命令を割り付ける場合を示したが、こ
れに限られるものではない。他の命令を割り当てられた
オペコードに代替命令を割り付けてもよい。
Further, when it is difficult to allow the memory consumption and the overhead in the analysis by the method analysis unit 307 and the preprocessing by the preprocessing unit 311, these are omitted and the method is executed in the first subsystem 308. It may be configured to. Furthermore, in the sixth embodiment, as an example, the case where the alternative instruction is assigned to the operation code to which the instruction of the floating point operation is assigned is shown, but the present invention is not limited to this. Alternate instructions may be assigned to opcodes to which other instructions have been assigned.

【0097】そして、上記第1から第6実施形態は、い
ずれもJava(R)のクラスファイルをモディファイ
した中間コードに適用することも可能であるし、Jav
a(R)以外の言語であってもソースコードとネイティ
ブコードとの間の中間的なコードで実行することを想定
したものであれば適用することが可能である。
All of the first to sixth embodiments can be applied to the intermediate code obtained by modifying the Java (R) class file.
Any language other than a (R) can be applied as long as it is assumed to be executed by an intermediate code between the source code and the native code.

【0098】以上、本発明の第1から第6実施形態につ
いて説明した。即ち、第1および第2の実施形態による
と、所定の命令パターンを特定し、当該特定された命令
パターンを短縮されたコードである代替命令に置換す
る。したがって、命令の種類を少なくすることができる
と共に、命令間の冗長な処理が省かれた新たな中間コー
ドを得ることができる。しかも、この前処理で中間コー
ドのサイズは大きくなることがない。また、前処理自体
は単純な置換を行っているだけなので高速で実行可能で
ある。さらに、得られた新たな中間コードを、代替命令
に対応した実行系で実行することで、中間コードを高速
で実行できる。
The first to sixth embodiments of the present invention have been described above. That is, according to the first and second embodiments, a predetermined instruction pattern is specified, and the specified instruction pattern is replaced with an alternative instruction which is a shortened code. Therefore, it is possible to reduce the number of types of instructions and obtain a new intermediate code in which redundant processing between instructions is omitted. Moreover, the size of the intermediate code is not increased by this preprocessing. In addition, the preprocessing itself can be executed at high speed because it only performs simple replacement. Furthermore, by executing the obtained new intermediate code in the execution system corresponding to the alternative instruction, the intermediate code can be executed at high speed.

【0099】そして、第3実施形態によれば、装置内に
複数の中間コード実行部を設ける一方、中間コード解析
部が、実行対象となる中間コードを解析することにより
当該中間コードの効率的実行に適切な中間コード実行部
を選択して記録する。したがって、その記録された中間
コード実行部を選択することにより、中間コードを高速
で実行することができる。また、中間コードに含まれる
各バイトコード命令と、各中間コード実行手段における
処理効率度のスコアの対応関係を記憶し、これに基づい
て中間コードの実行に利用する中間コード実行部を特定
する。したがって、各中間コード実行部の性質を考慮し
た細かな設定に基づいて、バイトコード命令の効率的実
行に適切な中間コード実行部を判断することが可能にな
る。
According to the third embodiment, while the plurality of intermediate code execution units are provided in the device, the intermediate code analysis unit analyzes the intermediate code to be executed to efficiently execute the intermediate code. Select and record the appropriate intermediate code execution part. Therefore, the intermediate code can be executed at high speed by selecting the recorded intermediate code execution unit. Further, the correspondence relation between each bytecode instruction included in the intermediate code and the score of the processing efficiency in each intermediate code executing means is stored, and based on this, the intermediate code executing unit used for executing the intermediate code is specified. Therefore, it is possible to determine the appropriate intermediate code execution unit for efficient execution of the bytecode instruction based on the fine setting in consideration of the property of each intermediate code execution unit.

【0100】また、第4実施形態によれば、中間コード
に含まれる各バイトコード命令と中間コード実行部にお
ける処理効率度スコアとの対応関係、およびスコアの範
囲とこれに応じて特定する中間コード実行部との対応関
係を記憶し、これらに基づいて、中間コードの実行に利
用する中間コード実行部を特定している。従って、準備
される中間コード実行部が多数に及ぶ場合でも、各中間
コード実行部毎の処理効率度スコアを設定、および積算
する必要がなくなるというメリットを享受できる。
Further, according to the fourth embodiment, the correspondence relationship between each bytecode instruction included in the intermediate code and the processing efficiency score in the intermediate code execution unit, and the range of the score and the intermediate code specified accordingly. The correspondence relation with the execution unit is stored, and the intermediate code execution unit used for executing the intermediate code is specified based on these. Therefore, even when the number of prepared intermediate code execution units is large, there is no need to set and accumulate the processing efficiency score of each intermediate code execution unit.

【0101】また、第5実施形態によれば、特殊中間コ
ード実行部と、一般中間コード実行部という2種類の中
間コード実行部を設け、特殊中間コード実行部が実行不
能なバイトコード命令を含む中間コードについてのみ一
般中間コード実行部に実行させる一方で、他の中間コー
ドは特殊中間コード実行部に実行させる。したがって、
特定の処理に特化した中間コード実行部と汎用的に利用
できる中間コード実行部との間で中間コードの出力先を
二者択一的に選択するといったケースにおいて、中間コ
ードの実行を極めて高速に実現するシステムを提供でき
る。
Further, according to the fifth embodiment, two types of intermediate code execution units, that is, a special intermediate code execution unit and a general intermediate code execution unit are provided, and the special intermediate code execution unit includes a bytecode instruction that cannot be executed. Only the intermediate code is executed by the general intermediate code execution unit, while the other intermediate code is executed by the special intermediate code execution unit. Therefore,
Execution of intermediate code is extremely fast in the case where the output destination of intermediate code is selectively selected between the intermediate code execution section specialized for specific processing and the general-purpose intermediate code execution section. It is possible to provide a system that realizes

【0102】そして、上記第6実施形態によれば、一部
の命令を実行することができないものの、メソッドに含
まれる特定の命令パターンを代替命令に置検して実行す
ることにより、命令問の冗長な処理を省いてメソッドを
高速に実行することができる第2のサブシステムと、メ
ソッド実行の高速化は図られていないものの、全命令を
実行することができる第1のサブシステムとを有効に運
用し、優れたパフォーマンスでクラスファイルを実行す
ることができる。
According to the sixth embodiment, although some of the instructions cannot be executed, a specific instruction pattern included in the method is inspected and executed as an alternative instruction to execute the instruction A second subsystem that can execute a method at high speed by omitting redundant processing and a first subsystem that can execute all instructions although speedup of method execution is not effective And can execute class files with excellent performance.

【0103】尚、本発明は、上記第1から第6実施形態
に限定されることなく、その目的の範囲内で種々の改良
・変更が可能である。例えば、上述した第3から第5の
実施形態では、当該中間コードに含まれるバイトコード
命令と当該バイトコード命令の効率的実行に適切な前記
中間コード実行部との対応関係を予め記憶した構成とし
た。しかし、これに限定されるものではなく、前記対応
関係を状況に応じて変化させるように構成してもよい。
また、インタープリタ機能の少なくとも一部をハードウ
ェアアクセラレータで実現することで、実行速度の高速
化を図ることもできる。このハードウェアアクセラレー
タを採用することには、メモリ要求量が増加せず、さら
に組み込み機器に適した方法が取れる等、種々の利点が
ある。
The present invention is not limited to the first to sixth embodiments described above, and various improvements and modifications can be made within the scope of the object thereof. For example, in the above-described third to fifth embodiments, the correspondence relationship between the bytecode instruction included in the intermediate code and the intermediate code execution unit suitable for efficient execution of the bytecode instruction is stored in advance. did. However, the present invention is not limited to this, and the correspondence may be changed according to the situation.
Further, by realizing at least a part of the interpreter function with a hardware accelerator, it is possible to increase the execution speed. Adopting this hardware accelerator has various advantages such as an increase in memory requirement and a method suitable for embedded devices.

【0104】[0104]

【発明の効果】本発明によれば、仮想計算機により実行
される中間コードに前処理を施すことで実行速度を向上
させる中間コード前処理装置、組み込み機器に好適に適
用することができ、中間コードを高速に処理することが
可能な中間コード実行システム、および中間コードに前
処理を施しまたは実行するコンピュータプログラムプロ
ダクトを提供することができる。
According to the present invention, the intermediate code executed by the virtual machine can be suitably applied to an intermediate code preprocessing device or an embedded device which improves the execution speed by preprocessing the intermediate code. It is possible to provide an intermediate code execution system capable of processing at high speed and a computer program product for preprocessing or executing the intermediate code.

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

【図1】本発明の第1実施形態に係る中間コード前処理
装置の構成を示すブロック図である。
FIG. 1 is a block diagram showing a configuration of an intermediate code preprocessing device according to a first embodiment of the present invention.

【図2】本発明の第1実施形態に係る中間コード前処理
装置により中間コードに前処理を施す過程を説明するた
めのフローチャートである。
FIG. 2 is a flowchart for explaining a process of performing preprocessing on the intermediate code by the intermediate code preprocessing device according to the first exemplary embodiment of the present invention.

【図3】本発明の第1実施形態に係る中間コード前処理
装置による中間コードと代替命令の関連付けを説明する
ための対応図である。
FIG. 3 is a correspondence diagram for explaining the association between the intermediate code and the alternative instruction by the intermediate code preprocessing device according to the first embodiment of the present invention.

【図4】本発明の第1実施形態に係る中間コード前処理
装置により中間コードに前処理を施す過程の各段階を説
明するための図である。
FIG. 4 is a diagram for explaining each step of a process of preprocessing an intermediate code by the intermediate code preprocessing device according to the first exemplary embodiment of the present invention.

【図5】本発明の第2実施形態に係る中間コード実行シ
ステムの構成を示すブロック図である。
FIG. 5 is a block diagram showing a configuration of an intermediate code execution system according to a second embodiment of the present invention.

【図6】本発明の第2実施形態に係る中間コード実行シ
ステムによる処理を説明するためのフローチャートであ
る。
FIG. 6 is a flowchart for explaining processing by the intermediate code execution system according to the second embodiment of the present invention.

【図7】本発明の第3実施形態に係る中間コード実行シ
ステムの構成を示すブロック図である。
FIG. 7 is a block diagram showing a configuration of an intermediate code execution system according to a third embodiment of the present invention.

【図8】本発明の第3実施形態に係る中間コード実行シ
ステムが採用する対応関係データベース13のデータ構
造図である。
FIG. 8 is a data structure diagram of a correspondence relation database 13 adopted by the intermediate code execution system according to the third embodiment of the present invention.

【図9】本発明の第3実施形態に係る中間コード実行シ
ステムにおける中間コード解析部20による動作を示す
フローチャートである。
FIG. 9 is a flowchart showing an operation of the intermediate code analysis unit 20 in the intermediate code execution system according to the third exemplary embodiment of the present invention.

【図10】本発明の第4実施形態に係る中間コード実行
システムが採用する対応関係データベース13のデータ
構造図である。
FIG. 10 is a data structure diagram of a correspondence database 13 adopted by the intermediate code execution system according to the fourth embodiment of the present invention.

【図11】本発明の第4実施形態に係る中間コード実行
システムが採用する対応関係データベース13のデータ
構造図である。
FIG. 11 is a data structure diagram of a correspondence database 13 adopted by the intermediate code execution system according to the fourth embodiment of the present invention.

【図12】本発明の第5実施形態に係る中間コード実行
システムの構成を示すブロック図である。
FIG. 12 is a block diagram showing the configuration of an intermediate code execution system according to a fifth embodiment of the present invention.

【図13】本発明の第5実施形態に係る中間コード実行
システムが採用する中間コード解析部20による動作を
示すフローチャートである。
FIG. 13 is a flowchart showing an operation by the intermediate code analysis unit 20 adopted by the intermediate code execution system according to the fifth embodiment of the present invention.

【図14】本発明の第6実施形態に係る中間コード実行
システムの構成を示すブロック図である。
FIG. 14 is a block diagram showing a configuration of an intermediate code execution system according to a sixth embodiment of the present invention.

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

1 中間コード前処理装置 2 中間コード実行システム 5 演算部 10 記憶部 12 クラスファイル 13 対応関係D/B 20 中間コード解析部 30 中間コード実行部 31 一般中間コード実行部 32 特殊中間コード実行部 101 記憶部 102 処理部 103 入力部 201 記憶部 202 処理部 203 入力部 1 Intermediate code preprocessor 2 Intermediate code execution system 5 computing section 10 memory 12 class files 13 Correspondence D / B 20 Intermediate code analysis unit 30 Intermediate code execution unit 31 General intermediate code execution unit 32 Special intermediate code execution unit 101 storage unit 102 processing unit 103 input section 201 storage 202 processing unit 203 Input section

Claims (18)

【特許請求の範囲】[Claims] 【請求項1】 所定のプログラム言語で作成されたソー
スコードをコンパイルして得られた中間コードに前処理
を施す中間コード前処理装置において、 前記中間コードを格納する記憶手段と、 前記記憶手段に格納された中間コードに含まれる複数の
命令からなる特定の命令パターンを、予め前記特定の命
令パターンと関連付けられた代替命令に置換する処理手
段とを具備することを特徴とする中間コード前処理装
置。
1. An intermediate code preprocessing device for preprocessing an intermediate code obtained by compiling a source code created in a predetermined programming language, comprising: storage means for storing the intermediate code; and storage means for storing the intermediate code. An intermediate code preprocessing device, comprising: a processing unit that replaces a specific instruction pattern made up of a plurality of instructions included in the stored intermediate code with an alternative instruction that is associated with the specific instruction pattern in advance. .
【請求項2】 前記所定のプログラム言語はJava
(R)言語であり、前記中間コードはJava(R)ク
ラスファイルであることを特徴とする請求項1に記載の
中間コード前処理装置。
2. The predetermined programming language is Java
The intermediate code preprocessing device according to claim 1, wherein the intermediate code is a (R) language, and the intermediate code is a Java (R) class file.
【請求項3】 所定のプログラム言語で作成されたソー
スコードをコンパイルして得られた中間コードを実行す
る中間コード実行システムであって、 前記中間コードを格納する記憶手段と、 処理手段とを具備し、 前記処理手段が、 a)前記記憶手段に格納された中間コードに含まれる複
数の命令からなる特定の命令パターンを、予め前記特定
の命令パターンと関連付けられた代替命令に置換する処
理と、 b)前記特定の命令パターンが前記代替命令に置換され
た中間コードを逐次的に解釈して実行するにあたり、前
記代替命令を前記特定の命令パターンと実質的に同等の
処理に解釈して実行する処理とを実行することを特徴と
する中間コード実行システム。
3. An intermediate code execution system for executing an intermediate code obtained by compiling a source code created in a predetermined programming language, comprising a storage means for storing the intermediate code and a processing means. Then, the processing means: a) processing for replacing a specific instruction pattern made up of a plurality of instructions included in the intermediate code stored in the storage means with an alternative instruction previously associated with the specific instruction pattern; b) When sequentially interpreting and executing the intermediate code in which the specific instruction pattern is replaced by the alternative instruction, interpreting and executing the alternative instruction in a process substantially equivalent to the specific instruction pattern. An intermediate code execution system characterized by executing processing and.
【請求項4】 所定のプログラム言語で作成されたソー
スコードをコンパイルして得られた中間コードを実行す
る中間コード実行システムにおいて、 前記中間コードを実行する複数の中間コード実行手段
と、 前記中間コードを記憶すると共に、当該中間コードに含
まれる命令と当該命令の効率的実行に適切な前記中間コ
ード実行手段との対応関係を記憶した記憶手段と、 中間コード解析手段とを具備し、 前記中間コード解析手段が、 a)前記記憶手段に格納された中間コードに含まれる命
令を特定する処理と、 b)特定された命令と前記対応関係とに基づいて、前記
中間コードの効率的実行に適切な中間コード実行手段を
特定する処理と、 c)前記中間コードと特定された中間コード実行手段と
の関係を記録する処理とを実行することを特徴とする中
間コード実行システム。
4. An intermediate code execution system for executing intermediate code obtained by compiling source code created in a predetermined programming language, a plurality of intermediate code executing means for executing the intermediate code, and the intermediate code. And an intermediate code analyzing means for storing a correspondence relationship between an instruction included in the intermediate code and the intermediate code executing means suitable for efficient execution of the instruction. Analysis means: a) processing for identifying an instruction included in the intermediate code stored in the storage means; and b) suitable for efficient execution of the intermediate code based on the identified instruction and the correspondence relationship. Performing a process of specifying the intermediate code executing unit, and c) executing a process of recording the relationship between the intermediate code and the specified intermediate code executing unit. The intermediate code execution system according to symptoms.
【請求項5】 前記記憶手段における命令と当該命令の
効率的実行に適切な中間コード実行手段との対応関係
は、各命令を前記中間コード実行手段のそれぞれで実行
した場合の処理効率度のスコアテーブルを含み、 前記b)の処理は、 b1)前記スコアテーブルに基づいて、特定された命令
を前記中間コード実行手段のそれぞれで実行した場合の
処理効率度のスコアを取得する処理と、 b2)取得されたスコアを中間コード実行手段ごとに合
計する処理と、 b3)中間コード実行手段ごとに合計されたスコアに基
づいて、前記中間コードの実行に用いる前記中間コード
実行手段を特定する処理とを含むことを特徴とする請求
項4に記載の中間コード実行システム。
5. The correspondence between the instruction in the storage means and the intermediate code execution means suitable for efficient execution of the instruction is a score of processing efficiency when each instruction is executed by each of the intermediate code execution means. Including a table, the process of b) includes: b1) a process of acquiring a score of processing efficiency when the specified instruction is executed by each of the intermediate code executing means based on the score table; and b2) A process of summing the acquired scores for each intermediate code execution unit, and a process of specifying the intermediate code execution unit used for executing the intermediate code based on the score summed for each intermediate code execution unit. The intermediate code execution system according to claim 4, comprising:
【請求項6】 前記記憶手段における命令と当該命令の
効率的実行に適切な中間コード実行手段との対応関係
は、各命令に割り当てられたポイントの値と、前記中間
コード実行手段のそれぞれに対応した前記ポイントの合
計値の範囲とを含み、 前記b)の処理は、 b1)前記対応関係に基づいて、特定された命令のポイ
ントを取得する処理と、 b2)取得されたポイントの合計値を求める処理と、 b3)前記対応関係および求められた合計値に基づい
て、前記中間コードの実行に用いる前記中間コード実行
手段を特定する処理とを含むことを特徴とする請求項4
に記載の中間コード実行システム。
6. The correspondence relationship between the instruction in the storage means and the intermediate code execution means suitable for efficient execution of the instruction corresponds to the value of the point assigned to each instruction and each of the intermediate code execution means. And a range of the total value of the points, the process of b), b1) a process of acquiring the point of the specified instruction based on the correspondence, and b2) a total value of the acquired points. 5. A process for obtaining, and b3) a process for specifying the intermediate code executing means used for executing the intermediate code based on the correspondence relationship and the obtained total value.
The intermediate code execution system described in.
【請求項7】 所定のプログラム言語で作成されたソー
スコードをコンパイルして得られた中間コードを実行す
る中間コード実行システムにおいて、 全ての命令を実行可能な一般中間コード実行手段と、 一部の命令のみを実行可能な特殊中間コード実行手段
と、 中間コードが格納された記憶手段と、 中間コード解析手段とを具備し、 前記中間コード解析手段が、 a)前記記憶手段に格納された中間コードを解析し、前
記中間コードに含まれる命令に前記特殊中間コード実行
手段が実行不能な命令が含まれないかを判定する処理
と、 b)前記実行不能な命令が含まれないと判定したときに
は、前記中間コードを前記特殊中間コード実行手段で実
行すべきことを記録し、前記実行不能な命令が含まれる
と判定したときには、前記中間コードを前記一般中間コ
ード実行手段で実行すべきことを記録する処理とを実行
することを特徴とする中間コード実行システム。
7. An intermediate code execution system for executing all instructions in an intermediate code execution system for executing an intermediate code obtained by compiling source code created in a predetermined programming language, and a part of the general intermediate code execution means. A special intermediate code execution means capable of executing only instructions, a storage means storing the intermediate code, and an intermediate code analysis means, wherein the intermediate code analysis means is a) the intermediate code stored in the storage means And analyzing whether the instruction included in the intermediate code includes an instruction that the special intermediate code execution means cannot execute, and b) when determining that the instruction cannot be executed, When it is determined that the intermediate code is to be executed by the special intermediate code executing means, and it is determined that the unexecutable instruction is included, the intermediate code is stored. The intermediate code execution system and executes a process of recording should be performed in serial general intermediate code execution unit.
【請求項8】 前記所定のプログラム言語はJava
(R)言語であり、前記中間コードはJava(R)ク
ラスファイルであることを特徴とする請求項3から請求
項7のいずれか1項に記載の中間コード実行システム。
8. The predetermined programming language is Java
The intermediate code execution system according to claim 3, wherein the intermediate code is a (R) language, and the intermediate code is a Java (R) class file.
【請求項9】 所定のプログラム言語で作成されたソー
スコードをコンパイルして得られた中間コードをインタ
ープリタ方式で実行する中間コード実行システムにおい
て、 中間コードが格納された記憶手段と、 前記記憶手段に格納された中間コードに、当該中間コー
ドに含まれる特定の命令パターンを、予め前記特定の命
令パターンと関連付けられた代替命令に置換する処理を
施す前処理手段と、 前記代替命令を解釈して実行することができない第1の
インタープリタと、 前記代替命令を置換前の命令パターンと同等の内容に解
釈して実行することができる第2のインタープリタと、 前記前処理手段により処理された中間コードを解析し、
当該中間コードに前記代替命令が含まれているか否かを
判定し、前記代替命令が含まれている場合には当該中間
コードを前記第1のインタープリタで実行すべきことを
記録し、前記代替命令が含まれていない場合には当該中
間コードを前記第2のインタープリタで実行すべきこと
を記録する中間コード解析手段とを具備することを特徴
とする中間コード実行システム。
9. An intermediate code execution system for executing an intermediate code obtained by compiling a source code created in a predetermined programming language by an interpreter method, in a storage means storing the intermediate code, and in the storage means. Preprocessing means for replacing the stored intermediate code with a specific instruction pattern included in the intermediate code with an alternative instruction previously associated with the specific instruction pattern; and interpreting and executing the alternative instruction. A first interpreter that cannot perform the above, a second interpreter that can interpret and execute the alternative instruction in a content equivalent to the instruction pattern before replacement, and an intermediate code processed by the preprocessing means Then
It is determined whether or not the intermediate code includes the alternative instruction, and if the intermediate instruction is included, it is recorded that the intermediate code is to be executed by the first interpreter, and the alternative instruction is included. Is included, an intermediate code analysis system for recording that the intermediate code should be executed by the second interpreter.
【請求項10】 所定のプログラム言語で作成されたソ
ースコードをコンパイルして得られた中間コードをイン
タープリタ方式で実行する中間コード実行システムにお
いて、 コンパイルにより生成される命令の全てを解釈して実行
することができる第1のインタープリタを有する第1の
サブシステムと、 中間コードに含まれる複数の命令からなる命令パターン
を代替命令に置換する前処理を施す前処理部と、当該代
替命令を置換前の命令コードと実質的に同等の内容に解
釈して実行することができる第2のインタープリタと、
を有する第2のサブシステムと、 実行する中間コードに応じて、前記第1のサブシステム
において前記第1のインタープリタにより中間コードを
実行する処理と、前記第2のサブシステムにおいて前記
前処理部により中間コードに前処理を施してから前記第
2のインタープリタで実行する処理とのいずれか一方を
選択する選択部とを具備することを特徴とする中間コー
ド実行システム。
10. In an intermediate code execution system for executing an intermediate code obtained by compiling a source code created in a predetermined programming language by an interpreter method, all the instructions generated by the compilation are interpreted and executed. A first subsystem having a first interpreter capable of performing the preprocessing, a preprocessing unit that performs a preprocessing that replaces an instruction pattern including a plurality of instructions included in the intermediate code with an alternative instruction, and A second interpreter capable of interpreting and executing substantially the same content as the instruction code;
A second subsystem having: and a process of executing the intermediate code by the first interpreter in the first subsystem according to an intermediate code to be executed, and a process by the preprocessing unit in the second subsystem. An intermediate code execution system comprising: a selection unit that selects one of a process to be executed by the second interpreter after preprocessing the intermediate code.
【請求項11】 前記第2のサブシステムは、前記第1
のサブシステムにおいて特定の命令が割り付けられてい
るオペコードに代替命令を割り付けており、 前記選択部は、実行する中間コードに前記特定の命令が
含まれている場合には前記第1のサブシステムによる処
理を選択し、実行する中間コードに前記特定の命令が含
まれていない場合には前記第2のサブシステムによる処
理を選択することを特徴とする請求項10に記載の中間
コード実行システム。
11. The second subsystem is the first subsystem.
The alternative instruction is assigned to the operation code to which the specific instruction is assigned in the subsystem of, and the selecting unit uses the first subsystem when the intermediate instruction to be executed includes the specific instruction. 11. The intermediate code execution system according to claim 10, wherein a process is selected, and when the intermediate code to be executed does not include the specific instruction, the process by the second subsystem is selected.
【請求項12】 所定のプログラム言語で作成されたソ
ースコードをコンパイルして得られた中間コードを実行
する中間コード実行システムであって、 中間コードに含まれる複数の命令からなる第1の命令パ
ターンを第1の代替命令に置換する前処理を施す前処理
部と、当該第1の代替命令を置換前の命令コードと実質
的に同等の内容に解釈して実行することができる第1の
インタープリタとを有する第1のサブシステムと、 中間コードに含まれる第2の命令パターンを第2の代替
命令に置換する前処理を施す前処理部と、当該第2の代
替命令を置換前の命令コードと実質的に同等の内容に解
釈して実行することができる第2のインタープリタとを
有する第2のサブシステムと、 実行する中間コードに応じて、前記第1のサブシステム
において前記第1のインタープリタにより中間コードを
実行する処理と、前記第2のサブシステムにおいて前記
前処理部により中間コードに前処理を施してから前記第
2のインタープリタで実行する処理とのいずれか一方を
選択する選択部とを具備することを特徴とする中間コー
ド実行システム。
12. An intermediate code execution system for executing an intermediate code obtained by compiling a source code created in a predetermined programming language, the first instruction pattern consisting of a plurality of instructions included in the intermediate code. With a first alternative instruction, and a first interpreter capable of interpreting and executing the first alternative instruction into contents substantially equivalent to the instruction code before replacement. A pre-processing unit for performing pre-processing for replacing a second instruction pattern included in the intermediate code with a second alternative instruction, and an instruction code before replacement of the second alternative instruction A second subsystem having a second interpreter capable of being interpreted and executed as a content substantially equivalent to that of the first subsystem, and the second subsystem having the second subsystem according to the intermediate code to be executed. Either executing the intermediate code by the first interpreter or executing the intermediate code by the second interpreter after preprocessing the intermediate code by the preprocessing unit in the second subsystem. An intermediate code execution system, comprising: a selection unit for selecting.
【請求項13】 前記第1のサブシステムは前記第1の
代替命令を第1のオペコードに割り付けており、前記第
2のサブシステムは前記第2の代替命令を第2のオペコ
ードに割り付けており、 上記選択部は、実行する中間コードが第1のオペコード
に係る命令を含んでいる場合には第2のサブシステムに
よる処理を選択し、実行する中間コードが第2のオペコ
ードに係る命令を含んでいる場合には第1のサブシステ
ムによる処理を選択することを特徴とする請求項12に
記載の中間コード実行システム。
13. The first subsystem assigns the first alternative instruction to a first opcode and the second subsystem assigns the second alternative instruction to a second opcode. The selecting unit selects the process by the second subsystem when the intermediate code to be executed includes the instruction related to the first opcode, and the intermediate code to be executed includes the instruction related to the second opcode. 13. The intermediate code execution system according to claim 12, wherein the process by the first subsystem is selected when the intermediate code execution system exits.
【請求項14】 前記所定のプログラム言語はJava
(R)言語であり、前記中間コードはJava(R)ク
ラスファイルであって、前記命令はJava(R)バイ
トコード命令であることを特徴とする請求項10から請
求項13のいずれか1項に記載の中間コード実行システ
ム。
14. The predetermined programming language is Java
14. The (R) language, the intermediate code is a Java (R) class file, and the instruction is a Java (R) bytecode instruction. The intermediate code execution system described in.
【請求項15】 所定のプログラム言語で作成されたソ
ースコードをコンパイルして得られた中間コードに前処
理を施す中間コード前処理プログラムであって、処理手
段に、前記中間コードに含まれる特定の命令パターン
を、予め前記特定の命令パターンと関連付けられた代替
命令に置換する処理を実行させることを特徴とする中間
コード前処理プログラム。
15. An intermediate code preprocessing program for preprocessing an intermediate code obtained by compiling a source code created in a predetermined programming language, wherein the processing means specifies a specific code included in the intermediate code. An intermediate code preprocessing program that executes a process of replacing an instruction pattern with an alternative instruction previously associated with the specific instruction pattern.
【請求項16】 前記所定のプログラム言語はJava
(R)言語であり、前記中間コードはJava(R)バ
イトコード命令を含むクラスファイルであることを特徴
とする請求項15に記載の中間コード前処理プログラ
ム。
16. The predetermined programming language is Java
16. The intermediate code preprocessing program according to claim 15, wherein the intermediate code is a (R) language, and the intermediate code is a class file including a Java (R) bytecode instruction.
【請求項17】 所定のプログラム言語で作成されたソ
ースコードをコンパイルして得られた中間コードを実行
する中間コード実行プログラムであって、 処理手段に、 a)中間コードに含まれる複数の命令からなる特定の命
令パターンを、予め前記特定の命令パターンと関連付け
られた代替命令に置換する処理と、 b)前記特定の命令パターンが前記代替命令に置換され
た中間コードを解釈して実行するにあたり、前記代替命
令を前記特定の命令パターンと実質的に同等かつ冗長性
の低い処理に解釈して実行する処理とを実行させること
を特徴とする中間コード実行プログラム。
17. An intermediate code execution program for executing an intermediate code obtained by compiling a source code created in a predetermined programming language, the processing means comprising: a) a plurality of instructions included in the intermediate code. Replacing the specific instruction pattern with an alternative instruction previously associated with the specific instruction pattern, and b) interpreting and executing the intermediate code in which the specific instruction pattern is replaced with the alternative instruction, An intermediate code execution program that executes a process of interpreting the alternative instruction as a process substantially equivalent to the specific command pattern and having low redundancy and executing the process.
【請求項18】 前記所定のプログラム言語はJava
(R)言語であり、上記中間コードはJava(R)バ
イトコード命令を含むクラスファイルであることを特徴
とする請求項17に記載の中間コード実行プログラム。
18. The predetermined programming language is Java
The intermediate code execution program according to claim 17, wherein the intermediate code is a (R) language, and the intermediate code is a class file including a Java (R) bytecode instruction.
JP2002314986A 2001-10-31 2002-10-29 Intermediate code execution system Expired - Fee Related JP4234976B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002314986A JP4234976B2 (en) 2001-10-31 2002-10-29 Intermediate code execution system

Applications Claiming Priority (5)

Application Number Priority Date Filing Date Title
JP2001334823 2001-10-31
JP2001-334825 2001-10-31
JP2001-334823 2001-10-31
JP2001334825 2001-10-31
JP2002314986A JP4234976B2 (en) 2001-10-31 2002-10-29 Intermediate code execution system

Publications (2)

Publication Number Publication Date
JP2003202995A true JP2003202995A (en) 2003-07-18
JP4234976B2 JP4234976B2 (en) 2009-03-04

Family

ID=27670249

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002314986A Expired - Fee Related JP4234976B2 (en) 2001-10-31 2002-10-29 Intermediate code execution system

Country Status (1)

Country Link
JP (1) JP4234976B2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006302272A (en) * 2005-04-21 2006-11-02 Samsung Electronics Co Ltd Method and device for executing instruction in java virtual machine
JP2007141153A (en) * 2005-11-22 2007-06-07 Hitachi Software Eng Co Ltd Interpreter
JP2016151914A (en) * 2015-02-18 2016-08-22 大日本印刷株式会社 Electronic information storage medium, application replacement method, and program
GB2560410A (en) * 2017-01-06 2018-09-12 Google Llc Loop and library fusion

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006302272A (en) * 2005-04-21 2006-11-02 Samsung Electronics Co Ltd Method and device for executing instruction in java virtual machine
JP2007141153A (en) * 2005-11-22 2007-06-07 Hitachi Software Eng Co Ltd Interpreter
JP2016151914A (en) * 2015-02-18 2016-08-22 大日本印刷株式会社 Electronic information storage medium, application replacement method, and program
GB2560410A (en) * 2017-01-06 2018-09-12 Google Llc Loop and library fusion

Also Published As

Publication number Publication date
JP4234976B2 (en) 2009-03-04

Similar Documents

Publication Publication Date Title
US7213237B2 (en) Intermediate code preprocessing apparatus, intermediate code execution apparatus, intermediate code execution system, and computer program product for preprocessing or executing intermediate code
US7343482B2 (en) Program subgraph identification
JP3816961B2 (en) Data processing apparatus for processing virtual machine instructions
JP4018158B2 (en) Variable instruction set computer
EP1728155B1 (en) Method and system for performing link-time code optimization without additional code analysis
US7926046B2 (en) Compiler method for extracting and accelerator template program
JP3311462B2 (en) Compile processing unit
US6973644B2 (en) Program interpreter
US7350055B2 (en) Tightly coupled accelerator
US20160041816A1 (en) Systems and methods for mobile applications
JP3178403B2 (en) Program conversion method, program conversion device, and storage medium storing program conversion program
US20040255279A1 (en) Block translation optimizations for program code conversation
WO2013165461A1 (en) Recompiling with generic to specific replacement
WO2007017456A1 (en) Adaptive process dispatch in a computer system having a plurality of processors
KR20050075647A (en) Method for improving performance of java virtual machine and system employing the method
US8752056B2 (en) Running native code across single or multi-core hybrid processor achitecture
CN112882718B (en) Compiling processing method, device, equipment and storage medium
EP1283465A2 (en) Transforming &amp; caching computer programs
US20010042241A1 (en) Apparatus and method for executing program using just-in time-compiler system
JP2003202995A (en) Intermediate code preprocessing apparatus, intermediate code execution system, intermediate code preprocessing program and intermediate code execution program
US7698534B2 (en) Reordering application code to improve processing performance
JP2004240953A (en) Computer system, its simultaneous multithreading method, and cache controller system
McKevitt et al. New options from big chips
Brandner et al. Embedded JIT compilation with CACAO on YARI
US7028292B1 (en) Program executing apparatus, control method therefor, and storage medium for interpreting and executing intermediate codes

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050810

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20080227

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20080513

A521 Written amendment

Effective date: 20080711

Free format text: JAPANESE INTERMEDIATE CODE: A523

A02 Decision of refusal

Effective date: 20080819

Free format text: JAPANESE INTERMEDIATE CODE: A02

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20081020

A911 Transfer of reconsideration by examiner before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20081023

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

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)

Effective date: 20081212

Free format text: JAPANESE INTERMEDIATE CODE: A61

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

Year of fee payment: 3

Free format text: PAYMENT UNTIL: 20111219

R150 Certificate of patent (=grant) or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Year of fee payment: 4

Free format text: PAYMENT UNTIL: 20121219

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

Free format text: PAYMENT UNTIL: 20131219

Year of fee payment: 5

LAPS Cancellation because of no payment of annual fees