JP2019152911A - Information processing apparatus, information processing method and computer program - Google Patents

Information processing apparatus, information processing method and computer program Download PDF

Info

Publication number
JP2019152911A
JP2019152911A JP2018035569A JP2018035569A JP2019152911A JP 2019152911 A JP2019152911 A JP 2019152911A JP 2018035569 A JP2018035569 A JP 2018035569A JP 2018035569 A JP2018035569 A JP 2018035569A JP 2019152911 A JP2019152911 A JP 2019152911A
Authority
JP
Japan
Prior art keywords
snapshot
information processing
native code
processing apparatus
jit
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.)
Pending
Application number
JP2018035569A
Other languages
Japanese (ja)
Inventor
高橋 健太郎
Kentaro Takahashi
健太郎 高橋
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 JP2018035569A priority Critical patent/JP2019152911A/en
Publication of JP2019152911A publication Critical patent/JP2019152911A/en
Pending legal-status Critical Current

Links

Images

Abstract

To improve an execution speed of a computer program using an appropriate native code.SOLUTION: An information processing apparatus executing an application includes compile means that compiles the application into a native code, holding means that holds a group of native codes generated by the compile, acquisition means that acquires a state of the information processing apparatus, and using means that selects and uses the native code from the group of native codes based on the state of the information processing apparatus.SELECTED DRAWING: Figure 5

Description

本発明は、中間コードで記述されたプログラムを実行するための情報処理装置、情報処理方法およびコンピュータプログラムに関する。   The present invention relates to an information processing apparatus, an information processing method, and a computer program for executing a program described in an intermediate code.

従来から、中間コードにより記述されたプログラムを実行するための仮想マシン技術が知られている。仮想マシンは、仮想マシン用のコードである中間コードを実行するインタプリタを備える。しかし、インタプリタを用いたプログラムの実行処理速度は遅い。そこで、中間コードをネイティブコードに変換する方法(以下、コンパイルと記す)が普及している。ネイティブコードは、仮想マシンが動作しているCPUで直接実行可能なデータ形式であり、コンパイル後のプログラムは高速に動作する。   Conventionally, a virtual machine technique for executing a program described by an intermediate code is known. The virtual machine includes an interpreter that executes intermediate code that is code for the virtual machine. However, the execution processing speed of a program using an interpreter is slow. Therefore, a method of converting intermediate code into native code (hereinafter referred to as compilation) has become widespread. The native code has a data format that can be directly executed by the CPU in which the virtual machine is operating, and the compiled program operates at high speed.

コンパイル方法としては、AOT(Ahead Of Time)コンパイルとJIT(Just In Time)コンパイルがある。AOTコンパイルでは、仮想マシンがプログラムをロードする前にコンパイル処理がなされる。しかし、AOTコンパイルでは実行状態に応じたコンパイルができないため、最適なコンパイルを実現できない。   Compiling methods include AOT (Ahead Of Time) compilation and JIT (Just In Time) compilation. In AOT compilation, compilation processing is performed before the virtual machine loads a program. However, since AOT compilation cannot be performed according to the execution state, optimal compilation cannot be realized.

一方、JITコンパイルでは、中間コードでプログラムをロードした後、実行時にネイティブコードにコンパイルする。そのため、コンパイル後の動作は速いものの、最初の実行時にはコンパイルの処理が必要なため、実行時の負荷が高くなってしまう。そこで、JITコンパイルの処理の負荷を低減する方法として、特許文献1および特許文献2には、JITコンパイル結果を再利用する方法が開示されている   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. For this reason, although the operation after compilation is fast, a compilation process is required at the first execution, which increases the load at the time of execution. Therefore, as a method for reducing the processing load of JIT compilation, Patent Literature 1 and Patent Literature 2 disclose a method of reusing a JIT compilation result.

特開2001−273151号公報JP 2001-273151 A 特開2011−221609号公報JP 2011-221609 A

特許文献1では、JITコンパイルされたプログラムのネイティブコードを記憶装置に保持しておき、次回起動時に参照する。しかし、JITコンパイルを行ったときのデバイスの状態と次回起動時のデバイスの状態が異なると、保持するネイティブコードが再利用できない。   In Patent Document 1, the native code of a JIT-compiled program is held in a storage device and is referred to at the next startup. However, if the device state at the time of JIT compilation is different from the device state at the next startup, the retained native code cannot be reused.

特許文献2では、プログラム中のメソッド1つに対して、複数のネイティブコードを保持し、起動中の状態に応じてネイティブコードを選択して再利用する。しかし、ネイティブコードの参照はメソッド単位で行うため、プログラム中の各メソッドを実行するたびに保持するネイティブコード群から選択する処理が必要となり、プログラムの実行速度が遅くなることがある。   In Patent Document 2, a plurality of native codes are held for one method in a program, and the native codes are selected and reused according to the activated state. However, since the native code is referred to in units of methods, it is necessary to select a native code group to be held every time each method in the program is executed, and the execution speed of the program may be slow.

本発明は上記の課題に鑑みてなされたものであり、ネイティブコードを適切に利用し、コンピュータプログラムの実行速度を向上させることを目的とする。   The present invention has been made in view of the above problems, and an object of the present invention is to appropriately use native code and improve the execution speed of a computer program.

アプリケーションを実行する情報処理装置であって、前記アプリケーションをネイティブコードにコンパイルするコンパイル手段と、前記コンパイルによって生成されたネイティブコード群を保持する保持手段と、前記情報処理装置の状態を取得する取得手段と、前記情報処理装置の状態に基づいて、前記ネイティブコード群からネイティブコードを選択して利用する利用手段と、を有することを特徴とする。   An information processing apparatus for executing an application, the compiling means for compiling the application into native code, the holding means for holding a native code group generated by the compilation, and the acquisition means for acquiring the state of the information processing apparatus And using means for selecting and using a native code from the native code group based on the state of the information processing apparatus.

本発明によれば、ネイティブコードを適切に利用し、コンピュータプログラムの実行速度を向上させることが出来る。   According to the present invention, it is possible to appropriately use native code and improve the execution speed of a computer program.

情報処理装置のハードウェア構成の一例を示す概略図である。It is the schematic which shows an example of the hardware constitutions of information processing apparatus. 情報処理装置上に構築するシステム構成の一例を示す模式図である。It is a schematic diagram which shows an example of the system configuration | structure constructed | assembled on information processing apparatus. 仮想マシンの構成を示す模式図である。It is a schematic diagram which shows the structure of a virtual machine. スナップショットの構成を示す模式図である。It is a schematic diagram which shows the structure of a snapshot. 実施形態1にかかる情報処理装置の起動処理のフローチャートである。3 is a flowchart of an activation process of the information processing apparatus according to the first embodiment. 実施形態1にかかるスナップショットの作成処理のフローチャートである。6 is a flowchart of a snapshot creation process according to the first embodiment. 実施形態1にかかるスナップショットの適合度の確認処理のフローチャートである。6 is a flowchart of snapshot conformity confirmation processing according to the first embodiment; スナップショットを管理するテーブルの一例を示す図である。It is a figure which shows an example of the table which manages a snapshot. 実施形態2にかかる情報処理装置のプログラム実行処理のフローチャートである。10 is a flowchart of a program execution process of the information processing apparatus according to the second embodiment. 実施形態3にかかるJITコンパイルオプションの例を示す図である。It is a figure which shows the example of the JIT compilation option concerning Embodiment 3. 実施形態3にかかる仮想マシンの構成を示す模式図である。FIG. 10 is a schematic diagram illustrating a configuration of a virtual machine according to a third embodiment. 実施形態3にかかるJITコンパイルオプションの複雑な例を示す図である。It is a figure which shows the complicated example of the JIT compilation option concerning Embodiment 3. FIG. 実施形態4にかかるJITコンパイルオプションの例を示す図である。It is a figure which shows the example of the JIT compilation option concerning Embodiment 4. 実施形態4にかかる仮想マシンの構成を示す模式図である。FIG. 10 is a schematic diagram illustrating a configuration of a virtual machine according to a fourth embodiment. 実施形態4にかかるスナップショットの作成処理のフローチャートである。15 is a flowchart of snapshot creation processing according to the fourth embodiment.

以下、添付の図面を参照して、本発明の好適な実施形態を詳細に説明する。   Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the accompanying drawings.

(実施形態1)
図1は、一般的な情報処理装置101のハードウェア構成の一例を示す図である。図1に示されるように情報処理装置101は、ハードウェア構成として、CPU11を含む。
(Embodiment 1)
FIG. 1 is a diagram illustrating an example of a hardware configuration of a general information processing apparatus 101. As illustrated in FIG. 1, the information processing apparatus 101 includes a CPU 11 as a hardware configuration.

CPU11が、記憶装置13に記憶されている後述するアプリケーションやプログラム実行環境等の各々に対応するコンピュータプログラムに基づき処理を行うことによって、後述する各機能、又はフローチャートを実現する。   The CPU 11 realizes each function or flowchart described later by performing processing based on a computer program corresponding to each of an application and program execution environment described later stored in the storage device 13.

また、CPU11には、バス10を介して、入力装置12、記憶装置13、表示装置14及び外部接続IF15が接続されている。入力装置12は、情報を入力するキーボード及び/又はマウスである。記憶装置13は、例えば、ROM、RAM、ハードディスク装置等を含み、上述した各プログラム以外に、プログラムに基づく処理で用いられるデータ等を記憶する。表示装置14は、画面等を表示するディスプレイである。外部接続IF15は、ネットワークインタフェース、外部機器との各種接続インタフェースである。   Further, an input device 12, a storage device 13, a display device 14, and an external connection IF 15 are connected to the CPU 11 via the bus 10. The input device 12 is a keyboard and / or a mouse for inputting information. The storage device 13 includes, for example, a ROM, a RAM, a hard disk device, and the like, and stores data used in processing based on the program in addition to the above-described programs. The display device 14 is a display that displays a screen or the like. The external connection IF 15 is a network interface and various connection interfaces with external devices.

尚、CPU11はプログラムを実行することで各種の手段として機能することが可能である。なお、CPU11と協調して動作するASICなどの制御回路がこれらの手段として機能してもよい。また、CPU11と情報処理装置101の動作を制御する制御回路との協調によってこれらの手段が実現されてもよい。また、CPU11は単一のものである必要はなく、複数であってもよい。この場合、複数のCPU11は分散して処理を実行することが可能である。また、複数のCPU11は単一のコンピュータに配置されていてもよいし、物理的に異なる複数のコンピュータに配置されていてもよい。なお、CPU11がプログラムを実行することで実現する手段が専用の回路によって実現されてもよい。   The CPU 11 can function as various means by executing a program. Note that a control circuit such as an ASIC that operates in cooperation with the CPU 11 may function as these means. These means may be realized by cooperation between the CPU 11 and a control circuit that controls the operation of the information processing apparatus 101. Further, the CPU 11 does not have to be a single one and may be a plurality. In this case, the plurality of CPUs 11 can perform processing in a distributed manner. Further, the plurality of CPUs 11 may be disposed on a single computer, or may be disposed on a plurality of physically different computers. Note that the means realized by the CPU 11 executing the program may be realized by a dedicated circuit.

次に、情報処理装置101上に構築するシステム構成について、図2を用いて説明する。図2は、情報処理装置101のシステム構成の一例を示す図である。   Next, a system configuration built on the information processing apparatus 101 will be described with reference to FIG. FIG. 2 is a diagram illustrating an example of a system configuration of the information processing apparatus 101.

オペレーティングシステム201は、システム全体の基盤となるソフトウェアである。仮想マシン202は、オペレーティングシステム201上のプロセスでありながら、自身の上でアプリケーションが動作する環境を提供するソフトウェアである。アプリケーション203は仮想マシン202で実行されるプログラムであり、中間コードによって構成されている。   The operating system 201 is software that is the basis of the entire system. The virtual machine 202 is software that provides an environment in which an application operates on itself while being a process on the operating system 201. The application 203 is a program executed by the virtual machine 202, and is configured by an intermediate code.

次に、仮想マシン202の具体的な構成を、図3を用いて説明する。図3は仮想マシン202が備える機能を示す図である。仮想マシン202は、中間コードを実行するインタプリタ301を備える。また、仮想マシン202は、中間コードをネイティブコードにコンパイルするJITコンパイラ302を備える。JITコンパイラ302は、コンパイルしたネイティブコードをJITコードキャッシュ303に格納する。通常、JITコードキャッシュ303は、記憶装置13中の特定のメモリ領域である。もしメモリでなくハードディスクなどの記憶装置13中の不揮発性記憶領域にすると、アクセスが遅くなって処理が遅くなってしまう。   Next, a specific configuration of the virtual machine 202 will be described with reference to FIG. FIG. 3 is a diagram showing functions provided in the virtual machine 202. The virtual machine 202 includes an interpreter 301 that executes intermediate code. The virtual machine 202 includes a JIT compiler 302 that compiles intermediate code into native code. The JIT compiler 302 stores the compiled native code in the JIT code cache 303. Usually, the JIT code cache 303 is a specific memory area in the storage device 13. If a non-volatile storage area in the storage device 13 such as a hard disk is used instead of the memory, the access is delayed and the processing is delayed.

次に、再利用するために保存するスナップショットの構成を、図4を用いて説明する。図4は、記憶装置13上に保存したスナップショット401の構成を示す図である。スナップショット401は、機器の状態に応じて複数保存されうる。スナップショット401はネイティブコード群402を備える。ネイティブコード群402は、仮想マシン202の実行中にJITコードキャッシュ303に保存されるネイティブコードの集合である。また、スナップショット401は、ネイティブコード中のアドレスを機器の状態に適した値に変換するためのアドレス変換テーブル403を備える。また、スナップショット401は、スナップショットの適用開始条件404、適用停止条件405、削除条件406を備える。   Next, the configuration of a snapshot stored for reuse will be described with reference to FIG. FIG. 4 is a diagram showing the configuration of the snapshot 401 stored on the storage device 13. A plurality of snapshots 401 can be stored depending on the state of the device. The snapshot 401 includes a native code group 402. The native code group 402 is a set of native codes stored in the JIT code cache 303 during execution of the virtual machine 202. Further, the snapshot 401 includes an address conversion table 403 for converting an address in the native code into a value suitable for the state of the device. The snapshot 401 includes a snapshot application start condition 404, an application stop condition 405, and a delete condition 406.

仮想マシン202は、機器の状態を取得する機器状態取得手段304を備える。機器の状態には、例えば機器のネットワーク設定状態や、機器の起動モードがある。また、仮想マシン202は、仮想マシン202上で実行しているプログラムを監視するための実行プログラム監視手段305を備える。また、仮想マシン202は、スナップショット401を管理するスナップショット管理手段306を備える。スナップショット管理手段306は、複数のスナップショット401をスナップショット管理テーブル801によって管理する。図8にスナップショット401を管理するテーブルの一例を示す。   The virtual machine 202 includes device state acquisition means 304 that acquires the state of the device. The device status includes, for example, the device network setting state and the device activation mode. The virtual machine 202 includes an execution program monitoring unit 305 for monitoring a program executed on the virtual machine 202. In addition, the virtual machine 202 includes a snapshot management unit 306 that manages the snapshot 401. The snapshot management unit 306 manages a plurality of snapshots 401 using the snapshot management table 801. FIG. 8 shows an example of a table for managing the snapshot 401.

具体的に、本実施形態における仮想マシン202はJRE(Java Runtime Environment)とする。JREとは、Java(登録商標)言語で開発されたソフトウェアを実行するために必要なソフトウェアのセットである。JREは、クラスライブラリ、JavaVM(Java言語にて記述されたアプリケーションを実行するためのソフトウェア)、及びJREを搭載する端末固有のポーティングレイヤを含む。以降では、情報処理装置101を機器と記す。   Specifically, the virtual machine 202 in the present embodiment is a JRE (Java Runtime Environment). A JRE is a set of software necessary to execute software developed in the Java (registered trademark) language. The JRE includes a class library, JavaVM (software for executing an application written in the Java language), and a porting layer specific to a terminal on which the JRE is mounted. Hereinafter, the information processing apparatus 101 is referred to as a device.

JITコンパイルでは、Javaプログラムのメソッドをネイティブコードに変換する。JITコンパイルの処理の負荷を低減するには、以前のJITコンパイルで作成したネイティブコードの再利用が有効となる。しかし、機器の設定によっては、以前のネイティブコードを再利用できない。例えば、ネットワーク設定がIPv4アドレスであるときには、IPv4アドレス用のメソッドが実行される。一方、ネットワーク設定がIPv6アドレスであるときには、IPv6アドレス用のメソッドが実行される。そのため、IPv4アドレス設定のときに作成されたネイティブコードは、IPv6アドレス設定のときに再利用できない。そこで、機器の状態に応じたJITコンパイル結果を保存しておき、選択して再利用する仕組みが必要となる。また、再利用をメソッド単位で行うと、メソッドを実行する度に保存したネイティブコードを取得するオーバヘッドが生じ、機器が高速に動作できない。高速に動作するためには、実行するメソッド群に対応するネイティブコード群を一度に取得する仕組みが必要となる。   In JIT compilation, Java program methods are converted to native code. In order to reduce the processing load of JIT compilation, it is effective to reuse the native code created by the previous JIT compilation. However, depending on the device settings, the previous native code cannot be reused. For example, when the network setting is an IPv4 address, a method for the IPv4 address is executed. On the other hand, when the network setting is an IPv6 address, a method for the IPv6 address is executed. For this reason, the native code created when setting the IPv4 address cannot be reused when setting the IPv6 address. Therefore, it is necessary to have a mechanism for storing the JIT compilation result corresponding to the state of the device, selecting it, and reusing it. In addition, if reuse is performed in units of methods, an overhead for acquiring the stored native code every time a method is executed occurs, and the device cannot operate at high speed. In order to operate at high speed, a mechanism for acquiring a group of native codes corresponding to a group of methods to be executed at a time is necessary.

これらの仕組みを実現する実施形態を、図5、図8を用いて説明する。図5は機器の起動処理のフローチャートである。図8はスナップショット管理テーブルの例を示す図である。   An embodiment for realizing these mechanisms will be described with reference to FIGS. FIG. 5 is a flowchart of device activation processing. FIG. 8 is a diagram illustrating an example of a snapshot management table.

本実施形態では、以前の起動時にJITコンパイルしたネイティブコードを利用して起動する方法について説明する。機器の起動が開始されると、オペレーティングシステム201が起動する。そして、アプリケーション203を実行するための仮想マシン202の起動が開始される。仮想マシン202は、機器状態取得手段304によって、機器の状態を取得する(S501)。また、スナップショット管理手段306によって、スナップショット管理テーブル801を取得する(S502)。そして、仮想マシン202はスナップショット作成指示があるかを確認する(S503)。スナップショット作成指示としては、記憶装置13上に機器を操作するユーザが作成するフラグファイルや、仮想マシン202の起動時に与えるオプション値などが考えられる。例えば工場で機器を生産するときに、工員がスナップショット401の作成指示をだして機器を再起動することで、スナップショット401を作成する。   In the present embodiment, a method for starting using native code compiled by JIT at the previous start-up will be described. When the activation of the device is started, the operating system 201 is activated. Then, the activation of the virtual machine 202 for executing the application 203 is started. The virtual machine 202 acquires the device state by the device state acquisition unit 304 (S501). In addition, the snapshot management means 306 acquires the snapshot management table 801 (S502). Then, the virtual machine 202 confirms whether there is a snapshot creation instruction (S503). As the snapshot creation instruction, a flag file created by a user who operates the device on the storage device 13, an option value given when the virtual machine 202 is activated, or the like can be considered. For example, when producing equipment at a factory, an engineer creates a snapshot 401 by instructing creation of the snapshot 401 and restarting the equipment.

ステップS503においてスナップショット作成指示がある場合、仮想マシン202は機器の起動処理を実行する(S504)。起動処理では、機器のUIや各種機能を実現するアプリケーション203を起動する。これらの処理において、インタプリタ301で頻繁に実行されるメソッドは、JITコンパイラ302によってJITコンパイルされる。コンパイルされたネイティブコードはJITコードキャッシュ303に格納される。機器の起動処理は、機器のUIが操作可能となり、基本機能をユーザが利用できるようになった段階で完了する。仮想マシンが機器の起動処理が完了したことを検知するには、機器上で動作する複数のアプリケーション203を管理するアプリケーション管理フレームワークが発行する起動完了イベントを受信する方法がある。機器の起動処理が完了すると、仮想マシン202はスナップショット401を作成する(S505)。スナップショット401の作成処理については、後述する。以降では、起動完了イベントを受信したときを、起動完了と記す。   If there is a snapshot creation instruction in step S503, the virtual machine 202 executes device activation processing (S504). In the activation process, the application 203 for realizing the UI and various functions of the device is activated. In these processes, methods frequently executed by the interpreter 301 are JIT-compiled by the JIT compiler 302. The compiled native code is stored in the JIT code cache 303. The device activation process is completed when the device UI can be operated and the basic functions can be used by the user. In order to detect that the virtual machine has completed the startup process of the device, there is a method of receiving a startup completion event issued by an application management framework that manages a plurality of applications 203 running on the device. When the device activation process is completed, the virtual machine 202 creates a snapshot 401 (S505). The creation process of the snapshot 401 will be described later. Hereinafter, the time when an activation completion event is received is referred to as activation completion.

ステップS503においてスナップショット作成指示がない場合、仮想マシン202はスナップショット管理テーブル801を参照して、状態に応じたスナップショット401があるかを確認する(S506)。確認は、スナップショット管理テーブル801内のスナップショット401の適用開始条件を参照し、現在の機器の状態に応じるものがあるかどうかを調べることで行う。状態に応じたスナップショット401がない場合、仮想マシン202はスナップショット401の作成条件を満たしているかを確認する(S512)。スナップショット401の作成条件について、通常なら作成しても問題ない。しかし、メンテナンスモードで機器が起動している場合や、スナップショット401を保存するだけの空き容量が記憶装置13にない場合には、スナップショット401を作成しないほうが望ましい。また、実施形態2に示すように、累積したJITコンパイル処理の時間を閾値と比較して、スナップショット401を作成すべきか判断する場合もある。そこで、ステップS512において、新規に作成してもよいかを確認する。   If there is no snapshot creation instruction in step S503, the virtual machine 202 refers to the snapshot management table 801 and confirms whether there is a snapshot 401 corresponding to the state (S506). The confirmation is performed by referring to the application start condition of the snapshot 401 in the snapshot management table 801 and checking whether there is something corresponding to the current device state. If there is no snapshot 401 corresponding to the state, the virtual machine 202 confirms whether the creation conditions of the snapshot 401 are satisfied (S512). Regarding the creation conditions of the snapshot 401, there is no problem even if it is created normally. However, when the device is activated in the maintenance mode, or when the storage device 13 does not have enough free space to store the snapshot 401, it is preferable not to create the snapshot 401. Further, as shown in the second embodiment, it may be determined whether the snapshot 401 should be created by comparing the accumulated JIT compilation processing time with a threshold value. Therefore, in step S512, it is confirmed whether a new file can be created.

ステップS512において、スナップショット401の作成条件を満たしている場合、ステップS504を実施する。ステップS512において、スナップショット401の作成条件を満たしていない場合、ステップS504と同様に機器の起動処理を行い(S513)、機器の起動は完了する。   If the creation conditions for the snapshot 401 are satisfied in step S512, step S504 is performed. If the creation conditions for the snapshot 401 are not satisfied in step S512, device activation processing is performed in the same manner as in step S504 (S513), and the device activation is completed.

ステップS506において状態に応じたスナップショット401がある場合、スナップショット管理手段306は、そのスナップショット401を選択する(S507)。   If there is a snapshot 401 corresponding to the state in step S506, the snapshot management unit 306 selects the snapshot 401 (S507).

そして、スナップショット管理手段306は、選択したスナップショット401のネイティブコード群402をJITコードキャッシュ303に展開する(S508)。展開においては、アドレス変換テーブル403を参照して、ネイティブコード群402に含まれるアドレスを現在の起動状態に適したアドレスに変換する。また、スナップショット管理テーブル801で、選択したスナップショットの適用中の状態は「○」にする。   Then, the snapshot management unit 306 expands the native code group 402 of the selected snapshot 401 in the JIT code cache 303 (S508). In expansion, the address conversion table 403 is referenced to convert the address included in the native code group 402 into an address suitable for the current activation state. Further, in the snapshot management table 801, the state where the selected snapshot is being applied is set to “◯”.

そして、選択したスナップショット401が有効に機能しているかを確認するために、適合度の確認を行う。適合度を確認するために、仮想マシン202は実行プログラム監視手段305によって実行プログラムの監視を開始する(S509)。監視では、仮想マシン202上で実行されるメソッドや、実行されるアプリケーション203を監視する。そして、ステップS504と同様に機器の起動処理を行う(S510)。起動処理が完了すると、選択したスナップショット401の適合度の確認を行う(S511)。適合度の確認処理については、後述する。   Then, in order to confirm whether or not the selected snapshot 401 is functioning effectively, the fitness is confirmed. In order to confirm the fitness, the virtual machine 202 starts monitoring the execution program by the execution program monitoring unit 305 (S509). In the monitoring, the method executed on the virtual machine 202 and the application 203 to be executed are monitored. Then, a device activation process is performed as in step S504 (S510). When the activation process is completed, the compatibility of the selected snapshot 401 is confirmed (S511). The confirmation process of the fitness level will be described later.

次に、スナップショット401の作成処理について、図6を用いて説明する。図6はスナップショット401の作成処理のフローチャートである。図8のスナップショット管理テーブル801が空の状態、かつ機器のネットワーク設定がIPv4アドレスの設定である状態でステップS505から作成処理が開始されるとする。   Next, the creation process of the snapshot 401 will be described with reference to FIG. FIG. 6 is a flowchart of the snapshot 401 creation process. Assume that the creation processing starts from step S505 in a state where the snapshot management table 801 in FIG. 8 is empty and the network setting of the device is an IPv4 address setting.

スナップショット401の作成を開始すると、スナップショット管理手段306はJITコードキャッシュ303からネイティブコード群402を取得する(S601)。しかし、このネイティブコードには、オペレーティングシステム201がロードしたライブラリのアドレスのように、起動の度に値が変わるものが含まれる。そこで、ネイティブコード群402に含まれるアドレスを次回起動時に変換して適用できるように、スナップショット管理手段306はアドレス変換テーブル403を作成する(S602)。   When the creation of the snapshot 401 is started, the snapshot management unit 306 acquires the native code group 402 from the JIT code cache 303 (S601). However, the native code includes a code whose value changes at each activation, such as an address of a library loaded by the operating system 201. Therefore, the snapshot management unit 306 creates the address conversion table 403 so that the address included in the native code group 402 can be converted and applied at the next startup (S602).

さらにスナップショット管理手段306は、機器状態取得手段304で取得した機器の状態から、適用開始条件を設定する(S603)。本実施形態で作成したネイティブコードは、機器の起動時、かつネットワーク設定がIPv4である状態で作成したものである。そこで、「機器の起動時、かつネットワーク設定がIPv4である状態」をスナップショット401の適用開始条件とする。また、実行プログラム監視手段305によって取得したプログラムの履歴と、JITコンパイラ302から取得するJITコンパイル処理の履歴を照合する。そして、JITコンパイル処理が多数発生するきっかけとなるプログラムを適用開始条件に設定する方法も考えられる。   Further, the snapshot management unit 306 sets an application start condition from the device status acquired by the device status acquisition unit 304 (S603). The native code created in this embodiment is created when the device is activated and the network setting is IPv4. Therefore, “the state when the device is activated and the network setting is IPv4” is set as the application start condition of the snapshot 401. In addition, the program history acquired by the execution program monitoring unit 305 is collated with the history of JIT compilation processing acquired from the JIT compiler 302. A method of setting a program that triggers many JIT compilation processes as an application start condition is also conceivable.

また、スナップショット管理手段306は、適用停止条件を設定する(S604)。適用停止条件は、利用中のスナップショット401が実際に機器で実行されるプログラムと対応しないことを判定する条件として利用する。機器の起動時に作成したスナップショットは、起動完了後の動作でしか実行されないメソッドに対応するネイティブコードを含んでいない。そのため、適用停止の条件として、「機器の起動が完了した時」を設定する。また、例えばスナップショットを作成後に203がアップデートされた場合、そのスナップショットを適用しても、スナップショットに含まれないメソッドが多く実行されることがありえる。このような場合にはスナップショットの適用を停止することが望ましい。そこで、スナップショットの適用停止条件に、「スナップショットに含まれないメソッドの実行回数が500回以上の時」を設定する。スナップショットに含まれないメソッドの実行回数の集計は、実行プログラム監視手段305が行う。   Further, the snapshot management unit 306 sets an application stop condition (S604). The application stop condition is used as a condition for determining that the snapshot 401 being used does not correspond to a program that is actually executed by the device. The snapshot created when the device is activated does not include native code corresponding to a method that is executed only in the operation after the activation is completed. Therefore, “when the activation of the device is completed” is set as a condition for stopping application. For example, when 203 is updated after a snapshot is created, even if the snapshot is applied, many methods not included in the snapshot may be executed. In such a case, it is desirable to stop applying the snapshot. Therefore, “when the number of execution times of methods not included in the snapshot is 500 times or more” is set as the snapshot application stop condition. The execution program monitoring unit 305 aggregates the number of execution times of methods not included in the snapshot.

そして、スナップショット管理手段306は、スナップショット管理テーブル801内の既存のスナップショットの更新が必要かどうかを判定する(S605)。判定方法としては、適用開始条件が同一であるスナップショット401が、スナップショット管理テーブル801内に存在するかどうかを確認する方法が単純である。   Then, the snapshot management unit 306 determines whether the existing snapshot in the snapshot management table 801 needs to be updated (S605). As a determination method, a method of confirming whether or not the snapshot 401 having the same application start condition exists in the snapshot management table 801 is simple.

ステップS605において更新が必要と判定すれば、既存のスナップショットを作成したスナップショットで更新する(S606)。具体的には、スナップショット管理テーブル801内の既存のスナップショット401のネイティブコード群402とアドレス変換テーブル403を、新しいものに更新する。更新では、適用開始条件が同一のスナップショットを更新するので、適用開始条件404の更新は不要である。また、適用停止条件405と削除条件406も、基本的に更新は不要である。   If it is determined in step S605 that updating is necessary, the existing snapshot is updated with the created snapshot (S606). Specifically, the native code group 402 and the address conversion table 403 of the existing snapshot 401 in the snapshot management table 801 are updated to new ones. In the update, since the snapshot having the same application start condition is updated, it is not necessary to update the application start condition 404. Further, the application stop condition 405 and the deletion condition 406 need not be updated basically.

ステップS605において更新が不要と判定すれば、新しいスナップショット401を作成し、スナップショット管理テーブル801に追加する(S607)。ところで、多数のスナップショット401をスナップショット管理テーブル801に追加すると、記憶装置13の容量を多く消費してしまう。そこで、スナップショット401には、削除条件を設定する。削除の方法として、記憶装置13の空き容量が不足している場合に、使用頻度が低いスナップショットを削除する方法が適切である。そこで、標準の削除条件を「ハードディスクの空き容量が5%以下、かつスナップショット管理テーブルのスナップショット群において使用頻度が3位以下である場合」とする。   If it is determined in step S605 that no update is necessary, a new snapshot 401 is created and added to the snapshot management table 801 (S607). By the way, if a large number of snapshots 401 are added to the snapshot management table 801, a large capacity of the storage device 13 is consumed. Therefore, a deletion condition is set for the snapshot 401. As a deletion method, when the free capacity of the storage device 13 is insufficient, a method of deleting a snapshot that is not frequently used is appropriate. Therefore, the standard deletion condition is “when the available capacity of the hard disk is 5% or less and the usage frequency is 3rd or less in the snapshot group of the snapshot management table”.

削除条件の判定を行うために、スナップショット401を適用した履歴をスナップショット管理手段306が保持する。例えば削除処理を機器の起動時に実行する場合、S501において記憶装置13の空き容量を取得する。空き容量が5%以下であれば、S502においてスナップショット管理テーブル801の各スナップショット401を適用した履歴を参照し、使用頻度が3位以下のスナップショット401を削除する。スナップショット管理テーブル801に追加したスナップショット401の削除処理を実行するタイミングとしては、機器の起動時だけでなく、機器のシャットダウン時なども考えられるが、特に制限はない。   In order to determine the deletion condition, the snapshot management unit 306 holds a history of applying the snapshot 401. For example, when the deletion process is executed when the device is activated, the free capacity of the storage device 13 is acquired in S501. If the free space is 5% or less, the history of applying each snapshot 401 in the snapshot management table 801 is referred to in S502, and the snapshot 401 with the third or lower usage frequency is deleted. The timing for executing the deletion processing of the snapshot 401 added to the snapshot management table 801 can be considered not only when the device is started, but also when the device is shut down, but is not particularly limited.

次に、適合度の確認処理について、図7を用いて説明する。図7はスナップショット401の適合度の確認処理のフローチャートである。適合度は、仮想マシン202上で実行された実際のプログラムにスナップショット401がどれだけ適合するかを示す度合いである。適合度の利用方法として、スナップショット401を適用中に適合度を適宜計測し、スナップショット401の適用をいつまで行うかを判断するために利用することが考えられる。また、スナップショット401の更新が必要かどうかを判断するために利用することが考えられる。   Next, the conformity confirmation process will be described with reference to FIG. FIG. 7 is a flowchart of the confirmation process of the adaptability of the snapshot 401. The degree of conformity is a degree indicating how much the snapshot 401 conforms to an actual program executed on the virtual machine 202. As a method of using the adaptability, it is conceivable that the adaptability is appropriately measured during the application of the snapshot 401 and used to determine how long the snapshot 401 is applied. Further, it may be used to determine whether the snapshot 401 needs to be updated.

適合度の確認では、はじめにスナップショット管理手段306が、仮想マシン202が実行したプログラムの履歴を取得する(S701)。この履歴は、実行プログラム監視手段305によって作成されたものである。   In the confirmation of the fitness level, first, the snapshot management unit 306 acquires a history of programs executed by the virtual machine 202 (S701). This history is created by the execution program monitoring unit 305.

実行したプログラムの履歴を取得すると、適用中のスナップショット401との適合度が閾値以下の値であるかを確認する(S702)。具体的な適合度の算出方法として単純な方法は、スナップショットに含まれないメソッドが実行された回数を用いる方法である。例えば、「適合度=1/(スナップショットに含まれないメソッドが実行された回数)」として、閾値を1/100とする。すると、スナップショットに含まれないメソッドが機器の起動処理中に100回以上実行された場合に、ステップS702において適合度が閾値以下となる。   When the history of the executed program is acquired, it is confirmed whether the fitness with the applied snapshot 401 is a value equal to or less than a threshold value (S702). A simple method for calculating a specific fitness is a method using the number of times a method not included in the snapshot is executed. For example, the threshold value is set to 1/100 as “fitness = 1 / (the number of times a method not included in the snapshot has been executed)”. Then, when a method that is not included in the snapshot is executed 100 times or more during the device activation process, the fitness is equal to or less than the threshold value in step S702.

また、適合度の算出方法として、JITコードキャッシュ303のdiffを用いる方法もありえる。スナップショット401を適用すると、ネイティブコード群402がJITコードキャッシュ303に展開される。しかし、適用したスナップショット401と機器が実行するプログラムが適合しなければ、適用したスナップショット401に対応しないメソッドの実行が頻発する。すると、それらのメソッドがJITコンパイルされ、JITコードキャッシュ303にネイティブコードとして追加されていく。また、追加時にJITコードキャッシュ303の空きがなければ、実行頻度が低いネイティブコードがJITコードキャッシュ303から削除される。この結果、JITコードキャッシュ303の内容は、スナップショット401を適用した時点の状態と差異が生じていく。そこで、スナップショット401を適用直後のJITコードキャッシュ303と、適合度の確認を行う時点でのJITコードキャッシュ303のdiffを計測し、適合度として利用する。   Further, as a method for calculating the degree of conformity, there may be a method using diff of the JIT code cache 303. When the snapshot 401 is applied, the native code group 402 is expanded in the JIT code cache 303. However, if the applied snapshot 401 does not match the program executed by the device, the method that does not correspond to the applied snapshot 401 is frequently executed. Then, these methods are JIT-compiled and added as native code to the JIT code cache 303. If the JIT code cache 303 is not empty at the time of addition, a native code with a low execution frequency is deleted from the JIT code cache 303. As a result, the contents of the JIT code cache 303 differ from the state when the snapshot 401 is applied. Therefore, the diff of the JIT code cache 303 immediately after the snapshot 401 is applied and the JIT code cache 303 at the time when the conformity is confirmed is measured and used as the conformance.

ステップS702において適合度が閾値以下の場合、スナップショット401を作成する(S703)。スナップショット作成の手順については、図6を用いて前述した。ステップS702において適合度が閾値より大きい場合、適用中のスナップショットは適切であると判断し、何も行わずに適合度の確認は終了する。   If the fitness level is equal to or smaller than the threshold value in step S702, a snapshot 401 is created (S703). The procedure for creating a snapshot has been described above with reference to FIG. If the fitness level is larger than the threshold value in step S702, it is determined that the snapshot being applied is appropriate, and the verification of the fitness level ends without doing anything.

以上、機器の起動時にスナップショット401を利用する方法について説明した。機器の起動時には多くのメソッドが実行されるため、スナップショット401を利用してJITコンパイル処理の負荷を低減することで、機器は高速に起動する。   The method of using the snapshot 401 when starting up the device has been described above. Since many methods are executed when the device is activated, the device is activated at high speed by reducing the JIT compilation processing load using the snapshot 401.

(実施形態2)
実施形態1では、機器の起動時にスナップショット401を利用する方法について説明した。しかし、機器の起動完了後に実行されるプログラムによって、JITコンパイルが多く発生することがある。例えば、機器の起動が完了したあとで、ユーザがアプリケーション203の実行を開始して、多くのJITコンパイルが発生する場合である。
(Embodiment 2)
In the first embodiment, the method of using the snapshot 401 when the device is activated has been described. However, many JIT compilations may occur depending on the program that is executed after the start-up of the device. For example, the case where the user starts the execution of the application 203 after the activation of the device is completed and many JIT compilations occur.

このような場合にJITコンパイル処理の負荷を低減するためには、多くのJITコンパイルが発生する処理を検出してスナップショット401を作成し、次回からはそのタイミングで作成したスナップショット401を利用すればよい。   In such a case, in order to reduce the load of JIT compilation processing, a snapshot 401 is created by detecting a process in which many JIT compilations occur, and the snapshot 401 created at that timing is used from the next time. That's fine.

そこで、機器の起動完了後にスナップショット401を選択して利用する方法を、実施形態2として説明する。説明は図9を用いて行う。図9は機器がプログラムを実行する処理を示すフローチャートである。機器の起動時にスナップショット管理テーブル801のスナップショット_aを選択して適用中であるとして説明する。実行するプログラムは、機器の起動が完了したのちに、ユーザの指示で起動したアプリケーション203とする。以降、このアプリケーション203を、アプリXと記す。また、スナップショット管理テーブル801にはスナップショット_aのみがある状態であるとする。   Therefore, a method for selecting and using the snapshot 401 after the completion of device activation will be described as a second embodiment. The description will be given with reference to FIG. FIG. 9 is a flowchart showing a process in which a device executes a program. A description will be given assuming that snapshot_a in the snapshot management table 801 is selected and applied when the device is activated. The program to be executed is the application 203 that is started by the user's instruction after the start of the device is completed. Hereinafter, this application 203 is referred to as application X. Further, it is assumed that only the snapshot_a exists in the snapshot management table 801.

仮想マシン202はプログラムを開始する前に、実行プログラムの監視を開始する(S901)。この処理はステップS509と同様である。   The virtual machine 202 starts monitoring the execution program before starting the program (S901). This process is the same as step S509.

そして、仮想マシン202は、シャットダウンが指示されたかどうかを確認する(S902)。ステップS902においてシャットダウンが指示されていれば、シャットダウンの処理を実行し(S913)、プログラムの実行は終了する。   Then, the virtual machine 202 confirms whether shutdown is instructed (S902). If shutdown is instructed in step S902, a shutdown process is executed (S913), and the execution of the program ends.

ステップS902においてシャットダウンの指示がなければ、仮想マシン202は、プログラムを実行する(S903)。実行するプログラムの単位で最小のものはメソッドである。しかし、このフローチャートにおいて1つのメソッドを実行するたびにステップS904以降の処理を行うと、負荷が高くなってしまう。そのため、ステップS903で実行するプログラムの単位は、ある程度まとまった処理とする。例えば、メソッド100個の実行処理や、3分間の実行処理、などが考えられる。   If there is no shutdown instruction in step S902, the virtual machine 202 executes the program (S903). The smallest unit of program to be executed is a method. However, if the processing after step S904 is performed every time one method is executed in this flowchart, the load increases. For this reason, the unit of the program executed in step S903 is set to a certain process. For example, an execution process of 100 methods, an execution process for 3 minutes, and the like can be considered.

プログラムの実行が終わると、スナップショット管理手段306はスナップショットを適用中かどうか確認する(S904)。実施形態1で説明したように、スナップショット401はJITコードキャッシュ303のネイティブコード群である。そのため、複数のスナップショット401では、例えばJavaの基本クラスのメソッドに対応するネイティブコードなどが重複しえる。そのため、複数のスナップショットを同時に適用すると重複を解決する必要があるため、本実施形態ではスナップショットは一度に1つしか適用しない。ここで、現在はスナップショット_aを選択して適用中であるので、スナップショット管理手段306はスナップショット_aの適用停止条件を満たしているかを確認する(S905)。   When the execution of the program ends, the snapshot management means 306 checks whether a snapshot is being applied (S904). As described in the first embodiment, the snapshot 401 is a native code group of the JIT code cache 303. Therefore, in the plurality of snapshots 401, for example, native codes corresponding to Java base class methods may overlap. For this reason, if a plurality of snapshots are applied at the same time, it is necessary to resolve duplication. Therefore, in this embodiment, only one snapshot is applied at a time. Here, since the snapshot_a is currently selected and being applied, the snapshot management unit 306 confirms whether the application stop condition for the snapshot_a is satisfied (S905).

そして、スナップショット_aの適用停止条件である「機器の起動が完了した時」を満たしているため、スナップショット管理手段306はスナップショットの適用を停止する(S907)。スナップショットの適用を停止する方法では、単にスナップショット管理テーブル801の適用中の項目を「×」にする方法が単純である。   The snapshot management unit 306 stops the application of the snapshot because the application stop condition of the snapshot_a “when the activation of the device is completed” is satisfied (S907). In the method of stopping the application of the snapshot, a method of simply setting the item being applied in the snapshot management table 801 to “x” is simple.

そして、スナップショット管理手段306は、状態に応じたスナップショット401があるかを確認する(S908)。ここで、現在はスナップショット_aしかないため、状態に応じたスナップショットがない。そこで、スナップショットの作成条件を満たしているかを確認する(S909)。   Then, the snapshot management unit 306 confirms whether there is a snapshot 401 corresponding to the state (S908). Here, since there is currently only snapshot_a, there is no snapshot corresponding to the state. Therefore, it is confirmed whether or not the snapshot creation conditions are satisfied (S909).

ステップS909の処理は基本的にステップS512と同様であるが、本実施形態でさらに詳細に説明する。スナップショット401は、ハードディスクのように大容量だが低速なデバイスに保存される。スナップショット401を適用して機器の動作を高速にするためには、低速なデバイスにアクセスする遅延時間よりも、スナップショット401の適用によって省略されるJITコンパイル処理の時間が大きくなければならない。つまり、本実施形態の場合、アプリXが起動してから発生したJITコンパイル処理の合計時間が閾値以上でなければならない。   The processing in step S909 is basically the same as that in step S512, but will be described in more detail in this embodiment. The snapshot 401 is stored in a large capacity but low speed device such as a hard disk. In order to increase the operation speed of the apparatus by applying the snapshot 401, the JIT compilation processing time to be omitted by applying the snapshot 401 must be longer than the delay time for accessing a low-speed device. In other words, in the case of the present embodiment, the total time of JIT compilation processing that has occurred since the application X has been started must be greater than or equal to the threshold value.

ステップS909において、アプリXが起動してから発生したJITコンパイル処理の合計時間が閾値以上でなければ、ステップS902に戻ってアプリXのプログラムの実行を継続する。   In step S909, if the total time of JIT compilation processing that has occurred since the application X is started is not equal to or greater than the threshold, the process returns to step S902 to continue execution of the application X program.

ステップS909において、アプリXが起動してから発生したJITコンパイル処理の合計時間が閾値以上であれば、スナップショットを作成する(S910)。スナップショットを作成する処理は、実施形態1で説明したとおりである。本実施形態では、適用開始条件として、「アプリXの実行開始時」を設定し、スナップショット管理テーブル801にスナップショット_cを作成する。また、適用停止条件には、「アプリXの停止」を設定する。また、このスナップショット_cはアプリXのプログラムに依存するものであり、アプリXがアンインストールされれば不要となる。また、アプリXがアップデートされた場合、このスナップショット_cは不適切なものとなる。そこで、スナップショット_cを作成時のアプリXのバージョンを2.0の場合、スナップショット_cの削除条件は「アプリXのアンインストール。またはアプリXのバージョンが2.0と異なるとき」とする。   In step S909, if the total time of JIT compilation processing that has occurred since the application X is started is greater than or equal to the threshold, a snapshot is created (S910). The process for creating a snapshot is as described in the first embodiment. In the present embodiment, “when application X is started” is set as an application start condition, and a snapshot_c is created in the snapshot management table 801. Also, “stop application X” is set as the application stop condition. Further, this snapshot_c depends on the program of the application X, and becomes unnecessary if the application X is uninstalled. In addition, when the application X is updated, the snapshot_c is inappropriate. Therefore, when the version of the application X at the time of creating the snapshot_c is 2.0, the deletion condition of the snapshot_c is “uninstallation of the application X or when the version of the application X is different from 2.0”.

ステップS910においてスナップショット_cを作成後、機器を再起動して再度アプリXを実行したとする。すると、ステップS908において状態に応じたスナップショット_cがあるため、スナップショット管理手段306はスナップショット_cを選択する(S911)。そして、ステップS508と同様に選択したスナップショット_cを展開する(S912)。   Assume that after creating the snapshot_c in step S910, the device is restarted and the app X is executed again. Then, since there is a snapshot_c corresponding to the state in step S908, the snapshot management unit 306 selects the snapshot_c (S911). Then, the selected snapshot_c is expanded as in step S508 (S912).

以上、実行するプログラムに応じてスナップショット401を利用する方法について説明した。   The method of using the snapshot 401 according to the program to be executed has been described above.

(実施形態3)
スナップショット401を適用中かどうかでJITコンパイルの処理の動作を変える方法について、実施形態3として図10、図11を用いて説明する。図10はJITコンパイルオプションの例を示す図である。図11は仮想マシンの構成を示す図である。
(Embodiment 3)
A method of changing the operation of JIT compilation processing depending on whether or not the snapshot 401 is being applied will be described as a third embodiment with reference to FIGS. FIG. 10 is a diagram showing an example of JIT compilation options. FIG. 11 is a diagram illustrating a configuration of a virtual machine.

仮想マシン202では、JITコンパイルにおいてインライン展開する関数の大きさの上限を指定するオプション(MaxInlineSize)を使用できる。また、JITコンパイルするメソッドを選択する条件を指定するオプション(CompileThreshold)を使用できる。これらのオプションによって、実行環境や実行対象プログラムに適したJITコンパイルを行える。インライン展開を積極的に行う、あるいはJITコンパイルするメソッドを増やすと、JITコンパイル後のプログラムの動作はより高速になる。その一方で、JITコンパイルの処理に時間がかかるようにもなる。以降、このようなJITコンパイルを、高レベルのJITコンパイルと記す。   In the virtual machine 202, an option (MaxInlineSize) that specifies the upper limit of the size of a function to be expanded inline in JIT compilation can be used. Also, an option (CompileThreshold) for specifying a condition for selecting a method for JIT compilation can be used. With these options, JIT compilation suitable for the execution environment and the execution target program can be performed. If inline expansion is actively performed or the number of methods for JIT compilation is increased, the operation of the program after JIT compilation becomes faster. On the other hand, JIT compilation processing takes time. Hereinafter, such JIT compilation is referred to as high-level JIT compilation.

一般的に、JITコンパイルに時間をかけないように高レベルのJITコンパイルは避けられる。しかし、本発明では一度JITコンパイルすればその結果をスナップショット401として利用できるため、高レベルなJITコンパイルを行いたい。   In general, high-level JIT compilation is avoided so as not to spend time on JIT compilation. However, in the present invention, once the JIT is compiled, the result can be used as the snapshot 401. Therefore, a high level JIT compilation is desired.

これを実現するためには、JITコンパイルのオプションを、スナップショット適用時とスナップショット未適用時のそれぞれで設定できるようにすればよい。スナップショット管理テーブル801に適用できるスナップショット401がなければ、実行されるメソッドを高レベルにJITコンパイルしていく。ステップS909の条件を満たすと高レベルなJITコンパイルの結果がスナップショット401として作成され、次回からはJITコンパイルをせずに高速に機器が動作する。   In order to realize this, JIT compilation options may be set when the snapshot is applied and when the snapshot is not applied. If there is no applicable snapshot 401 in the snapshot management table 801, the method to be executed is JIT compiled at a high level. When the condition of step S909 is satisfied, a high-level JIT compilation result is created as a snapshot 401, and the apparatus operates at high speed without performing JIT compilation from the next time.

具体的には、図10に示すように、オプション名にスナップショット401を適用時用のprefixを追加する。prefixは、”UseSnap_”のような文字列でよい。例えばCompileThresholdオプションについて、オプションの値が大きいほど、プログラムのメソッドはJITコンパイルされにくくなる。また、値が0の場合はJITコンパイルされない。また、図11に示すように、仮想マシン202はJITコンパイル指示受信手段307を備える。JITコンパイル指示受信手段307は、オプションを受け取り、JITコンパイラの動作をスナップショット401の適用時と未適用時で変更する。   Specifically, as shown in FIG. 10, a prefix for applying the snapshot 401 is added to the option name. The prefix may be a character string such as “UseSnap_”. For example, with respect to the CompileThreshold option, the larger the value of the option, the more difficult the method of the program is JIT compiled. If the value is 0, JIT compilation is not performed. Further, as shown in FIG. 11, the virtual machine 202 includes a JIT compilation instruction receiving unit 307. The JIT compilation instruction receiving unit 307 receives the option and changes the operation of the JIT compiler between when the snapshot 401 is applied and when it is not applied.

例として、仮想マシン202の実行時に、”CompileThreshold=10,UseSnap_CompileThreshold=0”というオプションを与えるとする。このオプションの場合、スナップショット401を適用していなければ多数のメソッドがネイティブコードに変換され、作成されるスナップショット401に含まれるようになる。作成したスナップショット401を適用していれば、スナップショット401に含まれないメソッドが実行されてもJITコンパイルが行われない。スナップショット401を適用中に実行されるプログラムは、すべてネイティブコード群402に対応するメソッドのみを実行することが理想である。しかし、スレッドの実行タイミングや機器に保存されたデータによっては、ネイティブコード群402に対応しないメソッドを少数だけ実行することもありえる。このようなときには少数のメソッドはJITコンパイルを行わないことで、機器全体の動作を高速化できる。   As an example, when executing the virtual machine 202, it is assumed that an option “CompileThreshold = 10, UseSnap_CompileThreshold = 0” is given. In the case of this option, if the snapshot 401 is not applied, a large number of methods are converted into native code and included in the created snapshot 401. If the created snapshot 401 is applied, JIT compilation is not performed even if a method not included in the snapshot 401 is executed. Ideally, all programs executed during the application of the snapshot 401 execute only methods corresponding to the native code group 402. However, depending on the execution timing of the thread and the data stored in the device, a small number of methods that do not correspond to the native code group 402 may be executed. In such a case, a small number of methods do not perform JIT compilation, thereby speeding up the operation of the entire device.

また、JITコンパイル処理の遅延がとくに問題となるのは、ユーザが遅延を実感しやすい処理である機器の起動処理だけであることが多い。そこで、機器の起動処理中と起動完了後でJITコンパイルのオプションを変えることも有効となる。具体的には、図12のように、JITコンパイル用オプションを機器の起動処理中と起動完了後で異なるようにprefixを設定する。   In many cases, the delay of the JIT compilation process is particularly problematic only in the device activation process, which is a process in which the user can easily feel the delay. Therefore, it is also effective to change the JIT compilation options during the device startup process and after the startup is completed. Specifically, as shown in FIG. 12, the prefix is set so that the JIT compilation options are different during the device startup process and after the startup is completed.

以上、スナップショット401を適用中かどうかでJITコンパイルの処理の動作を変える方法について説明した。   The method of changing the operation of JIT compilation processing depending on whether the snapshot 401 is being applied has been described above.

(実施形態4)
実施形態3ではスナップショット401を適用中かどうかで、JITコンパイルの内容を変える方法を説明した。スナップショット401を作成するには高レベルなJITコンパイルを行いたいが、高レベルなJITコンパイルは処理に時間がかかり、機器の動作が遅くなるという問題がある。高レベルなJITコンパイルの時間を問題にならないようにするには、JITコンパイルを非同期で行えばよい。非同期でJITコンパイルを行うには、スナップショット作成用のスレッドを仮想マシン202上で実行することが単純である。以降の説明では、JITコンパイルだけでなくスナップショットの作成処理の全てを、スナップショット作成用スレッドで行うとする。
(Embodiment 4)
In the third embodiment, the method of changing the contents of JIT compilation depending on whether the snapshot 401 is being applied has been described. To create the snapshot 401, it is desired to perform high-level JIT compilation. However, the high-level JIT compilation has a problem that it takes time to process and the operation of the device becomes slow. To avoid the problem of high-level JIT compilation time, JIT compilation may be performed asynchronously. To perform JIT compilation asynchronously, it is simple to execute a snapshot creation thread on the virtual machine 202. In the following description, it is assumed that not only JIT compilation but all snapshot creation processing is performed by a snapshot creation thread.

そこで、スナップショット401を作成するためのJITコンパイルを非同期で行う方法を、実施形態4として説明する。スナップショット401を作成するためのJITコンパイルのオプションのprefixは、図13に示すように”CreateSnap_”とする。   Therefore, a method for asynchronously performing JIT compilation for creating the snapshot 401 will be described as a fourth embodiment. The prefix of the JIT compilation option for creating the snapshot 401 is “CreateSnap_” as shown in FIG.

はじめに、仮想マシン202の構成について図14を用いて説明する。図14は、仮想マシン202の構成を示す図である。図14は図11とほぼ同様であるが、新たにスナップショット作成用JITコードキャッシュ308を備えている。スナップショット401を作成するためのJITコンパイルによって生成されるネイティブコードは、スナップショット作成用JITコードキャッシュ308に格納される。JITコードキャッシュ303はプログラムの実行時に参照するため、メモリのような高速の記憶装置13である必要があった。しかし、スナップショット作成用JITコードキャッシュ308は非同期に参照するため、ハードディスクのような低速の記憶装置13でもよい。   First, the configuration of the virtual machine 202 will be described with reference to FIG. FIG. 14 is a diagram illustrating a configuration of the virtual machine 202. FIG. 14 is substantially the same as FIG. 11, but newly includes a snapshot creation JIT code cache 308. Native code generated by JIT compilation for creating the snapshot 401 is stored in the snapshot creation JIT code cache 308. Since the JIT code cache 303 is referred to when the program is executed, it has to be a high-speed storage device 13 such as a memory. However, since the snapshot creation JIT code cache 308 is referenced asynchronously, it may be a low-speed storage device 13 such as a hard disk.

次に、スナップショット401を作成する手順について図15を用いて説明する。図15はスナップショットの作成処理のフローチャートである。スナップショット401の作成を開始すると、すでにJITコードキャッシュ303に存在するネイティブコードだけでスナップショット401を作れるかを確認する(S1501)。図13に示したJITコンパイルのオプションで、スナップショット未適用時、スナップショット適用時、スナップショット作成時の各オプションが同一であるとする。このときは、JITコードキャッシュ303にあるネイティブコード群をそのままスナップショット401にすればよい。この場合、ステップS601と同様にJITコードキャッシュ303からネイティブコード群を取得する(S1502)。   Next, a procedure for creating the snapshot 401 will be described with reference to FIG. FIG. 15 is a flowchart of snapshot creation processing. When the creation of the snapshot 401 is started, it is confirmed whether the snapshot 401 can be created only with the native code already existing in the JIT code cache 303 (S1501). It is assumed that the options for JIT compilation shown in FIG. 13 are the same when a snapshot is not applied, when a snapshot is applied, and when a snapshot is created. In this case, the native code group in the JIT code cache 303 may be used as the snapshot 401 as it is. In this case, the native code group is acquired from the JIT code cache 303 as in step S601 (S1502).

ステップS1501において、JITコードキャッシュ303のネイティブコードではスナップショット401が作れない場合、スナップショット管理手段306は実行プログラム監視手段305から実行したプログラムの履歴を取得する(S1503)。そして、JITコンパイルの対象となるメソッドを選択する(S1504)。選択の方法としては、JITコンパイラ302からJITコンパイルの履歴を取得し、最後にJITコンパイルが頻発しはじめたメソッドの実行から最も新しい実行履歴のメソッドまでを選択することが単純である。   In step S1501, when the snapshot 401 cannot be created with the native code of the JIT code cache 303, the snapshot management unit 306 acquires the history of the executed program from the execution program monitoring unit 305 (S1503). Then, a method to be subjected to JIT compilation is selected (S1504). As a selection method, it is simple to obtain a history of JIT compilation from the JIT compiler 302 and select from the method execution with the most frequent execution of JIT compilation to the method with the latest execution history.

そして、スナップショット管理手段306は、スナップショット作成用JITコードキャッシュ308に、”CreateSnap_”で始まるオプション値でJITコンパイルしたネイティブコードを生成する(S1505)。生成が終わると、スナップショット管理手段306は、スナップショット作成用JITコードキャッシュ308からネイティブコード群を取得する(S1506)。   Then, the snapshot management unit 306 generates a native code JIT-compiled with an option value starting with “CreateSnap_” in the snapshot creation JIT code cache 308 (S1505). When the generation is finished, the snapshot management unit 306 acquires a native code group from the snapshot creation JIT code cache 308 (S1506).

ステップS1502、またはステップS1506でネイティブコード群を取得すると、ステップS602と同様に、403を作成する(S1507)。また、ステップS603と同様に適用開始条件を設定し(S1508)、ステップS604と同様に適用停止条件を設定する(S1509)。   When the native code group is acquired in step S1502 or step S1506, 403 is created as in step S602 (S1507). Further, an application start condition is set in the same manner as in step S603 (S1508), and an application stop condition is set in the same manner as in step S604 (S1509).

そして、ステップS605と同様に既存のスナップショットの更新が必要かを判定する(S1510)。更新が必要であればステップS606と同様に更新を行う(S1511)。更新が必要でなければ、ステップS607と同様に作成したスナップショット401をスナップショット管理テーブル801に追加する(S1512)。   Then, similarly to step S605, it is determined whether an existing snapshot needs to be updated (S1510). If updating is necessary, updating is performed in the same manner as in step S606 (S1511). If no update is necessary, the snapshot 401 created in the same manner as in step S607 is added to the snapshot management table 801 (S1512).

以上、スナップショット401を作成するためのJITコンパイルを非同期で行う方法を説明した。   The method of performing JIT compilation for creating the snapshot 401 asynchronously has been described above.

(他の実施形態)
また、本発明は、以下の処理を実行することによっても実現される。即ち、上述した実施形態の機能を実現するソフトウェア(プログラム)を、ネットワーク又は各種記憶媒体を介してシステム或いは装置に供給し、そのシステム或いは装置のコンピュータ(またはCPUやMPU等)がプログラムを読み出して実行する処理である。
(Other embodiments)
The present invention can also be realized by executing the following processing. That is, software (program) that realizes the functions of the above-described embodiments is supplied to a system or apparatus via a network or various storage media, and a computer (or CPU, MPU, or the like) of the system or apparatus reads the program. It is a process to be executed.

Claims (11)

アプリケーションを実行する情報処理装置であって、
前記アプリケーションをネイティブコードにコンパイルするコンパイル手段と、
前記コンパイルによって生成されたネイティブコード群を保持する保持手段と、
前記情報処理装置の状態を取得する取得手段と、
前記情報処理装置の状態に基づいて、前記ネイティブコード群からネイティブコードを選択して利用する利用手段と、を有することを特徴とする情報処理装置。
An information processing apparatus that executes an application,
Compiling means for compiling the application into native code;
Holding means for holding a group of native codes generated by the compilation;
Obtaining means for obtaining a state of the information processing apparatus;
An information processing apparatus comprising: a utilization unit that selects and uses a native code from the native code group based on a state of the information processing apparatus.
前記情報処理装置で実行するプログラムを監視する監視手段を更に有し、
前記コンパイル手段は、前記監視手段による監視の結果に基づいて、前記ネイティブコード群を作成することを特徴とする請求項1に記載の情報処理装置。
Further comprising monitoring means for monitoring a program executed by the information processing apparatus;
The information processing apparatus according to claim 1, wherein the compiling unit creates the native code group based on a result of monitoring by the monitoring unit.
前記利用手段は、前記ネイティブコード群の利用を行う条件と前記情報処理装置の状態とに基づき、前記ネイティブコード群からネイティブコードを選択して利用することを特徴とする請求項1または請求項2に記載の情報処理装置。   3. The utilization unit selects and uses a native code from the native code group based on a condition for using the native code group and a state of the information processing apparatus. The information processing apparatus described in 1. 前記利用手段は、前記ネイティブコード群の利用を行う条件と前記情報処理装置の状態と前記監視の結果とに基づき、前記ネイティブコード群からネイティブコードを選択して利用することを特徴とする請求項2に記載の情報処理装置。   The utilization unit selects and uses a native code from the native code group based on a condition for using the native code group, a state of the information processing apparatus, and a result of the monitoring. 2. The information processing apparatus according to 2. 前記利用手段は、前記ネイティブコード群の利用を停止する条件に基づき、前記ネイティブコード群の利用を停止することを特徴とする請求項1乃至4のいずれか1項に記載の情報処理装置。   The information processing apparatus according to claim 1, wherein the use unit stops using the native code group based on a condition for stopping the use of the native code group. 前記利用手段は、前記ネイティブコード群の利用を停止する条件と前記開始の結果とに基づき、前記ネイティブコード群の利用を停止することを特徴とする請求項2に記載の情報処理装置。   The information processing apparatus according to claim 2, wherein the utilization unit stops the use of the native code group based on a condition for stopping the use of the native code group and a result of the start. 前記利用手段は、前記ネイティブコード群を削除する条件と前記監視の結果に基づき、前記ネイティブコード群を削除することを特徴とする請求項2に記載の情報処理装置。   The information processing apparatus according to claim 2, wherein the utilization unit deletes the native code group based on a condition for deleting the native code group and a result of the monitoring. 前記コンパイル手段は、前記ネイティブコード群を利用しているか否かに関する情報に基づき、前記コンパイルの動作を変えることを特徴とする請求項1乃至7のいずれか1項に記載の情報処理装置。   The information processing apparatus according to claim 1, wherein the compiling unit changes the operation of the compiling based on information regarding whether or not the native code group is used. 前記保持手段は、前記ネイティブコード群を利用しているか否かに関する情報に基づき、
複数のネイティブコード群を保持することを特徴とする請求項8に記載の情報処理装置。
The holding unit is based on information on whether or not the native code group is used,
The information processing apparatus according to claim 8, wherein a plurality of native code groups are held.
アプリケーションを実行する情報処理装置の情報処理方法であって、
コンパイル手段が、前記アプリケーションをネイティブコードにコンパイルするコンパイル工程と、
保持手段が、前記コンパイルによって生成されたネイティブコード群を保持する保持工程と、
取得手段が、前記情報処理装置の状態を取得する取得工程と、
利用手段が、前記情報処理装置の状態に基づいて、前記ネイティブコード群からネイティブコードを選択して利用する利用工程と、を有することを特徴とする情報処理方法。
An information processing method for an information processing apparatus that executes an application,
A compiling step for compiling the application into native code;
A holding step in which holding means holds a group of native codes generated by the compilation;
An obtaining step for obtaining a state of the information processing apparatus;
And a utilization step of selecting and using a native code from the native code group based on a state of the information processing apparatus.
コンピュータを、
アプリケーションを実行する情報処理装置であって、
前記アプリケーションをネイティブコードにコンパイルするコンパイル手段と、
前記コンパイルによって生成されたネイティブコード群を保持する保持手段と、
前記情報処理装置の状態を取得する取得手段と、
前記情報処理装置の状態に基づいて、前記ネイティブコード群からネイティブコードを選択して利用する利用手段と、を有することを特徴とする情報処理装置として機能させるためのコンピュータプログラム。
Computer
An information processing apparatus that executes an application,
Compiling means for compiling the application into native code;
Holding means for holding a group of native codes generated by the compilation;
Obtaining means for obtaining a state of the information processing apparatus;
A computer program for functioning as an information processing apparatus, comprising: a utilization unit that selects and uses a native code from the native code group based on a state of the information processing apparatus.
JP2018035569A 2018-02-28 2018-02-28 Information processing apparatus, information processing method and computer program Pending JP2019152911A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2018035569A JP2019152911A (en) 2018-02-28 2018-02-28 Information processing apparatus, information processing method and computer program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2018035569A JP2019152911A (en) 2018-02-28 2018-02-28 Information processing apparatus, information processing method and computer program

Publications (1)

Publication Number Publication Date
JP2019152911A true JP2019152911A (en) 2019-09-12

Family

ID=67946330

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2018035569A Pending JP2019152911A (en) 2018-02-28 2018-02-28 Information processing apparatus, information processing method and computer program

Country Status (1)

Country Link
JP (1) JP2019152911A (en)

Similar Documents

Publication Publication Date Title
JP4828271B2 (en) Software generation apparatus for multiple OS versions and software generation support program for multiple OS versions
JP5167589B2 (en) Application server device and virtual machine program
JP2014170515A (en) Device, information storage program, and information storage method
US20150242205A1 (en) Non-Transitory Computer-Readable Recording Medium Storing Application Development Support Program and Application Development Support System That Automatically Support Platform Version
CN110825428A (en) State machine configuration method, device, equipment and readable storage medium
JP6879625B2 (en) Programmable controller, management device and control system
JP5489884B2 (en) Instruction execution device, instruction execution method, and instruction execution program
JP2020030621A (en) Information processing unit and program
CN106250068B (en) Image forming apparatus and application deletion method
JP6555981B2 (en) Information processing apparatus and control method thereof
JP2017126293A (en) Information processing apparatus and resource management method
US9335990B2 (en) Method, a system, and a non-transitory computer-readable medium for supporting application development
JP2019152911A (en) Information processing apparatus, information processing method and computer program
JP2016051395A (en) Image forming apparatus and resource management method
JP2021048489A (en) Information processing apparatus, method of controlling the same, and program
JP2015210769A (en) Information processing device, information processing method, and program
JP2016224559A (en) Program creation support device, control method and program
JP2015197845A (en) Information processing apparatus and control method of the same, and program
KR101670916B1 (en) Method for storing function and system device using the same
JP2008305021A (en) Information processor and application management method
CN112486511A (en) Method for generating operating system installation mirror image through web
JP6398456B2 (en) Software generator
JP2019046001A (en) Application porting support device, application porting support program, and application porting method
JP6143476B2 (en) Application processing apparatus, method, and program thereof
US11397572B2 (en) Image forming apparatus capable of executing extension application, method of controlling same, and storage medium