JP2007233472A - Information processor, and control method and control program of information processor - Google Patents

Information processor, and control method and control program of information processor Download PDF

Info

Publication number
JP2007233472A
JP2007233472A JP2006051166A JP2006051166A JP2007233472A JP 2007233472 A JP2007233472 A JP 2007233472A JP 2006051166 A JP2006051166 A JP 2006051166A JP 2006051166 A JP2006051166 A JP 2006051166A JP 2007233472 A JP2007233472 A JP 2007233472A
Authority
JP
Japan
Prior art keywords
code
native code
native
program
order
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
JP2006051166A
Other languages
Japanese (ja)
Inventor
Koichi Oi
浩一 大井
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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP2006051166A priority Critical patent/JP2007233472A/en
Publication of JP2007233472A publication Critical patent/JP2007233472A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a technique capable of attaining speeding-up in initialization processing of a program described in an intermediate code. <P>SOLUTION: The information processor having a native environment for executing a native code and a virtual machine environment for executing an intermediate code and including a storage means storing a program comprises an interpreter means for successively interpreting one or more methods constituting the program; a conversion means converting a method interpreted to be executed in activating the program, to a native code; a registration means registering the native code in association with the method; and a control means controlling to read and execute the native code, when registered, in the native environment and to execute, when the native code is not registered, the method in the virtual machine environment. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、中間コードで記述されたプログラムを実行するための仮想マシン技術に関するものである。   The present invention relates to a virtual machine technique for executing a program described in intermediate code.

従来から、中間コードにより記述されたプログラムを実行するための仮想マシン(Virtual Machine)技術が知られている。仮想マシン環境は逐次実行するインタプリタとして実現されることが多いが、一般的にインタプリタを用いたプログラムの実行処理速度は遅い。そこで、プログラムを構成する中間コードをネイティブコードに変換する(以下、コンパイルと呼ぶ)方法が用いられることがある。すなわち、プログラムを構成する中間コードを仮想マシンを実現しているCPUで直接実行可能なデータ形式に変換するのである。   Conventionally, a virtual machine technology for executing a program described by an intermediate code is known. The virtual machine environment is often realized as an interpreter that executes sequentially, but generally, the execution processing speed of a program using the interpreter is slow. Therefore, a method of converting intermediate code constituting the program into native code (hereinafter referred to as compilation) may be used. That is, the intermediate code constituting the program is converted into a data format that can be directly executed by the CPU that implements the virtual machine.

コンパイル方法としては、AOT(Ahead Of Time)コンパイルとJIT(Just In Time)コンパイルがある。AOTコンパイルでは、仮想マシンがプログラムをロードする前に前もってコンパイル処理がなされ前もってされる。つまり、ロードされる時点で既にネイティブコードになっている。一方、JITコンパイルでは、中間コードでプログラムをロードした後、実行時にネイティブコードにコンパイルする。そのため、コンパイル後の動作は速いものの、最初の実行時にはコンパイルの処理が必要なため必要な処理量が多くなる。   Compiling methods include AOT (Ahead Of Time) compilation and JIT (Just In Time) compilation. In the AOT compilation, a compilation process is performed in advance before the virtual machine loads a program. In other words, it is already native code when it is loaded. On the other hand, in JIT compilation, a program is loaded with intermediate code and then compiled into native code at the time of execution. Therefore, although the operation after compilation is fast, the amount of processing required increases because compilation processing is required at the first execution.

ところで、JITコンパイルの場合、たいていは、コンパイルされたネイティブコードはメモリ中に置かれ、当該プログラムを仮想マシン上で実行する時にのみ利用される。そして、プログラムの実行が終了した時、ネイティブコードは破棄(以降、デコンパイルと呼ぶ)される。従って、再度同じプログラムを動作させるときには、新たにプログラムの同じ部分をコンパイル処理する必要がある。   By the way, in the case of JIT compilation, the compiled native code is usually placed in a memory and used only when the program is executed on a virtual machine. When the execution of the program ends, the native code is discarded (hereinafter referred to as decompilation). Therefore, when the same program is operated again, it is necessary to newly compile the same part of the program.

その問題に対処するため、特許文献1には、コンパイルされたネイティブコードのプレロードクラスを生成し、次回の仮想マシンの起動時に再利用できる技術が提案されている。
特開2003−316584号公報
In order to cope with this problem, Patent Document 1 proposes a technique that generates a preloaded class of compiled native code and can reuse it at the next startup of the virtual machine.
JP 2003-31658 A

しかしながら、コンパイルされたネイティブコードは中間コードに比較し容量が大きい。そのため、中間コードのプログラムに対応するネイティブコードを全てメモリ中に記憶する場合、膨大なメモリが必要になる。通常は、コンパイルされたネイティブコードの一時記憶用に確保されたメモリ領域(コードキャッシュとも呼ばれる)が一杯になると、たとえば実行頻度の少ないネイティブコードから順にコードキャッシュから破棄される。そして、新たにコンパイルされたネイティブコードのための空きメモリが確保される。そのため、プレロードクラスを出力しようとした時点で既にデコンパイルされてしまったネイティブコードはプレロードクラスの中に入れることができない。そのため、特許文献1に開示される技術には以下のような課題が存在する。すなわち、プレロードクラスの中に保存されるネイティブコードは、プレロードクラスを出力しようとした時点でコードキャッシュに記憶されているネイティブコードのみということである。   However, the compiled native code has a larger capacity than the intermediate code. Therefore, when all the native codes corresponding to the intermediate code program are stored in the memory, a huge amount of memory is required. Normally, when a memory area (also referred to as a code cache) reserved for temporary storage of compiled native code becomes full, the code cache is discarded from the code cache in order of execution frequency, for example. Then, a free memory for a newly compiled native code is secured. For this reason, native code that has already been decompiled when attempting to output the preload class cannot be included in the preload class. Therefore, the technique disclosed in Patent Document 1 has the following problems. In other words, the native code stored in the preload class is only the native code stored in the code cache when the preload class is output.

比較的性能の低いCPUを用いてプログラムの起動を高速化しようとしたとき、プログラムの起動に関する処理(以降、初期化処理と呼ぶ)を予めコンパイルしておくことが望ましい。しかし、初期化処理が大規模である場合、あるいは、コードキャッシュの容量が小さい場合は、上述したデコンパイルが発生してしまう。   When attempting to speed up program startup using a CPU with relatively low performance, it is desirable to compile in advance processing related to program startup (hereinafter referred to as initialization processing). However, when the initialization process is large-scale or when the code cache capacity is small, the above-described decompilation occurs.

特に、搭載メモリ容量が少ない機器では、必然的にコードキャッシュの容量も小さくなるので、JITコンパイラを利用した際のデコンパイルは避けられないものとなる。そのため、結果的にプログラムの起動時には毎回中間コードのコンパイルが必要となり初期化処理の高速化を実現することができない。   In particular, in a device with a small installed memory capacity, the capacity of the code cache is inevitably small, so that decompilation when using the JIT compiler is inevitable. Therefore, as a result, the intermediate code must be compiled every time the program is started, and the initialization process cannot be speeded up.

本発明は上記問題点に鑑みなされたものであり、中間コードで記述されたプログラムの初期化処理の高速化を実現可能な技術を提供することに有る。   The present invention has been made in view of the above problems, and it is an object of the present invention to provide a technique capable of realizing high-speed initialization processing of a program described in intermediate code.

上記課題を解決すべく、本発明の情報処理装置は以下の構成を備える。第1命令群に基づいて構成されたネイティブコードを実行するネイティブ環境と前記第1命令群とは独立に定義された第2命令群に基づいて構成された中間コードを実行する仮想マシン環境とを備え、少なくとも前記中間コードにより構成されるプログラムを記憶する記憶手段を備える情報処理装置において、プログラムを読み込み当該プログラムを構成する1以上のメソッドを逐次解釈するインタプリタ手段と、インタプリタ手段によりプログラムの起動時に実行されると解釈されたメソッドをネイティブコードに変換する変換手段と、変換手段により得られたネイティブコードをメソッドと関連付けて記憶手段に登録する登録手段と、メソッドを実行する際記憶手段に当該メソッドに対応するネイティブコードが登録されているか否かを確認しネイティブコードが登録されている場合には当該ネイティブコードを読み出しネイティブ環境で実行し、ネイティブコードが登録されていない場合にはメソッドを仮想マシン環境で実行するよう制御する制御手段と、を備える。   In order to solve the above problems, the information processing apparatus of the present invention has the following configuration. A native environment for executing native code configured based on a first instruction group, and a virtual machine environment for executing intermediate code configured based on a second instruction group defined independently of the first instruction group And an information processing apparatus comprising at least a storage means for storing a program composed of the intermediate code, an interpreter means for reading the program and sequentially interpreting one or more methods constituting the program, and when the program is started by the interpreter means A conversion means for converting a method interpreted to be executed into native code, a registration means for registering the native code obtained by the conversion means in association with the method in the storage means, and a method in the storage means when executing the method Whether the native code corresponding to is registered And a control unit that controls to read the native code when it is registered and execute it in the native environment, and to execute the method in the virtual machine environment when the native code is not registered. .

本発明によれば、中間コードで記述されたプログラムの初期化処理の高速化を実現可能とする技術を提供することができる。   ADVANTAGE OF THE INVENTION According to this invention, the technique which can implement | achieve high-speed of the initialization process of the program described by the intermediate code can be provided.

以下に、図面を参照して、この発明の好適な実施の形態を例示的に詳しく説明する。ただし、この実施の形態に記載されている構成要素はあくまで例示であり、この発明の範囲をそれらのみに限定する趣旨のものではない。   Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the drawings. However, the constituent elements described in this embodiment are merely examples, and are not intended to limit the scope of the present invention only to them.

(第1実施形態)
本発明に係る情報処理装置の第1実施形態として、Java(登録商標)仮想マシン(VM:Virtual Machine)を例に挙げて以下に説明する。Java(登録商標)VMは、Java(登録商標)における中間コードであるJava(登録商標)バイトコードで記述されたアプリケーションプログラムを実行する。
(First embodiment)
As a first embodiment of the information processing apparatus according to the present invention, a Java (virtual machine) virtual machine (VM) will be described below as an example. The Java (registered trademark) VM executes an application program described in Java (registered trademark) bytecode, which is an intermediate code in Java (registered trademark).

<装置構成>
図1は、第1実施形態に係る仮想マシンが動作している情報処理機器の内部構成を示すブロック図である。
<Device configuration>
FIG. 1 is a block diagram illustrating an internal configuration of an information processing device in which a virtual machine according to the first embodiment is operating.

情報処理機器100は、機器全体を制御するためのCPU101、各種制御プログラムを格納したROM102、プログラム実行中の一時記憶に用いるRAM103を備えている。そして、各種時間を計測するタイマ104、各種設定メニューなどを表示するディスプレイ105、音声の入力に用いるマイク106、音声出力に用いるスピーカ107を備える。また、各種操作ボタン108、各種設定ファイルなどを保存しておくための書き換え可能な不揮発性メモリであるFlashROM109、ネットワークを介して機器外部と接続するインタフェースであるネットワークI/F110、各種データファイルを保存しておくためのハードディスク111を備える。   The information processing device 100 includes a CPU 101 for controlling the entire device, a ROM 102 storing various control programs, and a RAM 103 used for temporary storage during program execution. A timer 104 for measuring various times, a display 105 for displaying various setting menus, a microphone 106 for inputting sound, and a speaker 107 for outputting sound are provided. In addition, various operation buttons 108, a flash ROM 109 that is a rewritable nonvolatile memory for storing various setting files, a network I / F 110 that is an interface connected to the outside of the apparatus via a network, and various data files are stored. A hard disk 111 is provided.

<仮想マシン(VM)およびアプリケーションプログラムの構成と基本動作>
図2は、第1実施形態に係る仮想マシンの内部構成を示すブロック図である。なお、仮想マシン環境は、ネイティブ環境で動作する仮想マシンプログラムを実行することにより実現される。
<Configuration and basic operation of virtual machine (VM) and application program>
FIG. 2 is a block diagram illustrating an internal configuration of the virtual machine according to the first embodiment. The virtual machine environment is realized by executing a virtual machine program that operates in a native environment.

201はVM(仮想マシン)であり、220はVM201が実行するアプリケーションプログラム(以降、単にアプリケーションと呼ぶ)である。なお、アプリケーション220は1以上のクラス231から構成されている。なお、クラス231はJava(登録商標)バイトコード(以降、単にバイトコードと呼ぶ)で記述されている。さらに、クラス231はメソッド、フィールド、定数プール及びその他の情報から構成される。なお、メソッドとはクラスを構成している実行単位の命令のことを示している。   Reference numeral 201 denotes a VM (virtual machine), and reference numeral 220 denotes an application program (hereinafter simply referred to as an application) executed by the VM 201. Note that the application 220 includes one or more classes 231. The class 231 is described in Java (registered trademark) byte code (hereinafter simply referred to as byte code). Further, the class 231 includes methods, fields, constant pools, and other information. A method indicates an instruction of an execution unit constituting a class.

アプリケーション220には、バイトコードがコンパイルされた結果であるネイティブコード232と、使用順序及びデコンパイル順序についての情報が格納された順序情報233も併せて格納される。ただし、ネイティブコード232および順序情報233は、後述するアプリケーションの実行により、生成されるものであり、アプリケーション未実行時には存在しない。詳細は後述する。   The application 220 also stores the native code 232 that is a result of compiling the bytecode, and order information 233 that stores information about the use order and the decompile order. However, the native code 232 and the order information 233 are generated by executing an application described later, and do not exist when the application is not executed. Details will be described later.

また、アプリケーション220の格納場所としては、FlashROM109やハードディスク111の他、ROM102やRAM103でもよい。または、ネットワークI/F110を経由して不図示の外部機器からアプリケーション120を読み込むよう構成してもよい。なお、メモリ205は仮想マシンがRAM103内に確保した領域として実現されている。   Further, the storage location of the application 220 may be the ROM 102 and the RAM 103 in addition to the flash ROM 109 and the hard disk 111. Alternatively, the application 120 may be read from an external device (not shown) via the network I / F 110. The memory 205 is realized as an area secured in the RAM 103 by the virtual machine.

なお、上述したようにアプリケーション220には、クラス231、ネイティブコード232、順序情報233は格納される。しかし、クラス231、ネイティブコード232、順序情報233は、全てまとまって一つの記憶媒体に格納されていなければならないということはない。つまり、図におけるアプリケーション120を示す矩形は、上記3つのデータが同じアプリケーション220に関連付けられていることを概念的に示しているだけである。   As described above, the application 220 stores the class 231, the native code 232, and the order information 233. However, the class 231, native code 232, and order information 233 need not all be stored in one storage medium. That is, the rectangle indicating the application 120 in the figure only conceptually indicates that the three data are associated with the same application 220.

そのため、クラス231、ネイティブコード232、順序情報233は、実際には異なる記憶媒体に格納されていても良い。例えば、アプリケーション220がハードディスク111において、上記3つのデータが各々異なるファイルとして格納されるよう構成しても良い。あるいは、一般に変更が少ないクラス231はROM102上に記憶され、更新されうるネイティブコード232および順序情報233は書き換え可能な媒体であるFlashROM109に記憶されるようにしてもよい。   Therefore, the class 231, the native code 232, and the order information 233 may actually be stored in different storage media. For example, the application 220 may be configured to store the above three data as different files in the hard disk 111. Alternatively, the class 231 that generally has few changes may be stored in the ROM 102, and the native code 232 and the order information 233 that can be updated may be stored in the Flash ROM 109 that is a rewritable medium.

VM201は、アプリケーションプログラム220を構成するクラス231を外部からロードするためのクラスローダ202を備える。そして、クラス231の中の実行単位であるメソッドを逐次解釈し実行するためのインタプリタ203を備える。さらに、中間コードをCPUのネイティブコードにコンパイルするJIT(Just In Time)コンパイラ(以降、単にコンパイラと呼ぶ)204を備える。   The VM 201 includes a class loader 202 for loading the class 231 constituting the application program 220 from the outside. Then, an interpreter 203 for sequentially interpreting and executing the method as the execution unit in the class 231 is provided. Furthermore, a JIT (Just In Time) compiler (hereinafter simply referred to as a compiler) 204 for compiling intermediate code into CPU native code is provided.

また、各種データを一時記憶するためのメモリ205、アプリケーション220のネイティブコード232をメモリ205にロードし、かつ、アプリケーション220の順序情報233をメモリ205に読み出すためのネイティブコードローダ210を備える。そして、メモリ205に格納されたネイティブコード232を外部に保存するためのネイティブコードセーバ211を備える。さらに、メモリ205の所定の場所に格納されたネイティブコード232を破棄するためのデコンパイラ212及びその他の制御部(以降ではVM201で総称する)を備える。   Further, a memory 205 for temporarily storing various data, a native code loader 210 for loading the native code 232 of the application 220 into the memory 205 and reading out the order information 233 of the application 220 to the memory 205 are provided. A native code saver 211 for storing the native code 232 stored in the memory 205 is provided. Furthermore, a decompiler 212 and other control units (hereinafter collectively referred to as VM 201) for discarding the native code 232 stored in a predetermined location of the memory 205 are provided.

メモリ205には、クラスローダ202がロードしたクラス206が一時記憶される。また、コンパイラ204がコンパイルしたメソッドであるネイティブコード207が一時記憶される。さらに、ネイティブコードローダ210がロードしたネイティブコード215および順序情報216が一時記憶される。そして、デコンパイラ212が破棄したネイティブコード217が一時記憶される。   The memory 205 temporarily stores the class 206 loaded by the class loader 202. A native code 207, which is a method compiled by the compiler 204, is temporarily stored. Further, the native code 215 and the order information 216 loaded by the native code loader 210 are temporarily stored. Then, the native code 217 discarded by the decompiler 212 is temporarily stored.

図2においては、ネイティブコード207およびネイティブコード215は別々に表記してあるが、区別せずにメモリ205内の一つの領域で実現してもよい。なお、以下では、ネイティブコード207およびネイティブコード215が一時記憶される領域をコードキャッシュ218と呼ぶ。前述したように、コードキャッシュ218に置かれたネイティブコードはCPU101によって直接、実行可能なコードである。   In FIG. 2, the native code 207 and the native code 215 are shown separately, but may be realized in one area in the memory 205 without distinction. Hereinafter, an area in which the native code 207 and the native code 215 are temporarily stored is referred to as a code cache 218. As described above, the native code placed in the code cache 218 is code that can be directly executed by the CPU 101.

デコンパイラ212はコードキャッシュ218中のネイティブコードを後述する条件のもとでコードキャッシュ218から破棄し、破棄したネイティブコードをデコンパイルしたネイティブコード217として記憶する。ただし、ネイティブコード217はCPUにより直接実行されることは無い領域に記憶される。   The decompiler 212 discards the native code in the code cache 218 from the code cache 218 under conditions described later, and stores the discarded native code as a decompiled native code 217. However, the native code 217 is stored in an area that is not directly executed by the CPU.

<アプリケーションプログラム実行時の仮想マシンの動作(ネイティブコード生成・登録)>
図3は、第1実施形態に係る仮想マシン上でアプリケーションを実行する際の動作フローチャートである。特に、ここでは、アプリケーションを最初に実行する際の動作について説明する。前述したように、アプリケーション120を最初に動作させるときは、クラス231のみ存在している。ここでは、主に、2回目以降の実行時に利用されるネイティブコード232および順序情報233の生成手順・登録手順を主に説明する。
<Virtual machine operation (native code generation / registration) during application program execution>
FIG. 3 is an operation flowchart when an application is executed on the virtual machine according to the first embodiment. In particular, here, the operation when the application is first executed will be described. As described above, when the application 120 is operated for the first time, only the class 231 exists. Here, the generation procedure / registration procedure of the native code 232 and the order information 233 used mainly at the second and subsequent executions will be mainly described.

ステップS301では、ユーザによる操作ボタン108によるアプリケーション220の実行指示などに基づき、CPU101はVM201環境を動作開始する。例えば、CPU101がVM201環境を実現するためのVMプログラムを実行することにより実現される。   In step S301, the CPU 101 starts operating the VM 201 environment based on an instruction to execute the application 220 by the operation button 108 by the user. For example, this is realized by the CPU 101 executing a VM program for realizing the VM 201 environment.

ステップS302では、VM201は、ユーザにより指定されたアプリケーション220を開始する。このとき、クラスローダ202がクラス231をメモリ205にロードする。   In step S302, the VM 201 starts the application 220 designated by the user. At this time, the class loader 202 loads the class 231 into the memory 205.

ステップS303では、VM201は、このアプリケーション220のネイティブコード232がロード可能か否か判断する。ここては、アプリケーション220のネイティブコード232は存在しないため、ステップS304に進む。なお、存在する場合の動作については後述する。   In step S303, the VM 201 determines whether the native code 232 of the application 220 can be loaded. Here, since the native code 232 of the application 220 does not exist, the process proceeds to step S304. The operation when it exists will be described later.

ステップS304では、ステップS302でロードしたクラス206のバイトコードをインタプリタ203が解釈、実行する。あるいは、コンパイラ204がコンパイルしたネイティブコード(メソッド207)をCPU101が直接実行する。なお、インタプリタ203はクラス206を構成する1以上のメソッドの実行頻度(実行回数)の情報(不図示)をメモリ205の中に蓄積している。   In step S304, the interpreter 203 interprets and executes the byte code of the class 206 loaded in step S302. Alternatively, the CPU 101 directly executes the native code (method 207) compiled by the compiler 204. The interpreter 203 stores information (not shown) of the execution frequency (number of executions) of one or more methods constituting the class 206 in the memory 205.

ステップS305では、VM201はアプリケーション220の初期化が完了したか否かを判断する。初期化が完了していなければステップS306に進み、完了したならばステップS316に進む。なお、アプリケーション220の初期化完了の判断は、初期化終了をVM201に通知するようなメソッド呼び出しを行ったか、あるいは、アプリケーション220の最初の表示画面を表示し終えたかというようなことから行うことができる。   In step S305, the VM 201 determines whether the initialization of the application 220 has been completed. If initialization has not been completed, the process proceeds to step S306. If completed, the process proceeds to step S316. Note that the initialization completion of the application 220 can be determined based on whether a method call for notifying the VM 201 of the completion of initialization has been performed, or whether the first display screen of the application 220 has been displayed. it can.

ステップS306では、ステップS302でロードしたクラス206内のメソッドのコンパイルを必要としているかどうかを調べる。前述の実行頻度情報に基づいて、実行頻度が高いと判断されると、そのメソッドはコンパイルが必要と判断される。なお、コンパイルが必要と判断されるのは実行頻度が高い場合に限らない。例えば、初期化が終了するまでに実行されるメソッドを全てコンパイルしてもよい。その際、1回目のアプリケーション220の初期化にはコンパイル処理を要するため、より多くの時間を必要とする。しかし、2回目以降のアプリケーション220の初期化には一切コンパイル処理が走らず、ネイティブコードがCPU101により直接実行されるため、より短い時間に収まる。コンパイルが必要であると判断された場合はステップS307に進み、必要でないと判断された場合は、ステップS304に戻る。   In step S306, it is checked whether the method in the class 206 loaded in step S302 needs to be compiled. If it is determined that the execution frequency is high based on the above execution frequency information, it is determined that the method needs to be compiled. Note that compiling is not necessary only when the execution frequency is high. For example, all methods that are executed before the initialization is completed may be compiled. At that time, the initialization of the application 220 for the first time requires a compile process, so more time is required. However, the initialization of the application 220 for the second and subsequent times does not run any compilation processing, and the native code is directly executed by the CPU 101, so that it takes less time. If it is determined that the compilation is necessary, the process proceeds to step S307. If it is determined that the compilation is not necessary, the process returns to step S304.

ステップS307では、VM201はコードキャッシュ218に空きがあるかどうかを調べる。すなわち、コードキャッシュ218の空き容量が、新たなメソッドをコンパイルして生成したネイティブコード207を格納するのに十分なものかどうかを判定する。コードキャッシュ218に空きがある場合ステップS313に進み、空きがない場合ステップS308に進む。   In step S307, the VM 201 checks whether there is a free space in the code cache 218. That is, it is determined whether or not the free capacity of the code cache 218 is sufficient to store the native code 207 generated by compiling a new method. If the code cache 218 has a vacancy, the process proceeds to step S313, and if there is no vacancy, the process proceeds to step S308.

ステップS308では、VM201はデコンパイルするネイティブコード(メソッド207)を決定する。なお、VM201は、コンパイルした後もメソッドの実行頻度情報を蓄積し続けており、実行頻度が低いメソッドがデコンパイル対象となる。   In step S308, the VM 201 determines native code (method 207) to be decompiled. Note that the VM 201 continues to accumulate method execution frequency information after compiling, and a method with a low execution frequency becomes a decompile target.

ステップS309では、VM201は、現在のデコンパイル順序をデコンパイル順序553に記憶する。デコンパイル順序については図5を用いて後述するが、当該メソッドが何番目にデコンパイルされたかという順序を示し、VM201開始時(S301)に0に初期化される。   In step S309, the VM 201 stores the current decompile order in the decompile order 553. The order of decompilation will be described later with reference to FIG. 5, but indicates the order in which the method is decompiled, and is initialized to 0 at the start of the VM 201 (S 301).

ステップS310では、VM201は、デコンパイル順序の数字をインクリメントする。   In step S310, the VM 201 increments the decompile order number.

ステップS311では、デコンパイラ212は、デコンパイル対象メソッドのネイティブコードをコードキャッシュ218外の領域117にコピーする。なお、ここではデコンパイルされたネイティブコードをメモリ205の内部として説明するが、もちろん他の場所に格納しても良い。例えばハードディスク111上に格納しても良い。   In step S311, the decompiler 212 copies the native code of the method to be decompiled to the area 117 outside the code cache 218. Here, the decompiled native code is described as being inside the memory 205, but of course, it may be stored in another location. For example, it may be stored on the hard disk 111.

ステップS312では、デコンパイラ212はデコンパイル対象メソッドをコードキャッシュ218から破棄する。その後、ステップS307に戻って、コードキャッシュ218に十分空きができるまで、上述のステップ(S307〜S312)を繰り返す。   In step S312, the decompiler 212 discards the decompile target method from the code cache 218. Thereafter, the process returns to step S307, and the above steps (S307 to S312) are repeated until the code cache 218 has enough space.

なお、上述のステップ(S307〜S312)ではデコンパイル順序が重複してメソッドに付加されることはないが、重複させるよう構成しても良い。そのためには、ステップS310のインクリメント処理を行わなければ良い。このように構成することにより、同じデコンパイル順序が付加されたメソッドを後でまとめてデコンパイルするのが容易になる。   In the above steps (S307 to S312), the decompilation order is not duplicated and added to the method. For that purpose, the increment process of step S310 may not be performed. By configuring in this way, it becomes easy to collectively decompile methods to which the same decompile order is added later.

ステップS313では、コンパイラ204はコンパイルが必要になったメソッドのバイトコードをコンパイルしてネイティブコードを生成し、コードキャッシュ218に記憶する。なお、後でリロケータブルなネイティブコード232を生成するためにシンボル情報が必要であれば、ここでシンボル情報とネイティブコードからの参照情報を生成・記憶しておき、メモリ205の図示しない部分あるいは他の記憶媒体に格納しておくとよい。   In step S 313, the compiler 204 compiles the byte code of the method that needs to be compiled to generate a native code, and stores it in the code cache 218. If symbol information is necessary to generate the relocatable native code 232 later, symbol information and reference information from the native code are generated and stored here, and a part of the memory 205 (not shown) or other information is stored. It may be stored in a storage medium.

ステップS314では、VM201は、現在の使用順序を使用順序552に記憶する。使用順序については図5を用いて後述するが、当該メソッドのネイティブコードが何番目に使用(実行)されたかという順序を示し、VM201開始時(S301)に0に初期化される。   In step S314, the VM 201 stores the current use order in the use order 552. The order of use will be described later with reference to FIG. 5. This indicates the order in which the native code of the method is used (executed), and is initialized to 0 when the VM 201 starts (S301).

ステップS315では、VM201は、現在の使用順序の数字をインクリメントする。その後、ステップS304に戻る。   In step S315, the VM 201 increments the number of the current usage order. Thereafter, the process returns to step S304.

ステップS316では、ネイティブコードセーバ211は、使用順序552およびデコンパイル順序553などに基づいて生成される順序情報216を順序情報233として登録する。詳しく述べると、まずネイティブコードセーバ211はメモリ205に蓄えられた各メソッドについてのメソッド情報551を走査し、使用順序552の若い方からソートし、メモリ205内に新たに順序情報216を作成する。   In step S316, the native code saver 211 registers the order information 216 generated based on the use order 552, the decompile order 553, and the like as the order information 233. More specifically, first, the native code saver 211 scans the method information 551 for each method stored in the memory 205, sorts the method information 551 from the youngest in the usage order 552, and creates new order information 216 in the memory 205.

ステップS317では、ネイティブコードセーバ211はコードキャッシュ218からネイティブコードを読み出し、ネイティブコード232として登録する。シンボル情報をメモリ205から読み出し、リロケータブルなコードとして合わせて保存するようにしても良い。   In step S 317, the native code saver 211 reads the native code from the code cache 218 and registers it as the native code 232. The symbol information may be read from the memory 205 and stored together as a relocatable code.

ステップS318では、デコンパイルされたネイティブコード217をネイティブコード232の中に追加保存する。   In step S 318, the decompiled native code 217 is additionally stored in the native code 232.

なお、上述の手順では初期化終了と判断された時点で、順序情報216およびネイティブコードの登録を行った。しかし、登録処理のタイミングは必要に応じて任意に決定してよい。例えば、ある特定の処理までの時間がかかるので、それまでの処理をネイティブコードを実行することで高速化を図りたい場合には、そのタイミングに達したときに保存を行うようにしてもよい。   In the above procedure, the order information 216 and native code are registered when it is determined that the initialization is completed. However, the timing of the registration process may be arbitrarily determined as necessary. For example, since it takes time until a specific process, if it is desired to speed up the process by executing native code, the process may be stored when the timing is reached.

<データ構造>
図4は、ネイティブコードおよび順序情報の関係および内部構造(構造体)を説明する図である。なお、ネイティブコードおよび順序情報に関するデータフォーマットはVM201の外部及び内部において共通である。但し、ポインタデータ等の値については変化する。
<Data structure>
FIG. 4 is a diagram for explaining the relationship between the native code and the order information and the internal structure (structure). The data format related to the native code and order information is common outside and inside the VM 201. However, the value of pointer data etc. changes.

順序情報401は、その順序情報401が含むメソッドの数を示すメソッド個数402を含む。さらに、メソッド毎に、使用順序403、デコンパイル順序404、メソッド名ポインタ405、コードポインタ406、コード長407を含む。これらメソッド毎に存在するデータはメソッド個数402が示す個数分、存在する。さらに、メソッドの名前を示すテキストデータであるメソッド名413がメソッド個数402が示す個数分、連続する。なお、メソッド名413は可変長データである。データの終端はヌル文字で表される。   The order information 401 includes a method number 402 indicating the number of methods included in the order information 401. Further, each method includes a use order 403, a decompilation order 404, a method name pointer 405, a code pointer 406, and a code length 407. The data that exists for each method exists for the number indicated by the method number 402. Further, the method name 413 that is text data indicating the name of the method is continued by the number indicated by the method number 402. The method name 413 is variable length data. The end of the data is represented by a null character.

メソッド0のメソッド名ポインタ405には、メソッド名0 413の先頭を指すポインタが格納される。この値は、順序情報401の格納場所によって変わる。例えば、順序情報401がハードディスク111のファイルとして存在する場合、メソッド名ポインタ405にはメソッド名0 413先頭のファイル先頭からのオフセットが格納される。順序情報401がメモリ205の中に存在する場合、メソッド名ポインタ405にはメソッド名0 413先頭のアドレスが格納される。ネイティブコードローダ210が順序情報233を読み出して順序情報216としてメモリ205に格納する際、上述したようにメソッド名ポインタ405が書き換えられる。   In the method name pointer 405 of the method 0, a pointer indicating the head of the method name 0 413 is stored. This value varies depending on the storage location of the order information 401. For example, when the order information 401 exists as a file on the hard disk 111, the method name pointer 405 stores an offset from the beginning of the method name 0 413 at the beginning of the file. When the order information 401 exists in the memory 205, the method name pointer 405 stores the head address of the method name 0 413. When the native code loader 210 reads the order information 233 and stores it in the memory 205 as the order information 216, the method name pointer 405 is rewritten as described above.

ネイティブコード451は、各メソッドに対応するネイティブコードである。ところで、ここに格納されるネイティブコードはリロケータブルである場合と、リロケータブルでない場合がある。なお、リロケータブルであるとはメモリ上の位置について再配置可能であることを意味する。   The native code 451 is a native code corresponding to each method. Incidentally, the native code stored here may be relocatable or not relocatable. Note that being relocatable means that it can be rearranged at a position on the memory.

コンパイラ204がバイトコードをネイティブコードに変換するとき、あるいは、ネイティブコードローダ210がネイティブコード232をロードするとき、ネイティブコード451はコードキャッシュ218中に置かれる。ただし、ネイティブコード451は、CPU101による直接実行を可能とするためアドレス解決がなされた非リロケータブルなコードである。一方、ネイティブコードセーバ211が登録するネイティブコード232は、コードキャッシュ218のどのアドレスにも配置可能とするために、リロケータブルなコードとなっている。   When the compiler 204 converts bytecode into native code, or when the native code loader 210 loads the native code 232, the native code 451 is placed in the code cache 218. However, the native code 451 is a non-relocatable code that has been address-resolved to enable direct execution by the CPU 101. On the other hand, the native code 232 registered by the native code saver 211 is a relocatable code so that it can be placed at any address in the code cache 218.

順序情報401とネイティブコード451が共にハードディスク111上のファイルとして置かれる場合は、メソッド0のコードポインタ406には、ネイティブコード451中のメソッドコード0 452先頭のファイル先頭からのオフセットが格納される。また、メソッド0のコード長407には、メソッドコード0のバイトレングスが格納される。他のメソッドについても同様である。   When the order information 401 and the native code 451 are both placed as files on the hard disk 111, the method pointer 0 of the method code 0 452 in the native code 451 stores the offset from the beginning of the file. The code length 407 of method 0 stores the byte length of method code 0. The same applies to other methods.

一方、順序情報401とネイティブコード451が共にメモリ205中に置かれる場合は、メソッド0のコードポインタ406には、ネイティブコード451中のメソッドコード0 452先頭アドレスが格納される。また、メソッド0のコード長407には、メソッドコード0のバイトレングスが格納される。   On the other hand, when both the order information 401 and the native code 451 are placed in the memory 205, the start address of the method code 0 452 in the native code 451 is stored in the code pointer 406 of the method 0. The code length 407 of method 0 stores the byte length of method code 0.

ところで、ネイティブコード451がハードディスク111上のファイルとして置かれるか、メモリ205中に置かれるかで、メソッドコード452の長さが変わる場合がある。例えば、リロケータブルなネイティブコードの場合シンボル情報を含むため、非リロケータブルな場合に比べより長くなる。その場合は、ネイティブコード451がメモリ205に読み出されたときに、メソッドコード452自身の変更に基づき、コード長407に格納する値の更新がなされる。つまり、アドレス解決が済むとシンボル情報は不要になるので取り除かれ、コード長は短くなるからである。   Incidentally, the length of the method code 452 may change depending on whether the native code 451 is placed as a file on the hard disk 111 or in the memory 205. For example, since symbol information is included in the case of relocatable native code, it is longer than in the case of non-relocatable code. In this case, when the native code 451 is read into the memory 205, the value stored in the code length 407 is updated based on the change of the method code 452 itself. That is, when the address resolution is completed, the symbol information becomes unnecessary and is removed, and the code length is shortened.

メモリ205に格納された順序情報401は図4ではメソッド0、1、...と並んでいるが、この並びは事前に使用順序403の昇順にソートされているものとする。また、メソッド毎に用意された使用順序403からコード長407までのデータは固定長サイズである。このようにすることによって、使用順序403の若い順にメソッドを選択する操作を高速に行うことができる。   The order information 401 stored in the memory 205 is represented by the methods 0, 1,. . . Are arranged in ascending order of the usage order 403 in advance. The data from the use order 403 to the code length 407 prepared for each method has a fixed length size. In this way, an operation for selecting a method in ascending order of the usage order 403 can be performed at high speed.

図5は、デコンパイル順序情報、デコンパイルメソッド情報及びメソッド情報のデータ内部構造(構造体)を説明する図である。いずれもメモリ205に一時記憶されるデータの構造を示す。   FIG. 5 is a diagram for explaining the data internal structure (structure) of decompile order information, decompile method information, and method information. Both show the structure of data temporarily stored in the memory 205.

デコンパイル順序情報501は、デコンパイル順序の昇順に並べられたデータであり、その各々のデータはデコンパイル順序502とデコンパイルメソッドポインタ503から構成される。デコンパイル順序502には、デコンパイル順序404の値が格納される。ネイティブコードローダ210が順序情報233を読み出したとき、順序情報401がメモリ105に格納されると共に、順序情報401が有する全メソッドを走査し、デコンパイル順序404を調べ、デコンパイル順序404の若い方から並べていく。なお、デコンパイル順序404は重複することがあり得る、すなわち、同じデコンパイル順序404を持ったメソッドが複数存在し得る。デコンパイルメソッドポインタ503には、デコンパイル順序502に格納された値をデコンパイル順序として持つメソッドについて情報を格納した、デコンパイルメソッド情報531の先頭アドレスが格納される。   The decompile order information 501 is data arranged in ascending order of the decompile order, and each piece of data includes a decompile order 502 and a decompile method pointer 503. In the decompile order 502, the value of the decompile order 404 is stored. When the native code loader 210 reads the order information 233, the order information 401 is stored in the memory 105, and all methods included in the order information 401 are scanned to check the decompilation order 404. We will line up from. Note that the decompile order 404 may overlap, that is, there may be a plurality of methods having the same decompile order 404. The decompile method pointer 503 stores the start address of the decompile method information 531 that stores information about a method having the value stored in the decompile order 502 as the decompile order.

デコンパイルメソッド情報531のメソッド個数532には、同じデコンパイル順序を持つメソッドの個数が格納される。その後ろには、メソッド個数分のメソッドポインタ533が続く。メソッドポインタ533には、対応するメソッドについてのメソッド情報551の先頭アドレスが格納される。   The method number 532 of the decompile method information 531 stores the number of methods having the same decompile order. The method pointer 533 for the number of methods follows. The method pointer 533 stores the start address of the method information 551 for the corresponding method.

メソッド情報551は各メソッドについての情報を格納したもので、多くのデータは順序情報401から持ってこられる。メソッド情報551は、実際にメソッドを実行した時点での使用順序を格納する使用順序552、実際にメソッドを実行した時点でのデコンパイル順序を格納するデコンパイル順序553が格納される。また、そのメソッドについてのメソッド名ポインタ405を格納したメソッド名ポインタ554が格納される。また、そのメソッドについてのコードポインタ406を格納したコードポインタ555が格納される。さらに、そのメソッドについてのコード長407を格納したコード長556が格納される。そして、デコンパイルされたネイティブコード217中のネイティブコードへのポインタを格納するデコンパイルドコードポインタ557が格納される。さらに、そのメソッドについての使用順序403を格納したロードされた使用順序558、及びそのメソッドについてのデコンパイル順序404を格納したロードされたデコンパイル順序559が格納される。   The method information 551 stores information about each method, and a lot of data is brought from the order information 401. The method information 551 stores a usage order 552 for storing the usage order when the method is actually executed, and a decompilation order 553 for storing the decompilation order when the method is actually executed. In addition, a method name pointer 554 that stores a method name pointer 405 for the method is stored. In addition, a code pointer 555 storing a code pointer 406 for the method is stored. Furthermore, a code length 556 that stores the code length 407 for the method is stored. Then, a decompiled code pointer 557 for storing a pointer to the native code in the decompiled native code 217 is stored. Further, a loaded usage order 558 storing the usage order 403 for the method and a loaded decompilation order 559 storing the decompilation order 404 for the method are stored.

図5においては、各メソッドについての情報にどんなものがあるか分かりやすく示すために、あえて順序情報401と重複するデータをメソッド情報551中にも置いている。しかし、重複させなければならないということはない。もちろん、同じメソッドについての情報であるということで、両者をリンクさせ、重複したデータはどちらか一方にだけ持つようにしても良い。   In FIG. 5, data that overlaps with the order information 401 is also placed in the method information 551 in order to easily show what information about each method is. But it doesn't have to be duplicated. Of course, since it is information about the same method, both may be linked so that duplicate data is held in only one of them.

<アプリケーションプログラム実行時の仮想マシンの動作(ネイティブコード読出による実行)>
図6は、第1実施形態に係る仮想マシン上でアプリケーションを実行する際の動作フローチャートである。2回目以降のアプリケーション実行においては、クラス231の他、ネイティブコード232及び順序情報233が保存・登録されている。ここでは、主に、ネイティブコード232および順序情報233を用いたアプリケーションの実行を主に説明する。なお、ここでは、前述したステップS303において、ネイティブコード232がロード可能と判断された後の手順について説明を行う。
<Virtual machine operation during execution of application program (execution by reading native code)>
FIG. 6 is an operation flowchart when an application is executed on the virtual machine according to the first embodiment. In the second and subsequent application executions, the native code 232 and the order information 233 are stored and registered in addition to the class 231. Here, mainly the execution of an application using the native code 232 and the order information 233 will be mainly described. Here, the procedure after it is determined in step S303 described above that the native code 232 can be loaded will be described.

ステップS601では、ネイティブコードローダ210は順序情報233を読み出し、メモリ205中に順序情報216として記憶する。図4に示した通り、順序情報401は、予め使用順序の昇順にソートされているが、デコンパイル順序の昇順にはソートされていない。通常、使用順序とデコンパイル順序の間に関連性はないので、使用順序をキーにソートすればデコンパイル順序の順に並ぶことは無い。ただし、この場合、デコンパイル順序の若い順からメソッドを走査が実行しにくい。そこでネイティブコードローダ210は読み出した順序情報401を解析してデコンパイル順序の昇順にソートされたデコンパイル順序情報601のデータとデコンパイルメソッド情報631のデータを生成する。また、各メソッドについての情報であるメソッド情報651のデータも生成する。その際、使用順序403の値はロードされた使用順序558に格納される。デコンパイル順序404はロードされたデコンパイル順序559に格納される。   In step S <b> 601, the native code loader 210 reads the order information 233 and stores it in the memory 205 as the order information 216. As shown in FIG. 4, the order information 401 is sorted in advance in ascending order of use order, but is not sorted in ascending order of decompile order. Usually, since there is no relationship between the use order and the decompilation order, if the use order is sorted by the key, they are not arranged in the order of the decompilation order. However, in this case, it is difficult to scan the method from the youngest decompile order. Therefore, the native code loader 210 analyzes the read order information 401 and generates data of decompile order information 601 and data of decompile method information 631 sorted in ascending order of the decompile order. In addition, data of method information 651 that is information about each method is also generated. At this time, the value of the use order 403 is stored in the loaded use order 558. The decompile order 404 is stored in the loaded decompile order 559.

なお、使用順序にしてもデコンパイル順序にしてもソート処理は後に行うメソッド探索処理を高速化するためであり、必須の処理ではない。そのため、ソート処理自体の時間がかかるのを避けたい、あるいは、消費メモリを少なくしたいということであればソート処理はしなくともよい。   Note that the sort process is for speeding up the method search process to be performed later, regardless of the order of use or the order of decompilation, and is not an essential process. Therefore, if it is desired to avoid the time required for the sorting process itself or to reduce the consumption memory, the sorting process may not be performed.

ステップS602では、ネイティブコードローダ210は、使用順序403の若い方からコードキャッシュ218がフルになるまでネイティブコード232をロードする。コードポインタ406に、目指すメソッドのネイティブコード232におけるオフセットが格納されており、コード長407に、目指すメソッドのネイティブコード232における長さが格納されている。そのため、ネイティブコード232中の個々のメソッドデータにアクセスできる。なお、ロードの際には、ネイティブコードローダ210はアドレス解決処理を行い、CPU101が直接実行可能な形式に変換する。また、コードポインタ406とコード長407をコードキャッシュ218におけるメソッドコード452に適合するように更新する。   In step S602, the native code loader 210 loads the native code 232 from the younger use order 403 until the code cache 218 becomes full. The code pointer 406 stores an offset in the native code 232 of the target method, and the code length 407 stores the length of the target method in the native code 232. Therefore, individual method data in the native code 232 can be accessed. At the time of loading, the native code loader 210 performs address resolution processing and converts it into a format that can be directly executed by the CPU 101. Further, the code pointer 406 and the code length 407 are updated so as to conform to the method code 452 in the code cache 218.

ステップS603では、VM201はアプリケーション220のコードを実行する。   In step S603, the VM 201 executes the code of the application 220.

ステップS604では、VM201はアプリケーション120の初期化が完了したか否かを調べる。初期化が完了した場合については、図8を用いて後述する。初期化が完了していない場合はステップS605に進む。   In step S604, the VM 201 checks whether the initialization of the application 120 has been completed. The case where the initialization is completed will be described later with reference to FIG. If initialization has not been completed, the process proceeds to step S605.

ステップS605では、VM201は、次のコード実行がメソッド呼び出しであり、かつ、そのメソッドのネイティブコードを実行すべきかどうかを判断する。Yesの場合はステップS606に進み、Noの場合はステップS603に戻る。   In step S605, the VM 201 determines whether the next code execution is a method call and the native code of the method should be executed. In the case of Yes, it progresses to step S606, and in No, it returns to step S603.

ステップS606では、VM201は、メソッドのネイティブコードがコードキャッシュ218の中に存在するかどうかを調べる。コードキャッシュ218の中に存在する場合はステップS607に進み、無い場合はステップS611に進む。   In step S606, the VM 201 checks whether the native code of the method exists in the code cache 218. If it exists in the code cache 218, the process proceeds to step S607, and if not, the process proceeds to step S611.

ステップS607では、メソッドが既に一度実行されたことのあるネイティブコードかどうかを調べる。実行されたことがある場合はステップS603に戻り、実行されたことのないメソッドの場合にはステップS608に進む。   In step S607, it is checked whether the method is a native code that has already been executed once. If the method has been executed, the process returns to step S603. If the method has not been executed, the process proceeds to step S608.

ステップS608では、VM201は現在の使用順序の番号を使用順序552に記憶する。   In step S608, the VM 201 stores the current use order number in the use order 552.

ステップS609では、VM201は現在の使用順序の番号をインクリメントする。   In step S609, the VM 201 increments the current use order number.

ステップS610では、使用順序ずれ評価ポイント702を更新する。使用順序ずれ評価ポイント702は、ステップS608で記憶された使用順序552とロードされた使用順序558のずれ状態を示すデータである。具体的には、ずれ状態を各メソッド毎に評価、点数化したものをVM201全体で加算したものである。例えば、単純に使用順序552とロードされた使用順序558の差の絶対値をそのメソッドのポイントとしてもよい。そして、そのポイントを現在の使用順序ずれ評価ポイントに加算することで更新処理とする。   In step S610, the use order deviation evaluation point 702 is updated. The use order deviation evaluation point 702 is data indicating a deviation state between the use order 552 stored in step S608 and the loaded use order 558. Specifically, the deviation state is evaluated and scored for each method and added to the entire VM 201. For example, the absolute value of the difference between the usage order 552 and the loaded usage order 558 may be used as the point of the method. Then, the update process is performed by adding the point to the current use order deviation evaluation point.

図7は、メモリ205上に置かれる図2に示したデータ以外のデータの例を示している。これらのデータはVM201に対し各々存在し、例えば、新たにコンパイルしたメソッドの数701、使用順序ずれ評価ポイント702、及びデコンパイル順序ずれ評価ポイント703がある。   FIG. 7 shows an example of data other than the data shown in FIG. These pieces of data exist for each VM 201, and include, for example, the number of newly compiled methods 701, use order deviation evaluation points 702, and decompile order deviation evaluation points 703.

ステップS611では、VM201はメソッドのネイティブコードは登録先であるネイティブコード232の中に存在するかどうかを調べる。これは順序情報401を調べることによって判断される。必要とするメソッドが順序情報401の中にあれば、そのネイティブコードはネイティブコード232の中に存在する。存在する場合はステップS612に進み、存在しない場合はステップS616に進む。   In step S611, the VM 201 checks whether the native code of the method exists in the native code 232 that is the registration destination. This is determined by examining the order information 401. If the required method is in the order information 401, the native code is in the native code 232. When it exists, it progresses to step S612, and when it does not exist, it progresses to step S616.

ステップS612では、VM201はコードキャッシュ218に十分な空き領域があるか否かを判断する。空きがある場合はステップS613に進み、無い場合はステップS620に進む。   In step S612, the VM 201 determines whether there is sufficient free space in the code cache 218. If there is a vacancy, the process proceeds to step S613. Otherwise, the process proceeds to step S620.

ステップS613では、VM201は使用順序が若い他のネイティブコードもロードすべきかどうかを判定する。なお、判定の基準となる情報は、VM201起動時あるいは他の方法による指定によって予め設定されている。例えば、起動するアプリケーション220が毎回同じで、かつ、アプリケーション220のコマンドオプションやコンフィギュレーションも同じである場合、VM201が実行するメソッドの順番も変わらないということはしばしば起こり得る。そのような場合、メソッドの使用順序は同じであるから、メソッドのネイティブコードを一つづつロードするよりも、まとめてロードした方が保存先にアクセスする回数、時間が減って高速化される。特に、FlashROM109、ネットワークI/F110、及びハードディスク111等へのI/Oアクセスは非常に時間がかかる処理なので、できるだけ回数を減らした方がよい。そのために、使用順序が若い他のネイティブコードもロードすべきと設定しておくのは有用である。他のコードもロードすべきと判断した場合はステップS615に進み、ロードしないと判断した場合はステップS614に進む。   In step S613, the VM 201 determines whether to load another native code whose use order is young. It should be noted that the information serving as a criterion for determination is set in advance when the VM 201 is activated or designated by another method. For example, when the application 220 to be started is the same every time and the command options and the configuration of the application 220 are the same, it is often possible that the order of the methods executed by the VM 201 does not change. In such a case, the usage order of the methods is the same, so that loading the method at a time reduces the number of times and the time for accessing the storage destination, rather than loading the method native codes one by one. In particular, I / O access to the Flash ROM 109, the network I / F 110, the hard disk 111, and the like is a process that takes a very long time, so it is better to reduce the number of times as much as possible. For that reason, it is useful to set that other native code with a lower usage order should also be loaded. If it is determined that another code should be loaded, the process proceeds to step S615, and if it is determined not to be loaded, the process proceeds to step S614.

ステップS614では、VM201はステップS605で指定されたメソッドに対応するネイティブコードをロードする。その後、ステップS608に戻る。   In step S614, the VM 201 loads the native code corresponding to the method specified in step S605. Thereafter, the process returns to step S608.

ステップS615では、順序情報401の中でまだロードしていないメソッドを使用順序403の若い方から順にコードキャッシュ218にロードする。もちろん、使用順序403の若い方から探索されるネイティブコードのロードは、コードキャッシュ218の容量に制限される。その後、ステップS608に戻る。   In step S615, the methods that have not yet been loaded in the order information 401 are loaded into the code cache 218 in order from the lowest use order 403. Of course, the loading of the native code searched from the younger use order 403 is limited to the capacity of the code cache 218. Thereafter, the process returns to step S608.

ステップS620では、VM201は順序情報301の中にデコンパイル順序404があるかどうかを判断する。デコンパイル順序404がある場合はステップS621に進み、ない場合はステップS629に進む。なお、図3に示した手順ではデコンパイル順序を保存するよう構成したが、保存しなければならないということはない。その場合、ステップS620があることで、例えデコンパイル順序が保存されなくても動作することができる。   In step S620, the VM 201 determines whether the decompile order 404 is included in the order information 301. If the decompile order 404 exists, the process proceeds to step S621, and if not, the process proceeds to step S629. In the procedure shown in FIG. 3, the decompilation order is saved, but it is not necessary to save it. In that case, the presence of step S620 enables operation even if the decompile order is not saved.

ステップS621では、VM201はデコンパイル順序404の若い方からコードキャッシュ218中のネイティブコードを選択する。この若い方から選択する処理に、上述のデコンパイル順序情報601、デコンパイルメソッド情報631、及びメソッド情報651が用いられる。なお、同じ値のデコンパイル順を持つ複数のメソッドが存在する場合は複数のネイティブコードが選択される。   In step S621, the VM 201 selects the native code in the code cache 218 from the younger one in the decompile order 404. The decompile order information 601, decompile method information 631, and method information 651 described above are used for the process of selecting from the younger one. If there are a plurality of methods having the same decompile order, a plurality of native codes are selected.

ステップS622では、VM201は選択したネイティブコードの実行頻度は予め指定された頻度より低いかどうかを判断する。低い場合はステップS823に進み、高い場合はステップS830に進む。なお、ステップS621で複数のネイティブコードが選択されている場合は各々に対し判断される。   In step S622, the VM 201 determines whether or not the execution frequency of the selected native code is lower than a frequency specified in advance. When it is low, the process proceeds to step S823, and when it is high, the process proceeds to step S830. If a plurality of native codes are selected in step S621, the determination is made for each.

ステップS623では、VM201は、現在のデコンパイル順序の番号をデコンパイル順序553に記憶する。   In step S623, the VM 201 stores the current decompile order number in the decompile order 553.

ステップS624では、VM201は現在のデコンパイル順序の番号をインクリメントする。   In step S624, the VM 201 increments the current decompile order number.

ステップS625では、デコンパイラ212は、デコンパイル対象メソッドのネイティブコードをコードキャッシュ218外の領域117にコピーする。   In step S625, the decompiler 212 copies the native code of the decompile target method to the area 117 outside the code cache 218.

ステップS626では、デコンパイラ212はデコンパイル対象メソッドをコードキャッシュ218から破棄する。   In step S626, the decompiler 212 discards the decompile target method from the code cache 218.

ステップS627では、VM201はデコンパイル順序ずれ評価ポイント703を更新する。デコンパイル順序ずれ評価ポイント703は上述した使用順序ずれ評価ポイントと同様に評価され、ポイントが更新される。   In step S627, the VM 201 updates the decompilation order evaluation point 703. The decompile order deviation evaluation point 703 is evaluated in the same manner as the use order deviation evaluation point described above, and the point is updated.

ステップS628では、VM201はコードキャッシュ218に十分な空きがあるか否かを確認する。十分な空きがある場合にはステップS613に戻り、無い場合にはステップS620に戻る。   In step S628, the VM 201 confirms whether there is sufficient space in the code cache 218. If there is sufficient space, the process returns to step S613, and if not, the process returns to step S620.

ステップS629では、VM201はデコンパイル順序404の実行頻度情報を参照してデコンパイル対象メソッドを決定する。以降はそのネイティブコードに対し前述のステップS623から始まるデコンパイル処理を行う。   In step S629, the VM 201 refers to the execution frequency information of the decompile order 404 and determines a decompile target method. Thereafter, a decompilation process starting from the above-described step S623 is performed on the native code.

但し、ステップS627のデコンパイル順序ずれ評価ポイントの更新処理に関しては、このシーケンスの場合、ロードされたデコンパイル順序559が存在しない。そのため、デコンパイル順序553とロードされたデコンパイル順序559の差の絶対値を取るなどということはできない。従って、この場合の処理としては、例えばデコンパイル順序ずれ評価ポイント703を最大値に設定する。このようにすることで、後で必ずデコンパイル順序が保存されるようになる。なお、デコンパイル順序を保存しなくてよい場合はデコンパイル順序ずれ評価ポイント703を変化させないようにしてもよい。   However, with regard to the update processing of the decompilation order deviation evaluation point in step S627, in the case of this sequence, the loaded decompilation order 559 does not exist. Therefore, the absolute value of the difference between the decompile order 553 and the loaded decompile order 559 cannot be taken. Therefore, as a process in this case, for example, the decompilation order deviation evaluation point 703 is set to the maximum value. By doing so, the decompilation order is always saved later. If the decompilation order does not need to be stored, the decompilation order deviation evaluation point 703 may not be changed.

ステップS630では、デコンパイル順序ずれ評価ポイント703は更新する。この場合、実際にデコンパイルされたわけではないので、デコンパイル順序553は有効な値が設定されていない。そのため、デコンパイル順序553とロードされたデコンパイル順序559の差の絶対値を取る操作は行えない。しかし、デコンパイル順序404(すなわち、ロードされたデコンパイル順序559)は若い値を示している。にもかかわらずデコンパイルすべきでないということは、やはりデコンパイル順序として異変があったとことを示している。   In step S630, the decompilation order deviation evaluation point 703 is updated. In this case, since the actual decompilation is not performed, a valid value is not set in the decompilation order 553. Therefore, an operation that takes the absolute value of the difference between the decompile order 553 and the loaded decompile order 559 cannot be performed. However, decompile order 404 (ie, loaded decompile order 559) shows a young value. Nevertheless, the fact that it should not be decompiled indicates that the decompile order has changed.

そこで、ここでは、例えばある定数値からロードされたデコンパイル順序559の値を差し引いた値を加算することによりデコンパイル順序ずれ評価ポイント703を更新する。このようにすることにより、デコンパイル順序の若いネイティブコードほど、大きいずれとしてデコンパイル順序ずれ評価ポイント703に加算することができる。   Therefore, here, for example, the decompile order deviation evaluation point 703 is updated by adding a value obtained by subtracting the value of the decompile order 559 loaded from a certain constant value. In this way, the smaller the decompile order native code, the larger the decompile order evaluation point 703 can be added.

ステップS616では、コンパイラ204はコンパイルが必要になったメソッドのバイトコードをコンパイルしてネイティブコードを生成し、コードキャッシュ218に記憶する。   In step S 616, the compiler 204 compiles the byte code of the method that needs to be compiled to generate native code, and stores it in the code cache 218.

ステップS617では、VM201は現在の使用順序の番号を使用順序552に記憶する。   In step S617, the VM 201 stores the current use order number in the use order 552.

ステップS618では、VM201は現在の使用順序の番号をインクリメントする。   In step S618, the VM 201 increments the current use order number.

ステップS631では、VM201は使用順序ずれ評価ポイント702を更新する。ここでは新たなメソッドのコンパイルが必要になっているため、このメソッドに対しロードされた使用順序558は存在しない。従って、使用順序552とロードされた使用順序558の差の絶対値を取ることはできない。そこで、上述のデコンパイル順序ずれ評価ポイント703についての処理と同様に、使用順序ずれ評価ポイントを最大値に設定するなどの方法が考えられる。   In step S631, the VM 201 updates the use order deviation evaluation point 702. Here, since a new method needs to be compiled, there is no usage order 558 loaded for this method. Therefore, the absolute value of the difference between the usage order 552 and the loaded usage order 558 cannot be taken. Therefore, a method of setting the use order deviation evaluation point to the maximum value as in the above-described processing for the decompilation order deviation evaluation point 703 is conceivable.

ステップS619では、新たにコンパイルしたメソッドの数701の数字をインクリメントする。その後、ステップS603に戻る。   In step S619, the number of newly compiled methods 701 is incremented. Thereafter, the process returns to step S603.

<アプリケーションプログラム実行後の仮想マシンの動作(ネイティブコードの更新)>
ところで、アプリケーションの初期化動作に必要なメソッドはパラメータの変更などにより変化する。つまり、同一のアプリケーションに対して、異なるネイティブコードが必要となることがある。以下では、そのような場合における仮想マシンの動作、特にネイティブコードの更新動作について説明する。
<Virtual machine operation after application program execution (update of native code)>
By the way, the method required for the initialization operation of the application changes due to a change of parameters or the like. In other words, different native codes may be required for the same application. In the following, the operation of the virtual machine in such a case, in particular, the native code update operation will be described.

図8は、第1実施形態に係る仮想マシン上でアプリケーションを実行する際の動作フローチャートである。図6の場合と同様、2回目以降のアプリケーション実行においては、クラス231の他、ネイティブコード232及び順序情報233が保存・登録されている。なお、ここでは、前述したステップS604において、アプリケーション220の初期化が完了したと判断された後の手順について説明を行う。つまり、以下の動作は、アプリケーション220が起動した後のタイミングで実行される動作である。   FIG. 8 is an operation flowchart when an application is executed on the virtual machine according to the first embodiment. As in the case of FIG. 6, in the second and subsequent application executions, the native code 232 and the order information 233 are stored and registered in addition to the class 231. Here, the procedure after it is determined in step S604 described above that the initialization of the application 220 has been completed will be described. That is, the following operation is an operation executed at a timing after the application 220 is activated.

ステップS801では、VM201はデコンパイル順序ずれ評価ポイント703が予め指定された値を超えたか否かを判断する。超えた場合はステップS802に進み、超えていない場合はステップS803に進む。

ステップS802では、VM201はデコンパイル順序553が設定されているメソッドについて、メモリ205中の順序情報401のデコンパイル順序404をデコンパイル順序553の値で更新する。
In step S801, the VM 201 determines whether or not the decompilation order evaluation point 703 has exceeded a predetermined value. If exceeded, the process proceeds to step S802, and if not exceeded, the process proceeds to step S803.

In step S <b> 802, the VM 201 updates the decompile order 404 of the order information 401 in the memory 205 with the value of the decompile order 553 for the method for which the decompile order 553 is set.

ステップS803では、VM201は使用順序ずれ評価ポイント702が予め指定された値を超えたか否かを判断する。超えた場合はステップS804に進み、超えていない場合はステップS805に進む。   In step S803, the VM 201 determines whether or not the use order deviation evaluation point 702 has exceeded a predetermined value. If exceeded, the process proceeds to step S804, and if not exceeded, the process proceeds to step S805.

ステップS804では、VM201は使用順序552が設定されているメソッドについて、メモリ205中の順序情報401の使用順序403を使用順序552の値で更新する。   In step S804, the VM 201 updates the use order 403 of the order information 401 in the memory 205 with the value of the use order 552 for the method for which the use order 552 is set.

ステップS805では、VM201は新たにコンパイルしたメソッドの数701が予め指定された数を超えたか否かを判断する。超えた場合はステップS806に進み、超えていない場合はステップS807に進む。   In step S805, the VM 201 determines whether or not the number of newly compiled methods 701 exceeds a predetermined number. If exceeded, the process proceeds to step S806, and if not exceeded, the process proceeds to step S807.

ステップS806では、VM201は新たにコンパイルしたメソッドについて、順序情報401を作成する。   In step S806, the VM 201 creates order information 401 for the newly compiled method.

ステップS807では、VM201はメソッド情報551を走査する。そして、ロードされた使用順序558がセットされているにも関わらず、使用順序552がセットされていないメソッド、つまりロードされたが使用されなかったメソッドの数が予め指定された数を超えたか否かを判断する。超えた場合はステップS808に進み、超えていない場合はステップS809に進む。   In step S807, the VM 201 scans the method information 551. Whether or not the number of methods for which the order of use 552 is not set, that is, the number of methods that have been loaded but not used, even though the loaded use order 558 is set, exceeds a predetermined number Determine whether. If exceeded, the process proceeds to step S808, and if not exceeded, the process proceeds to step S809.

ステップS808では、VM201は該当するメソッドに関する順序情報401を削除する。また、VM201は順序情報401を削除したメソッドは何かを記憶しておく。   In step S808, the VM 201 deletes the order information 401 regarding the corresponding method. Also, the VM 201 stores what method has the order information 401 deleted.

ステップS809では、VM201は順序情報401のコードポインタ406がファイルオフセットのままで、アドレスに変換されていないメソッドの数が予め指定された数を超えたか否かを判断する。つまり、順序情報401は読み出されたが、ネイティブコード232からそのネイティブコードは読み出されなかったメソッドの数が予め指定された数を超えたか否かを判断する。超えた場合はステップS810に進み、超えていない場合はステップS811に進む。なお、コードポインタ406がファイルオフセットかアドレスか区別がつかない場合は、順序情報401のメソッド毎にネイティブコードをロード済みか否か示す情報を追加し、それによって判断してもよい。   In step S809, the VM 201 determines whether or not the code pointer 406 of the order information 401 remains at the file offset and the number of methods that have not been converted into addresses has exceeded a predetermined number. That is, it is determined whether or not the number of methods from which the order information 401 has been read but the native code has not been read from the native code 232 exceeds a predetermined number. If exceeded, the process proceeds to step S810, and if not exceeded, the process proceeds to step S811. If it is not possible to distinguish whether the code pointer 406 is a file offset or an address, information indicating whether or not the native code has been loaded may be added for each method of the order information 401, and the determination may be made accordingly.

ステップS810では、VM201はネイティブコード132を削除する。この場合は、ネイティブコード132を完全に入れ替えることになる。   In step S810, the VM 201 deletes the native code 132. In this case, the native code 132 is completely replaced.

ステップS811では、VM201は、ステップS801、ステップS803、ステップS805、ステップS807、ステップS809のいずれかでYesになったか否かを判断する。つまり、順序情報401およびネイティブコードの何れか保存が必要になったかどうかを判断する。保存が必要でないと判断されれば、終了する。   In step S811, the VM 201 determines whether or not the answer is YES in any of step S801, step S803, step S805, step S807, and step S809. That is, it is determined whether saving of either the order information 401 or the native code is necessary. If it is determined that storage is not necessary, the process ends.

ステップS812では、VM201はステップS805またはステップS809でYになった、つまりネイティブコードの保存が必要になったかどうかを判断する。ネイティブコードの保存が必要になったと判断されればステップS813へ進み、ネイティブコードの保存が必要でないと判断された場合はステップS815に進む。   In step S812, the VM 201 determines whether it is Y in step S805 or step S809, that is, whether it is necessary to save the native code. If it is determined that the native code needs to be stored, the process proceeds to step S813. If it is determined that the native code needs not be stored, the process proceeds to step S815.

ステップS813では、VM201は保存対象のネイティブコードのセットを生成する。なお、保存対象のネイティブコードはコードキャッシュ218あるいはデコンパイルされたネイティブコード217に記憶されている。このステップにより、非リロケータブルなネイティブコードはリロケータブルなネイティブコードになる。また、ネイティブコード451のように各メソッドが連続した領域に配置すると好適である。つまり、このように配置することにより、後述する保存が容易になる。   In step S813, the VM 201 generates a set of native codes to be saved. Note that the native code to be saved is stored in the code cache 218 or the decompiled native code 217. By this step, the non-relocatable native code becomes a relocatable native code. Further, it is preferable to arrange each method in a continuous area like the native code 451. That is to say, this arrangement facilitates storage, which will be described later.

ステップS814では、VM201は順序情報401中の各メソッドに関する情報を設定する。ここでコードポインタ406、コード長407はネイティブコード232として保存されるときに合わせて更新される。メソッド名ポインタ405も順序情報401が保存されるときに併せて更新される。   In step S814, the VM 201 sets information regarding each method in the order information 401. Here, the code pointer 406 and the code length 407 are updated in accordance with the saving as the native code 232. The method name pointer 405 is also updated when the order information 401 is saved.

ステップS815では、VM201は使用順序403の値で順序情報401のメソッド毎のデータ部分をソートする。   In step S <b> 815, the VM 201 sorts the data part for each method of the order information 401 by the value of the use order 403.

ステップS816では、ネイティブコードセーバ211は順序情報401を順序情報233として保存する。   In step S816, the native code saver 211 stores the order information 401 as the order information 233.

ステップS817では、VM201はネイティブコードの全保存が必要かどうかを判定する。具体的には、ステップS810で保存先のネイティブコード232を削除した場合に全保存が必要と判定される。全保存が必要な場合はステップS818に進み、全保存が必要でない場合はステップS819に進む。   In step S817, the VM 201 determines whether it is necessary to save all native code. Specifically, when the storage destination native code 232 is deleted in step S810, it is determined that all storage is necessary. If all storage is necessary, the process proceeds to step S818. If all storage is not necessary, the process proceeds to step S819.

ステップS818では、ネイティブコードセーバ211はネイティブコードをネイティブコード232に全保存して、終了する。   In step S818, the native code saver 211 stores all the native code in the native code 232, and the process ends.

ステップS819では、VM201はネイティブコードの追加が必要かどうかを判定する。具体的には、ステップS806で新たなメソッドの順序情報401を生成した場合、追加が必要と判定される。必要な場合はステップS820に進み、不必要な場合はステップS821に進む。   In step S819, the VM 201 determines whether it is necessary to add a native code. Specifically, if new method order information 401 is generated in step S806, it is determined that addition is necessary. If necessary, the process proceeds to step S820; otherwise, the process proceeds to step S821.

ステップS820では、ネイティブコードセーバ211はステップS806で順序情報401を作成したメソッドのネイティブコードをネイティブコード232に追加する。   In step S 820, the native code saver 211 adds the native code of the method that created the order information 401 in step S 806 to the native code 232.

ステップS821では、VM201はネイティブコードの削除が必要かどうかを判定する。具体的には、ステップS808で順序情報401が削除されたメソッドがある場合、削除が必要と判定される。必要な場合はステップS822に進み、不必要な場合は終了する。   In step S821, the VM 201 determines whether it is necessary to delete the native code. Specifically, if there is a method from which the order information 401 is deleted in step S808, it is determined that deletion is necessary. If necessary, the process proceeds to step S822, and if not necessary, the process ends.

ステップS822では、VM201はネイティブコード232からステップS808で記憶した削除対象メソッドについて、ネイティブコードを削除する。その後終了する。   In step S822, the VM 201 deletes the native code for the deletion target method stored in step S808 from the native code 232. Then exit.

以上説明したように、第1実施形態の情報処理装置によれば、バイトコードで記述されたプログラムをより速く初期化完了することが可能となる。また、アプリケーション220の初期化完了後に初期化時のネイティブコードの利用状態に応じて更新処理を行うことにより、より効率的なネイティブコード232を保存することが可能となる。   As described above, according to the information processing apparatus of the first embodiment, it is possible to complete initialization of a program written in byte code more quickly. Further, by performing update processing according to the use state of the native code at the time of initialization after the initialization of the application 220 is completed, it is possible to store the more efficient native code 232.

すなわち、コードキャッシュのサイズが小さく、初期化処理の際にデコンパイル処理が避けられないような場合でも、デコンパイルされたコードが再利用でき、次回のプログラムの起動を高速化することが可能となる。従って、PCあるいは複写機や複合機といった比較的メモリ資源に余裕のある機器だけでは無く、パーソナルプリンタやデジタルカメラなどのメモリが少ないコンシューマ向け機器にも利用可能である。特に、コンシューマ向け機器では製造コストを抑えるため、中央演算処理装置などに必要最低限の性能のものが使用されており、本発明のような高速化技法は有効である。   In other words, even if the code cache size is small and decompilation is unavoidable during initialization, the decompiled code can be reused and the next program startup can be accelerated. Become. Therefore, it can be used not only for devices having a relatively large memory resource, such as PCs, copiers, and multifunction devices, but also for consumer devices with little memory, such as personal printers and digital cameras. In particular, in consumer equipment, in order to reduce manufacturing costs, a central processing unit having a minimum performance is used, and a high-speed technique such as the present invention is effective.

また、外部記憶装置に記憶されたコンパイル済みコードをコードキャッシュにロードしてプログラムを実行する場合、使用順序を参照しコードをロードすることにより効率の良いロードが可能となり高速化に寄与する。   Also, when the compiled code stored in the external storage device is loaded into the code cache and the program is executed, efficient loading is possible by referring to the order of use and loading the code, which contributes to speeding up.

(第2実施形態)
第2実施形態では、アプリケーション220毎にネイティブコード232および順序情報233の管理を行うことにより、複数のアプリケーションに対し、効率的なネイティブコードの管理を可能としている。なお、装置構成および、個々のアプリケーションに対する実行時の仮想マシン201の動作については第1実施形態と同様であるため、詳細な説明は省略する。
(Second Embodiment)
In the second embodiment, by managing the native code 232 and the order information 233 for each application 220, it is possible to efficiently manage native codes for a plurality of applications. The apparatus configuration and the operation of the virtual machine 201 at the time of execution for each application are the same as those in the first embodiment, and thus detailed description thereof is omitted.

<仮想マシン(VM)およびアプリケーションプログラムの構成>
図9は、複数のアプリケーションを実行する際のソフトウェア階層構造の概念図である。図9において、VM201の上でアプリケーション管理マネージャ901が動作しており、複数のアプリケーション220a〜cはアプリケーション管理マネージャ901により管理され実行される。
<Configuration of virtual machine (VM) and application program>
FIG. 9 is a conceptual diagram of a software hierarchical structure when a plurality of applications are executed. In FIG. 9, an application management manager 901 operates on the VM 201, and a plurality of applications 220a to 220c are managed and executed by the application management manager 901.

図10は、第2実施形態に係る仮想マシンの内部構成を示すブロック図である。なお、仮想マシン環境は、ネイティブ環境で動作する仮想マシンプログラムを実行することにより実現される。なお、図が煩雑になるのを避けるため、図10においては図2に比較しいくつか矢印を削除してある。以下では、図2に対して追加された部分について説明を行う。   FIG. 10 is a block diagram illustrating an internal configuration of the virtual machine according to the second embodiment. The virtual machine environment is realized by executing a virtual machine program that operates in a native environment. In order to avoid complication of the figure, some arrows are deleted in FIG. 10 compared to FIG. Below, the part added with respect to FIG. 2 is demonstrated.

アプリケーション管理マネージャ901は、インストーラ1001、アンインストーラ1002、実行開始指示部1003、停止指示部1004および初期化完了通知部1005を備えている。インストーラ1001は、1つ以上のアプリケーション220をインストール(登録)する機能を有する。アンインストーラ1002、インストールされているアプリケーション220をアンインストール(登録解除)する機能を有する。また、実行開始指示部1003は、アプリケーション220を指定し実行開始を指示する機能を有する。停止指示部1004は、実行中のアプリケーション220を指定し停止を指示する機能を有する。さらに、初期化完了通知部1005は、アプリケーション220の初期化完了をVM201に通知する機能を有する。   The application management manager 901 includes an installer 1001, an uninstaller 1002, an execution start instruction unit 1003, a stop instruction unit 1004, and an initialization completion notification unit 1005. The installer 1001 has a function of installing (registering) one or more applications 220. The uninstaller 1002 has a function of uninstalling (deregistering) the installed application 220. The execution start instruction unit 1003 has a function of specifying the application 220 and instructing the start of execution. The stop instruction unit 1004 has a function of specifying the application 220 being executed and instructing the stop. Further, the initialization completion notification unit 1005 has a function of notifying the VM 201 of the completion of initialization of the application 220.

一方、VM201は、図2に示された各部に加え、ネイティブコード削除部1021、順序情報削除部1022、メモリ順序情報削除部1023および初期化終了検出部1024を備えている。ネイティブコード削除部1021は、ネイティブコード232を削除する機能を有する。順序情報削除部1022は、順序情報233を削除する機能を有する。メモリ順序情報削除部1023は、順序情報216の中にある各メソッドについての順序情報を削除する機能を有する。初期化完了検出部1024は、アプリケーション220の初期化完了を検出する機能を有する。   On the other hand, the VM 201 includes a native code deletion unit 1021, an order information deletion unit 1022, a memory order information deletion unit 1023, and an initialization end detection unit 1024 in addition to the units illustrated in FIG. The native code deletion unit 1021 has a function of deleting the native code 232. The order information deletion unit 1022 has a function of deleting the order information 233. The memory order information deleting unit 1023 has a function of deleting order information for each method in the order information 216. The initialization completion detection unit 1024 has a function of detecting completion of initialization of the application 220.

<アプリケーションのインストール(登録)および管理>
図11は、第2実施形態に係る仮想マシン上でアプリケーションを実行する際の動作フローチャートである。ここでは、アプリケーションとして220a、220bおよび220cの3つがROM102に記憶され、予めインストーラ1001によりアプリケーション管理マネージャ901に登録されているとする。なお、インストーラ1001による登録動作はアプリケーションの起動とは独立して行っても良いが、あるアプリケーションが最初に実行指示される際に自動的に登録動作がなされるように構成しても良い。
<Installation (registration) and management of application>
FIG. 11 is an operation flowchart when an application is executed on the virtual machine according to the second embodiment. Here, it is assumed that three applications 220a, 220b, and 220c are stored in the ROM 102 and registered in the application management manager 901 by the installer 1001 in advance. Note that the registration operation by the installer 1001 may be performed independently of the activation of the application, but may be configured such that the registration operation is automatically performed when an execution instruction is given for a certain application for the first time.

ステップS1101では、ユーザによる操作ボタン108によるアプリケーション220の実行指示などに基づき、CPU101はVM201環境を動作開始する。例えば、CPU101がVM201環境を実現するためのVMプログラムを実行することにより実現される。   In step S1101, the CPU 101 starts the operation of the VM 201 environment based on an instruction to execute the application 220 by the operation button 108 by the user. For example, this is realized by the CPU 101 executing a VM program for realizing the VM 201 environment.

ステップS1102では、VM201は、アプリケーション管理マネージャ901を開始する。   In step S1102, the VM 201 starts the application management manager 901.

ステップS1103では、実行開始指示部1003は、既にインストールされたアプリケーション220a〜cの中から、ユーザにより指定されたアプリケーション220を選んで開始する。以下では、アプリケーション220aが選択されたものとして説明をする。   In step S1103, the execution start instruction unit 1003 selects and starts the application 220 designated by the user from the already installed applications 220a to 220c. In the following description, it is assumed that the application 220a is selected.

ステップS1104では、VM201はアプリケーション220aを実行開始する。具体的には、第1実施形態において、図3および図6を用いて説明した動作を行う。つまり、アプリケーション220aのネイティブコード232及び順序情報233のロード及び読み出し、順序情報401の更新処理等を行う。 ステップS1105では、アプリケーション220aの初期化が完了したか否かを判断する。完了していなければ、引き続き初期化動作を行う。完了した場合はステップS1106に進む。なお、初期化の完了は、例えば、初期化完了通知部1005によるVM201への通知、あるいは、初期化完了検出部1024による初期化完了の検出により実現される。   In step S1104, the VM 201 starts executing the application 220a. Specifically, the operation described with reference to FIGS. 3 and 6 is performed in the first embodiment. That is, the native code 232 and the order information 233 of the application 220a are loaded and read, the order information 401 is updated, and the like. In step S1105, it is determined whether initialization of the application 220a has been completed. If not completed, the initialization operation is continued. If completed, the process advances to step S1106. The completion of initialization is realized by, for example, notification to the VM 201 by the initialization completion notification unit 1005 or detection of initialization completion by the initialization completion detection unit 1024.

ステップS1106では、VM201は、アプリケーション220aのネイティブコード232および順序情報233を保存する。   In step S1106, the VM 201 stores the native code 232 and the order information 233 of the application 220a.

ステップS1107では、VM201は、コードキャッシュ218に十分な空きがあるか否かを判断する。空きがある場合はステップS1114に進み、無い場合はステップS1108に進む。なお、このステップは第1実施形態で述べたステップ(例えば、S307)とは意味合いが異なる。つまり、ここでは、他のアプリケーション(220b、c)を起動するために必要なコードキャッシュ218に十分な空きがあるか否かを判断するのである。   In step S1107, the VM 201 determines whether there is sufficient space in the code cache 218. If there is a vacancy, the process proceeds to step S1114; otherwise, the process proceeds to step S1108. This step has a different meaning from the step described in the first embodiment (for example, S307). That is, here, it is determined whether or not there is sufficient free space in the code cache 218 necessary for starting other applications (220b, c).

ステップS1108では、VM201はデコンパイル対象と判定する実行頻度の基準を決定する。決定方法としてはユーザからの入力を受け付けるよう構成しても良いし、予め指定した初期パラメータ(不図示)を用いて決定しても良い。   In step S <b> 1108, the VM 201 determines an execution frequency criterion for determining that the object is to be decompiled. The determination method may be configured to accept input from the user, or may be determined using an initial parameter (not shown) designated in advance.

ステップS1109では、VM201は、複数のアプリケーション220の中で、アプリケーション220aのクラス231のみが有するメソッドで、かつ、実行頻度が前述の実行頻度より低いものがあるか否かを判断する。低いものがない場合はステップS1110に進み、低いものがある場合はステップS1112に進む。   In step S <b> 1109, the VM 201 determines whether there is a method that is included in only the class 231 of the application 220 a and has an execution frequency lower than the above-described execution frequency among the plurality of applications 220. If there is no low one, the process proceeds to step S1110, and if there is a low one, the process proceeds to step S1112.

ステップS1110では、VM201は、複数のアプリケーション220間で共通に使用されるのメソッド(以降、共通メソッドと呼ぶ)でかつ、実行頻度が前述の実行頻度より低いものがあるか否かを判断する。低いものがない場合はステップS1111に進み、低いものがある場合はステップS1112に進む。ステップS1110をステップS1109と分けることにより、共通メソッドのデコンパイルの優先度を、アプリケーション220a固有のメソッドに比較し下げることが可能となる。   In step S1110, the VM 201 determines whether there is a method that is used in common among a plurality of applications 220 (hereinafter referred to as a common method) and that has an execution frequency lower than the above-described execution frequency. If there is no low one, the process proceeds to step S1111. If there is a low one, the process proceeds to step S1112. By dividing step S1110 from step S1109, it is possible to lower the priority of decompilation of the common method compared to the method specific to the application 220a.

ステップS1111では、VM201はデコンパイル対象と判定する実行頻度の基準を上げる。その後、ステップS1109に戻る。ステップS1109〜ステップS1111のステップを繰り返すことによりにより、ステップS1109またはステップS1110によりデコンパイル対象となるメソッドが決定される。   In step S <b> 1111, the VM 201 increases the execution frequency criterion for determining that the object is to be decompiled. Thereafter, the process returns to step S1109. By repeating steps S1109 to S1111, a method to be decompiled is determined in step S1109 or step S1110.

ステップS1112では、デコンパイラ212はデコンパイル対象として選択されたメソッドのネイティブコードをデコンパイルする。これは第1実施形態で説明したデコンパイルと同様の処理である。ただし、デコンパイルされたネイティブコードは領域217にコピーはされない。なぜなら次回の起動に必要なネイティブコードは既にステップS1106で保存されているためコピーは必要ないからである。   In step S1112, the decompiler 212 decompiles the native code of the method selected as the decompile target. This is the same processing as the decompilation described in the first embodiment. However, the decompiled native code is not copied to the area 217. This is because the native code necessary for the next activation is already stored in step S1106, so no copy is necessary.

ステップS1113では、メモリ順序情報削除部1023はデコンパイルしたメソッドの順序情報216を削除する。そしてステップS1107に戻る。   In step S1113, the memory order information deletion unit 1023 deletes the order information 216 of the decompiled method. Then, the process returns to step S1107.

ステップS1114では、VM201はアプリケーション120aのメソッド及び共通メソッドの順序情報(使用順序552及びデコンパイル順序553)を初期化する。次に起動するアプリケーション120a〜cの実行時に、古い順序情報が残らないようにするためである。   In step S1114, the VM 201 initializes the order information (usage order 552 and decompile order 553) of the method and common method of the application 120a. This is to prevent old order information from remaining when the application 120a-c to be started next is executed.

ステップS1115では、実行開始指示部1003は、既にインストールされたアプリケーション220a〜cの中から、ユーザにより指定された2つ目のアプリケーション220を選んで開始する。そして、2つ目のアプリケーション(例えば、220b)について、ステップS1103に戻り同様に処理を行う。   In step S1115, the execution start instruction unit 1003 selects and starts the second application 220 designated by the user from the already installed applications 220a to 220c. Then, for the second application (for example, 220b), the process returns to step S1103 and the same processing is performed.

<アプリケーションのアンインストール(登録削除)>
図12は、第2実施形態に係る仮想マシン上でアプリケーションをアンインストールする際の動作フローチャートである。ここでは、アプリケーションとして220a、220bおよび220cの3つがROM102に記憶され、予めインストーラ1001によりアプリケーション管理マネージャ901に登録されているとする。
<Uninstall (delete registration)>
FIG. 12 is an operation flowchart when the application is uninstalled on the virtual machine according to the second embodiment. Here, it is assumed that three applications 220a, 220b, and 220c are stored in the ROM 102 and registered in the application management manager 901 by the installer 1001 in advance.

ステップS1201では、ユーザによる操作ボタン108によるアプリケーション220の実行指示などに基づき、CPU101はVM201環境を動作開始する。例えば、CPU101がVM201環境を実現するためのVMプログラムを実行することにより実現される。   In step S1201, the CPU 101 starts operation of the VM 201 environment based on an instruction to execute the application 220 by the operation button 108 by the user. For example, this is realized by the CPU 101 executing a VM program for realizing the VM 201 environment.

ステップS1202では、VM201は、アプリケーション管理マネージャ901を開始する。   In step S1202, the VM 201 starts the application management manager 901.

ステップS1203では、アンインストーラ1002は例えばユーザにより指定されたアプリケーション(例えば220c)のアンインストールを開始する。具体的には、ショートカットの削除などアプリケーション220cを即座に起動できない状態にする。   In step S1203, the uninstaller 1002 starts uninstalling an application (for example, 220c) designated by the user, for example. Specifically, the application 220c is made in a state where it cannot be started immediately, such as deleting a shortcut.

ステップS1204では、ネイティブコード削除部1021はアプリケーション220cに対応するネイティブコード232cを削除する。   In step S1204, the native code deletion unit 1021 deletes the native code 232c corresponding to the application 220c.

ステップS1205では、順序情報削除部1022はアプリケーション220cに対応する順序情報233cを削除する。   In step S1205, the order information deletion unit 1022 deletes the order information 233c corresponding to the application 220c.

以上のステップを経て、アプリケーション220cをインストールしていない状態に戻すのである。なお、停止指示部1004の指示によりネイティブコード削除部1021および順序情報削除部1022を動作させるようにしても良い。その場合、ネイティブコード232cおよび順序情報233cのみ削除され、ショートカットなどは削除されず、残すことが可能となる。   Through the above steps, the application 220c is returned to the non-installed state. Note that the native code deletion unit 1021 and the order information deletion unit 1022 may be operated according to an instruction from the stop instruction unit 1004. In this case, only the native code 232c and the order information 233c are deleted, and shortcuts and the like can be left without being deleted.

<共通メソッドに対応するネイティブコードの保存>
前述したように、複数のアプリケーション220が存在する場合、2以上のアプリケーションに共通するメソッド(共通メソッド)が存在する場合がある。特に、第1実施形態で述べたように、初期化処理に対応したメソッドの場合共通メソッドの存在する確率は高いものとなる。
<Save native code corresponding to common methods>
As described above, when there are a plurality of applications 220, there may be a method (common method) common to two or more applications. In particular, as described in the first embodiment, in the case of a method corresponding to the initialization process, the probability that a common method exists is high.

その場合、例えば、アプリケーション220aのネイティブコード232aとアプリケーション220bのネイティブコード232bに共通メソッドが存在しているとする。その場合、アプリケーション220aの初期化完了時、アプリケーション220bを初期化開始する場合、共通メソッドに対応するネイティブコード232bをさらにロードするのは効率が悪い。また、記憶領域に対する効率も悪いものになってしまうことになる。   In this case, for example, it is assumed that a common method exists in the native code 232a of the application 220a and the native code 232b of the application 220b. In this case, when the initialization of the application 220a is completed, when the initialization of the application 220b is started, it is inefficient to further load the native code 232b corresponding to the common method. In addition, the efficiency with respect to the storage area will be poor.

そこで、共通メソッドが存在する際には、当該メソッドに対応するネイティブコードは1つにまとめて登録するのが望ましい。そして、それぞれのアプリケーションに対応するコード領域には、共通コードの位置(ポインタ)のみを格納するように構成するとよい。   Therefore, when there is a common method, it is desirable to register the native codes corresponding to the method as one. And it is good to comprise so that only the position (pointer) of a common code may be stored in the code field corresponding to each application.

図13は、共通メソッドに対応するネイティブコードの保存形式を説明する図である。   FIG. 13 is a diagram for explaining the storage format of the native code corresponding to the common method.

1301は、アプリケーション220aのネイティブコード232aの内部構造を示している。また、1321は、アプリケーション220bのネイティブコード232bの内部構造を示している。アプリケーション220aに特有のメソッドに対応するネイティブコード1302は、ネイティブコード232aに直接格納されている。また、アプリケーション220bに特有のメソッドに対応するネイティブコード1322は、ネイティブコード232bに直接格納されている。   Reference numeral 1301 denotes the internal structure of the native code 232a of the application 220a. Reference numeral 1321 denotes the internal structure of the native code 232b of the application 220b. The native code 1302 corresponding to the method specific to the application 220a is directly stored in the native code 232a. The native code 1322 corresponding to a method specific to the application 220b is directly stored in the native code 232b.

一方、アプリケーション220aおよびアプリケーション220bの共通メソッドに対応するネイティブコード1352は、共通ネイティブコード1351の内部に格納される。そして、ネイティブコード232aおよびネイティブコード232bの内部には、ネイティブコード1352に対するポインタのみ格納されている。   On the other hand, the native code 1352 corresponding to the common method of the application 220a and the application 220b is stored inside the common native code 1351. Only a pointer to the native code 1352 is stored in the native code 232a and the native code 232b.

なお、共通ネイティブコード1351は、VM201からアクセスできる場所に記憶される。ただし、アプリケーション220a関連ネイティブコード1301およびアプリケーション220b関連ネイティブコード1321などと同じ場所に置く必要はない。   The common native code 1351 is stored in a location accessible from the VM 201. However, it is not necessary to place the application 220a-related native code 1301 and the application 220b-related native code 1321 in the same place.

以上説明したように、第2実施形態の情報処理装置によれば、第1実施形態で述べた利点に加え、複数のアプリケーションを動作させる際により効率よくコードキャッシュを利用することが可能となる。その結果、初期化の高速化にも寄与することとなる。   As described above, according to the information processing apparatus of the second embodiment, in addition to the advantages described in the first embodiment, it is possible to use the code cache more efficiently when operating a plurality of applications. As a result, it also contributes to speeding up initialization.

また複数のアプリケーションに共通するメソッドについて、ネイティブコードを共用領域に記憶することにより、より少ない記憶容量でより多くのネイティブコードを記憶可能となる。   Further, by storing native code in a common area for methods common to a plurality of applications, it is possible to store more native code with less storage capacity.

(他の実施形態)
なお、本発明は、前述した実施形態の機能を実現するプログラムを、システム或いは装置に直接或いは遠隔から供給し、そのシステム或いは装置が、供給されたプログラムコードを読み出して実行することによっても達成される。従って、本発明の機能処理をコンピュータで実現するために、コンピュータにインストールされるプログラムコード自体も本発明の技術的範囲に含まれる。
(Other embodiments)
The present invention can also be achieved by supplying a program that realizes the functions of the above-described embodiments directly or remotely to a system or apparatus, and the system or apparatus reads and executes the supplied program code. The Accordingly, the program code itself installed in the computer in order to realize the functional processing of the present invention by the computer is also included in the technical scope of the present invention.

プログラムを供給するための記録媒体としては、例えば、フロッピー(登録商標)ディスク、ハードディスク、光ディスク(CD,DVD)、光磁気ディスク、MO、磁気テープ、不揮発性の半導体メモリなどがある。   Examples of the recording medium for supplying the program include a floppy (registered trademark) disk, a hard disk, an optical disk (CD, DVD), a magneto-optical disk, an MO, a magnetic tape, and a nonvolatile semiconductor memory.

また、コンピュータが、読み出したプログラムを実行することによって、前述した実施形態の機能が実現される他、そのプログラムの指示に基づき、コンピュータ上で稼動しているOSなどが、実際の処理の一部または全部を行い、その処理によっても前述した実施形態の機能が実現され得る。   In addition to the functions of the above-described embodiments being realized by the computer executing the read program, the OS running on the computer based on the instruction of the program is a part of the actual processing. Alternatively, the functions of the above-described embodiment can be realized by performing all of them and performing the processing.

さらに、記録媒体から読み出されたプログラムが、コンピュータに挿入された機能拡張ボードやコンピュータに接続された機能拡張ユニットに備わるメモリに書き込まれた後、そのプログラムの指示に基づき、その機能拡張ボードや機能拡張ユニットに備わるCPUなどが実際の処理の一部または全部を行い、その処理によっても前述した実施形態の機能が実現される。   Furthermore, after the program read from the recording medium is written in a memory provided in a function expansion board inserted into the computer or a function expansion unit connected to the computer, the function expansion board or The CPU or the like provided in the function expansion unit performs part or all of the actual processing, and the functions of the above-described embodiments are realized by the processing.

第1実施形態に係る仮想マシンが動作している情報処理機器の内部構成を示すブロック図である。It is a block diagram which shows the internal structure of the information processing apparatus with which the virtual machine which concerns on 1st Embodiment is operating. 第1実施形態に係る仮想マシンの内部構成を示すブロック図である。It is a block diagram which shows the internal structure of the virtual machine which concerns on 1st Embodiment. 第1実施形態に係る仮想マシン上でアプリケーションを実行する際の動作フローチャートである(1回目)。It is an operation | movement flowchart at the time of executing an application on the virtual machine which concerns on 1st Embodiment (1st time). ネイティブコードおよび順序情報の関係および内部構造(構造体)を説明する図である。It is a figure explaining the relationship between a native code and order information, and an internal structure (structure). デコンパイル順序情報、デコンパイルメソッド情報及びメソッド情報のデータ内部構造(構造体)を説明する図である。It is a figure explaining the data internal structure (structure) of decompile order information, decompile method information, and method information. 第1実施形態に係る仮想マシン上でアプリケーションを実行する際の動作フローチャートである(2回目以降)。It is an operation | movement flowchart at the time of executing an application on the virtual machine which concerns on 1st Embodiment (after the 2nd). メモリ205上に置かれる図2に示したデータ以外のデータの例を示している。An example of data other than the data shown in FIG. 2 placed on the memory 205 is shown. 第1実施形態に係る仮想マシン上でアプリケーションを実行する際の動作フローチャートである(初期化完了後)。It is an operation | movement flowchart at the time of executing an application on the virtual machine which concerns on 1st Embodiment (after completion of initialization). 複数のアプリケーションを実行する際のソフトウェア階層構造の概念図である。It is a conceptual diagram of the software hierarchical structure at the time of performing a some application. 第2実施形態に係る仮想マシンの内部構成を示すブロック図である。It is a block diagram which shows the internal structure of the virtual machine which concerns on 2nd Embodiment. 第2実施形態に係る仮想マシン上でアプリケーションを実行する際の動作フローチャートである。It is an operation | movement flowchart at the time of executing an application on the virtual machine which concerns on 2nd Embodiment. 第2実施形態に係る仮想マシン上でアプリケーションをアンインストールする際の動作フローチャートである。It is an operation | movement flowchart at the time of uninstalling an application on the virtual machine which concerns on 2nd Embodiment. 共通メソッドに対応するネイティブコードの保存形式を説明する図である。It is a figure explaining the preservation | save format of the native code corresponding to a common method.

Claims (8)

第1命令群に基づいて構成されたネイティブコードを実行するネイティブ環境と、前記第1命令群とは独立に定義された第2命令群に基づいて構成された中間コードを実行する仮想マシン環境とを備え、少なくとも前記中間コードにより構成されるプログラムを記憶する記憶手段を備える情報処理装置であって、
前記プログラムを読み込み、該プログラムを構成する1以上のメソッドを逐次解釈するインタプリタ手段と、
前記インタプリタ手段により、前記プログラムの起動時に実行されると解釈されたメソッドを、ネイティブコードに変換する変換手段と、
前記変換手段により得られた前記ネイティブコードを前記メソッドと関連付けて前記記憶手段に登録する登録手段と、
前記メソッドを実行する際、前記記憶手段に該メソッドに対応するネイティブコードが登録されているか否かを確認し、ネイティブコードが登録されている場合には該ネイティブコードを読み出しネイティブ環境で実行し、ネイティブコードが登録されていない場合には前記メソッドを仮想マシン環境で実行するよう制御する制御手段と、
を備えることを特徴とする情報処理装置。
A native environment for executing native code configured based on a first instruction group; and a virtual machine environment for executing intermediate code configured based on a second instruction group defined independently of the first instruction group; An information processing apparatus comprising storage means for storing a program composed of at least the intermediate code,
Interpreter means for reading the program and sequentially interpreting one or more methods constituting the program;
Conversion means for converting the method interpreted by the interpreter means to be executed when the program is started into native code;
A registration unit that registers the native code obtained by the conversion unit in the storage unit in association with the method;
When executing the method, check whether the native code corresponding to the method is registered in the storage means, if the native code is registered, read the native code and execute it in the native environment, Control means for controlling execution of the method in a virtual machine environment when native code is not registered;
An information processing apparatus comprising:
前記プログラムを構成する1以上の各メソッドの実行回数に基づいて、前記記憶手段に登録された各メソッドに対応するネイティブコードを更新する更新手段をさらに備えることを特徴とする請求項1に記載の情報処理装置。   2. The update apparatus according to claim 1, further comprising an update unit configured to update a native code corresponding to each method registered in the storage unit based on the number of execution times of one or more methods constituting the program. Information processing device. 前記記憶手段に登録されたネイティブコードはアドレス解決がなされていないリロケータブルなネイティブコードであることを特徴とする請求項1または請求項2に記載の情報処理装置。   The information processing apparatus according to claim 1, wherein the native code registered in the storage unit is a relocatable native code that has not been address-resolved. 前記登録手段は、1以上のネイティブコードとともに、該1以上のネイティブコードの読み出し順序情報を記憶手段に登録することを特徴とする請求項1乃至請求項3の何れか1項に記載の情報処理装置。   The information processing apparatus according to any one of claims 1 to 3, wherein the registration unit registers the reading order information of the one or more native codes in the storage unit together with the one or more native codes. apparatus. 1以上のプログラムに対応するネイティブコードの前記記憶手段への登録管理を行う管理手段をさらに備え、
前記管理手段は、アプリケーションを登録管理対象からはずす場合、前記ネイティブコードを併せて削除することを特徴とする請求項1乃至請求項4の何れか1項に記載の情報処理装置。
Management means for managing registration of the native code corresponding to one or more programs in the storage means;
The information processing apparatus according to any one of claims 1 to 4, wherein the management unit deletes the native code together when the application is removed from the registration management target.
前記管理手段は、前記1以上のプログラムに共通するメソッドに対応するネイティブコードを前記記憶手段に設けられた共通領域に登録管理することを特徴とする請求項5に記載の情報処理装置。   The information processing apparatus according to claim 5, wherein the management unit registers and manages a native code corresponding to a method common to the one or more programs in a common area provided in the storage unit. 第1命令群に基づいて構成されたネイティブコードを実行するネイティブ環境と、前記第1命令群とは独立に定義された第2命令群に基づいて構成された中間コードを実行する仮想マシン環境とを備え、少なくとも前記中間コードにより構成されるプログラムを記憶する記憶手段を備える情報処理装置の制御方法であって、
前記プログラムを読み込み、該プログラムを構成する1以上のメソッドを逐次解釈するインタプリタ工程と、
前記インタプリタ工程により、前記プログラムの起動時に実行されると解釈されたメソッドを、ネイティブコードに変換する変換工程と、
前記変換工程により得られた前記ネイティブコードを前記メソッドと関連付けて前記記憶手段に登録する登録工程と、
前記メソッドを実行する際、前記記憶手段に該メソッドに対応するネイティブコードが登録されているか否かを確認し、ネイティブコードが登録されている場合には該ネイティブコードをネイティブ環境で実行し、ネイティブコードが登録されていない場合には前記メソッドを仮想マシン環境で実行するよう制御する制御工程と、
を備えることを特徴とする制御方法。
A native environment for executing native code configured based on a first instruction group; and a virtual machine environment for executing intermediate code configured based on a second instruction group defined independently of the first instruction group; A method of controlling an information processing apparatus comprising storage means for storing a program composed of at least the intermediate code,
An interpreter step of reading the program and sequentially interpreting one or more methods constituting the program;
A conversion step of converting a method interpreted by the interpreter step to be executed when the program is started into a native code;
A registration step of registering the native code obtained by the conversion step in the storage means in association with the method;
When executing the method, it is confirmed whether or not the native code corresponding to the method is registered in the storage means. If the native code is registered, the native code is executed in the native environment, A control process for controlling the method to be executed in a virtual machine environment when the code is not registered;
A control method comprising:
第1命令群に基づいて構成されたネイティブコードを実行するネイティブ環境と、前記第1命令群とは独立に定義された第2命令群に基づいて構成された中間コードを実行する仮想マシン環境とを備え、少なくとも前記中間コードにより構成されるプログラムを記憶する記憶手段を備える情報処理装置の制御プログラムであって、
前記プログラムを読み込み、該プログラムを構成する1以上のメソッドを逐次解釈するインタプリタ工程を実行するためのプログラムコードと、
前記インタプリタ工程により、前記プログラムの起動時に実行されると解釈されたメソッドを、ネイティブコードに変換する変換工程を実行するためのプログラムコードと、
前記変換工程により得られた前記ネイティブコードを前記メソッドと関連付けて前記記憶手段に登録する登録工程を実行するためのプログラムコードと、
前記メソッドを実行する際、前記記憶手段に該メソッドに対応するネイティブコードが登録されているか否かを確認し、ネイティブコードが登録されている場合には該ネイティブコードをネイティブ環境で実行し、ネイティブコードが登録されていない場合には前記メソッドを仮想マシン環境で実行するよう制御する制御工程を実行するためのプログラムコードと、
を備えることを特徴とする制御プログラム。
A native environment for executing native code configured based on a first instruction group; and a virtual machine environment for executing intermediate code configured based on a second instruction group defined independently of the first instruction group; A control program for an information processing device comprising storage means for storing at least a program composed of the intermediate code,
Program code for reading the program and executing an interpreter step for sequentially interpreting one or more methods constituting the program;
A program code for executing a conversion step of converting a method interpreted by the interpreter step to be executed when the program is started into a native code;
Program code for executing a registration step of registering the native code obtained by the conversion step in the storage means in association with the method;
When executing the method, it is confirmed whether or not the native code corresponding to the method is registered in the storage means. If the native code is registered, the native code is executed in the native environment, A program code for executing a control process for controlling the method to be executed in a virtual machine environment when the code is not registered;
A control program comprising:
JP2006051166A 2006-02-27 2006-02-27 Information processor, and control method and control program of information processor Withdrawn JP2007233472A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006051166A JP2007233472A (en) 2006-02-27 2006-02-27 Information processor, and control method and control program of information processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006051166A JP2007233472A (en) 2006-02-27 2006-02-27 Information processor, and control method and control program of information processor

Publications (1)

Publication Number Publication Date
JP2007233472A true JP2007233472A (en) 2007-09-13

Family

ID=38554040

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006051166A Withdrawn JP2007233472A (en) 2006-02-27 2006-02-27 Information processor, and control method and control program of information processor

Country Status (1)

Country Link
JP (1) JP2007233472A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009015830A (en) * 2007-06-07 2009-01-22 Canon Inc Program start-up device and program start-up method
JP2016537755A (en) * 2013-10-18 2016-12-01 マイクロソフト テクノロジー ライセンシング,エルエルシー Incrementally compiling software artifacts from an interactive development environment
JP2018510428A (en) * 2015-05-29 2018-04-12 グーグル エルエルシー Code caching system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009015830A (en) * 2007-06-07 2009-01-22 Canon Inc Program start-up device and program start-up method
JP2016537755A (en) * 2013-10-18 2016-12-01 マイクロソフト テクノロジー ライセンシング,エルエルシー Incrementally compiling software artifacts from an interactive development environment
JP2018510428A (en) * 2015-05-29 2018-04-12 グーグル エルエルシー Code caching system

Similar Documents

Publication Publication Date Title
US8099729B2 (en) Method and device for creating and using pre-internalized program files
JP6018590B2 (en) Application compatibility with library operating system
CN101763279B (en) BootLoader architectural design method
KR101051872B1 (en) Program execution control device
JP4881023B2 (en) Information processing apparatus, method for executing object-oriented program in the apparatus, and program therefor
JP6398725B2 (en) Compile program, compile method, and compiler apparatus
JP2012527027A (en) System and method for building a runtime environment
KR100725386B1 (en) Method for executing virtual machine application, and the digital broadcast receiver thereof
KR100577366B1 (en) Method and apparatus for executing different forms of java methods
JP2018092383A (en) Compilation program, compilation method and information processor
CN102289380A (en) firefox starting acceleration method
JP2007233472A (en) Information processor, and control method and control program of information processor
JP4986598B2 (en) Application management system and control method thereof
KR20000002446A (en) Apparatus and method for swapping between main memory device and auxiliary memory device and web video phone having thereof
JP2017126293A (en) Information processing apparatus and resource management method
CN103927207A (en) Software acceleration method and device
KR100478463B1 (en) Dynamic Linking Method for Application Program
US7558810B2 (en) System and method for managing a path environment variable
JP2004013536A (en) Flash memory rewrite control system and method, program for operating processe in flash memory rewrite control method, and information storage medium
JP4504756B2 (en) Memory management method and memory management program in Java (registered trademark) execution environment
JP6143476B2 (en) Application processing apparatus, method, and program thereof
JP3774051B2 (en) Compiling device, loading device, program transmitting device, and program recording medium
KR100945151B1 (en) Mobile media device for effectively executing VM-based mobile application programs on external memory, and operating method for the same
JP2021184208A (en) Information processing device, information processing method and program
JP2002063096A (en) Terminal device, provision source, and information processing device

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20090512