JP2009199391A - Garbage collection method, and its execution device, and processing program - Google Patents

Garbage collection method, and its execution device, and processing program Download PDF

Info

Publication number
JP2009199391A
JP2009199391A JP2008040926A JP2008040926A JP2009199391A JP 2009199391 A JP2009199391 A JP 2009199391A JP 2008040926 A JP2008040926 A JP 2008040926A JP 2008040926 A JP2008040926 A JP 2008040926A JP 2009199391 A JP2009199391 A JP 2009199391A
Authority
JP
Japan
Prior art keywords
heap area
area
garbage collection
program
java heap
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
JP2008040926A
Other languages
Japanese (ja)
Inventor
Takuma Nagase
卓真 長瀬
Koichi Okada
浩一 岡田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP2008040926A priority Critical patent/JP2009199391A/en
Publication of JP2009199391A publication Critical patent/JP2009199391A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To prevent all threads from stopping at garbage collection when executing a program with multi-thread. <P>SOLUTION: A method includes the steps of: storing contents of a first heap area, in which an object that is referred or updated by the program is stored, in a second heap area; changing the heap area, in which the garbage collection is executed, from the first heap area to the second heap area: executing the garbage collection in the second heap area, and also continuously executing the program even during execution of the garbage collection; and changing a reference route from the first heap area to the second heap area after the execution of the garbage collection in the second heap area. <P>COPYRIGHT: (C)2009,JPO&INPIT

Description

本発明は言語処理システムにおいてメモリに記憶されているオブジェクトのガーベージコレクションに関するものである。 The present invention relates to garbage collection of objects stored in a memory in a language processing system.

言語処理システムにおいてメモリ上のヒープ領域に記憶されているオブジェクトの暗黙的な解放手段としてガーベージコレクション(以後、GCと呼ぶ)がある。GCはヒープ領域にあるオブジェクトをその時点で使用することができるか(以後、生存していると呼ぶ)を判別し、生存していないと判断したオブジェクトをヒープ領域から解放する。GCには様々な手法があり、それぞれの手法について長所が存在する。   Garbage collection (hereinafter referred to as GC) is a means for implicitly releasing objects stored in a heap area in a memory in a language processing system. The GC determines whether an object in the heap area can be used at that time (hereinafter referred to as alive), and releases the object that is determined not to be alive from the heap area. There are various GC methods, and each method has its advantages.

GCの手法の1つにStop&Copy方式がある。この方式ではプログラムの実行を止め、プログラムが参照を辿ることができる元(以後、参照ルートと呼ぶ)から辿ることができた(生存している)オブジェクトを元のヒープ領域から別に用意したヒープ領域にコピーする。そのコピーしたオブジェクトから辿ることのできるオブジェクトを更に同じ別の領域にコピーする。これを繰り返すことによって、生存しているオブジェクトのみを別の領域にコピーし、元のヒープ領域全体を生存していないオブジェクトごと破棄し、プログラムは別の領域をヒープ領域として実行を続ける。   One of the GC methods is the Stop & Copy method. In this method, the execution of the program is stopped, and the heap area prepared separately from the original heap area that can be traced from the source from which the program can trace the reference (hereinafter referred to as the reference route) To copy. The object that can be traced from the copied object is further copied to another same area. By repeating this, only the surviving objects are copied to another area, the entire original heap area is discarded together with the non-living objects, and the program continues to execute using the other area as a heap area.

他の手法の1つにMark&Sweep方式がある。この方式ではプログラムの実行を止め、参照ルートから辿ることができる全てのオブジェクトに印を付け(マークする)、その後に印の付かなかったオブジェクトを破棄する(スイープする)。   One of the other methods is the Mark & Sweep method. In this method, execution of the program is stopped, all objects that can be traced from the reference route are marked (marked), and then objects that are not marked are discarded (swept).

この2つの方式はMark&Sweep方式の方がGC実行時間で優れており、Stop&Copy方式の方が新しいデータをメモリに割り付けるのが速いという長所を持っている(非特許文献1)。   These two methods have the advantage that the Mark & Sweep method is superior in GC execution time, and the Stop & Copy method is faster in assigning new data to the memory (Non-patent Document 1).

言語処理システムの1つであるJava(TM)仮想マシン(以後、JavaVMと呼ぶ)(Java及び全てのJava関連の商標及びロゴは、米国及びその他の国における米国Sun Microsystems,Inc.の商標または登録商標である)においてはMark&Sweep方式とStop&Copy方式の2つを組み合わせた世代別GCを採用している(特許文献1)。この方式はStop&Copy方式とMark&Sweep方式の長所を組み合わせたものであり、ヒープ領域を2分割しオブジェクトの生存期間が短いものを片方の領域に置きStop&Copy方式でGCを行い、生存期間が長いものをもう片方の領域に置きMark&Sweep方式でGCを行う。生存期間が短いオブジェクトを扱う領域はStop&Copy方式が向いており、生存期間が長いオブジェクトが多くある領域に対してはMark&Sweep方式を適用する。   Java (TM) Virtual Machine (hereinafter referred to as JavaVM), one of the language processing systems (Java and all Java-related trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries) Is a generational GC that combines the Mark & Sweep method and the Stop & Copy method (Patent Document 1). This method combines the advantages of the Stop & Copy method and the Mark & Sweep method. Divide the heap area into two, place the object with a short lifetime in one area, perform the GC with the Stop & Copy method, and add the one with the long lifetime. Place in one area and perform GC with Mark & Sweep method. The Stop & Copy method is suitable for areas that handle objects with a short lifetime, and the Mark & Sweep method is applied to areas that have many objects with a long lifetime.

特許文献1に記載のようにGCの実行時間の改善は研究されているが、GCの実行の際に発生するプログラムの停止という問題は依然として発生している。このプログラムの停止時間を発生させずに行う手法についても研究はされてはいるが、プログラムの完全な停止を防ぐことは難しく、またオーバーヘッドも大きい。特許文献2においてはStop&Copy方式において、プログラムとGCの並列実行に対して発生するオーバーヘッドを低減する技術を挙げている。しかしながら、プログラムの完全な停止は依然として存在する。   Although improvement of GC execution time has been studied as described in Patent Document 1, a problem of program stoppage occurring during GC execution still occurs. Although research has also been conducted on a method of performing this program without causing a program stop time, it is difficult to prevent the program from being completely stopped, and the overhead is large. Japanese Patent Application Laid-Open No. 2004-228561 discloses a technique for reducing overhead generated in parallel execution of a program and a GC in the Stop & Copy method. However, there is still a complete stop of the program.

遠藤敏夫、「一般教養としてのGarbage Collection」http://matsu-www.is.titech.ac.jp/~endo/gc/gc.pdf、p.11Toshio Endo, “Garbage Collection as General Education” http://matsu-www.is.titech.ac.jp/~endo/gc/gc.pdf, p.11 特表2003-515812号公報Special Table 2003-515812 特開2001-184254号公報Japanese Patent Laid-Open No. 2001-184254

GCによってオブジェクトを解放する処理では一般的にはプログラムの実行が停止される。これはGCの処理によってヒープ領域の状態が変化する為、同じくヒープ領域の状態を変化させるプログラムの実行と並列に行うことは難しいからである。   In the process of releasing an object by GC, program execution is generally stopped. This is because the state of the heap area changes due to the GC processing, and it is difficult to execute in parallel with the execution of the program that also changes the state of the heap area.

GCによって発生するプログラムの停止時間は方式によってオブジェクトの生存数、GCを行う領域のサイズ等に比例するが、言語処理システムが扱うオブジェクトの量やヒープ領域のサイズは大規模な環境での運用や半導体技術の向上により増加の傾向にあり、方式によらず停止時間が伸びてきている。   The program stop time generated by GC is proportional to the number of objects alive, the size of the GC area, etc. depending on the method, but the amount of objects handled by the language processing system and the size of the heap area are There is a tendency to increase due to improvement in semiconductor technology, and the stop time is extended regardless of the method.

本発明はこのGCによるプログラムの実行の停止を軽減する為に、マルチスレッド環境にある言語処理システムにおいて、GCの処理中においてもプログラムの実行を続け、GCによる全スレッドの停止を削減することを目的とする。   In the present invention, in order to reduce the suspension of program execution by GC, in a language processing system in a multi-thread environment, program execution is continued even during GC processing, and the suspension of all threads by GC is reduced. Objective.

上記目的を達成する為に、言語処理システムが持つヒープ領域を複製する機能を持たせる。本来複製元で行うGCをこの新しいヒープ領域に対して行うように変更する機能を持たせ、プログラムの動作は複製元のヒープ領域において並列に行うようにする。GC終了後、プログラムの動作を新しいヒープ領域において実行するように切り替える機能を持たせることにより、GCによるプログラムの停止時間を削減する。   In order to achieve the above object, a function for replicating the heap area of the language processing system is provided. A function to change the GC that is originally performed on the replication source to be performed on the new heap area is provided, and the program operation is performed in parallel on the replication heap area. After the GC ends, the program stop time by GC is reduced by providing a function to switch the program operation to be executed in the new heap area.

また、プログラムの実行が新しい領域に切り替わった後に、領域の複製開始から新しい領域においてGCが終了するまで、複製元のヒープ領域において並列に実行していたプログラムが更新した位置を覚えておく機能とテーブルを備えておく。また、新しい領域で行うGCによってオブジェクトが新しいヒープ領域内を移動することがあるので、その移動した量をテーブルに覚えておく。そして、この更新した位置と移動した量を元に、新しいヒープ領域でのGC終了後に複製元の領域で行った更新を新しい領域に対して反映する機能を用意する。この反映処理の最中にもプログラムは実行を続けるので、このプログラムが新しい領域に存在する複製元の領域において更新されたオブジェクトを参照したことを検知する機能と検知した際にその参照を行ったスレッドのみを停止させる機能を持たせる。   In addition, after the program execution has been switched to a new area, from the start of replication of the area until the GC ends in the new area, the function that remembers the updated location of the program that was executed in parallel in the original heap area Have a table. Also, since the object may move in the new heap area due to GC performed in the new area, remember the amount of movement in the table. Then, based on the updated position and the amount moved, a function is provided to reflect the update performed in the copy source area after the end of the GC in the new heap area to the new area. Since the program continues to execute during the reflection process, the program refers to the function when it detects that the updated object is referenced in the copy source area that exists in the new area. Provide a function to stop only the thread.

本発明によれば、GCを行うヒープ領域とプログラムの実行を行うヒープ領域を分けることができる為、GCの実行中にもプログラムの実行を並列に行うことができる。これによってGCの実行中にプログラムを停止する原因が解決する為、プログラムの停止を削減することができる。   According to the present invention, since the heap area for performing GC and the heap area for executing the program can be separated, the program can be executed in parallel even during the execution of the GC. As a result, the cause of stopping the program during the execution of the GC is solved, so that the program stop can be reduced.

以下、計算機システム101上で動作する言語処理システムとしてJavaVM107を使用した場合の実施例について図面に基づいて詳細に説明する。   Hereinafter, an embodiment in which Java VM 107 is used as a language processing system operating on the computer system 101 will be described in detail with reference to the drawings.

図1は、実施形態のJavaVMの構成とその入出力データの図である。計算機システム101は、主記憶(メモリ)105に格納されるJavaVM107の実行を行う中央演算装置130は、JavaVM107がロードされ、各種領域が確保される主記憶105、ファイル等が保存される補助記憶装置102から構成され、主記憶105と中央演算装置130は、バス128によって結合されている。データ領域109はJavaVM107がデータを保持する為に確保された記憶領域であり、その中でもオブジェクトを割り当てる記憶領域がJavaヒープ領域110である。メソッド読み取り部108、メソッド実行部118は、言語処理システムを構成するプログラムである。   FIG. 1 is a diagram of the configuration of the JavaVM and its input / output data according to the embodiment. The computer system 101 executes the JavaVM 107 stored in the main memory (memory) 105, the central processing unit 130 loads the JavaVM 107, the main memory 105 in which various areas are secured, and an auxiliary storage device in which files and the like are stored The main memory 105 and the central processing unit 130 are coupled by a bus 128. The data area 109 is a storage area reserved for the Java VM 107 to hold data, and among them, the storage area to which objects are allocated is the Java heap area 110. The method reading unit 108 and the method execution unit 118 are programs constituting the language processing system.

補助記憶装置102に格納されているJavaソースファイル104は、Javaコンパイラ106により、JavaVM107で解釈・実行できる形式であるJavaバイトコードを保持するJavaクラスファイル103に変換され、これがJavaVM107に入力される。JavaVM107に入力されたJavaクラスファイル103は、メソッド読み取り部108によって解析されて、データ領域109にメソッド情報113を作成する。メソッド実行部118は、スレッド機構126からスレッドを割り当てられ、メソッド情報113を読み込むことにより、メソッド情報113に保持されている処理内容を参照ルート114からJavaヒープ領域110にあるオブジェクトを操作することによって、メソッドを実行する。   The Java source file 104 stored in the auxiliary storage device 102 is converted by the Java compiler 106 into a Java class file 103 that holds a Java bytecode in a format that can be interpreted and executed by the JavaVM 107, and this is input to the JavaVM 107. The Java class file 103 input to the Java VM 107 is analyzed by the method reading unit 108 and creates method information 113 in the data area 109. The method execution unit 118 is assigned a thread from the thread mechanism 126, reads the method information 113, and manipulates the processing content held in the method information 113 by operating an object in the Java heap area 110 from the reference route 114. Execute the method.

本実施形態の対象はメソッドを実行する際にメソッド実行部118がJavaヒープ領域110内に作成したオブジェクトを解放するGCに関するものである。GCはJavaVM107に不要となったオブジェクトを自動で判別して解放するものであるが、これはJavaヒープ管理部120の中のGC実行部121がスレッド機構126からスレッドを割り当てられ、GC実行部121がJavaヒープ領域110内部にあるオブジェクトの必要性を判断してオブジェクトを解放する。このGC実行部121による処理とメソッド実行部118による処理はどちらもスレッド機構126からスレッドを割り当てられているが、どちらもJavaヒープ領域110に対する処理の為、同時に行うことは難しく、GC実行部121が処理を行っている最中はメソッド実行部118に割り当てられた全てのスレッドを停止させる必要がある。このGC処理を行っている最中に発生する全てのスレッド停止を低減する為に本発明を考案した。   The object of this embodiment relates to a GC that releases an object created in the Java heap area 110 by the method execution unit 118 when a method is executed. The GC automatically detects and releases an object that is no longer necessary for the Java VM 107. This is because the GC execution unit 121 in the Java heap management unit 120 is assigned a thread from the thread mechanism 126, and the GC execution unit 121 Determines the necessity of the object in the Java heap area 110 and releases the object. Both the processing by the GC execution unit 121 and the processing by the method execution unit 118 are assigned threads from the thread mechanism 126, but both are processing for the Java heap area 110 and are difficult to perform at the same time. During the processing, all threads assigned to the method execution unit 118 must be stopped. The present invention has been devised to reduce all thread stops that occur during the GC process.

コンピュータを前記各処理部として機能させる為のプログラムは、CD−ROM等の記録媒体に記録され磁気ディスク等に格納された後、メモリにロードされて実行されるものとする。なお前記プログラムを記録する記録媒体はCD−ROM以外の他の記録媒体でも良い。また前記プログラムを当該記録媒体から情報処理装置にインストールして使用しても良いし、ネットワークを通じて当該記録媒体にアクセスして前記プログラムを使用するものとしても良い。   A program for causing a computer to function as each processing unit is recorded on a recording medium such as a CD-ROM and stored in a magnetic disk or the like, and then loaded into a memory and executed. The recording medium for recording the program may be a recording medium other than the CD-ROM. The program may be used by installing it from the recording medium into the information processing apparatus, or the program may be used by accessing the recording medium through a network.

図2は、本実施形態のJavaVM107においてのフローチャートである。最初にJavaヒープコピー部122のコピー部123がJavaヒープ領域110の複製を行ってJavaヒープ領域(新)112を生成し、Javaヒープコピー部122はJavaヒープ領域110をJavaヒープ領域(旧)111とする。この処理がJavaヒープ領域コピー処理201である。   FIG. 2 is a flowchart in the JavaVM 107 of this embodiment. First, the copy unit 123 of the Java heap copy unit 122 duplicates the Java heap area 110 to generate the Java heap area (new) 112, and the Java heap copy unit 122 converts the Java heap area 110 to the Java heap area (old) 111. And This process is a Java heap area copy process 201.

その処理が終了した後、GC実行部121にスレッド機構126から割り当てられたスレッドに対してスレッド制御部125は通常Javaヒープ領域(旧)111において行われるGC処理をJavaヒープ領域(新)112で行うように、GC処理の行われるJavaヒープ領域を示す記憶装置内の情報を変更する。また、GC処理においてオブジェクトの位置が移動した場合にはGC実行部121はその移動した量を移動オフセットテーブル115に記録する。この処理はJavaヒープ領域(新)GC処理202である。   After the processing is completed, the thread control unit 125 performs the GC processing normally performed in the Java heap area (old) 111 on the Java heap area (new) 112 for the thread allocated from the thread mechanism 126 to the GC execution unit 121. As is done, the information in the storage device indicating the Java heap area where the GC processing is performed is changed. Further, when the position of the object moves in the GC process, the GC execution unit 121 records the amount of movement in the movement offset table 115. This process is a Java heap area (new) GC process 202.

Javaヒープ領域コピー処理201及びJavaヒープ領域(新)GC処理202の動作中はメソッド実行部118によりプログラムの実行がJavaヒープ領域(旧)111において並列して行われている。この処理の間、更新テーブル管理部117はメソッド実行部118がJavaヒープ領域(旧)111においてデータを更新したことを更新管理テーブル116に記憶しておく。この処理は図10の更新テーブル管理処理であり、この更新管理テーブル116はこの後の処理に使用される。   During the operations of the Java heap area copy process 201 and the Java heap area (new) GC process 202, the method execution unit 118 executes the program in parallel in the Java heap area (old) 111. During this process, the update table management unit 117 stores in the update management table 116 that the method execution unit 118 has updated the data in the Java heap area (old) 111. This processing is the update table management processing of FIG. 10, and this update management table 116 is used for the subsequent processing.

次に参照管理部124はJavaヒープ領域(旧)111を指している参照ルート114を示す記憶装置内の情報をJavaヒープ領域(新)112を指すように変更して参照ルートを切り替える。この処理より前において参照ルート114はJavaヒープ領域(旧)111を指していた為、メソッド実行部118はJavaヒープ領域(旧)111に対して処理を行っていた。この参照ルート114を、Javaヒープ領域(新)112を指すように変更することによってメソッド実行部118によって動作するプログラムはJavaヒープ領域(新)112で動作するようになる。この処理は領域切り替え処理203である。   Next, the reference management unit 124 changes the information in the storage device indicating the reference route 114 pointing to the Java heap area (old) 111 to point to the Java heap area (new) 112 and switches the reference route. Prior to this processing, the reference route 114 points to the Java heap area (old) 111, so the method execution unit 118 performs processing on the Java heap area (old) 111. By changing the reference route 114 to point to the Java heap area (new) 112, the program that is operated by the method execution unit 118 operates in the Java heap area (new) 112. This process is an area switching process 203.

最後に参照管理部124はメソッド実行部118がJavaヒープ領域コピー処理201及びJavaヒープ領域(新)GC処理202の最中にJavaヒープ領域(旧)111において行ったデータの更新をJavaヒープ領域(新)112に反映する。Javaヒープ領域(旧)111において更新を行ったデータの位置は更新管理テーブル116で記録されているので、その位置と移動オフセットテーブル115から、Javaヒープ領域(旧)111にあるデータのJavaヒープ領域(新)112での位置が計算できる。この計算結果によりJavaヒープ領域(旧)111にあるデータをJavaヒープ領域(新)112に上書きする。その後、Javaヒープコピー部122はJavaヒープ領域(旧)111を解放し、Javaヒープ領域(新)112をJavaヒープ領域110とする。この処理はJavaヒープ領域(旧)更新内容反映処理204である。   Finally, the reference management unit 124 updates the data that the method execution unit 118 performed in the Java heap area (old) 111 during the Java heap area copy process 201 and the Java heap area (new) GC process 202 in the Java heap area ( New) Reflected in 112. Since the position of the data updated in the Java heap area (old) 111 is recorded in the update management table 116, the Java heap area of the data in the Java heap area (old) 111 is determined from the position and the movement offset table 115. (New) The position at 112 can be calculated. Based on this calculation result, the data in the Java heap area (old) 111 is overwritten in the Java heap area (new) 112. Thereafter, the Java heap copy unit 122 releases the Java heap area (old) 111 and sets the Java heap area (new) 112 as the Java heap area 110. This processing is Java heap area (old) update content reflection processing 204.

領域切り替え処理203及びJavaヒープ領域(旧)更新内容反映処理204の動作中はメソッド実行部118によりプログラムの実行がJavaヒープ領域(新)112において並列して行われている。領域切り替え処理203が終了する前は参照ルート114がJavaヒープ領域(旧)111を参照しているのでメソッド実行部118はJavaヒープ領域(旧)111の上で動作を行おうとする。そこで例外処理部119がJavaヒープ領域(旧)111の上でメソッド実行部118が動作しようとしたことを検知して参照ルート114がJavaヒープ領域(新)112を指すように変更する。Javaヒープ領域(旧)更新内容反映処理204が終了する前はメソッド実行部118がJavaヒープ領域(旧)111の更新済みのデータに対応するJavaヒープ領域(新)112のデータに対して参照を行ってしまうと、既にJavaヒープ領域(旧)111で行った更新内容が正しく扱われなくなる。そこで例外処理部119は、Javaヒープ領域(旧)111の更新済みのデータに対応するJavaヒープ領域(新)112のデータに対してメソッド実行部118が参照しようとしたことを検知して、その参照を行ったメソッド実行部118にスレッド機構126から割り当てられているスレッドのみを停止させる。この停止することとなったスレッドはJavaヒープ領域(旧)更新内容反映処理204の最後において再開される。この処理は図11の参照例外処理である。   During operation of the area switching process 203 and the Java heap area (old) update content reflection process 204, the method execution unit 118 executes the program in parallel in the Java heap area (new) 112. Before the area switching process 203 ends, the reference execution route 114 refers to the Java heap area (old) 111, so that the method execution unit 118 tries to operate on the Java heap area (old) 111. Therefore, the exception processing unit 119 detects that the method execution unit 118 is about to operate on the Java heap area (old) 111 and changes the reference route 114 to point to the Java heap area (new) 112. Before the Java heap area (old) update content reflection processing 204 is finished, the method execution unit 118 references the data in the Java heap area (new) 112 corresponding to the updated data in the Java heap area (old) 111. If you do, update contents already done in Java heap area (old) 111 will not be handled correctly. Therefore, the exception processing unit 119 detects that the method execution unit 118 tries to refer to the data in the Java heap area (new) 112 corresponding to the updated data in the Java heap area (old) 111, and Only the thread assigned from the thread mechanism 126 to the method execution unit 118 that has made the reference is stopped. The thread to be stopped is resumed at the end of the Java heap area (old) update content reflection process 204. This process is the reference exception process of FIG.

以上の処理によって、本実施形態において、実施前ではGC処理が行われていなかったJavaヒープ領域110がメソッド実行部118によってプログラムを実行しながらもGC処理を行うことができ、実施後にはJavaヒープ領域110がプログラムの並列動作にもかかわらず正常にGC処理を行われている状態を実現することができる。   With the above processing, in this embodiment, the Java heap area 110 that has not been subjected to GC processing before the execution can perform the GC processing while executing the program by the method execution unit 118. It is possible to realize a state in which the area 110 is normally performing GC processing despite the parallel operation of the program.

図3は、実施形態の各々の処理がどのタイミングで行われるかを示す図である。上記で述べたように図10の更新テーブル管理処理はJavaヒープ領域コピー処理201及びJavaヒープ領域(新)GC処理202と並列に実行されており、また図11の参照例外処理は領域切り替え処理203及びJavaヒープ領域(旧)更新内容反映処理204と並列に実行される。この為、図10の更新テーブル管理処理と図11の参照例外処理は同時に実行されることがない。   FIG. 3 is a diagram illustrating at which timing each process of the embodiment is performed. As described above, the update table management process of FIG. 10 is executed in parallel with the Java heap area copy process 201 and the Java heap area (new) GC process 202, and the reference exception process of FIG. And the Java heap area (old) update content reflection processing 204 are executed in parallel. For this reason, the update table management process of FIG. 10 and the reference exception process of FIG. 11 are not executed simultaneously.

図4は、更新管理テーブル116を示す図である。Javaヒープ領域コピー処理201及びJavaヒープ領域(新)GC処理202の動作中に、メソッド実行部118がプログラムを実行することでJavaヒープ領域(旧)111に存在するオブジェクトを更新した際に更新管理テーブル116の値を変更する。このテーブルの持つ値はオブジェクトの更新が行われたかどうかのみを記録するだけでよいので1ビットで表現できる。また、Javaヒープ領域(旧)111に存在する全てのオブジェクトに対して管理することが求められるが、それを行うとテーブルのサイズが大きくなってしまう。その為、Javaヒープ領域(旧)111を論理的に分割し、それぞれについて管理する。従って、更新されたオブジェクト401がその分割された領域の中に1つ以上あった時のみテーブルの値を1に変更すればよく、更新されていないオブジェクト402しかない場合は、テーブルの値を0のままにしておけばよい。   FIG. 4 is a diagram showing the update management table 116. Update management when the method execution unit 118 updates the object existing in the Java heap area (old) 111 by executing the program during the operation of the Java heap area copy process 201 and the Java heap area (new) GC process 202 Change the value in table 116. The value of this table can be expressed by 1 bit because it is only necessary to record whether or not the object has been updated. In addition, it is required to manage all objects existing in the Java heap area (old) 111, but if this is done, the size of the table will increase. Therefore, the Java heap area (old) 111 is logically divided and managed for each. Therefore, it is only necessary to change the value of the table to 1 when there are one or more updated objects 401 in the divided area. When there is only an object 402 that has not been updated, the value of the table is set to 0. Just leave it.

図5は、移動オフセットテーブル115を示す図である。移動オフセットテーブル115はJavaヒープ領域(新)GC処理202の最中にGC実行部121が行うGC処理において、GC処理で消滅するオブジェクト501以外のオブジェクトがGC処理によって何アドレス分移動したかを記録するテーブルである。GCによってオブジェクトがどのように移動するかは不定であり、Javaヒープ領域(旧)111にあったオブジェクトがJavaヒープ領域(新)112のどの位置に存在するかを計算する為に必要である。全てのオブジェクトに対して記録する必要はなく、GC処理で消滅するオブジェクト501以外のオブジェクトについてのみを記録すればよく、また隣り合っているオブジェクトのような、GC処理による移動量が同じオブジェクトについてはまとめて1つのデータとして記録すればよい。   FIG. 5 is a diagram showing the movement offset table 115. The move offset table 115 records how many addresses other than the object 501 that disappears in the GC process are moved by the GC process in the GC process performed by the GC execution unit 121 during the Java heap area (new) GC process 202 It is a table to do. It is undefined how the object moves due to the GC, and it is necessary for calculating where in the Java heap area (new) 112 the object that was in the Java heap area (old) 111 exists. It is not necessary to record for all objects, it is only necessary to record objects other than the object 501 that disappears by GC processing, and for objects that have the same movement amount by GC processing, such as neighboring objects What is necessary is just to record collectively as one data.

図6は、Javaヒープ領域コピー処理201を表したフローチャートである。Javaヒープコピー部122は現在メソッド実行部118によってプログラムが動いているJavaヒープ領域110をJavaヒープ領域(旧)111とする(ステップ601)。この後にコピー部123によりJavaヒープ領域(旧)111のデータをコピーすることによってJavaヒープ領域(新)112を生成する。   FIG. 6 is a flowchart showing the Java heap area copy process 201. The Java heap copy unit 122 sets the Java heap area 110 where the program is currently running by the method execution unit 118 as the Java heap area (old) 111 (step 601). Thereafter, the data in the Java heap area (old) 111 is copied by the copy unit 123, thereby generating the Java heap area (new) 112.

Javaヒープ領域(旧)111にあるデータはオブジェクトであり、実際にはJavaヒープ領域(旧)111にある全てのオブジェクトをコピーすることになる。その為、Javaヒープ領域(旧)111の先頭から順にコピーを行っていくので、まずはコピー部123が全てのデータをコピーしたかを判定する(ステップ602)。全てのデータのコピーが終わっていない場合は、データをコピーする必要がある。   The data in the Java heap area (old) 111 is an object, and all objects in the Java heap area (old) 111 are actually copied. Therefore, since copying is performed in order from the top of the Java heap area (old) 111, it is first determined whether the copy unit 123 has copied all the data (step 602). If all the data has not been copied, it is necessary to copy the data.

ここでコピーするデータについてだが、参照データについてはそのままデータをコピーしてはいけない。図7に参照データ及び参照データをそのままコピーしてはいけない理由を示す。ここでオブジェクトA701が持つデータとしてオブジェクトB702を導き出す為のメモリのアドレス703と数値704があるとする。このオブジェクトA701からオブジェクトB702のメモリのアドレス703へのポインタ705が参照データであるが、この値をそのままコピーしてJavaヒープ領域(新)にオブジェクトA701を生成してしまうと、メモリのアドレス703の数値はそのままである為、Javaヒープ領域(旧)111にあるオブジェクトB702へのポインタ707となってしまう。この為、Javaヒープ領域(旧)111とJavaヒープ領域(新)112のアドレスの差分706をメモリのアドレス703に足しこむことによりJavaヒープ領域(新)112にあるオブジェクトB702へのポインタ708にする。   As for the data to be copied here, the reference data should not be copied as it is. FIG. 7 shows the reason why the reference data and the reference data should not be copied as they are. Here, it is assumed that there is a memory address 703 and a numerical value 704 for deriving the object B702 as data held by the object A701. The pointer 705 from the object A701 to the memory address 703 of the object B702 is reference data. If this value is copied as it is and the object A701 is generated in the Java heap area (new), the address 703 of the memory is stored. Since the numerical value remains as it is, it becomes a pointer 707 to the object B702 in the Java heap area (old) 111. Therefore, by adding the address difference 706 between the Java heap area (old) 111 and the Java heap area (new) 112 to the memory address 703, the pointer 708 to the object B702 in the Java heap area (new) 112 is obtained. .

以上の理由により、コピーする値が参照であるか、参照でないかを判定する必要がある(ステップ603)。参照でない場合はそのままの値をJavaヒープ領域(新)112にコピーする(ステップ604)。参照の場合はコピーする値をJavaヒープ領域(旧)111とJavaヒープ領域(新)112のアドレスの差分だけ増加させてコピーを行う(ステップ605)。これによって参照の値もJavaヒープ領域(新)112を指すようになる。全てのJavaヒープ領域(旧)のデータに対して処理を行ったらJavaヒープ領域コピー処理201を終了する(ステップ602)。   For these reasons, it is necessary to determine whether the value to be copied is a reference or not (step 603). If it is not a reference, the value as it is is copied to the Java heap area (new) 112 (step 604). In the case of reference, copying is performed by increasing the value to be copied by the difference between the addresses of the Java heap area (old) 111 and the Java heap area (new) 112 (step 605). As a result, the reference value also points to the Java heap area (new) 112. When processing has been performed on all the data in the Java heap area (old), the Java heap area copy process 201 is terminated (step 602).

図8は、Javaヒープ領域(新)GC処理202を表したフローチャートである。本来、GC実行部121はスレッド機構126からスレッドを割り当てられJavaヒープ領域110においてGC処理を行う。実際にはJavaヒープ領域110はJavaヒープ領域(旧)111である。ここでスレッド制御部125は、スレッド機構126がGC実行部121に割り当てたスレッドに対してGC処理をJavaヒープ領域(新)112でGC処理を行うように切り替える(ステップ801)。これによってGC実行部121はGC処理をJavaヒープ領域(新)112において行うようになる(ステップ802)。図5で述べたように、GC処理によって移動したオブジェクトは移動オフセットテーブル115に記録しなければならない(ステップ803)。   FIG. 8 is a flowchart showing the Java heap area (new) GC process 202. Originally, the GC execution unit 121 is assigned a thread from the thread mechanism 126 and performs GC processing in the Java heap area 110. Actually, the Java heap area 110 is a Java heap area (old) 111. Here, the thread control unit 125 switches the GC process to be performed in the Java heap area (new) 112 for the thread assigned by the thread mechanism 126 to the GC execution unit 121 (step 801). As a result, the GC execution unit 121 performs GC processing in the Java heap area (new) 112 (step 802). As described in FIG. 5, the object moved by the GC process must be recorded in the movement offset table 115 (step 803).

図9は、領域切り替え処理203を表したフローチャートである。ここでは、参照ルート114がJavaヒープ領域(旧)111を指しているのをJavaヒープ領域(新)112を指すようにする。ここで問題となるのはこの処理と並列にメソッド実行部118によりプログラムが実行されていることである。その為、メソッド実行部118がJavaヒープ領域(旧)111で行った更新をJavaヒープ領域(新)112に反映する前にそのオブジェクトをメソッド実行部118が参照した場合に結果が不正となってしまう。メソッド実行部118が不正な実行を行おうとしたことを検知する方法を図10において説明する。更新管理テーブル116によりJavaヒープ領域(旧)111において更新されたオブジェクト401の位置がわかる。まずはこの更新されたオブジェクト401がJavaヒープ領域(新)112においてどの位置に存在するかを計算する。それは更新されたオブジェクト401のJavaヒープ領域(旧)111の位置、Javaヒープ領域(旧)111とJavaヒープ領域(新)112のアドレスの差分706、更新されたオブジェクト401に対応する移動オフセットテーブル115の値1001の和が更新されたオブジェクト401のJavaヒープ領域(新)112における位置である。このオブジェクトに対してメソッド実行部118がデータを参照した際に例外が発生するようにこの領域をガード領域1002とする。以上のことを実現する為に次の処理を行う。   FIG. 9 is a flowchart showing the area switching process 203. Here, the reference route 114 points to the Java heap area (old) 111 so as to point to the Java heap area (new) 112. The problem here is that the program is executed by the method execution unit 118 in parallel with this processing. Therefore, if the method execution unit 118 references the object before the method execution unit 118 updates the Java heap area (old) 111 to the Java heap area (new) 112, the result becomes invalid. End up. A method of detecting that the method execution unit 118 has attempted to perform illegal execution will be described with reference to FIG. The update management table 116 shows the position of the object 401 updated in the Java heap area (old) 111. First, the position where the updated object 401 exists in the Java heap area (new) 112 is calculated. It is the position of the Java heap area (old) 111 of the updated object 401, the difference 706 between the addresses of the Java heap area (old) 111 and the Java heap area (new) 112, and the movement offset table 115 corresponding to the updated object 401 Is the position of the updated object 401 in the Java heap area (new) 112. This area is set as a guard area 1002 so that an exception occurs when the method execution unit 118 refers to data for this object. In order to realize the above, the following processing is performed.

最初に全ての更新管理テーブル116に対して処理を行ったかを判定する(ステップ901)。完了していない場合は、更新管理テーブル116にある更新されたオブジェクト401に対して以下の処理を行っていく。まずは更新されたオブジェクト401が移動オフセットテーブル115に登録されているかを判定する(ステップ902)。これを行う理由としてはJavaヒープ領域コピー処理201より後でJavaヒープ領域(旧)111生成されたオブジェクト1101を判定する必要があるからである。   First, it is determined whether or not all the update management tables 116 have been processed (step 901). If not completed, the following processing is performed on the updated object 401 in the update management table 116. First, it is determined whether or not the updated object 401 is registered in the movement offset table 115 (step 902). The reason for doing this is that it is necessary to determine the object 1101 generated in the Java heap area (old) 111 after the Java heap area copy processing 201.

図11にJavaヒープ領域コピー処理201より後でJavaヒープ領域(旧)111に生成されたオブジェクト1101が存在する状態を示す。移動オフセットテーブル115に登録されていないオブジェクトはGC処理で消滅するオブジェクト501であるかJavaヒープ領域コピー処理201より後でJavaヒープ領域(旧)111に生成されたオブジェクト1101である。また、GC処理で消滅するオブジェクト501はどこからも参照されていないオブジェクトであり更新することができない。よって、更新管理テーブル116に登録されているオブジェクトかつ移動オフセットテーブル115に登録されていないオブジェクトはJavaヒープ領域コピー処理201より後で生成されたオブジェクトと判定することができる。   FIG. 11 shows a state where an object 1101 generated in the Java heap area (old) 111 after the Java heap area copy process 201 exists. An object that is not registered in the movement offset table 115 is an object 501 that disappears in the GC process or an object 1101 that is generated in the Java heap area (old) 111 after the Java heap area copy process 201. Also, the object 501 that disappears in the GC process is an object that is not referenced from anywhere and cannot be updated. Therefore, an object registered in the update management table 116 and an object not registered in the movement offset table 115 can be determined as an object generated after the Java heap area copy process 201.

このJavaヒープ領域コピー処理201より後で生成されたオブジェクトがJavaヒープ領域(新)112に存在しないままでは後のJavaヒープ領域(旧)更新内容反映処理204において不都合が生じる為、ここでJavaヒープ領域コピー処理201より後でJavaヒープ領域(旧)111に生成されたオブジェクト1101の場合は、情報を持たないダミーオブジェクト1102をJavaヒープ領域(新)112に生成する(ステップ903)。そして、このダミーオブジェクト1102を移動オフセットテーブル115に登録する(ステップ904)。ダミーオブジェクト1102が持つデータは特に定める必要はなく不定な値1103でよく、ダミーオブジェクト1102はJavaヒープ領域コピー処理201より後でJavaヒープ領域(旧)111に生成されたオブジェクト1101と同じサイズを持っていればよい。   If an object generated after the Java heap area copy processing 201 does not exist in the Java heap area (new) 112, there will be inconvenience in the subsequent Java heap area (old) update content reflection processing 204. In the case of an object 1101 generated in the Java heap area (old) 111 after the area copy processing 201, a dummy object 1102 having no information is generated in the Java heap area (new) 112 (step 903). Then, this dummy object 1102 is registered in the movement offset table 115 (step 904). The data held by the dummy object 1102 need not be defined in particular and may be an indefinite value 1103. The dummy object 1102 has the same size as the object 1101 generated in the Java heap area (old) 111 after the Java heap area copy processing 201. It only has to be.

ステップ904が終了後またはステップ902によって更新されたオブジェクト401が移動オフセットテーブル115に登録されていると判定された場合は、ダミーオブジェクト1102または更新されたオブジェクト401に対応するJavaヒープ領域(新)112にあるオブジェクトをガード領域とする(ステップ905)。   After step 904 is completed or when it is determined that the object 401 updated in step 902 is registered in the movement offset table 115, the Java heap area (new) 112 corresponding to the dummy object 1102 or the updated object 401 is displayed. The object located at is a guard area (step 905).

上記の処理が終了した後、Javaヒープ領域(旧)111を指している参照ルート114をJavaヒープ領域(新)112を指すように変更する。それにはまずJavaヒープ領域(旧)111全体をガード領域とする(ステップ906)。これはメソッド実行部118によって領域切り替え処理203と並列に実行されているプログラムよってJavaヒープ領域(新)112に切り替える前にJavaヒープ領域(旧)111を参照された場合を検知する為である。   After the above processing is completed, the reference route 114 pointing to the Java heap area (old) 111 is changed to point to the Java heap area (new) 112. First, the entire Java heap area (old) 111 is set as a guard area (step 906). This is to detect a case in which the Java heap area (old) 111 is referred to before switching to the Java heap area (new) 112 by a program executed in parallel with the area switching processing 203 by the method execution unit 118.

また、この処理の後に全ての参照ルート114をガード領域とする(ステップ907)。これは参照ルート114を切り替えている途中で、一度Javaヒープ領域(新)112に切り替えた参照ルート114をJavaヒープ領域(旧)111を指すように他のJavaヒープ領域(旧)111を指している参照ルート114で上書きされないためである。図12にステップ906及びステップ907を行った後の参照ルート114、Javaヒープ領域(旧)111及びJavaヒープ領域(新)112の状態を示す。   After this processing, all reference routes 114 are set as guard areas (step 907). In the middle of switching the reference route 114, point to another Java heap area (old) 111 so that the reference route 114 once switched to the Java heap area (new) 112 points to the Java heap area (old) 111 This is because the reference route 114 is not overwritten. FIG. 12 shows the state of the reference route 114, the Java heap area (old) 111, and the Java heap area (new) 112 after performing Step 906 and Step 907.

ステップ906及びステップ907が終わった後、全ての参照ルート114に対して切り替え処理を行う。全ての参照ルート114がJavaヒープ領域(新)112を指している場合は処理が終了しており、指していない場合は処理がまだ終了していない(ステップ908)。処理が終了していない場合はそれぞれの参照ルート114に対して参照ルート114のガード領域を解除して参照ルート114をJavaヒープ領域(旧)111からJavaヒープ領域(新)112を指すように変更する(ステップ909)。このJavaヒープ領域(旧)111を指している参照をJavaヒープ領域(新)112を指すように変更する為には、Javaヒープ領域(新)112での位置を計算しなければならない。この計算はJavaヒープ領域(新)112の更新されたオブジェクト401をガード領域とした時の計算と同じ計算方法で行うことができる。全ての参照ルート114をJavaヒープ領域(新)112を指すように変更した後、Javaヒープ領域(旧)111全体にかけたガード領域を解除する(ステップ910)。これら一連の処理で領域切り替え処理203を行う。   After step 906 and step 907 are completed, switching processing is performed for all reference routes 114. If all the reference routes 114 point to the Java heap area (new) 112, the processing has ended. If not, the processing has not yet ended (step 908). If processing is not completed, release the guard area of the reference route 114 for each reference route 114 and change the reference route 114 from the Java heap area (old) 111 to the Java heap area (new) 112 (Step 909). In order to change the reference pointing to the Java heap area (old) 111 to point to the Java heap area (new) 112, the position in the Java heap area (new) 112 must be calculated. This calculation can be performed by the same calculation method as that used when the updated object 401 in the Java heap area (new) 112 is used as a guard area. After changing all the reference routes 114 to point to the Java heap area (new) 112, the guard area applied to the entire Java heap area (old) 111 is released (step 910). The area switching process 203 is performed by a series of these processes.

図13は、Javaヒープ領域(旧)更新内容反映処理204を表したフローチャートである。Javaヒープ領域(旧)更新内容反映処理204は更新管理テーブル116に登録されている全ての更新内容を反映する必要があるので、まずは全ての更新内容が反映されているかを判定する(ステップ1301)。全ての更新内容が反映されていない場合は、未反映のJavaヒープ領域(新)112にあるオブジェクトにかかっているガード領域を解除する(ステップ1302)。   FIG. 13 is a flowchart showing the Java heap area (old) update content reflection process 204. Since the Java heap area (old) update content reflection processing 204 needs to reflect all the update contents registered in the update management table 116, first, it is determined whether all the update contents are reflected (step 1301). . If all the updated contents are not reflected, the guard area applied to the object in the unreflected Java heap area (new) 112 is released (step 1302).

そして、そのJavaヒープ領域(新)112にあるオブジェクトに対してJavaヒープ領域(旧)にあるデータと同じ内容にする必要があるが、Javaヒープ領域コピー処理201の時と同じように、参照の値だけはそのままの値を上書きするとJavaヒープ領域(旧)111を指してしまう。この為、更新されたオブジェクト401のデータの値が参照かどうかを判定する(ステップ1303)。参照でない場合はそのままの値をJavaヒープ領域(新)112に上書きする(ステップ1304)。参照の場合は領域切り替え処理203のステップ909と同じ方法で参照をJavaヒープ領域(旧)111からJavaヒープ領域(新)112を指すように変更する(ステップ1305)。   Then, the object in the Java heap area (new) 112 needs to have the same contents as the data in the Java heap area (old), but as with the Java heap area copy process 201, the reference If only the value is overwritten, the Java heap area (old) 111 will be pointed to. Therefore, it is determined whether or not the data value of the updated object 401 is a reference (step 1303). If it is not a reference, the value as it is is overwritten in the Java heap area (new) 112 (step 1304). In the case of reference, the reference is changed from the Java heap area (old) 111 to the Java heap area (new) 112 by the same method as in step 909 of the area switching process 203 (step 1305).

全ての更新反映処理が終了した後、Javaヒープコピー部120はJavaヒープ領域(新)112をJavaヒープ領域110として扱うように変更する(ステップ1306)。その後、不要となったJavaヒープ領域(旧)111を解放する(ステップ1307)。最後に、後述する例外処理部119によって停止されていたスレッドを全て再開させることによってメソッド実行部118によるプログラムの実行を通常の状態に戻す(ステップ1308)。   After all the update reflection processes are completed, the Java heap copy unit 120 changes the Java heap area (new) 112 to be handled as the Java heap area 110 (step 1306). Thereafter, the Java heap area (old) 111 that is no longer needed is released (step 1307). Finally, the execution of the program by the method execution unit 118 is returned to the normal state by resuming all threads that have been stopped by the exception processing unit 119 described later (step 1308).

以上のJavaヒープ領域コピー処理201、Javaヒープ領域(新)GC処理202、領域切り替え処理203、Javaヒープ領域(旧)更新内容反映処理204によって、メソッド実行部118にプログラムの実行を処理させると同時に並列にGC処理を行うことができる。しかし、まだ更新管理テーブル116を更新する更新テーブル管理部117の処理とメソッド実行部118がプログラムを実行する際に参照したら不正となる領域を参照した場合に行う処理について述べていない。それらについては以下で述べる。   At the same time as causing the method execution unit 118 to execute the program execution by the Java heap area copy process 201, the Java heap area (new) GC process 202, the area switching process 203, and the Java heap area (old) update content reflection process 204. GC processing can be performed in parallel. However, the processing of the update table management unit 117 that updates the update management table 116 and the processing that is performed when the method execution unit 118 refers to an area that becomes invalid if it is referred to when executing the program are not described. These are described below.

図14は、更新テーブル管理処理を表したフローチャートである。図2で述べたようにメソッド実行部118がJavaヒープ領域(旧)111で行った更新はJavaヒープ領域コピー処理201及びJavaヒープ領域(新)GC処理202の最中に記録するだけでよい。この為、更新テーブル管理部117は現在がJavaヒープ領域コピー処理201及びJavaヒープ領域(新)GC処理202の最中であるかを判定する(ステップ1401)。Javaヒープ領域コピー処理201及びJavaヒープ領域(新)GC処理202の最中でない場合は更新テーブル管理部117の処理は終了する。Javaヒープ領域コピー処理201及びJavaヒープ領域(新)GC処理202の最中である場合は、メソッド実行部118がJavaヒープ領域(旧)111に対して更新処理を行ったかを判定する(ステップ1402)。Javaヒープ領域(旧)111に対して更新処理を行った場合はJavaヒープ領域(旧)111にあるオブジェクトの位置に対応した更新管理テーブル116のビットを操作して更新したことを記録する(ステップ1403)。   FIG. 14 is a flowchart showing the update table management process. As described in FIG. 2, the update performed by the method execution unit 118 in the Java heap area (old) 111 only needs to be recorded during the Java heap area copy process 201 and the Java heap area (new) GC process 202. Therefore, the update table management unit 117 determines whether the Java heap area copy process 201 and the Java heap area (new) GC process 202 are currently in progress (step 1401). If the Java heap area copy process 201 and the Java heap area (new) GC process 202 are not in the middle of processing, the process of the update table management unit 117 ends. When the Java heap area copy process 201 and the Java heap area (new) GC process 202 are in the middle, the method execution unit 118 determines whether the Java heap area (old) 111 has been updated (step 1402). ). When update processing is performed for the Java heap area (old) 111, record that the update is performed by manipulating the bit of the update management table 116 corresponding to the position of the object in the Java heap area (old) 111 (step) 1403).

図15は、参照例外処理を表したフローチャートである。例外処理部119はメソッド実行部118がプログラムの実行中に発生させた例外を補足して以下の処理を実行する。例外が発生するのは領域切り替え処理203において参照ルート114、Javaヒープ領域(旧)111、Javaヒープ領域(新)112に対してかけたガード領域に対してメソッド実行部118が参照を行った場合である。   FIG. 15 is a flowchart showing the reference exception process. The exception processing unit 119 supplements the exception generated by the method execution unit 118 during the execution of the program and executes the following processing. An exception occurs when the method execution unit 118 references a guard area that has been applied to the reference route 114, Java heap area (old) 111, and Java heap area (new) 112 in the area switching process 203. It is.

メソッド実行部118によるプログラムの実行中に例外が発生した際にはその例外がどの領域を参照したことによって発生したかを判定する(ステップ1501)。例外が発生した領域が参照ルート114であった場合は、その参照ルート114は領域切り替え処理203による参照ルート114のJavaヒープ領域(新)112への切り替えが終わっていないので、まずは参照ルート114のガード領域を解除し(ステップ1502)、参照ルート114の指す先をJavaヒープ領域(旧)111からJavaヒープ領域(新)112に切り替える(ステップ1503)。   When an exception occurs during the execution of the program by the method execution unit 118, it is determined which area the exception has occurred by referring to (step 1501). If the area where the exception occurred is the reference route 114, the reference route 114 has not yet been switched to the Java heap area (new) 112 of the reference route 114 by the area switching processing 203. The guard area is released (step 1502), and the destination indicated by the reference route 114 is switched from the Java heap area (old) 111 to the Java heap area (new) 112 (step 1503).

また例外が補足された領域がJavaヒープ領域(旧)111である場合は、参照ルート114がJavaヒープ領域(旧)111を指しているままなのでJavaヒープ領域(新)112を指すように変更する(ステップ1503)。また、例外が発生した領域がJavaヒープ領域(新)112である場合は、Javaヒープ領域(旧)更新内容反映処理204によるJavaヒープ領域(旧)111で更新した内容が反映される前なので、例外を発生させたメソッド実行部118にスレッド機構126から割り当てされたスレッドのみをスレッド制御部125が停止させる(ステップ1504)。この停止したスレッドはJavaヒープ領域(旧)更新内容反映処理204のステップ1308で再開される。   If the area supplemented with the exception is the Java heap area (old) 111, the reference route 114 remains pointing to the Java heap area (old) 111, so change it to point to the Java heap area (new) 112. (Step 1503). Also, if the area where the exception occurred is the Java heap area (new) 112, it is before the contents updated in the Java heap area (old) 111 by the Java heap area (old) update contents reflection process 204 are reflected, Only the thread assigned from the thread mechanism 126 to the method execution unit 118 that generated the exception is stopped by the thread control unit 125 (step 1504). The stopped thread is resumed in step 1308 of the Java heap area (old) update content reflection process 204.

以上説明した通り、本実施形態により、プログラムの実行と並列にGC処理を行うことができ、そのGC処理を起こっている最中にプログラムの実行によって更新されたJavaヒープ領域のデータの内容をGC処理が終了した先へ反映することが可能となる。   As described above, according to this embodiment, the GC process can be performed in parallel with the execution of the program, and the contents of the data in the Java heap area updated by the execution of the program during the GC process are displayed in the GC. It is possible to reflect the result at the end of processing.

本実施形態のJavaVMが動作する計算機システムの構成及び入出力データを示す構成図である。It is a block diagram which shows the structure and input / output data of a computer system with which JavaVM of this embodiment operates. 本実施形態のJavaVMにおいて、全スレッドの停止を削減する方法を示すフローチャートである。It is a flowchart which shows the method of reducing the stop of all the threads in JavaVM of this embodiment. 本実施形態のJavaVMにおいて、それぞれの処理が行われるタイミングを示すタイミング図である。FIG. 5 is a timing diagram showing timings at which each process is performed in the Java VM of the present embodiment. 本実施形態のJavaVMにおいて、更新管理テーブルのデータ構造を示す図である。It is a figure which shows the data structure of an update management table in JavaVM of this embodiment. 本実施形態のJavaVMにおいて、移動オフセットテーブルのデータ構造を示す図である。It is a figure which shows the data structure of a movement offset table in JavaVM of this embodiment. 本実施形態のJavaVMにおいて、Javaヒープ領域をコピーする手順を示すフローチャートである。It is a flowchart which shows the procedure which copies a Java heap area in JavaVM of this embodiment. 本実施形態のJavaVMにおいて、参照データ及びオブジェクトのデータのコピーを示す図である。It is a figure which shows the copy of the reference data and the data of an object in JavaVM of this embodiment. 本実施形態のJavaVMにおいて、コピーしたJavaヒープ領域に対してGC処理を行う手順を示すフローチャートである。It is a flowchart which shows the procedure which performs GC processing with respect to the copied Java heap area in JavaVM of this embodiment. 本実施形態のJavaVMにおいて、コピー前のJavaヒープ領域を参照している参照ルートをコピー先のJavaヒープ領域に切り替える手順を示すフローチャートである。6 is a flowchart illustrating a procedure for switching a reference route that refers to a Java heap area before copying to a Java heap area that is a copy destination in the JavaVM of the present embodiment. 本実施形態のJavaVMにおいて、Javaヒープ領域(新)にある更新されたオブジェクトに対する不正参照を検知する為のガード領域を示す図である。It is a figure which shows the guard area | region for detecting the unauthorized reference with respect to the updated object in Java heap area | region (new) in JavaVM of this embodiment. 本実施形態のJavaVMにおいて、Javaヒープ領域コピー処理より後でJavaヒープ領域(旧)に生成されたオブジェクトへ対応するJavaヒープ領域(新)に生成するダミーオブジェクトを示す図である。In JavaVM of this embodiment, it is a figure which shows the dummy object produced | generated to the Java heap area (new) corresponding to the object produced | generated to the Java heap area (old) after the Java heap area copy process. 本実施形態のJavaVMにおいて、参照ルートの指し先をJavaヒープ領域(新)へ変更する前に参照ルートを使用したことを検知する為のガード領域を示す図である。In JavaVM of this embodiment, it is a figure which shows the guard area | region for detecting that the reference route was used before changing the pointing destination of a reference route to a Java heap area | region (new). 本実施形態のJavaVMにおいて、プログラムの実行をコピー先のJavaヒープ領域に切り替える前に、プログラムの実行によりコピー前のJavaヒープ領域で行った更新内容をコピー先のJavaヒープ領域に反映する手順を示すフローチャートである。In JavaVM of this embodiment, before switching the program execution to the copy-destination Java heap area, show the procedure for reflecting the update contents made in the Java heap area before the copy by executing the program to the copy-destination Java heap area It is a flowchart. 本実施形態のJavaVMにおいて、プログラムの実行をコピー先のJavaヒープ領域に切り替える前に、プログラムの実行によりコピー前のJavaヒープ領域で更新を行ったことを記録する手順を示すフローチャートである。In the JavaVM of this embodiment, before switching the program execution to the copy destination Java heap area, it is a flowchart showing a procedure for recording that the update is performed in the Java heap area before copying by executing the program. 本実施形態のJavaVMにおいて、プログラムの実行によってJavaヒープ領域が不正になる状態を検知した際に、不正になるのを防止する手順を示すフローチャートである。6 is a flowchart illustrating a procedure for preventing an illegality when a Java heap area becomes invalid due to execution of a program in the JavaVM of the present embodiment.

符号の説明Explanation of symbols

101…計算機システム、102…補助記憶装置、103…Javaクラスファイル、104…Javaソースファイル、105…主記憶、106…Javaコンパイラ、107…JavaVM、108…メソッド読み取り部、109…データ領域、110…Javaヒープ領域、111…Javaヒープ領域(旧)、112…Javaヒープ領域(新)、113…メソッド情報、114…参照ルート、115…移動オフセットテーブル、116…更新管理テーブル、117…更新テーブル管理部、118…メソッド実行部、119…例外処理部、120…Javaヒープ管理部、121…GC実行部、122…Javaヒープコピー部、123…コピー部、124…参照管理部、125…スレッド制御部、126…スレッド機構、127…オペレーティングシステム、128…バス、129…出力装置、130…中央演算装置、131…入力装置   DESCRIPTION OF SYMBOLS 101 ... Computer system, 102 ... Auxiliary storage device, 103 ... Java class file, 104 ... Java source file, 105 ... Main memory, 106 ... Java compiler, 107 ... JavaVM, 108 ... Method reading part, 109 ... Data area, 110 ... Java heap area, 111 ... Java heap area (old), 112 ... Java heap area (new), 113 ... method information, 114 ... reference route, 115 ... moving offset table, 116 ... update management table, 117 ... update table management unit 118 ... Method execution unit, 119 ... Exception processing unit, 120 ... Java heap management unit, 121 ... GC execution unit, 122 ... Java heap copy unit, 123 ... Copy unit, 124 ... Reference management unit, 125 ... Thread control unit, 126 ... Thread mechanism, 127 ... Operating system, 128 ... Bus, 129 ... Output device, 130 ... Central processing unit, 131 ... Input device

Claims (5)

記憶装置に格納されているオブジェクトのガーベージコレクションを行う計算機システムにおけるガーベージコレクション方法において、
前記計算機システムがプログラムによって参照または更新可能なオブジェクトを格納した記憶装置内の第1のヒープ領域の内容を前記記憶装置内の第2のヒープ領域に格納し、前記計算機システムがガーベージコレクションの行われるヒープ領域を示す記憶装置内の情報を前記第1のヒープ領域を示す内容から前記第2のヒープ領域を示す内容へ変更し、前記計算機システムが前記第2のヒープ領域でガーベージコレクションを実行すると共に前記第2のヒープ領域でのガーベージコレクションの実行中も継続して前記プログラムを実行し、前記第2のヒープ領域でのガーベージコレクションの実行後、前記計算機システムが前記プログラムによってオブジェクトを参照する際の参照ルートを示す記憶装置内の情報を前記第1のヒープ領域から前記第2のヒープ領域を指す内容に変更することを特徴とするガーベージコレクション方法。
In a garbage collection method in a computer system that performs garbage collection of an object stored in a storage device,
The contents of the first heap area in the storage device in which the computer system stores objects that can be referenced or updated by a program are stored in the second heap area in the storage device, and the computer system is garbage collected. The information in the storage device indicating the heap area is changed from the contents indicating the first heap area to the contents indicating the second heap area, and the computer system executes garbage collection in the second heap area. The program is continuously executed during execution of garbage collection in the second heap area. After execution of garbage collection in the second heap area, the computer system refers to an object by the program. Whether the information in the storage device indicating the reference route is the first heap area Garbage collection method characterized by changing the contents to refer to the second heap.
前記計算機システムが、前記記憶装置内の第1のヒープ領域で更新されたオブジェクトの内容を前記記憶装置内の前記第2のヒープ領域へ反映する前に、前記第1のヒープ領域で更新されたオブジェクトに対応する前記第2のヒープ領域のオブジェクトに前記プログラムが参照を行おうとした場合に、参照を行おうとしたことを検知することを特徴とする請求項1に記載されたガーベージコレクション方法。   The computer system is updated in the first heap area before reflecting the contents of the object updated in the first heap area in the storage device to the second heap area in the storage device. 2. The garbage collection method according to claim 1, wherein when the program attempts to refer to an object in the second heap area corresponding to the object, it detects that the reference is attempted. 前記計算機システムが、前記検知された参照を行おうとしたプログラムのスレッドのみを停止することを特徴とする請求項2に記載されたガーベージコレクション方法。   The garbage collection method according to claim 2, wherein the computer system stops only a thread of a program that tried to perform the detected reference. 記憶装置に格納されているオブジェクトのガーベージコレクションを行う計算機システムにおいて、
プログラムによって参照または更新可能なオブジェクトを格納した記憶装置内の第1のヒープ領域の内容を記憶装置内の第2のヒープ領域に格納するコピー部と、ガーベージコレクションの行われるヒープ領域を示す記憶装置内の情報を、前記第1のヒープ領域を示す内容から前記第2のヒープ領域を示す内容へ変更するスレッド制御部と、前記第2のヒープ領域でガーベージコレクションを実行するガーベージコレクション実行部と、前記第2のヒープ領域でのガーベージコレクションの実行中も継続して前記プログラムを実行するスレッド実行部と、前記第2のヒープ領域でのガーベージコレクションの実行後、前記プログラムによってオブジェクトを参照する際の参照ルートを示す記憶装置内の情報を、前記第1のヒープ領域から前記第2のヒープ領域を指す内容に変更する参照管理部とを備えることを特徴とする計算機システム。
In a computer system that performs garbage collection of objects stored in a storage device,
A copy unit that stores the contents of a first heap area in a storage device that stores objects that can be referenced or updated by a program in a second heap area in the storage device, and a storage device that indicates a heap area in which garbage collection is performed A thread control unit for changing the information in the content indicating the first heap area from the content indicating the second heap area, and a garbage collection executing part for executing garbage collection in the second heap area, A thread execution unit that continuously executes the program even during execution of garbage collection in the second heap area; and after executing garbage collection in the second heap area, when the object is referred to by the program The information in the storage device indicating the reference route is obtained from the first heap area. Computer system, characterized in that it comprises a reference management unit for changing the contents to refer to the second heap.
記憶装置に格納されているオブジェクトのガーベージコレクションを行う計算機システムにおけるガーベージコレクション方法をコンピュータに実行させる為のプログラムにおいて、
前記計算機システムがプログラムによって参照または更新可能なオブジェクトを格納した記憶装置内の第1のヒープ領域の内容を前記記憶装置内の第2のヒープ領域に格納し、前記計算機システムがガーベージコレクションの行われるヒープ領域を示す記憶装置内の情報を前記第1のヒープ領域を示す内容から前記第2のヒープ領域を示す内容へ変更し、前記計算機システムが前記第2のヒープ領域でガーベージコレクションを実行すると共に前記第2のヒープ領域でのガーベージコレクションの実行中も継続して前記プログラムを実行し、前記第2のヒープ領域でのガーベージコレクションの実行後、前記計算機システムが前記プログラムによってオブジェクトを参照する際の参照ルートを示す記憶装置内の情報を前記第1のヒープ領域から前記第2のヒープ領域を指す内容に変更するガーベージコレクション方法をコンピュータに実行させることを特徴とするプログラム。
In a program for causing a computer to execute a garbage collection method in a computer system that performs garbage collection of objects stored in a storage device,
The contents of the first heap area in the storage device in which the computer system stores objects that can be referenced or updated by a program are stored in the second heap area in the storage device, and the computer system is garbage collected. The information in the storage device indicating the heap area is changed from the contents indicating the first heap area to the contents indicating the second heap area, and the computer system executes garbage collection in the second heap area. The program is continuously executed during execution of garbage collection in the second heap area. After execution of garbage collection in the second heap area, the computer system refers to an object by the program. Whether the information in the storage device indicating the reference route is the first heap area A program characterized by executing the garbage collection process to change the contents to refer to the second heap area computer.
JP2008040926A 2008-02-22 2008-02-22 Garbage collection method, and its execution device, and processing program Pending JP2009199391A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008040926A JP2009199391A (en) 2008-02-22 2008-02-22 Garbage collection method, and its execution device, and processing program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008040926A JP2009199391A (en) 2008-02-22 2008-02-22 Garbage collection method, and its execution device, and processing program

Publications (1)

Publication Number Publication Date
JP2009199391A true JP2009199391A (en) 2009-09-03

Family

ID=41142811

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008040926A Pending JP2009199391A (en) 2008-02-22 2008-02-22 Garbage collection method, and its execution device, and processing program

Country Status (1)

Country Link
JP (1) JP2009199391A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010137600A1 (en) * 2009-05-25 2010-12-02 株式会社日立製作所 Memory management method, computer system, and storage medium in which program is stored

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010137600A1 (en) * 2009-05-25 2010-12-02 株式会社日立製作所 Memory management method, computer system, and storage medium in which program is stored
JP2010272059A (en) * 2009-05-25 2010-12-02 Hitachi Ltd Memory management method computer system and program

Similar Documents

Publication Publication Date Title
Moraru et al. Consistent, durable, and safe memory management for byte-addressable non volatile main memory
US8438193B2 (en) Copy collector with efficient abort-on-copy transition to mark collector
JP5618796B2 (en) Computer, computer control method and program
JP6044181B2 (en) Information processing method, program and apparatus for garbage collection
JP2010238228A (en) Method and device for dynamically analyzing program
JP4676289B2 (en) Debug system and method
JP5391422B2 (en) Memory management method, computer system, and program
US8296742B2 (en) Automatic native generation
KR101996641B1 (en) Apparatus and method for memory overlay
JP2009199391A (en) Garbage collection method, and its execution device, and processing program
JP5987501B2 (en) Branch address management program, method, and apparatus
US20120054723A1 (en) Dynamic instrumentation method and apparatus thereof
JP2018097817A (en) Information processor, information processing method and program
WO2011104889A1 (en) Computer system, memory management method and memory management program
KR102150597B1 (en) Method for operating hybrid transactional memory system with optimal retry policy, and hybrid transactional memory system
JP5316148B2 (en) Information processing apparatus and data restoration method
KR100928865B1 (en) Stack expansion and protection methods in computer systems and devices therefor
JP2012084069A (en) Computer system and failure information collection method
JP2009230395A (en) Journal log recording control method
JP2005284647A (en) Parallel processor, instruction retry method, and program
JP2008197980A (en) Failure analysis file weight reduction device for distributed parallel program, its method and its program
WO2016002225A1 (en) Information processing device, data element recovery method, and computer-readable recording medium having program stored therein
JP2006323763A (en) Language processing operation method and system
JP2007094922A (en) Automatic program generation, method, and program
JP2006277429A (en) Method for dynamic alteration of instruction using bypass route