JP2006195644A - Device and method for executing virtual machine - Google Patents

Device and method for executing virtual machine Download PDF

Info

Publication number
JP2006195644A
JP2006195644A JP2005005322A JP2005005322A JP2006195644A JP 2006195644 A JP2006195644 A JP 2006195644A JP 2005005322 A JP2005005322 A JP 2005005322A JP 2005005322 A JP2005005322 A JP 2005005322A JP 2006195644 A JP2006195644 A JP 2006195644A
Authority
JP
Japan
Prior art keywords
virtual machine
class
runtime
execution
storage device
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.)
Withdrawn
Application number
JP2005005322A
Other languages
Japanese (ja)
Inventor
Masanobu Fujihira
雅信 藤平
Toshihiko Nishimura
利彦 西村
Nobuyuki Odera
信行 大寺
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.)
Kobe Steel Ltd
Original Assignee
Kobe Steel Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kobe Steel Ltd filed Critical Kobe Steel Ltd
Priority to JP2005005322A priority Critical patent/JP2006195644A/en
Publication of JP2006195644A publication Critical patent/JP2006195644A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To speed up arithmetic processing in execution of a virtual machine, while simplifying the configuration. <P>SOLUTION: In the virtual machine execution device adapted to load an intermediate cord from a secondary storage to a main storage followed by execution, a virtual machine engine includes a class sequence including a class the intermediate code of which is loaded to the main storage, and a run-time sequence including a runtime storing information in execution. Each class includes a method member having a method describing processing procedure information including an operation code and a field member. When the intermediate code is loaded to the main storage, the address of the operation code contained in the method is expressed by the address of the main storage and stored in the data area of each class. The runtime includes a local variable area storing variables and a stack area temporarily storing a calculation result in processing including an operand, and the operand stored in the stack area is expressed by the corresponding data format and value form. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

本発明は、計算機のハードウェアアーキテクチャに依存しない中間コードを実行し、例えばJava仮想マシンなどの仮想マシンを実行する仮想マシン実行装置及び方法に関する。   The present invention relates to a virtual machine execution apparatus and method for executing an intermediate code independent of a hardware architecture of a computer and executing a virtual machine such as a Java virtual machine.

中間コード方式とは、人間が理解できる表面言語から機械が理解できる実行コードへ変換し実行するまでにおいて、一旦予め定められたコード体系である中間コードへ変換し、実行時は実行処理モジュールが中間コードを読み込み解釈しながら処理を実現していく方式である。これらの技術は、Java技術の出現によって一般的なものとなった(ここで、JavaはSun Microsystems社の登録商標である。)。中間コード実行装置を「仮想マシン」と呼び、中間コードをまた「バイトコード」と呼ぶこともある。   The intermediate code method converts from a surface language that can be understood by humans to an executable code that can be understood by a machine, and then converts it into an intermediate code that is a predetermined code system. This is a method that implements processing while reading and interpreting code. These technologies have become commonplace with the advent of Java technology (where Java is a registered trademark of Sun Microsystems). The intermediate code execution device is sometimes called a “virtual machine”, and the intermediate code is sometimes called a “byte code”.

非特許文献1では、Java仮想マシンの仕様について説明しており、非特許文献1の第6章ではバイトコードの命令セットを定義している。例えば算術命令に関しては、加算では(iadd/ladd/fadd/dadd)、乗算では(imul/lmul/fmul/dmul)といった命令を用意している。このように整数と浮動小数点数に対する命令では、オーバーフロー及びゼロ除算の際における振る舞いが異なるため、従来の仮想マシンでは、それぞれに対して命令を用意する。   Non-Patent Document 1 describes the specifications of a Java virtual machine, and Chapter 6 of Non-Patent Document 1 defines a bytecode instruction set. For example, regarding arithmetic instructions, instructions such as (iadd / ladd / fadd / dadd) are provided for addition, and (imul / lmul / fmul / dmul) are provided for multiplication. As described above, since instructions for integers and floating-point numbers have different behaviors in overflow and division by zero, the conventional virtual machine prepares instructions for each.

また、中間コード方式によって異なる種類の計算機に対して同一のプログラムを配信することを可能とする。ワークステーションやパソコンなど、強力な処理能力を持つCPU及び充分なメモリを搭載した計算機がある一方、組込みシステムなどのように処理能力の劣るCPU及び限られたメモリを搭載した計算機でも利用される。また、仮想マシンなどの中間コード実行装置は多くの場合、インタプリタ方式で実現されており、実行速度はネイティブコードによる実行速度と比較して遅いという問題点があった。   Further, the same program can be distributed to different types of computers depending on the intermediate code system. While some computers such as workstations and personal computers have powerful processing capability and computers with sufficient memory, they are also used in CPUs with inferior processing capability and computers with limited memory, such as embedded systems. Further, in many cases, an intermediate code execution device such as a virtual machine is realized by an interpreter method, and there is a problem that an execution speed is slower than an execution speed by a native code.

この問題点に対して、特許文献1では、「限られたリソースにおいて高速にJavaのバイトコードを実行可能とするコンパイラを提供するために、バイトコードを、各バイトコードに対応する処理ルーチンのアドレスをオペコードとする中間コードに変換し、中間コードの順番に処理ルーチンを実行し、この時中間コードを固定長にし、その中でオペコードのビット位置も固定する。また処理ルーチンを、メモリ上の連続領域に配置し、オペコードには処理ルーチン群104の先頭アドレスからのオフセットを用いる。さらに、CPUのパイプラインの空きを利用して、中間コードのための本来の処理に並行して、次の中間コードの処理ルーチンにジャンプするための命令群の一部(オペランドの生成及びジャンプ)、及び次の次の中間コードの処理ルーチンにジャンプするための命令群の一部(中間コードのプリフェッチと処理ルーチンのアドレス計算)を実行する。」すなわち、特許文献1に開示された装置(以下、第1の従来例という。)では、中間コード列をロード時に高速実行可能な内部中間コード列に変換することで高速化しており、具体的には、ロード時の中間コード変換処理により、各命令に対して、該当する命令実行モジュールの基準アドレスからのオフセットを算出し変換する。そして実行時には取得オフセットと基準アドレスを加算し、命令実行モジュール開始アドレスを算出する。   In order to solve this problem, Japanese Patent Application Laid-Open No. 2005-228561 discloses that “in order to provide a compiler capable of executing Java bytecode at high speed with limited resources, the bytecode is an address of a processing routine corresponding to each bytecode. Is converted to an intermediate code having an operation code, and the processing routine is executed in the order of the intermediate code, and at this time, the intermediate code is set to a fixed length, and the bit position of the operation code is also fixed therein. The offset from the start address of the processing routine group 104 is used for the operation code, and the next intermediate is used in parallel with the original processing for the intermediate code by utilizing the CPU pipeline free space. Part of the instruction group for jumping to the code processing routine (operand generation and jump), and the next intermediate code A part of the instruction group for jumping to the processing routine of the host (execution of prefetch of intermediate code and address calculation of the processing routine) is executed. ”That is, the device disclosed in Patent Document 1 (hereinafter referred to as the first conventional example) )), The intermediate code string is converted to an internal intermediate code string that can be executed at the time of loading at a high speed. Specifically, the intermediate code conversion process at the time of loading corresponds to each instruction. An offset from the reference address of the instruction execution module is calculated and converted. At the time of execution, the obtained offset and the reference address are added to calculate the instruction execution module start address.

また、特許文献2では、「計算機のハードウェアアーキテクチャに依存しない中間コードを実行する中間コード実行装置において、中間コードの実行を高速化しながら、中央処理装置のレジスタを高速化目的に使用することを避け、なおかつ使用記憶領域の増加を抑制するために、入力された中間コード列中の各命令を、直前命令実行モジュール終端アドレスから当該命令実行モジュール開始アドレスへの相対アドレスに置換する置換手段により内部中間コード列を用意しておき、前記相対アドレスの取得手段と、前記相対アドレスを用いる相対ジャンプ手段により内部中間コードを順次実行すること」を特徴としている。すなわち、特許文献2に開示された中間コード実行装置(以下、第2の従来例という。)においては、各モジュールの開始アドレス及び終了アドレスのテーブルを持たせ、現在モジュールから次期モジュールへ移行する場合、現在モジュールの終了アドレス及び次期モジュールの開始アドレスから、相対アドレスを算出し、相対ジャンプをすることによって、次期モジュールへ移動する。   Further, Patent Document 2 states that “in an intermediate code execution device that executes intermediate code that does not depend on the hardware architecture of a computer, the execution of the intermediate code is accelerated while the register of the central processing unit is used for the purpose of speeding up. In order to avoid the increase in the storage area to be used and to prevent an increase in the used storage area, each instruction in the input intermediate code string is internally replaced by a replacement means that replaces the instruction execution module end address with the relative address from the instruction execution module end address. An intermediate code string is prepared, and the internal intermediate code is sequentially executed by the relative address acquisition unit and the relative jump unit using the relative address. That is, the intermediate code execution device disclosed in Patent Document 2 (hereinafter referred to as the second conventional example) has a table of the start address and end address of each module, and shifts from the current module to the next module. Then, a relative address is calculated from the end address of the current module and the start address of the next module, and a relative jump is performed to move to the next module.

さらに、特許文献3では、「共通のアルゴリズムに基づく異なったデータ型に対する計算を、同一の実行プログラムで実行することができる情報処理装置を提供するために、演算を行うデータのデータ型を指示するレジスタと、当該レジスタにデータ型を設定する手段を有し、複数のデータ型のうちの少なくとも1つに対して共通の命令手段を持ち、当該命令手段と上記レジスタの内容に対応させてそれぞれのデータ型の演算を行うことにより、共通のアルゴリズムに基づく異なったデータ型に対する計算を同一の実行プログラムで実行すること」を特徴としている。すなわち、特許文献3に開示された情報処理装置(以下、第3の従来例という。)では、高級言語によるソースプログラムを機械語プログラムに変換して出力するコンパイラ装置においてレジスタを用意することにより、コンパイラ装置自体を簡素化している。   Further, in Patent Document 3, “in order to provide an information processing apparatus capable of executing calculations for different data types based on a common algorithm with the same execution program, the data type of data to be operated is indicated. A register and a means for setting a data type in the register, a common instruction means for at least one of the plurality of data types, and corresponding to the contents of the instruction means and the register By performing data type operations, calculations for different data types based on a common algorithm are executed by the same execution program ”. That is, in the information processing apparatus disclosed in Patent Document 3 (hereinafter, referred to as a third conventional example), by preparing a register in a compiler apparatus that converts a high-level language source program into a machine language program and outputs it, The compiler device itself is simplified.

特開平11−175349号公報。Japanese Patent Laid-Open No. 11-175349. 特開2003−216443号公報。JP2003-216443. 特開昭60−169944号公報。Japanese Patent Laid-Open No. 60-169944. ティム・リンドホルムほか著,村上雅章訳,「Java仮想マシン仕様第2版」,ピアソン・エデュケーション,2001年5月発行。Published by Tim Lindholm et al., Translated by Masaaki Murakami, “Java Virtual Machine Specification 2nd Edition”, Pearson Education, May 2001.

整数と浮動小数点数とでは振る舞いが異なることから、Java仮想マシンをはじめとして、従来技術に係る中間コード実行装置では、それぞれに対して命令を用意している。加算・減算・乗算・除算・剰余・符号反転など、あらゆる算術命令に対して、データ型に対応した命令セットを必要とするため、テーブルサイズが膨れ上がり、中間コード実行装置をコンパクトなものとすることが困難であった。第1の従来例に開示されている手法では、実行時に基準アドレスと取得されているオフセットを加算し、命令実行モジュール開始アドレスを算出する必要がある。従って、実行時に依然として演算処理を必要とするという問題点があった。   Since the behavior differs between an integer and a floating-point number, an intermediate code execution device according to the prior art including a Java virtual machine prepares an instruction for each. An instruction set corresponding to the data type is required for all arithmetic instructions such as addition, subtraction, multiplication, division, remainder, and sign inversion, so the table size increases and the intermediate code execution device is made compact. It was difficult. In the technique disclosed in the first conventional example, it is necessary to calculate the instruction execution module start address by adding the reference address and the acquired offset at the time of execution. Therefore, there has been a problem that it still requires arithmetic processing at the time of execution.

また、第2の従来例に係る中間コード実行装置においては、実行速度を高速化するための技術が開示されているが、上述のように、各モジュールの開始アドレス及び終了アドレスのテーブルを持たせ、現在モジュールから次期モジュールへ移行する場合、現在モジュールの終了アドレス及び次期モジュールの開始アドレスから、相対アドレスを算出し、相対ジャンプをすることによって、次期モジュールへ移動しているために、いまだ実行速度を大幅に向上できないという問題点があった。さらに、第3の従来例に係る情報処理装置においては、コンパイラの構成を簡素化できるが、インタプリタ型の仮想マシンの構成を簡素化できないという問題点があった。   In addition, in the intermediate code execution device according to the second conventional example, a technique for increasing the execution speed is disclosed, but as described above, a table of the start address and end address of each module is provided. When moving from the current module to the next module, the relative speed is calculated from the end address of the current module and the start address of the next module, and the relative speed is used to move to the next module. There was a problem that could not be improved significantly. Furthermore, in the information processing apparatus according to the third conventional example, the configuration of the compiler can be simplified, but the configuration of the interpreter type virtual machine cannot be simplified.

本発明の目的は以上の問題点を解決し、従来技術に比較して、仮想マシンの実行時の演算処理を高速化できる仮想マシン実行装置及び方法を提供することにある。   An object of the present invention is to provide a virtual machine execution apparatus and method that can solve the above problems and can speed up the arithmetic processing at the time of execution of the virtual machine as compared with the prior art.

また、本発明の別の目的は以上の問題点を解決し、従来技術に比較して、仮想マシンの構成を簡素化できる仮想マシン実行装置及び方法を提供することにある。   Another object of the present invention is to provide a virtual machine execution apparatus and method capable of solving the above-described problems and simplifying the configuration of the virtual machine as compared with the prior art.

第1の発明に係る仮想マシン実行装置は、中間コードを二次記憶装置から主記憶装置にロードして実行する仮想マシン実行装置において、
中間コードを主記憶装置にロードされた少なくとも1つのクラスを有するクラス配列と、実行時の情報を格納する少なくとも1つのランタイムを有するランタイム配列とを含む仮想マシンエンジンを備え、
上記クラスは、オペコードを含む処理手順情報を記述した少なくとも1つのメソッドを有するメソッドメンバーと、数値データ又は文字列データもしくは他のクラスへの少なくとも1つの参照情報を有するフィールドメンバーとを備え、
上記中間コードを主記憶装置にロードしたときに、上記メソッドに含まれるオペコードのアドレスを上記主記憶装置のアドレスで表しかつ上記各クラスのデータ領域に格納したことを特徴とする。
A virtual machine execution device according to a first aspect of the present invention is a virtual machine execution device that loads and executes an intermediate code from a secondary storage device to a main storage device.
A virtual machine engine comprising a class array having at least one class loaded with intermediate code in main memory and a runtime array having at least one runtime for storing runtime information;
The class includes a method member having at least one method describing processing procedure information including an operation code, and a field member having at least one reference information to numeric data or character string data or another class,
When the intermediate code is loaded into the main storage device, the address of the operation code included in the method is expressed by the address of the main storage device and stored in the data area of each class.

上記仮想マシン実行装置において、上記ランタイムは、実行メソッドへのアドレス及びメソッド内だけで生成され使用される変数を格納するローカル変数領域を確保することが可能であり、処理途中の計算結果を一時的に格納するスタック領域を備え、
上記スタック領域にデータ型とその値の形式で表されたオペランドが格納されることを特徴とする。
In the virtual machine execution device, the runtime can secure a local variable area for storing an address to an execution method and a variable generated and used only in the method, and temporarily calculates a calculation result during the process. With a stack area to store
Operands expressed in a data type and a value format are stored in the stack area.

第2の発明に係る仮想マシン実行装置は、中間コードを二次記憶装置から主記憶装置にロードして実行する仮想マシン実行装置において、
中間コードを主記憶装置にロードされた少なくとも1つのクラスを有するクラス配列と、実行時の情報を格納する少なくとも1つのランタイムを有するランタイム配列とを含む仮想マシンエンジンを備え、
上記クラスは、オペコードを含む処理手順情報を記述した少なくとも1つのメソッドを有するメソッドメンバーと、数値データ又は文字列データもしくは他のクラスへの少なくとも1つの参照情報を有するフィールドメンバーとを備え、
上記ランタイムは、実行メソッドへのアドレス及びメソッド内だけで生成され使用される変数を格納するローカル変数領域を確保することが可能であり、処理途中の計算結果を一時的に格納するスタック領域を備え、
上記スタック領域にデータ型とその値の形式で表されたオペランドが格納されることを特徴とする。
A virtual machine execution device according to a second aspect of the present invention is a virtual machine execution device that loads an intermediate code from a secondary storage device to a main storage device and executes the intermediate code.
A virtual machine engine comprising a class array having at least one class loaded with intermediate code in main memory and a runtime array having at least one runtime for storing runtime information;
The class includes a method member having at least one method describing processing procedure information including an operation code, and a field member having at least one reference information to numeric data or character string data or another class,
The runtime can secure an address to the execution method and a local variable area for storing variables that are generated and used only within the method, and has a stack area for temporarily storing calculation results during processing. ,
Operands expressed in a data type and a value format are stored in the stack area.

第3の発明に係る仮想マシン実行方法は、中間コードを二次記憶装置から主記憶装置にロードして実行する仮想マシン実行方法において、
中間コードを主記憶装置にロードされた少なくとも1つのクラスを有するクラス配列と、実行時の情報を格納する少なくとも1つのランタイムを有するランタイム配列とを含む仮想マシンエンジンを備え、
上記クラスは、オペコードを含む処理手順情報を記述した少なくとも1つのメソッドを有するメソッドメンバーと、数値データ又は文字列データもしくは他のクラスへの少なくとも1つの参照情報を有するフィールドメンバーとを備え、
上記中間コードを主記憶装置にロードしたときに、上記メソッドに含まれるオペコードのアドレスを上記主記憶装置のアドレスで表しかつ上記各クラスのデータ領域に格納するステップを含むことを特徴とする。
According to a third aspect of the present invention, there is provided a virtual machine execution method in which an intermediate code is loaded from a secondary storage device to a main storage device and executed.
A virtual machine engine comprising a class array having at least one class loaded with intermediate code in main memory and a runtime array having at least one runtime for storing runtime information;
The class includes a method member having at least one method describing processing procedure information including an operation code, and a field member having at least one reference information to numeric data or character string data or another class,
When the intermediate code is loaded into the main memory, the address of the operation code included in the method is represented by the address of the main memory and stored in the data area of each class.

上記仮想マシン実行方法において、上記ランタイムは、実行メソッドへのアドレス及びメソッド内だけで生成され使用される変数を格納するローカル変数領域を確保することが可能であり、処理途中の計算結果を一時的に格納するスタック領域を備え、
上記スタック領域にデータ型とその値の形式で表されたオペランドが格納されることを特徴とする。
In the virtual machine execution method, the runtime can secure a local variable area for storing an address to an execution method and a variable generated and used only in the method, and temporarily calculates a calculation result during the process. With a stack area to store
Operands expressed in a data type and a value format are stored in the stack area.

第4の発明に係る仮想マシン実行方法は、中間コードを二次記憶装置から主記憶装置にロードして実行する仮想マシン実行方法において、
中間コードを主記憶装置にロードされた少なくとも1つのクラスを有するクラス配列と、実行時の情報を格納する少なくとも1つのランタイムを有するランタイム配列とを含む仮想マシンエンジンを備え、
上記クラスは、オペコードを含む処理手順情報を記述した少なくとも1つのメソッドを有するメソッドメンバーと、数値データ又は文字列データもしくは他のクラスへの少なくとも1つの参照情報を有するフィールドメンバーとを備え、
上記ランタイムは、実行メソッドへのアドレス及びメソッド内だけで生成され使用される変数を格納するローカル変数領域を確保することが可能であり、処理途中の計算結果を一時的に格納するスタック領域を備え、
上記スタック領域にデータ型とその値の形式で表されたオペランドが格納されることを特徴とする。
According to a fourth aspect of the present invention, there is provided a virtual machine execution method in which an intermediate code is loaded from a secondary storage device to a main storage device and executed.
A virtual machine engine comprising a class array having at least one class loaded with intermediate code in main memory and a runtime array having at least one runtime for storing runtime information;
The class includes a method member having at least one method describing processing procedure information including an operation code, and a field member having at least one reference information to numeric data or character string data or another class,
The runtime can secure an address to the execution method and a local variable area for storing variables that are generated and used only within the method, and has a stack area for temporarily storing calculation results during processing. ,
Operands expressed in a data type and a value format are stored in the stack area.

従って、本発明によれば、上記中間コードを主記憶装置にロードしたときに、上記メソッドに含まれるオペコードのアドレスを上記主記憶装置のアドレスで表しかつ上記各クラスのデータ領域に格納するので、仮想マシンの実行時においてアドレス変換処理を行う必要がないので、従来技術に比較して仮想マシンを高速で実行できる。   Therefore, according to the present invention, when the intermediate code is loaded into the main storage device, the address of the operation code included in the method is represented by the address of the main storage device and stored in the data area of each class. Since it is not necessary to perform address translation processing when the virtual machine is executed, the virtual machine can be executed at a higher speed than in the prior art.

また、本発明によれば、上記スタック領域に格納されたオペランドは、そのデータ型とその値の形式で表すので、データ型の組み合わせによる命令コードの増大をおさえ、コンパクトな仕様を有する仮想マシンを実現することができる。   Further, according to the present invention, since the operand stored in the stack area is expressed in the form of its data type and its value, a virtual machine having a compact specification can be suppressed without increasing the instruction code due to the combination of the data types. Can be realized.

以下、本発明に係る実施形態について図面を参照して説明する。なお、同様の構成要素については同一の符号を付している。   Hereinafter, embodiments according to the present invention will be described with reference to the drawings. In addition, the same code | symbol is attached | subjected about the same component.

実施形態.
図1は本発明の一実施形態に係る仮想マシン実行装置1000の構成を示すブロック図である。本実施形態に係る仮想マシン実行装置1000は、ディジタル計算機のハードウェアアーキテクチャに依存しない中間コードを実行する仮想マシンの実行装置であって、図1に示すように、中央処理装置1100と、二次記憶装置1200と、主記憶装置1300とを備え、これら装置1100,1200,1300がバスを介して接続されて構成され、二次記憶装置1200には、実行内容を記述したクラス中間コード1201が予め格納されている。
Embodiment.
FIG. 1 is a block diagram showing a configuration of a virtual machine execution apparatus 1000 according to an embodiment of the present invention. A virtual machine execution device 1000 according to the present embodiment is a virtual machine execution device that executes intermediate code that does not depend on the hardware architecture of a digital computer. As shown in FIG. 1, as shown in FIG. The storage device 1200 includes a main storage device 1300, and these devices 1100, 1200, and 1300 are connected via a bus, and the secondary storage device 1200 has a class intermediate code 1201 that describes the execution contents in advance. Stored.

図2は図1の中央処理装置1100によって実行される仮想マシンのインストール処理を示すフローチャートである。また、図4は図2のステップS1の処理後の仮想マシン実行装置1000の構成を示すブロック図であり、図5は図2のステップS3の処理後の仮想マシン実行装置1000の構成を示すブロック図である。   FIG. 2 is a flowchart showing a virtual machine installation process executed by the central processing unit 1100 of FIG. 4 is a block diagram showing the configuration of the virtual machine execution device 1000 after the process of step S1 in FIG. 2, and FIG. 5 is a block diagram showing the configuration of the virtual machine execution device 1000 after the process of step S3 in FIG. FIG.

図2において、まず、ステップS1では、図4に示すように、クラス中間コード1201に含まれる仮想マシンエンジン1400及び処理ルーチン群1410を、二次記憶装置1200から主記憶装置1300にロードする。ここで、ロードされた仮想マシン1400では、後にロードされるクラスを登録するクラス配列を有している。クラスとは少なくとも1つのメンバー変数と少なくとも1つのメンバー関数を有しており、ある程度概念的に関連ある変数及び関数をまとめたソフトウェアである。また、処理ルーチン群1410は、仮想マシン1400で提供する基本的な処理であり、各処理に番号が割り振られている。クラスにおけるメンバー関数は、具体的には実行する処理ルーチン群1410で割り当てたれている番号とそれに対するパラメータを、実行順に並べた配列である。図4の例では、処理ルーチン群1410は、オペコードa実行モジュール1410aと、オペコードb実行モジュール1410bと、オペコードc実行モジュール1410cなどを含む。   2, first, in step S1, as shown in FIG. 4, the virtual machine engine 1400 and the processing routine group 1410 included in the class intermediate code 1201 are loaded from the secondary storage device 1200 to the main storage device 1300. Here, the loaded virtual machine 1400 has a class array for registering classes to be loaded later. A class is software that has at least one member variable and at least one member function, and is a collection of variables and functions that are somewhat conceptually related. The processing routine group 1410 is a basic process provided by the virtual machine 1400, and a number is assigned to each process. Specifically, the member function in the class is an array in which the numbers assigned in the processing routine group 1410 to be executed and the parameters corresponding thereto are arranged in the order of execution. In the example of FIG. 4, the processing routine group 1410 includes an operation code a execution module 1410a, an operation code b execution module 1410b, an operation code c execution module 1410c, and the like.

次いで、ステップS2において、図5に示すように、二次記憶装置1200から、クラス中間コード1201に含まれ、仮想マシンの実行時に使用されるクラスファイル群を主記憶装置1300にロードする。二次記憶装置1200には少なくとも1つのクラスが保存されている。クラスはすべてロードするのではなく、必要なクラスのみをロードする。ユーザ又は仮想マシンを使用する他のシステムは、最初どのクラスのどのメンバー関数を起動関数とするかを指定する。これによって、二次記憶装置1200からロードするべきクラスが決定されてロードされる。クラスは、他のクラスの機能を利用することもあり、その情報もロードするファイル内に記述されている。この情報に基づいて、さらに必要なクラスがロードされる。   Next, in step S2, as shown in FIG. 5, the class file group included in the class intermediate code 1201 and used when the virtual machine is executed is loaded from the secondary storage device 1200 into the main storage device 1300. The secondary storage device 1200 stores at least one class. Instead of loading all classes, load only the classes you need. The user or other system that uses the virtual machine first specifies which member function of which class is the activation function. As a result, the class to be loaded from the secondary storage device 1200 is determined and loaded. A class may use functions of other classes, and the information is described in a file to be loaded. Based on this information, further required classes are loaded.

そして、ステップS3では、主記憶装置1300にロードしたクラスファイル群で、お互いに名前で参照している箇所を、実際の主記憶装置1300上のメモリアドレスに置き換えることによりリンク処理を行って、当該仮想マシンによる実行準備処理を終了する。当該ステップS3では、すべての必要なクラスのロードが完了した時点でリンク作業が実行される。二次記憶装置1200で保存されている状態では、クラス内における他クラス参照情報は、クラス名や関数名という文字列情報で記述されている。二次記憶装置1200から主記憶装置1400へロードが完了すると、主記憶装置1400におけるクラスのアドレスが明らかとなるので、他クラス参照情報に基づいて、主記憶装置1400におけるアドレスへ置き換える処理を実行する。   In step S3, the class file group loaded in the main storage device 1300 performs link processing by replacing the locations that are referred to by name with the actual memory addresses on the main storage device 1300. Ends execution preparation processing by the virtual machine. In step S3, the link operation is executed when loading of all necessary classes is completed. In the state stored in the secondary storage device 1200, the other class reference information in the class is described by character string information such as a class name and a function name. When loading from the secondary storage device 1200 to the main storage device 1400 is completed, the address of the class in the main storage device 1400 becomes clear. Therefore, processing for replacing with the address in the main storage device 1400 is executed based on the other class reference information. .

すなわち、主記憶装置1300では、図4及び図5に示すように、仮想マシンの実行時にすべての情報を管理する仮想マシンエンジン1400が存在し、仮想マシンエンジン1400はクラス配列及びランタイム配列を有する。仮想マシンエンジン1400は、中間コードのバイナリデータであるクラス中間コード1201を、実行に必要なコードだけ二次記憶装置1200から主記憶装置1300へロードし、少なくとも1つのクラス1500を生成して配列として管理する。また、ランタイム配列は実際に所定の起動メソッドから処理を実行する段階で、必要な情報を格納するために生成される。ここで、クラス1500とは、ある概念に基づいたデータ及び関数を1つのグループにまとめたプログラムモジュールのことであり、クラス1500は、図5に示すように、オペコードを含む処理手順情報を記述した少なくとも1つのメソッドを有するメソッドメンバー1510と、数値データ又は文字列データもしくは他のクラスへの少なくとも1つの参照情報を含む少なくとも1つのフィールドデータ(少なくとも1つのオペランドを含む)を有するフィールドメンバー1520と、後述するようにオペコードのアドレスを含むデータ領域とを含む。クラス配列とは、このようなクラスを1個以上有する配列である。仮想マシン実行装置1000によって、なんらかの処理を実行するときは必ず1個以上のクラスが仮想マシンエンジン1400にロードされる。クラスの関数内で他のクラスが利用されている場合は、さらに利用しているクラスがロードされる。   That is, in the main storage device 1300, as shown in FIGS. 4 and 5, there is a virtual machine engine 1400 that manages all information when the virtual machine is executed, and the virtual machine engine 1400 has a class array and a runtime array. The virtual machine engine 1400 loads the class intermediate code 1201 that is binary data of the intermediate code, from the secondary storage device 1200 to the main storage device 1300 as much as the code necessary for execution, and generates at least one class 1500 as an array. to manage. The runtime array is generated to store necessary information at the stage of actually executing processing from a predetermined activation method. Here, the class 1500 is a program module in which data and functions based on a certain concept are grouped into one group, and the class 1500 describes processing procedure information including an operation code as shown in FIG. A method member 1510 having at least one method, and a field member 1520 having at least one field data (including at least one operand) including at least one reference information to numeric data or character string data or other classes; As will be described later, a data area including the address of the operation code is included. A class array is an array having one or more such classes. When the virtual machine execution apparatus 1000 executes some processing, one or more classes are always loaded into the virtual machine engine 1400. If another class is used in the class function, the class being used is loaded.

上述のように、起動時の処理では、初期化した後、二次記憶装置1200よりクラスファイル群をロードし、リンク処理を実行しており、クラスファイルをロードする前段階の仮想マシン起動直後の主記憶装置1300の状態が図4に図示されている。この時点では、データ管理用の配列を有する仮想マシンエンジン1400や、プリミティブ機能の処理ルーチン及びプリミティブなデータ型とその値を含むオペランド1420のみが存在している。これに対して、二次記憶装置1200よりクラスファイル群をロードし、リンク処理を実行した後の主記憶装置1300の状態を図5に図示している。このとき、ファイルではオペコード(整数)で示されていたメソッドの処理手順は、オペコードに対応する処理関数へのポインタへ置き換えられている。すなわち、メソッドにアドレス管理用配列(クラス内のデータ領域にあるオペコードのアドレス)を用意し、配列に格納されている関数ポインタを順々に実行して行くことで処理が実現できる。また、実際にはクラスファイルが複数存在し、自己のメソッドや自己以外のメソッドを呼び出す。このようなメソッド呼び出し機能については、メソッドが管理している関数配列へのポインタを呼び出し側が知っていることで、直接に呼び出すことが可能となる。以上のような、実メモリ(主記憶装置1300)上におけるアドレスを検索し、利用側にその情報を記録することをリンク処理と呼ぶ。これらは起動直後に行い、実際の処理が始まった段階ではアドレスへダイレクトにジャンプするのみとなっており、従って、本実施形態は、従来技術における相対アドレスの計算などの余分なアドレス計算が発生しないことを特徴としている。   As described above, in the process at the time of startup, after initialization, the class file group is loaded from the secondary storage device 1200 and the link process is executed, and immediately after the virtual machine is started immediately before the class file is loaded. The state of the main memory 1300 is shown in FIG. At this point, there are only the virtual machine engine 1400 having an array for data management, and an operand 1420 including a primitive function processing routine and a primitive data type and its value. On the other hand, FIG. 5 shows the state of the main storage device 1300 after loading the class file group from the secondary storage device 1200 and executing the link processing. At this time, the processing procedure of the method indicated by the operation code (integer) in the file is replaced with a pointer to the processing function corresponding to the operation code. That is, processing can be realized by preparing an address management array (an address of an operation code in a data area in a class) as a method and sequentially executing function pointers stored in the array. In fact, there are multiple class files that call their own methods and methods other than self. Such a method call function can be called directly by the caller knowing the pointer to the function array managed by the method. Searching for an address on the real memory (main storage device 1300) as described above and recording the information on the use side is called link processing. These are performed immediately after startup, and only jump directly to the address when the actual processing starts. Therefore, this embodiment does not generate extra address calculation such as relative address calculation in the prior art. It is characterized by that.

また、図5に示すように、各メソッドメンバー1510の各メソッドに対応するメソッド1530は、複数のオペコードを含み、そのアドレスがメソッド内に記載されており、処理ルーチン群1410の各オペコード実行モジュールとリンクされている。図9は本実施形態に係る仮想マシンエンジン1400中のクラスの構成を示すブロック図である。図9において、クラスA1500Aにおいて、クラスBのオペコードQを引用している場合、クラスA1500Aにおけるデータ領域においてオペコードQのアドレスを格納することによりリンクされている。さらに、図5に示すように、フィールドメンバー1520の各オペランド1420はデータ型とその値との形式を有する。   Further, as shown in FIG. 5, a method 1530 corresponding to each method of each method member 1510 includes a plurality of operation codes, addresses of which are described in the method, and each operation code execution module of the processing routine group 1410 Linked. FIG. 9 is a block diagram showing a class configuration in the virtual machine engine 1400 according to the present embodiment. In FIG. 9, when the class B opcode Q is quoted in the class A 1500A, it is linked by storing the address of the op code Q in the data area in the class A 1500A. Further, as shown in FIG. 5, each operand 1420 of the field member 1520 has a data type and a value format.

図3は図1の中央処理装置1100によって実行される仮想マシンの実行処理を示すフローチャートである。また、図6は図3の仮想マシンの実行処理時の仮想マシン実行装置1000の構成を示すブロック図である。   FIG. 3 is a flowchart showing virtual machine execution processing executed by the central processing unit 1100 of FIG. FIG. 6 is a block diagram showing the configuration of the virtual machine execution apparatus 1000 during the execution process of the virtual machine of FIG.

図3において、まず、ステップS11において、仮想マシンエンジン1400のクラス配列から所定の起動メンバー関数アドレスを取得し、ステップS12でそれに対応するランタイムを生成する。次いで、ステップS13において、当該ランタイム1600においてメソッドフレーム1610を生成し、実行するメンバー関数のアドレスを登録し、ステップS14においてメソッドフレーム1610のプログラムカウンタ値を0に初期化する。さらに、ステップS22において、現在のメソッドフレーム1610のプログラムカウンタ値に登録されている初期化ルーチンを取得する。ステップS23では、当該処理ルーチン1410が関数呼び出しであるか否かが判断され、YESのときはステップS13に戻る一方、NOのときはステップS15に進む。ステップS15において、現在のメソッドフレームの1610のプログラムカウンタ値に登録されている処理ルーチン1410はジャンプ命令であるか否かが判断され、YESのときはステップS16に進む一方、NOのときはステップS17に進む。ステップS16では、ジャンプ命令に従ってプログラムカウンタ値を増減した後、ステップS19に進む。一方、ステップS17では、当該処理ルーチン1410を実行し、ステップS18においてプログラムカウンタ値を1だけインクリメントし、ステップS19に進む。ステップS19では、当該メンバー関数の終了であるか否かが判断され、YESのときはステップS20に進む一方、NOのときはステップS22に戻る。ステップS20では、当該メソッドフレーム1610を開放し、呼び出し元のメソッドフレームに戻り、ステップS21では、プログラムの終了であるか否かが判断され、NOであるときはステップS22に戻る一方、YESのときは当該仮想マシンの実行処理を終了する。   In FIG. 3, first, in step S11, a predetermined activation member function address is acquired from the class array of the virtual machine engine 1400, and in step S12, a corresponding runtime is generated. In step S13, the method frame 1610 is generated in the runtime 1600, the address of the member function to be executed is registered, and the program counter value of the method frame 1610 is initialized to 0 in step S14. In step S22, an initialization routine registered in the program counter value of the current method frame 1610 is acquired. In step S23, it is determined whether the processing routine 1410 is a function call. If YES, the process returns to step S13. If NO, the process proceeds to step S15. In step S15, it is determined whether or not the processing routine 1410 registered in the program counter value 1610 of the current method frame is a jump instruction. If YES, the process proceeds to step S16. If NO, step S17 is performed. Proceed to In step S16, the program counter value is increased or decreased according to the jump instruction, and then the process proceeds to step S19. On the other hand, in step S17, the processing routine 1410 is executed, the program counter value is incremented by 1 in step S18, and the process proceeds to step S19. In step S19, it is determined whether or not the member function is finished. If YES, the process proceeds to step S20. If NO, the process returns to step S22. In step S20, the method frame 1610 is released, and the process returns to the calling method frame. In step S21, it is determined whether or not the program is finished. If NO, the process returns to step S22. Terminates the execution process of the virtual machine.

図6には、仮想マシンがクラスメソッドを実行するときの主記憶装置1300の状態を図示している。図6を参照して、図3の実行処理について以下に詳述する。   FIG. 6 illustrates a state of the main storage device 1300 when the virtual machine executes the class method. With reference to FIG. 6, the execution process of FIG. 3 will be described in detail below.

仮想マシンの実行時処理では、上述のように、ランタイム1600及びメソッドフレーム1610を生成し主記憶装置1400へロードしたクラス情報から、処理ルーチン群1410を実行していく。まず、最初に実行する起動クラスの起動メンバー関数のアドレスを取得し、ランタイム1600を生成する。ランタイム1600は、1つの処理の流れに対して1つ生成される。すなわち、マルチタスクで実行したい場合は、複数のランタイム1600が生成される。ここでは、シングルタスクのケースで説明する。次に、メソッドフレーム1610を生成し、先に取得してある起動クラスの起動メンバー関数を登録する。メソッドフレーム1610とは、1つのメンバー関数の実行時に1つ用意される。メソッドフレーム1610は、プログラムカウンタ、ローカル変数配列、スタック領域を所有する。メンバー関数は処理ルーチン群1610で割り振られている番号を実行順に格納した配列であることを上述したが、プログラムカウンタは本配列において、どこまで実行したかを示すものである。ローカル変数配列は、メンバー関数内でのみ使用される変数の配列である。また、スタック領域とは処理ルーチン群を順々に実行していく段階で生じる途中の計算結果などを格納する領域である。さらに、メソッドフレーム1610を生成し、起動メンバー関数が登録されたら、プログラムカウンタを初期化する。関数に登録されている処理ルーチン1410を順に実行する。関数終了まで到達すると、本メソッドフレームの実行を完了したこととなる。ただし、処理ルーチン1410の中には関数コールの機能があり、これを実行すると、該当するクラスのメンバー関数取得が行われ、新たなメソッドフレーム1610を生成しメンバー関数のアドレスを登録した後、実行は生成したメソッドフレームへ移行する。関数呼び出しによって生成されたメソッドフレームは、同様に処理ルーチンを実行しながらプログラムカウンタを進め、関数終了と同時に、メソッドフレームを開放し、呼び出しもとのメソッドフレームへ戻ってくる。以上のようにして、関数実行がすべて終了し、残っているメソッドフレームもない状態になるとプログラム実行を完了する。   In the runtime processing of the virtual machine, as described above, the processing routine group 1410 is executed from the class information generated by the runtime 1600 and the method frame 1610 and loaded into the main storage device 1400. First, the address of the activation member function of the activation class to be executed first is acquired, and the runtime 1600 is generated. One runtime 1600 is generated for one process flow. That is, when it is desired to execute by multitasking, a plurality of runtimes 1600 are generated. Here, a single task case will be described. Next, a method frame 1610 is generated, and the activation member function of the activation class acquired previously is registered. One method frame 1610 is prepared when one member function is executed. The method frame 1610 owns a program counter, a local variable array, and a stack area. As described above, the member function is an array in which the numbers assigned by the processing routine group 1610 are stored in the order of execution. However, the program counter indicates the extent of execution in this array. Local variable arrays are arrays of variables that are used only within member functions. In addition, the stack area is an area for storing a calculation result in the middle of processing routines being executed in sequence. Furthermore, when the method frame 1610 is generated and the activation member function is registered, the program counter is initialized. Processing routines 1410 registered in the function are executed in order. When the end of the function is reached, the execution of this method frame is complete. However, the processing routine 1410 has a function call function. When this function is executed, the member function of the corresponding class is acquired, a new method frame 1610 is generated and the address of the member function is registered, and then executed. Moves to the generated method frame. Similarly, the method frame generated by the function call advances the program counter while executing the processing routine, and at the same time as the function ends, the method frame is released and returned to the calling method frame. As described above, when all the function executions are completed and there are no remaining method frames, the program execution is completed.

仮想マシンの実行時におけるランタイム配列とは、上述のように、実際にクラスのメソッドを実行する段階で生成され、ランタイム1600で格納する情報は起動メソッドへのアドレス及びメソッドフレームの配列である。仮想マシンエンジン1400が複数のランタイム1600を格納するためにランタイム配列を具備する理由は、マルチタスク処理を実現するためである。また、ランタイム1600において生成されるメソッドフレーム1610とは、新たにメソッドを実行するたびに生成される。例えば起動メソッド内で別のメソッドを起動した場合、メソッドフレーム配列には2つのメソッドフレームが格納される。メソッドフレーム1610では、実行メソッドへのアドレス、メソッド内で何番目のオペコードを実行中であるかを示すプログラムカウンタ、実行メソッドへのアドレス及びメソッド内だけで生成され使用される少なくとも1つの変数を格納するローカル変数領域1620、及び少なくとも1つのオペランドを含み処理途中の計算結果を一時的に格納するスタック領域1630を情報として格納する。メソッドフレーム1610によるメソッド実行の動作原理では、まずメソッドを起動すると、プログラムカウンタ値を初期化し、ローカル変数が用意される。そして実行メソッドアドレスへアクセスし、オペコードのアドレスを実行順に格納した配列をプログラムカウンタ値に従って実行していく。ローカル変数に対する演算を実施した途中経過はスタック領域へ格納する。オペコードの処理が完了するたびにプログラムカウンタ値を1つずつ増やし、次のオペコードを実行する。また、ジャンプ命令を意味するオペコードでは、プログラムカウンタを増減させることで実現し、余計なアドレス計算を不要なものとしている。   As described above, the runtime array at the time of execution of the virtual machine is generated at the stage of actually executing the method of the class, and information stored in the runtime 1600 is an array of an address to the activation method and a method frame. The reason why the virtual machine engine 1400 includes a runtime array for storing a plurality of runtimes 1600 is to realize multitask processing. The method frame 1610 generated in the runtime 1600 is generated every time a new method is executed. For example, when another method is activated in the activation method, two method frames are stored in the method frame array. The method frame 1610 stores an address to the execution method, a program counter indicating what number of operation code is being executed in the method, an address to the execution method, and at least one variable generated and used only in the method. The local variable area 1620 to be stored and the stack area 1630 that includes at least one operand and temporarily stores a calculation result in the middle of processing are stored as information. In the operation principle of method execution by the method frame 1610, when a method is first activated, a program counter value is initialized and a local variable is prepared. Then, the execution method address is accessed, and an array in which the opcode addresses are stored in the execution order is executed according to the program counter value. The progress of operations on local variables is stored in the stack area. Each time the processing of the operation code is completed, the program counter value is incremented by one and the next operation code is executed. In addition, the operation code representing the jump instruction is realized by increasing or decreasing the program counter, and unnecessary address calculation is unnecessary.

本実施形態においては、各クラス1500毎に生成されるフィールドメンバー1520と、各メソッドフレーム1610に対して生成されるローカル変数領域1620及びスタック領域1630において、データタグ及びデータ値とを格納したオペランド1420をプリミティブなデータ型とその値とを含む形式で構成したことを特徴としている。すなわち、特に、メソッドフレーム1610が有するローカル変数領域1620、スタック領域1630及び各クラスのフィールドメンバー1520のデータはオペランドの配列であることを特徴としている。通常、スタック領域へ記録する内容はデータ値のみを格納する。このため仮想マシンのプリミティブな命令では、整数用の加算であるiaddや浮動小数点用の加算であるfaddといった具合にデータ型を区別して命令を用意し、スタックの値を操作する。そのため、オペコードの増加を招くが、本実施形態に係る仮想マシンでは、図8に示すように、スタック領域1630にもデータ型を区別する当該データコードを配置し、コードを一本化することによって、命令体系の簡素化を実現した。   In this embodiment, the field member 1520 generated for each class 1500, and the operand 1420 storing the data tag and data value in the local variable area 1620 and stack area 1630 generated for each method frame 1610. Is formed in a format including a primitive data type and its value. Specifically, the local variable area 1620, the stack area 1630, and the field member 1520 of each class included in the method frame 1610 are characterized by an array of operands. Normally, the contents to be recorded in the stack area store only data values. For this reason, in the primitive instruction of the virtual machine, instructions are prepared by distinguishing data types such as iadd which is addition for integers and fadd which is addition for floating point, and the stack values are manipulated. Therefore, the operation code is increased, but in the virtual machine according to the present embodiment, as shown in FIG. 8, the data code for distinguishing the data type is also arranged in the stack area 1630 and the code is unified. The instruction system has been simplified.

図7は本実施形態に係る仮想マシン実行装置1000で用いるオペコードの一例を示す表である。図7に示すように、オペコードは非負の整数で表され、例えば0x0001ならば仮想マシンに対して加算処理を、0x0002ならば仮想マシンに対して減算処理を実行させる。実際の処理内容は、オペコードごとに処理ルーチン群1410として存在し、オペコードaに対する実行モジュール1410a、オペコードbに対する実行モジュール1410b、オペコードcに対する実行モジュール1410cなどという具合に、オペコードのIDごとに実行モジュールが存在する。クラス中間コード1201を二次記憶装置に記録している段階では、クラスのメソッドはオペコードのIDを記録するが、メモリへロードするタイミングで、オペコードのIDから実行モジュールへのアドレスへ変更する。例えばメソッドの最初の実行がオペコードcであるならば、オペコードの実行モジュール1410cのアドレスへ変換する。これによって、実行時にIDによる検索を無くし高速な実行を可能とする。また、直接的に主記憶装置1300のアドレスを記述することによって、(基準アドレス+オフセット)といったアドレス計算を不要なものとしている。   FIG. 7 is a table showing an example of an opcode used in the virtual machine execution apparatus 1000 according to the present embodiment. As shown in FIG. 7, the operation code is represented by a non-negative integer. For example, if 0x0001, an addition process is executed on the virtual machine, and if 0x0002, a subtraction process is executed on the virtual machine. The actual processing contents exist as a processing routine group 1410 for each operation code, such as an execution module 1410a for the operation code a, an execution module 1410b for the operation code b, an execution module 1410c for the operation code c, and the like. Exists. At the stage where the class intermediate code 1201 is recorded in the secondary storage device, the class method records the ID of the operation code, but changes the ID of the operation code to the address to the execution module at the timing of loading to the memory. For example, if the first execution of the method is the operation code c, it is converted to the address of the execution module 1410c of the operation code. This eliminates the search by ID during execution and enables high-speed execution. Further, the address calculation such as (reference address + offset) is made unnecessary by directly describing the address of the main storage device 1300.

図8は本実施形態に係る仮想マシン実行装置1000で用いるデータコードの一例を示す表である。図8に示すように、データコードは非負の整数で表され、例えば0x0002ならば2バイト整数を示し、0x0003ならば4バイト整数を示す。本実施形態に係る仮想マシンでは、スタック領域1630にもデータ型を区別する当該データコードを配置し、コードを一本化することによって、命令体系の簡素化を実現した。   FIG. 8 is a table showing an example of data codes used in the virtual machine execution apparatus 1000 according to the present embodiment. As shown in FIG. 8, the data code is represented by a non-negative integer. For example, 0x0002 indicates a 2-byte integer, and 0x0003 indicates a 4-byte integer. In the virtual machine according to the present embodiment, the instruction system is simplified by arranging the data code for distinguishing the data type in the stack area 1630 and unifying the codes.

変形例.
図10は本発明の変形例に係る仮想マシン実行装置1000Aの構成を示すブロック図である。図1の実施形態に係る仮想マシン実行装置1000では、仮想マシン実行装置1000に設けた二次記憶装置1200に格納されているクラス中間コードをロードし、主記憶装置1300へ展開して実行しているが、本発明はこれに限らず、図10の仮想マシン実行装置1000Aのごとく構成してもよい。すなわち、仮想マシン実行装置1000Aにおいて通信インターフェース回路1710を備え、例えばインターネットなどのネットワーク1800を経由してリモートにあるディジタル計算機のサーバ装置1900内の二次記憶装置からクラス中間コードを、ネットワーク1800を介して主記憶装置1300にダウンロードして展開した後実行してもよい。
Modified example.
FIG. 10 is a block diagram showing a configuration of a virtual machine execution device 1000A according to a modification of the present invention. In the virtual machine execution device 1000 according to the embodiment of FIG. 1, the class intermediate code stored in the secondary storage device 1200 provided in the virtual machine execution device 1000 is loaded, expanded into the main storage device 1300, and executed. However, the present invention is not limited to this, and may be configured as the virtual machine execution device 1000A in FIG. That is, the virtual machine execution apparatus 1000A includes a communication interface circuit 1710. For example, the class intermediate code is transmitted from the secondary storage device in the server apparatus 1900 of the digital computer remotely via the network 1800 such as the Internet via the network 1800. It may be executed after being downloaded to the main storage device 1300 and expanded.

以上の実施形態において、ランタイム1600は、実行メソッドへのアドレス及びメソッド内だけで生成され使用される変数を格納するローカル変数領域1620を確保することが可能であるように構成され、また、ランタイム1600は、処理途中の計算結果を一時的に格納するスタック領域1630を備え、スタック領域1630にデータ型とその値の形式で表されたオペランド1420が格納されるように構成してもよい。   In the above embodiment, the runtime 1600 is configured to be able to reserve a local variable area 1620 that stores an address to an execution method and a variable that is generated and used only within the method, and the runtime 1600 May include a stack area 1630 for temporarily storing calculation results during processing, and the stack area 1630 may be configured to store an operand 1420 expressed in the form of a data type and its value.

以上詳述したように、本発明によれば、上記中間コードを主記憶装置にロードしたときに、上記メソッドに含まれるオペコードのアドレスを上記主記憶装置のアドレスで表しかつ上記各クラスのデータ領域に格納するので、仮想マシンの実行時においてアドレス変換処理を行う必要がないので、従来技術に比較して仮想マシンを高速で実行できる。   As described above in detail, according to the present invention, when the intermediate code is loaded into the main storage device, the address of the operation code included in the method is represented by the address of the main storage device, and the data area of each class. Therefore, it is not necessary to perform an address conversion process when the virtual machine is executed, so that the virtual machine can be executed at a higher speed than in the prior art.

また、本発明によれば、上記スタック領域に格納されたオペランドは、そのデータ型とその値の形式で表すので、データ型の組み合わせによる命令コードの増大をおさえ、コンパクトな仕様を有する仮想マシンを実現することができる。   Further, according to the present invention, since the operand stored in the stack area is expressed in the form of its data type and its value, a virtual machine having a compact specification can be suppressed without increasing the instruction code due to the combination of the data types. Can be realized.

本発明の一実施形態に係る仮想マシン実行装置1000の構成を示すブロック図である。It is a block diagram which shows the structure of the virtual machine execution apparatus 1000 which concerns on one Embodiment of this invention. 図1の中央処理装置1100によって実行される仮想マシンのインストール処理を示すフローチャートである。2 is a flowchart showing virtual machine installation processing executed by the central processing unit 1100 of FIG. 1. 図1の中央処理装置1100によって実行される仮想マシンの実行処理を示すフローチャートである。3 is a flowchart showing virtual machine execution processing executed by the central processing unit 1100 of FIG. 1. 図2のステップS1の処理後の仮想マシン実行装置1000の構成を示すブロック図である。FIG. 3 is a block diagram showing a configuration of a virtual machine execution device 1000 after the process of step S1 of FIG. 図2のステップS3の処理後の仮想マシン実行装置1000の構成を示すブロック図である。FIG. 3 is a block diagram showing a configuration of a virtual machine execution device 1000 after the process of step S3 of FIG. 図3の仮想マシンの実行処理時の仮想マシン実行装置1000の構成を示すブロック図である。FIG. 4 is a block diagram illustrating a configuration of a virtual machine execution device 1000 during the virtual machine execution process of FIG. 3. 本実施形態に係る仮想マシン実行装置1000で用いるオペコードの一例を示す表である。It is a table | surface which shows an example of the opcode used with the virtual machine execution apparatus 1000 which concerns on this embodiment. 本実施形態に係る仮想マシン実行装置1000で用いるデータコードの一例を示す表である。It is a table | surface which shows an example of the data code used with the virtual machine execution apparatus 1000 which concerns on this embodiment. 本実施形態に係る仮想マシンエンジン1400中のクラスの構成を示すブロック図である。It is a block diagram which shows the structure of the class in the virtual machine engine 1400 which concerns on this embodiment. 本発明の変形例に係る仮想マシン実行装置1000Aの構成を示すブロック図である。It is a block diagram which shows the structure of 1000A of virtual machine execution apparatuses which concern on the modification of this invention.

符号の説明Explanation of symbols

1000…仮想マシン実行装置、
1100…中央処理装置、
1200…二次記憶装置、
1201…クラス中間コード、
1300…主記憶装置、
1400…仮想マシンエンジン、
1410…処理ルーチン群、
1410a…オペコードa実行モジュール、
1410b…オペコードb実行モジュール、
1410c…オペコードc実行モジュール、
1420…オペランド、
1500,1500A,1500B…クラス、
1510…メソッドメンバー、
1520…フィールドメンバー、
1530…メソッド、
1600…ランタイム、
1610…メソッドフレーム、
1620…ローカル変数領域、
1630…スタック領域、
1700…バス、
1710…通信インターフェース回路、
1800…ネットワーク、
1900…サーバ装置。
1000 ... virtual machine execution device,
1100: Central processing unit,
1200 ... secondary storage device,
1201 ... Class intermediate code,
1300 ... main memory,
1400: Virtual machine engine,
1410 ... Processing routine group,
1410a ... Opcode a execution module,
1410b ... Opcode b execution module,
1410c ... Opcode c execution module,
1420 ... Operand,
1500, 1500A, 1500B ... class,
1510 ... Method member,
1520 ... Field members,
1530 ... Method,
1600 ... runtime,
1610 ... Method frame,
1620 ... Local variable area,
1630 ... Stack area,
1700 ... Bus
1710: Communication interface circuit,
1800 ... network,
1900: Server device.

Claims (6)

中間コードを二次記憶装置から主記憶装置にロードして実行する仮想マシン実行装置において、
中間コードを主記憶装置にロードされた少なくとも1つのクラスを有するクラス配列と、実行時の情報を格納する少なくとも1つのランタイムを有するランタイム配列とを含む仮想マシンエンジンを備え、
上記クラスは、オペコードを含む処理手順情報を記述した少なくとも1つのメソッドを有するメソッドメンバーと、数値データ又は文字列データもしくは他のクラスへの少なくとも1つの参照情報を有するフィールドメンバーとを備え、
上記中間コードを主記憶装置にロードしたときに、上記メソッドに含まれるオペコードのアドレスを上記主記憶装置のアドレスで表しかつ上記各クラスのデータ領域に格納したことを特徴とする仮想マシン実行装置。
In a virtual machine execution device that loads and executes an intermediate code from a secondary storage device to a main storage device,
A virtual machine engine comprising a class array having at least one class loaded with intermediate code in main memory and a runtime array having at least one runtime for storing runtime information;
The class includes a method member having at least one method describing processing procedure information including an operation code, and a field member having at least one reference information to numeric data or character string data or another class,
A virtual machine execution device characterized in that when the intermediate code is loaded into a main storage device, an address of an operation code included in the method is represented by the address of the main storage device and stored in the data area of each class.
上記ランタイムは、実行メソッドへのアドレス及びメソッド内だけで生成され使用される変数を格納するローカル変数領域を確保することが可能であり、処理途中の計算結果を一時的に格納するスタック領域を備え、
上記スタック領域にデータ型とその値の形式で表されたオペランドが格納されることを特徴とする請求項1記載の仮想マシン実行装置。
The runtime can secure an address to the execution method and a local variable area for storing variables that are generated and used only within the method, and has a stack area for temporarily storing calculation results during processing. ,
2. The virtual machine execution device according to claim 1, wherein operands expressed in a data type and a value format are stored in the stack area.
中間コードを二次記憶装置から主記憶装置にロードして実行する仮想マシン実行装置において、
中間コードを主記憶装置にロードされた少なくとも1つのクラスを有するクラス配列と、実行時の情報を格納する少なくとも1つのランタイムを有するランタイム配列とを含む仮想マシンエンジンを備え、
上記クラスは、オペコードを含む処理手順情報を記述した少なくとも1つのメソッドを有するメソッドメンバーと、数値データ又は文字列データもしくは他のクラスへの少なくとも1つの参照情報を有するフィールドメンバーとを備え、
上記ランタイムは、実行メソッドへのアドレス及びメソッド内だけで生成され使用される変数を格納するローカル変数領域を確保することが可能であり、処理途中の計算結果を一時的に格納するスタック領域を備え、
上記スタック領域にデータ型とその値の形式で表されたオペランドが格納されることを特徴とする仮想マシン実行装置。
In a virtual machine execution device that loads and executes an intermediate code from a secondary storage device to a main storage device,
A virtual machine engine comprising a class array having at least one class loaded with intermediate code in main memory and a runtime array having at least one runtime for storing runtime information;
The class includes a method member having at least one method describing processing procedure information including an operation code, and a field member having at least one reference information to numeric data or character string data or another class,
The runtime can secure an address to the execution method and a local variable area for storing variables that are generated and used only within the method, and has a stack area for temporarily storing calculation results during processing. ,
A virtual machine execution device, wherein an operand expressed in a data type and a value format is stored in the stack area.
中間コードを二次記憶装置から主記憶装置にロードして実行する仮想マシン実行方法において、
中間コードを主記憶装置にロードされた少なくとも1つのクラスを有するクラス配列と、実行時の情報を格納する少なくとも1つのランタイムを有するランタイム配列とを含む仮想マシンエンジンを備え、
上記クラスは、オペコードを含む処理手順情報を記述した少なくとも1つのメソッドを有するメソッドメンバーと、数値データ又は文字列データもしくは他のクラスへの少なくとも1つの参照情報を有するフィールドメンバーとを備え、
上記中間コードを主記憶装置にロードしたときに、上記メソッドに含まれるオペコードのアドレスを上記主記憶装置のアドレスで表しかつ上記各クラスのデータ領域に格納するステップを含むことを特徴とする仮想マシン実行方法。
In a virtual machine execution method for loading and executing an intermediate code from a secondary storage device to a main storage device,
A virtual machine engine comprising a class array having at least one class loaded with intermediate code in main memory and a runtime array having at least one runtime for storing runtime information;
The class includes a method member having at least one method describing processing procedure information including an operation code, and a field member having at least one reference information to numeric data or character string data or another class,
A virtual machine including a step of storing an address of an operation code included in the method by an address of the main storage device and storing it in the data area of each class when the intermediate code is loaded into the main storage device Execution method.
上記ランタイムは、実行メソッドへのアドレス及びメソッド内だけで生成され使用される変数を格納するローカル変数領域を確保することが可能であり、処理途中の計算結果を一時的に格納するスタック領域を備え、
上記スタック領域にデータ型とその値の形式で表されたオペランドが格納されることを特徴とする請求項4記載の仮想マシン実行方法。
The runtime can secure an address to the execution method and a local variable area for storing variables that are generated and used only within the method, and has a stack area for temporarily storing calculation results during processing. ,
5. The virtual machine execution method according to claim 4, wherein operands expressed in a data type and a value format are stored in the stack area.
中間コードを二次記憶装置から主記憶装置にロードして実行する仮想マシン実行方法において、
中間コードを主記憶装置にロードされた少なくとも1つのクラスを有するクラス配列と、実行時の情報を格納する少なくとも1つのランタイムを有するランタイム配列とを含む仮想マシンエンジンを備え、
上記クラスは、オペコードを含む処理手順情報を記述した少なくとも1つのメソッドを有するメソッドメンバーと、数値データ又は文字列データもしくは他のクラスへの少なくとも1つの参照情報を有するフィールドメンバーとを備え、
上記ランタイムは、実行メソッドへのアドレス及びメソッド内だけで生成され使用される変数を格納するローカル変数領域を確保することが可能であり、処理途中の計算結果を一時的に格納するスタック領域を備え、
上記スタック領域にデータ型とその値の形式で表されたオペランドが格納されることを特徴とする仮想マシン実行方法。
In a virtual machine execution method for loading and executing an intermediate code from a secondary storage device to a main storage device,
A virtual machine engine comprising a class array having at least one class loaded with intermediate code in main memory and a runtime array having at least one runtime for storing runtime information;
The class includes a method member having at least one method describing processing procedure information including an operation code, and a field member having at least one reference information to numeric data or character string data or another class,
The runtime can secure an address to the execution method and a local variable area for storing variables that are generated and used only within the method, and has a stack area for temporarily storing calculation results during processing. ,
A virtual machine execution method characterized in that an operand represented by a data type and a value format is stored in the stack area.
JP2005005322A 2005-01-12 2005-01-12 Device and method for executing virtual machine Withdrawn JP2006195644A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005005322A JP2006195644A (en) 2005-01-12 2005-01-12 Device and method for executing virtual machine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005005322A JP2006195644A (en) 2005-01-12 2005-01-12 Device and method for executing virtual machine

Publications (1)

Publication Number Publication Date
JP2006195644A true JP2006195644A (en) 2006-07-27

Family

ID=36801699

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005005322A Withdrawn JP2006195644A (en) 2005-01-12 2005-01-12 Device and method for executing virtual machine

Country Status (1)

Country Link
JP (1) JP2006195644A (en)

Similar Documents

Publication Publication Date Title
US6324686B1 (en) Just in time compiler technique
US7380242B2 (en) Compiler and software product for compiling intermediate language bytecodes into Java bytecodes
US7877741B2 (en) Method and corresponding apparatus for compiling high-level languages into specific processor architectures
JP2002508560A (en) Combining multiple class files into a runtime image
JP3606561B2 (en) Method, system, program, and data structure for converting first bit architecture instructions to second bit architecture instructions
JP2001034483A (en) Numbering operational code for encoding metadata
KR101407629B1 (en) Apparatus and method for accelerating java translation
US8407678B2 (en) Method of array interception using data-flow analysis
FR3011354A1 (en) METHOD FOR EXECUTING A MICROPROCESSOR OF A POLYMORPHIC BINARY CODE OF A PREDETERMINED FUNCTION
JP5496792B2 (en) Code conversion program, method and system
Perez et al. A hybrid just-in-time compiler for android: comparing jit types and the result of cooperation
KR100771057B1 (en) Device and method for transforming WIPI into intermediate language
US20080104372A1 (en) Method, apparatus and computer program for executing a program
US7207036B2 (en) Preprocessing of interfaces to allow fast call through
JP2002229778A (en) Pc relative branching method with high-speed displacement
Courbot et al. Efficient off-board deployment and customization of virtual machine-based embedded systems
JP7295469B2 (en) Function generation program, function generation method, and information processing device
JP2006195644A (en) Device and method for executing virtual machine
Parsons et al. The java story
JP2000122876A (en) Information processor
US7314491B2 (en) Encapsulation of large native operating system functions as enhancements of the instruction set in an emulated central processor system
JP3727039B2 (en) Multiplication method in compiler
WO2024029174A1 (en) Processor for controlling pipeline processing based on jump instruction, and program storage medium
Davis et al. Portable parallelized blowfish via RenderScript
Di Cataldo et al. Executables and Libraries

Legal Events

Date Code Title Description
A621 Written request for application examination

Effective date: 20070928

Free format text: JAPANESE INTERMEDIATE CODE: A621

A761 Written withdrawal of application

Free format text: JAPANESE INTERMEDIATE CODE: A761

Effective date: 20081226