JP2014075046A - Trace generation method, device, and program, and multilevel compilation using the method - Google Patents
Trace generation method, device, and program, and multilevel compilation using the method Download PDFInfo
- Publication number
- JP2014075046A JP2014075046A JP2012222362A JP2012222362A JP2014075046A JP 2014075046 A JP2014075046 A JP 2014075046A JP 2012222362 A JP2012222362 A JP 2012222362A JP 2012222362 A JP2012222362 A JP 2012222362A JP 2014075046 A JP2014075046 A JP 2014075046A
- Authority
- JP
- Japan
- Prior art keywords
- trace
- edge
- execution
- node
- graph
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/443—Optimisation
- G06F8/4441—Reducing the execution time required by the program code
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/443—Optimisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/447—Target code generation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
Description
本発明は、トレースベースのコンパイラ技術に関し、より詳細には、トレースベースのコンパイラに適用するマルチレベルのコンパイレーション技術に関する。 The present invention relates to a trace-based compiler technique, and more particularly to a multi-level compilation technique applied to a trace-based compiler.
従来、頻繁に実行される一続きのコード列(以下、「トレース」という)をコンパイル及び実行の基本単位とするトレースベースのコンパイラが知られている(例えば、非特許文献1、2、及び3を参照)。トレースベースのコンパイラではトレースの選択が重要な鍵となる。より長いトレースの生成は、コンパイラによる最適化の機会を増やし、コンパイル済みトレース間の遷移によるオーバーヘッドを減らす。しかしながら長いトレースの生成はしばしば重複したトレースの生成を引き起こし、コードサイズやコンパイル時間を増加させ、起動時のパフォーマンスを下げる(例えば、非特許文献1を参照)。
Conventionally, a trace-based compiler using a series of frequently executed code strings (hereinafter referred to as “trace”) as a basic unit of compilation and execution is known (for example, Non-Patent
トレースベースのコンパイラにおいてより長いトレースを生成することは、メソッドベースのコンパイラにおいて積極的にメソッド・インラインを行うことでコンパイルスコープを広げることに似ている。メソッドベースのJITコンパイラを用いるシステムでは、高速なスタートアップと高いピーク性能を両立させるために適応的マルチレベルのコンパイレーション技術が広く用いられている(例えば、非特許文献4〜8及び特許文献1を参照)。適応的マルチレベルのコンパイレーション技術では、プログラムの起動時には低い最適化レベルでコンパイルを行い、起動後においては、プロファイリングにより実行時間をより多く使っているメソッドをみつけより高い最適化レベルで再コンパイルを行う。トレースベースのコンパイラにおいても、マルチレベルのコンパイレーションを行って、起動速度とピークパフォーマンスの両立を図ることが望まれる。
Producing longer traces in a trace-based compiler is similar to expanding the compilation scope by aggressive method inlining in a method-based compiler. In a system using a method-based JIT compiler, an adaptive multi-level compilation technique is widely used in order to achieve both high-speed startup and high peak performance (for example, Non-Patent
なお、以下の先行技術文献のリストにおいて、非特許文献10は、本発明の実施例において使用するトレース同士を結合する最適化技術(trace linking optimization)についての背景技術としてリストしたものである。また、非特許文献11は、本発明の実施例において使用する技術のもととなったバーストトレーシング技術についての背景技術としてリストしたものである。また、非特許文献12乃至14は、再コンパイルをサポートする既存のトレーシング技術としてリストしたものである。しかしながら、非特許文献12における再コンパイルは、頻繁にアボートするトレースを修正するためのものであり、本発明のようにアップグレードを目的とするものではない。また、非特許文献13及び14における1回目のコンパイルは、実行を監視するために挿入されたコードをコンパイルするためのものであり、これら文献における再コンパイルは通常のコンパイルに相当し、本発明のようにアップグレードを目的とするものではない。
In the following list of prior art documents, Non-Patent Document 10 is listed as a background art about optimization technology (trace linking optimization) for linking traces used in the embodiments of the present invention. Non-Patent Document 11 is a list of background technologies related to the burst tracing technology that is the basis of the technology used in the embodiments of the present invention. Non-Patent
トレースベースのコンパイラにおいてマルチレベルのコンパイレーション技術を使用するためには、再コンパイル時に長いトレースを生成してより大きなコンパイルスコープを得る必要がある。しかしながらコンパイルの基本単位をメソッドとするメソッドベースのコンパイラと異なり、トレースの生成ではコンパイルスコープの開始位置及び終了位置の自由度が高いため、単にトレースの最大長の制約を緩めるだけでは上述したように重複したトレースや開始位置が不適切なトレースが生成されてしまう。 In order to use multi-level compilation techniques in a trace-based compiler, it is necessary to generate a long trace during recompilation to obtain a larger compilation scope. However, unlike a method-based compiler that uses the basic unit of compilation as a method, since the generation of traces has a high degree of freedom in the start and end positions of the compilation scope, simply relaxing the maximum trace length constraint as described above Duplicate traces and traces with inappropriate start positions are generated.
メソッドベースのコンパイラでは頻繁に実行されるメソッドを見つけるために、タイマーベースのサンプリングが利用されている(例えば、特許文献2、非特許文献9を参照)。タイマーベースのサンプリングでは安全な位置で実行を停止させるために、メソッドの先頭、ループのバックエッジにyieldpoint (async check point) が挿入される。そして実行時にタイマー割り込みが起きるとフラグが設定され、スレッドが次のyieldpointに達したときに止まる必要があることが示される。なお停止した位置がメソッドの先頭に挿入されたyieldpointである場合は、1段のスタックウォークを行ってメソッドの呼び出し元を特定し、呼び出し元にタイマーティック(timer tick)があたったとして実行時間がチャージされる。また、メソッドの呼び出しとループを含まないメソッドについては、メソッドを抜ける場所(リターン)にyieldpointが挿入されて、タイマーが全く当たらないということがないようにされる。
In the method-based compiler, timer-based sampling is used to find a frequently executed method (see, for example,
トレースベースのコンパイラにおいても、タイマーベースのサンプリングを利用して頻繁に実行される直線実行パスを見つけることが考えられる。しかしながら、トレースを抜ける場所にyield pointを挿入しようとすると、条件分岐ごとに出口(exit)が存在するため挿入数が多くなり、コードサイズが大きくなる。また、トレースベースの実行では元の場所に戻るということがないため、スタックウォークなどの手段では停止したトレースの直前のトレースを見つけることができず、実行時間を適切にチャージできない。 Even in a trace-based compiler, it is conceivable to find a linear execution path that is frequently executed by using timer-based sampling. However, if a yield point is to be inserted at a location that leaves the trace, the number of insertions increases because there is an exit for each conditional branch, and the code size increases. Also, since trace-based execution does not return to the original location, it is not possible to find the trace immediately before the stopped trace by means such as a stack walk, and the execution time cannot be charged appropriately.
この発明は、上記の問題点を解決するためになされたものであって、トレースベースのコンパイラにおいてマルチレベルのコンパイレーションを実現することのできる技術を提供することを目的とする。本発明はまた、タイマーベースのサンプリングを利用して、重複したトレースの生成と、更に望ましくはコードサイズの増加とを避けながら、長い実行時間を費やすトレースを見つけ出すことのできる技術を提供することを目的とする。 The present invention has been made to solve the above-described problems, and an object thereof is to provide a technique capable of realizing multi-level compilation in a trace-based compiler. The present invention also provides a technique that can use timer-based sampling to find traces that spend a long execution time while avoiding the generation of duplicate traces and more preferably increasing the code size. Objective.
上記課題を解決するために、本発明の1態様によれば、以下のようなコンピュータによるトレースの生成方法が提供される。該トレース生成方法は、(a)前記コンピュータが、最大長を所定長以下に制限されたトレースをコンパイルして得られたコンパイル済みトレースの実行に基づいて、トレース間の実行の遷移を表す有向グラフ(以下、「TT(Trace Transition)グラフ」という)を作成するステップであって、トレースを示す各ノードが再コンパイルカウンタを有する、前記作成するステップと、(b)前記コンピュータが、前記コンパイル済みコードの実行中におけるタイマーベースのサンプリングにおいて、タイマーティックがあたったトレースに対応するノードを出発点として前記TTグラフのエッジを逆方向に辿り、周期トレース若しくは再コンパイル済みトレースの手前又はエッジがなくなったところで停止して辿り着いたトレースの前記再コンパイルカウンタを増加するステップと、(c)前記コンピュータが、いずれかの前記再コンパイルカウンタの値が第1閾値を超えることを条件に、前記第1閾値を超えた前記再コンパイルカウンタを有するノードに対応するトレースの先頭を新たなトレースの先頭として決定し、前記所定長より長いトレースの生成を許可して前記新たなトレースを生成するステップとを含む。 In order to solve the above-described problems, according to one aspect of the present invention, there is provided the following method for generating a trace by a computer. The trace generation method includes: (a) a directed graph representing a transition of execution between traces based on execution of a compiled trace obtained by compiling a trace whose maximum length is limited to a predetermined length or less by the computer. (Hereinafter referred to as “TT (Trace Transition) graph”), wherein each node indicating a trace has a recompile counter, and (b) the computer In timer-based sampling during execution, the edge of the TT graph is traced in the reverse direction starting from the node corresponding to the trace hit by the timer tick, and stopped before the periodic trace or the recompiled trace, or when the edge disappears The recompilation of the trace that arrived Incrementing a counter; and (c) the computer corresponds to a node having the recompile counter that exceeds the first threshold, provided that any of the recompile counter values exceeds a first threshold. Determining the beginning of the trace to be performed as the beginning of a new trace, permitting generation of a trace longer than the predetermined length, and generating the new trace.
好ましくは、前記コンパイル済みのコードは、前記タイマーティックがあたったトレースを見つけるためのyield pointをトレースの先頭及びループのバックエッジにのみ挿入されている。 Preferably, in the compiled code, yield points for finding the trace hit by the timer tick are inserted only at the beginning of the trace and the back edge of the loop.
好ましくは、前記TTグラフの各エッジは該エッジが表す遷移の相対頻度を示す重みを有する。そして上記トレース生成方法は、タイマーティックがあたったトレースとその直前に実行されたトレースとの間のエッジの前記重みを増加するステップ(d)を更に含み、上記ステップ(b)において、前記コンピュータは、その重みが所定の条件を満たすエッジのみを辿って辿り着いたトレースの前記再コンパイルカウンタを増加する。 Preferably, each edge of the TT graph has a weight indicating the relative frequency of the transition represented by the edge. The trace generation method further includes a step (d) of increasing the weight of an edge between a trace hit with a timer tick and a trace executed immediately before the trace, and in the step (b), the computer The recompilation counter of the trace arrived by tracing only the edge whose weight satisfies the predetermined condition is incremented.
ここで前記所定の条件を満たすエッジとは、前記有向グラフを逆方向に辿る途中に存在するノードに入ってくるエッジが複数ある場合には、該複数のエッジの重みの合計に対するそのエッジの重みの比率が第2閾値を超えるエッジである。 Here, the edge satisfying the predetermined condition is that when there are a plurality of edges entering a node existing in the reverse direction of the directed graph, the weight of the edge with respect to the sum of the weights of the plurality of edges. An edge whose ratio exceeds the second threshold.
また、次に辿ろうとするノードから出ているエッジが複数ある場合には、前記所定の条件を満たすエッジとは、該複数のエッジの重みの合計に対する現在のノードから前記次のノードへのエッジの重みの比率が第3閾値を超えるエッジである。 In addition, when there are a plurality of edges coming out from the node to be traced next, the edge satisfying the predetermined condition is an edge from the current node to the next node with respect to the sum of the weights of the plurality of edges. This is an edge whose weight ratio exceeds the third threshold.
更に好ましくは、ステップ(d)は、前記コンピュータが、前記TTグラフ上で前記タイマーティックがあたったトレースに続く1以上のトレースのyield pointにおいて連続して実行が停止するための設定を行うステップを含む。そして、前記連続して実行が停止するための設定は、実行が、周期トレース、既に停止済みのトレース及びコンパイル済みのトレースのうちのいずれかに到達したこと、連続した実行の停止が所定回数に達したこと、又は次のトレースが存在しないトレースを抜けたことに応答して終了する。 More preferably, the step (d) includes a step in which the computer performs a setting for continuously stopping execution at a yield point of one or more traces following the trace hit by the timer tick on the TT graph. Including. The setting for stopping the execution is that the execution has reached one of a periodic trace, a trace that has already been stopped, and a trace that has been compiled. Exit in response to having reached or exiting a trace for which the next trace does not exist.
また好ましくは、前記コンパイル済みのトレースは、その実行によりトレースを抜けることとなった命令のポインタを記録する命令を挿入されている。そして、ステップ(d)は、トレースの入り口に挿入されたyield pointで実行が停止することに応答して、前記コンピュータが記録された前記命令のポインタの値を参照することにより直前に実行されたトレースを特定するステップを含む。 Preferably, the compiled trace is inserted with an instruction for recording a pointer of an instruction that has exited the trace due to its execution. Then, step (d) was executed immediately before by the computer referring to the recorded pointer value of the instruction in response to execution stopping at the yield point inserted at the entrance of the trace. Including the step of identifying the trace.
また、本発明の他の態様によれば、以下のようなコンピュータによるマルチレベルのコンパイレーション実行方法が提供される。該マルチレベルのコンパイレーション実行方法は、(a)前記コンピュータが、最大長を所定長以下に制限して生成されたトレースをコンパイルするステップと、(b)前記コンピュータが、生成したコンパイル済みのトレースの実行結果を取得するステップと、(c)前記コンピュータが、取得した実行結果に対して上記説明したいずれかのトレース生成方法の各ステップを実行するステップと、(d)ステップ(c)の結果生成された前記新たなレースに対して前記コンピュータが再コンパイルを実行するステップとを含む。 Further, according to another aspect of the present invention, there is provided a multilevel compilation execution method by a computer as follows. The multi-level compilation execution method includes: (a) a step in which the computer compiles a trace generated by limiting a maximum length to a predetermined length or less; and (b) a compiled trace generated by the computer. (C) a step in which the computer executes each step of any one of the trace generation methods described above on the acquired execution result; and (d) a result of step (c). And recompiling the computer for the new race created.
以上、トレースの生成方法及びマルチレベルのコンパイレーション実行方法として本発明を説明したが、本発明は、上記説明したトレース生成方法及びマルチレベルのコンパイレーション実行方法のそれぞれの各ステップをコンピュータに実行させるためのトレース生成プログラム及びマルチレベルのコンパイレーション実行プログラムとして把握することもできる。また、そのようなトレース生成プログラム及びマルチレベルのコンパイレーション実行プログラムをそれぞれ、1以上のコンピュータにインストールすることにより実現されるトレース生成装置及びマルチレベルのコンパイレーション実行装置として把握することもできる。 Although the present invention has been described above as a trace generation method and a multilevel compilation execution method, the present invention causes a computer to execute each step of the trace generation method and the multilevel compilation execution method described above. It can also be understood as a trace generation program and a multi-level compilation execution program. It is also possible to grasp such a trace generation program and a multi-level compilation execution program that are realized by installing the trace generation program and the multi-level compilation execution program on one or more computers.
本発明によれば、タイマーベースのサンプリングを用いてトレース間の実行の遷移を表すTTグラフを作成しこれに基づいて適切なトレースに実行時間のチャージを行うので、重複が少なくより長い真にホットなトレースを見つけることができる。また、TTグラフを用いてより長い実行時間を消費するトレースを選択できるため、トレースベースのコンパイラにおいてマルチレベルのコンパイレーションを行うことが可能となり、高速なスタートアップと高いピーク性能の両立を図ることができる。本発明のその他の効果については、各実施の形態の記載から理解される。 In accordance with the present invention, timer-based sampling is used to create a TT graph that represents the transition of execution between traces, and based on this, the execution time is charged to the appropriate trace, so there is less overlap and a longer, truly hot Traces can be found. In addition, since a trace that consumes a longer execution time can be selected using a TT graph, it becomes possible to perform multi-level compilation in a trace-based compiler, thereby achieving both high-speed startup and high peak performance. it can. Other effects of the present invention will be understood from the description of each embodiment.
以下、本発明を実施するための形態を図面に基づいて詳細に説明するが、以下の実施形態は特許請求の範囲にかかる発明を限定するものではなく、また実施形態の中で説明されている特徴の組み合わせの全てが発明の解決手段に必須であるとは限らない。なお、実施の形態の説明の全体を通じて同じ要素には同じ番号を付している。 DESCRIPTION OF EXEMPLARY EMBODIMENTS Hereinafter, modes for carrying out the invention will be described in detail with reference to the drawings. However, the following embodiments do not limit the invention according to the claims, and are described in the embodiments. Not all combinations of features are essential to the solution of the invention. Note that the same numbers are assigned to the same elements throughout the description of the embodiment.
図1は、本発明を実施するのに好適なコンピュータ・システム100のハードウェア構成の一例を示す。コンピュータ・システム100は、バス106に接続されたメインCPU(中央処理装置)102とメイン・メモリ104を含んでいる。CPU102は好ましくは、32ビット又は64ビットのアーキテクチャに基づくものであり、例えば、インテル社のCore i(商標)シリーズ、Core 2(商標)シリーズ、Atom(商標)シリーズ、Xeon(商標)シリーズ、Pentium(登録商標)シリーズ、Celeron(登録商標)シリーズ、AMD社のPhenom(商標)シリーズ、Athlon(商標)シリーズ、Turion(商標)シリーズ又はSempron(商標)が使用されうる。メイン・メモリ104は好ましくは、1GB以上の容量、より好ましくは、2GB以上の容量をもつものであってよい。
FIG. 1 shows an example of a hardware configuration of a
バス106には、ディスプレイ・コントローラ108を介して、ディスプレイ110、例えば液晶ディスプレイ(LCD)が接続されうる。ディスプレイ110は、コンピュータの管理のために、通信回線を介してネットワークに接続されたコンピュータについての情報と、そのコンピュータ上で動作中のソフトウェアについての情報を、適当なグラフィック・インタフェースで表示するために使用される。
A display 110, for example, a liquid crystal display (LCD) can be connected to the
バス106にはまた、SATA又はIDEコントローラ112を介して、ディスク114、例えばシリコン・ディスク又はハードディスクが接続されうる。バス106にはまた、SATA又はIDEコントローラ112を介して、任意的に、ドライブ116、例えばCD、DVDまたはBDドライブが接続されうる。バス106にはさらに、任意的に、キーボード・マウスコントローラ118又はUSBバス(図示せず)を介して、キーボード120及びマウス122が接続されうるが、本発明を実施する上では必要ない。
A
ディスク114には、オペレーティング・システム、J2EEなどのJava(登録商標)処理環境、Java(登録商標)アプリケーション、Java(登録商標)仮想マシン(VM)を提供するプログラム、その他のプログラム及びデータが、メイン・メモリ104にロード可能なように記憶されている。
The
オペレーティング・システムは、例えば、LINUX(登録商標)、マイクロソフト・コーポレーションが提供するWindows(登録商標)オペレーティング・システム、アップル・コンピュータ・インコーポレイテッドが提供するMacOS(登録商標)若しくはiOS(登録商標)、XWindow System備えるUNIX(登録商標)系システム(たとえば、インターナショナル・ビジネス・マシーンズ・コーポレーション(登録商標)が提供するAIX(登録商標)でありうる。 Operating systems include, for example, LINUX (registered trademark), Windows (registered trademark) operating system provided by Microsoft Corporation, MacOS (registered trademark) or iOS (registered trademark) provided by Apple Computer Incorporated, XWindow UNIX (registered trademark) system provided with System (for example, AIX (registered trademark) provided by International Business Machines Corporation (registered trademark)).
上記ディスク114には更に、オペレーティング・システムと協働してCPU102に命令を与え、本発明を実施するためのコンピュータ・プログラムを記録することができる。即ち、上記ディスク114には、コンピュータ・システム100にインストールされ、コンピュータ・システム100を本発明の実施形態によるトレース生成装置として機能させるトレース生成プログラム、コンピュータ・システム100を本発明の実施形態によるマルチレベルのコンパイレーション実行装置として機能させるマルチレベルのコンパイレーション実行プログラム、及びそれら関連データを記録することができる。なお、マルチレベルのコンパイレーション実行プログラムは、Java(登録商標)実行時(JIT)コンパイラを、トレース生成装置によって生成されたトレースに基づきマルチレベルのコンパイレーションを実行可能なように一部修正することによって実装可能である。
The
上記トレース生成プログラムは、TTグラフ生成モジュールと、TTグラフ更新モジュールと、トレース生成モジュールと、トレースキャッシュを含む。これらプログラム及びモジュールは、CPU102に働きかけて、コンピュータ・システム100を、各々後述するTTグラフ生成部220と、TTグラフ更新部221と、トレース生成部222と、トレースキャッシュ224としてそれぞれ機能させる。また、上記マルチレベルのコンパイレーション実行プログラムは、中間コード生成モジュール、最適化モジュール、コード生成モジュールを含む。これらプログラム及びモジュールは、CPU102に働きかけて、コンピュータ・システム100を、各々後述する中間コード生成部230と、最適化部232と、コード生成部234としてそれぞれ機能させる。
The trace generation program includes a TT graph generation module, a TT graph update module, a trace generation module, and a trace cache. These programs and modules cause the
上記コンピュータ・プログラムは圧縮し、また複数に分割して複数の媒体に記録することもできる。ドライブ116は、必要に応じて、CD−ROM、DVD−ROMまたはBDからプログラムをディスク114にインストールするために使用されうる。
The computer program can be compressed, divided into a plurality of pieces, and recorded on a plurality of media. The
通信インタフェース126は、例えばイーサネット(登録商標)・プロトコルに従う。通信インタフェース126は、通信コントローラ124を介してバス106に接続され、コンピュータ・システム100を通信回線128に物理的に接続する役割を担い、コンピュータ・システム100のオペレーティング・システムの通信機能のTCP/IP通信プロトコルに対して、ネットワーク・インタフェース層を提供する。なお、通信回線は、有線LAN環境に基づくもの、又は、無線LAN環境、例えば、IEEE802.11a/b/g/nなどのWi−Fi規格に基づくものであってもよい。
The communication interface 126 follows, for example, the Ethernet (registered trademark) protocol. The communication interface 126 is connected to the
以上から、本発明の実施態様において使用されるコンピュータ・システム100は、特定のオペレーティング・システム環境に限定されるものではないことを理解することができるであろう。なお、上記説明した構成要素は例示であり、そのすべての構成要素が本発明の必須構成要素となるわけではない。
From the foregoing, it will be appreciated that the
図2は、図1に示すコンピュータ・システム100のソフトウェアの構成の一例を示す図である。CPU102は、ディスク114からJava(登録商標)仮想マシン(VM)、本発明の実施形態によるトレース生成プログラム、マルチレベルのコンパイレーション実行プログラムをメイン・メモリ104に読み出し実行することにより、オペレーティング・システム202、仮想マシン206、トレーシング実行環境226、及び動的コンパイラ228をメイン・メモリ104に展開する。オペレーティング・システム202は、CPU102やメモリの管理など、コンピュータ・システム100が有する基本的な機能を提供するソフトウェアである。
FIG. 2 is a diagram showing an example of a software configuration of the
仮想マシン206は、バイトコードの低速実行(interpret)、およびコンパイル済みトレースの実行を行うエミュレータである。仮想マシン206は、インタープリタ208と、実行部212と、トレースディスパッチャ214を含んで構成される。
The virtual machine 206 is an emulator that performs low-speed execution (interpret) of bytecode and execution of compiled traces. The virtual machine 206 includes an interpreter 208, an
トレースディスパッチャ214は、トレースキャッシュ224を参照して次に実行するバイトコードアドレスから始まるコンパイル済みトレースがコードキャッシュ216に保存されている否かを判定する。インタープリタ208は、コンパイル済みトレースが存在しない場合に、処理対象のバイトコードを低速に実行する。実行部212は、コンパイル済みトレースが存在する場合、動的コンパイラ228が生成したコンパイル済みトレースを保存するメモリ領域であるコードキャッシュ216からコンパイル済みトレースを取得して実行する。
The
トレーシング実行環境226は、インタープリタ208によるバイトコード及び実行部212によるコンパイル済みトレースの実行の結果に基づき、現在の最大長に関する制約の下で実行時間をより多く使っているトレース(以下、「ホットパス」ともいう)をコンパイル対象として選択するためのソフトウェアモジュール群である。トレーシング実行環境226は、トレース選択エンジン218と、トレースキャッシュ224とを含んで構成される。トレース選択エンジン218は、起動時の低い最適化レベルにおいては最大長を所定長以下に制限してトレースを選択し、起動後のより高い最適化レベルにおいては所定長よりも長いトレースの生成を許可して新たにトレースを選択する。トレースキャッシュ224は、コンパイル時の最適化レベルや、後述するTTグラフ生成部220によって生成されるTTグラフのデータ構造など、トレースを管理するための情報を記憶する。
The tracing execution environment 226 is based on the result of the execution of the compiled trace by the byte code by the interpreter 208 and the
本発明では、起動後のより高い最適化レベルに対してタイマーベースのサンプリングにより頻繁に実行される直線実行パスを見つけるために、トレース間の実行の遷移を表す有向グラフであるTTグラフを作成する。そしてTTグラフを用いて適切なトレースに実行時間のチャージを行うことで、重複したトレースの生成を避けながら長い実行時間を費やすトレースを見つけ出す。そのため、本発明に係るトレース選択エンジン218は、TTグラフ生成部220、TTグラフ更新部221、トレース生成部222を含んで構成される。これら3つの構成要素のそれぞれの機能の詳細については図4〜図9を参照して後述する。
In the present invention, in order to find a linear execution path that is frequently executed by timer-based sampling with respect to a higher optimization level after activation, a TT graph that is a directed graph representing an execution transition between traces is created. Then, the execution time is charged to an appropriate trace using the TT graph to find a trace that spends a long execution time while avoiding generation of a duplicate trace. Therefore, the trace selection engine 218 according to the present invention includes a TT
動的コンパイラ228は、起動時には起動速度を優先して低い最適化レベルでコンパイルを行い、起動後にはピークパフォーマンスを優先してより高い最適化レベルでコンパイルを行う、マルチレベルのコンパイレーションを採用するコンパイラである。動的コンパイラ228は、トレース選択エンジン218が出力するトレースを入力として、入力トレースに適用された制約に対応する最適化レベルで最適化を行い、ネイティブコードを動的に生成する。動的コンパイラ228は、中間コード生成部230と、最適化部232と、コード生成部234とを含んで構成される。
The dynamic compiler 228 employs a multi-level compilation that compiles at a low optimization level giving priority to startup speed at startup, and compiles at a higher optimization level giving priority to peak performance after startup. It is a compiler. The dynamic compiler 228 receives the trace output from the trace selection engine 218 as an input, performs optimization at an optimization level corresponding to the constraint applied to the input trace, and dynamically generates native code. The dynamic compiler 228 includes an intermediate code generation unit 230, an
中間コード生成部230は、トレース選択エンジン218が出力したトレースを動的コンパイラ228内部で扱う表現(intermediate representation)に変換する。最適化部232は、起動時における所定長以下のトレースに対しては低い最適化レベルの最適化処理を施しコード生成部230に出力する。最適化部232はまた、起動後における所定長以上の長さを許可されて選択されたトレースに対しては、より高い最適化レベルの最適化処理を施しコード生成部230に出力してアップグレードのための再コンパイルを図る。コード生成部234は、最適化部232により出力された最適化済みのトレースをネイティブコードに変換し、コードキャッシュ216に格納する。
The intermediate code generation unit 230 converts the trace output from the trace selection engine 218 into an intermediate representation handled in the dynamic compiler 228. The
以下では、まず図3を参照して、タイマーベースのサンプリングとそこで使用するyield pointについて説明する。続いて、図4〜図9を参照して、TTグラフの生成、更新及びTTグラフに基づく再コンパイルについて説明する。続いて図10〜図13を参照して、TTグラフの生成及び更新処理を含む、マルチレベルのコンパイレーション処理全体の流れを説明する。最後に図14〜図16を参照して、従来技術と本発明とを比較した実験結果について説明する。 In the following, the timer-based sampling and yield points used therein will be described first with reference to FIG. Next, generation and update of a TT graph and recompilation based on the TT graph will be described with reference to FIGS. Next, the flow of the entire multi-level compilation process including the TT graph generation and update process will be described with reference to FIGS. Finally, with reference to FIG. 14 to FIG. 16, experimental results comparing the prior art and the present invention will be described.
1.タイマーベースのサンプリングとyield point
タイマーベースのサンプリングでは、コンパイル済みコードの実行中にタイマー割り込みが起こると、yield flagと呼ばれるスレッドローカルなフラグが設定されて、次のyield pointでスレッドが停止する必要があることが示される。実行が次のyield pointで停止すると、対応するメソッドで実行時間が使われているとみなされ実行時間がチャージされる。このようにyield pointを用いることで、ランタイムシステムはスレッドを安全に停止できると共に、タイマーティックがあたった正確なプログラム位置を特定できる。従ってyield pointの挿入位置がプロファイリングの正確さとオーバーヘッドとを決める(詳細は例えば非特許文献9を参照)。
1. Timer-based sampling and yield point
In timer-based sampling, if a timer interrupt occurs during the execution of compiled code, a thread-local flag called yield flag is set to indicate that the thread needs to stop at the next yield point. When execution stops at the next yield point, it is assumed that the corresponding method is using the execution time, and the execution time is charged. By using yield points in this way, the run-time system can safely stop the thread and identify the exact program location with a timer tick. Therefore, the yield point insertion position determines the profiling accuracy and overhead (for example, see Non-Patent Document 9 for details).
ここでトレースベースのコンパイラにおいてタイマーベースのサンプリングを利用することを考える。タイマー割り込み時に実行されているトレースを正確に特定できるようにするためには、トレースの入り口(entry point)と全ての出口(exit point)にyield pointを挿入する必要がある。しかし全ての出口にyield pointを挿入するとなると、既に述べたように条件分岐ごとにexit pointが存在するため、yield pointの挿入数が多くなりコードサイズが大きくなる。そこで本発明では、ほとんどのexit pointは実行時間のチャージのためのトリガーとなることはないという事実に基づき、yield pointをトレースの先頭及びループのバックエッジにのみ挿入する。 Consider using timer-based sampling in a trace-based compiler. In order to be able to accurately identify the trace being executed at the time of timer interruption, it is necessary to insert yield points at the entry point of the trace and all exit points. However, if yield points are inserted at all exits, exit points exist for each conditional branch as described above, so the number of yield points increases and the code size increases. Therefore, in the present invention, based on the fact that most exit points do not trigger execution time charging, yield points are inserted only at the beginning of the trace and the back edge of the loop.
図3(a)は、線形トレース(linear trace)におけるyield pointの挿入位置を説明する図である。図3(a)に示す線形トレースは、基本ブロックA、B、Cから構成される。タイマーティックを正しく処理するためには、トレースの入り口300と、全ての出口302、304、306にyield pointを挿入する必要がある。しかしながら本発明では上記事実に基づいてトレースの入り口300にのみyield pointを挿入し、コードサイズが大きくなることを防ぐ。
FIG. 3A is a diagram illustrating the insertion position of the yield point in the linear trace. The linear trace shown in FIG. 3A is composed of basic blocks A, B, and C. In order to correctly handle timer ticks, it is necessary to insert yield points at the
また、図3(b)は、周期トレース(cyclic trace)におけるyield pointの挿入位置を説明する図である。図3(b)に示す周期トレースは、基本ブロックA、Bから構成される。タイマーティックを正しく処理するためには、トレースの入り口308と、ループのバックエッジ312と、全ての出口310にyield pointを挿入する必要がある。しかし本発明では上記事実に基づいてトレースの入り口308と、ループのバックエッジ312にのみyield pointを挿入し、コードサイズが大きくなることを防ぐ。なお、本実施例においてコンパイル単位とするトレースは、線形トレースと、周期トレースであり、各トレースは、図3(a)及び図3(b)に示すように、1つの入り口と1以上の出口をもつブロックとする。
FIG. 3B is a diagram for explaining the insertion position of the yield point in the cyclic trace. The periodic trace shown in FIG. 3B is composed of basic blocks A and B. In order to correctly handle timer ticks, it is necessary to insert yield points at the
本発明ではトレース出口のyield pointを省略する代わりに、トレース内で最後に実行される命令として分岐及び結合命令(branch-and-link命令)を挿入し、その実行によりトレースを抜けることとなった命令のポインタをリンクレジスタに記録する。これによって、タイマー割り込みにより実行がトレースの入り口に挿入されたyield pointで停まった場合でも、リンクレジスタの値を参照して直前に実行されていたトレースを特定することができる。なお、メソッドベースのコンパイラでは、トレース入り口のyield pointで実行が停まった場合、常に直前に実行されていたトレースに対して実行時間のチャージを行うが、本発明に係るトレーシング実行環境226では、詳細は後述するがホットパス全体を見つけ出すためにTTグラフを用いて実行時間をチャージすべき適切なトレースをその都度決定する。 In the present invention, instead of omitting the yield point of the trace exit, a branch and join instruction (branch-and-link instruction) is inserted as the last executed instruction in the trace, and the trace is exited by the execution. Record the instruction pointer in the link register. As a result, even when execution stops at the yield point inserted at the entrance of the trace due to the timer interrupt, it is possible to identify the trace executed immediately before by referring to the value of the link register. In the case of the method-based compiler, when execution stops at the yield point at the entrance of the trace, the execution time is always charged for the trace executed immediately before. However, in the tracing execution environment 226 according to the present invention, As will be described in detail later, in order to find the entire hot path, an appropriate trace to be charged with the execution time is determined each time using the TT graph.
上述したbranch-and-link命令は、通常のbranch命令と同じジャンプ命令であるが、ジャンプする際にリンクレジスタという専用レジスタにジャンプ元のアドレスを保存する命令である。branch-and-link命令は、一般的にはメソッドの呼び出しに使用され、呼び出されたメソッドから戻る際にリンクレジスタに保存されたアドレスが参照される。本実施例では、トレースリンキング技術によりトレース同士をリンクする際に、branch命令の代わりにbranch-and-link命令を用いることで、直前に実行されたトレースを特定可能とする。 The branch-and-link instruction described above is the same jump instruction as the ordinary branch instruction, but is an instruction for saving the jump source address in a dedicated register called a link register when jumping. The branch-and-link instruction is generally used to call a method, and the address stored in the link register is referred to when returning from the called method. In this embodiment, when the traces are linked by the trace linking technique, the branch-and-link instruction is used instead of the branch instruction so that the trace executed immediately before can be specified.
なお、トレースリンキング技術とは、トレース間で実行をインタープリタ208に戻さずに直接次のトレースに実行を移させるために用いられる最適化技術である。トレースリンキングを実現するためには、元のトレースの出口から直に次のトレースの先頭アドレスへのジャンプを行うコードを生成しこれを元のトレースに挿入する必要がある。このため通常は、コンパイル時に実行コードの最後にトレースディスパッチャ214へのbranch命令を挿入し、トレースディスパッチャ214は、次のトレースが一意に決まることを条件として、ジャンプ元、ジャンプ先のトレースがコンパイルされた後最初の実行時にbranch命令のとび先を次のトレースの先頭アドレスに書き換える。本実施例では上述したように、トレース同士をリンクする際にbranch命令の代わりにbranch-and-link命令によりトレースの先頭アドレスへジャンプするよう書き換える。なおトレースリンキングは既存技術であり本発明の要旨ではないからこれ以上の説明は省略する。トレースリンキングの更なる詳細については、例えば非特許文献10を参照されたい。
Note that the trace linking technique is an optimization technique used for transferring execution directly to the next trace without returning execution to the interpreter 208 between traces. In order to realize trace linking, it is necessary to generate a code that jumps from the exit of the original trace to the start address of the next trace and insert it into the original trace. For this reason, a branch instruction to the
2.TTグラフの生成
TTグラフ生成部220は、最大長を所定長以下に制限してコンパイルされたコンパイル済みトレースの実行中にタイマーベースのサンプリングを用いたプロファイリングを行うことで、TTグラフを生成する。TTグラフは、トレース間の実行の遷移を表す有向グラフであり、有向グラフの各ノードはトレースを示し、ノード間のエッジはトレース間の実行の遷移を示す。各ノードは該ノードにタイマーティックがあたった頻度を示す再コンパイルカウンタを有し、各エッジは対応するトレース間の遷移の相対頻度を示す重みを有する。
2. Generation of TT Graph The TT
一例としてTTグラフは、TTグラフ内の各ノードに対し次のa〜cの情報を保持するデータ構造で保持されてよい。
a.タイマーティックが当たった回数を数えるカウンタ(以下、「再コンパイルカウンタ」という)
b.入ってくるエッジ(incoming edge)それぞれについて{元のノード,エッジの重みカウンタ}
c.出ていくエッジ(outgoing edge)それぞれについて{行先のノード,エッジの重みカウンタ}
ここで各ノードは、該ノードが示すトレースの情報を管理するデータ構造へのポインタによって識別されてよい。なお1のノードに入ってくる又は出ていくエッジ数が多くなる場合は、重みカウンタが大きい上位のエッジの情報のみを保持し、残りのエッジについてはその他のエッジとしてまとめてカウントしてよい。これによりエッジ数の多いノードが増えてもメモリ消費が問題となることはない。
As an example, the TT graph may be held in a data structure that holds information of the following ac for each node in the TT graph.
a. A counter that counts the number of times a timer tick is hit (hereinafter referred to as “recompile counter”)
b. For each incoming edge {original node, edge weight counter}
c. For each outgoing edge {destination node, edge weight counter}
Here, each node may be identified by a pointer to a data structure that manages trace information indicated by the node. When the number of edges entering or exiting one node increases, only the information on the upper edge having a large weight counter may be retained, and the remaining edges may be counted together as other edges. As a result, memory consumption does not become a problem even if the number of nodes having a large number of edges increases.
TTグラフの生成は次のようにして行う。まずプログラムの起動時にコンパイル単位であるトレースの最大長を所定長以下に制限し短い多数のトレースを生成する。そして生成したトレースに対応する有向グラフのノードを作成する。但しこの時点では各ノードに対して保持される上記a〜cの各情報の中身は空である。次に生成された多数のトレースを低い最適化レベルでコンパイルする。このときトレースの先頭及びループのバックエッジにyield pointを挿入する。 The generation of the TT graph is performed as follows. First, at the time of starting the program, the maximum length of the trace that is a compilation unit is limited to a predetermined length or less, and a large number of short traces are generated. Then, a directed graph node corresponding to the generated trace is created. However, at this time, the contents of the information a to c held for each node are empty. The many generated traces are then compiled at a low optimization level. At this time, yield points are inserted at the beginning of the trace and the back edge of the loop.
次にコンパイル済みトレースを実行部212により実行し、トレースディスパッチャ214によりトレースリンキングが行われることに応答してTTグラフ内の対応するノード間のエッジをはる。より具体的には、元のトレースのノードに対しては情報cの行先のノードを設定し、現在のトレースのノードに対しては情報bの元のノードを設定し、それぞれ対応するエッジの重みカウンタを1で初期化する。これにより元のトレースと次のトレースとの間にエッジがはられる。
Next, the compiled trace is executed by the
図4は、トレース同士が結合されたばかりの時点におけるTTグラフの基本構造の一例を示す図である。図4に示すように、一般的にはホットループが周期トレース(ノード400が示すcyclictraceを参照)として選択され、そこから抜けた先が順次次のトレース(ノード402、406、…が示すlineartrace 1、linear trace 2、…を参照)としてコンパイルされていく。TTグラフ内のノードには、linear trace2を示すノード406のように入ってくるエッジが複数のものもある。上述したように本実施例においてトレースは1つの入り口と1以上の出口をもつブロックであるので、全ての入ってくるエッジは次のトレースの先頭にジャンプしなくてはならない。またTTグラフ内のノードには、lineartrace3を示すノード408のように出ていくエッジが複数のものもある。出ていくエッジは、トレースの途中にある出口又はトレースの終わりにある出口のいずれかから次のトレースの先頭への遷移を示す。
FIG. 4 is a diagram showing an example of the basic structure of the TT graph at the time when the traces have just been combined. As shown in FIG. 4, generally, a hot loop is selected as a periodic trace (refer to the cyclic trace indicated by the node 400), and the destination from there is sequentially the next trace (
3.エッジの重みの更新
TTグラフの基本構造ができると、次にTTグラフ更新部221は、コンパイル済みトレースを実行中にタイマーベースのサンプリング用いてプロファイリングを行うことにより、エッジの重みがトレース間の遷移の相対頻度を示すように調整する。即ちTTグラフ更新部221は、プロファイリングにより2つのトレース間の遷移を見つけると、該遷移を示すエッジの重みを1増加する。より具体的には、TTグラフ更新部221は、タイマーティックがあたったトレースとその直前に実行されたトレースとの間のエッジの重みを増加する。なお、ノードに入ってくるエッジが複数ある場合には、リンクレジスタを参照して該当する1のエッジを特定する。
3. Update of edge weights Once the basic structure of the TT graph is completed, the TT
図5(a)を参照して、エッジの重みの調整方法を具体的に説明する。図5(a)に示すように、linear trace 1(ノード502)を実行中にタイマー割り込みが起きてyield flagが設定され、実行が次のトレース、即ちlinear trace 2(ノード506)の先頭のyield pointで停まったとする。このとき直前のトレースはlineartrace 1(ノード502)であるので、linear trace 1のノード502とlinear trace 2のノード506間のエッジの重みを1増やす。なお、現在のトレースは、現在の命令のポインタからを特定され、直前のトレースはリンクレジスタを参照することにより特定される。また、周期トレースの実行中にタイマー割り込みが起こり、実行がその周期トレースのバックエッジのyieldpointで停まる場合は、同一のトレースへの遷移であり調整すべきエッジがないので何もしない。
With reference to FIG. 5A, the edge weight adjustment method will be described in detail. As shown in FIG. 5A, a timer interrupt occurs during execution of linear trace 1 (node 502), yield flag is set, and execution is the next trace, ie, yield at the beginning of linear trace 2 (node 506). Suppose you stop at point. At this time, since the trace immediately before is lineartrace 1 (node 502), the edge weight between the
サンプルを効率的に収集して十分に正確なTTグラフをより早く構築するために、従来技術のバーストトレーシング技術を応用することもできる。バーストトレーシング技術は、サンプリング開始時に1のイベントの代わりに一連のイベント列(バースト)をサンプリングすることによって、低オーバーヘッドの短時間のプロファイリングを可能とする技術である(詳細は非特許文献11を参照)。そこで本発明においてもバーストトレーシング技術を応用したバーストサンプリング、即ち、トレースの先頭のyieldpointごとに繰り返し実行を停止して、一連のトレース間の遷移をサンプリングすることを考える。 Prior art burst tracing techniques can also be applied to efficiently collect samples and build a sufficiently accurate TT graph faster. The burst tracing technique is a technique that enables profiling in a short time with low overhead by sampling a series of event sequences (bursts) instead of one event at the start of sampling (for details, refer to Non-Patent Document 11). reference). Therefore, in the present invention, it is also considered that burst sampling using the burst tracing technique, that is, the execution is repeatedly stopped for each yield point at the beginning of the trace, and the transition between a series of traces is sampled.
バーストサンプリングを利用する場合、TTグラフ更新部221はTTグラフ上でタイマーティックがあたったトレースに続く1以上のトレースのyield pointにおいて連続して実行が停止するよう設定を行う。具体的には、TTグラフ更新部221は実行がトレース先頭の任意のyield pointで停止するごとにyield flagを設定し、次のyield pointでスレッドが停止する必要があることを示す。
When burst sampling is used, the TT
図5(b)を参照してバーストサンプリングを具体的に説明する。図5(b)に示すように、プロファイリングを開始後タイマー割り込みが起きてyield flagが設定され、linear trace 2を示すノード526の先頭のyieldpointで実行が停止したとする。TTグラフ更新部221は対応するエッジの重み、即ちlinear trace 1のノード522とlineartrace 2を示すノード526の間のエッジの重みを1増加した後、次のyield pointで再び実行が停止するようにyield flagを設定する。そして次のlinear trace 3のyield pointで実行が停止するとTTグラフ更新部221は再び上記処理を繰り返す。
The burst sampling will be specifically described with reference to FIG. As shown in FIG. 5B, it is assumed that a timer interrupt occurs after profiling is started, yield flag is set, and execution stops at the yield point at the head of the
TTグラフ更新部221は上記処理を、(1)連続した実行の停止回数が所定数に達したこと、(2)実行が、周期トレース、バーストサンプリングにおいて既に停止済みのトレース、及びコンパイル済みトレースのうちのいずれかのトレースに到達したこと、(3)実行が、次のトレースが存在しないトレースの出口を通過したことのいずれかに応答して終了する。このようにバーストサンプリングを利用することで、タイマー割り込み頻度を増やすことなく連続したトレース間の遷移をサンプリングすることができる。また、ほとんどのホットパスが再コンパイル済みとなれば、上記(2)の条件によりほとんどのバーストサンプリングは終了する。そのため定常状態では、バーストサンプリングによるオーバーヘッドは、繰り返し停止のない通常のサンプリングと比較してそれほど大きくない。
The TT
4.再コンパイルカウンタの更新及びTTグラフに基づく再コンパイル
TTグラフ更新部221は、エッジの重みの更新と平行して、TTグラフ内の各ノードが有する再コンパイルカウンタを更新する。上述したように各ノードの再コンパイルカウンタはそのノードが示すトレースにタイマーティックがあたった頻度を示す。但しここでいうタイマーティックがあたった頻度とは、そのトレースに真にタイマーティックがあたった頻度ではなく、タイマー割り込みが起きたときにそのトレースに実行時間をチャージすべきと判断された頻度である。
4). Recompilation Counter Update and Recompilation Based on TT Graph The TT
本発明では実行時間をチャージすべきトレースを以下のようにTTグラフを用いて決定する。即ち、TTグラフ更新部221は、コンパイル済みコードの実行中において、タイマーティックがあたったトレースに対応するノードを出発点としてTTグラフのエッジを逆方向に辿り、周期トレース、再コンパイル済みトレース、若しくは後述する無効トレースの手前、又はエッジがなくなったところで停止して辿り着いたトレースの再コンパイルカウンタを増加する。
In the present invention, the trace to be charged with the execution time is determined using a TT graph as follows. That is, during execution of the compiled code, the TT
再コンパイルカウンタを増加する際にTTグラフ更新部221はまた、その値を所定の閾値S1と比較する。そして再コンパイルカウンタの値が所定の閾値S1よりも大きいと判定した場合、TTグラフ更新部221は、所定の閾値S1よりも大きい再コンパイルカウンタを有するノードに無効のマークをつけ、該ノードの全ての入ってくるエッジ及び出ていくエッジを削除する。次に実行が無効マークのついたトレースに到達するとトレース生成部222が呼び出され、トレース生成部222は無効マークのついたトレースの先頭アドレスを新たなトレースの開始位置として、所定長以上の長さを許可して新たにトレースを生成する。生成された新たなトレースはその後動的コンパイラ228に対して出力され、高い最適化レベルで最適化される。コンパイル済みとなった新たなトレースは、TTグラフ生成部220により新規ノードとしてTTグラフに追加される。なお無効マークは一定時間経過した後は削除される。
When incrementing the recompile counter, the
このように本発明に係るトレーシング実行環境226は、TTグラフを利用して適切なトレースに実行時間をチャージし、ホットパス全体を見つけ出す。なお、周期トレースに到達した際に逆方向の探索をそれ以上行わないのは、上述したように本実施例では周期トレースと線形トレースのみをコンパイル単位とするためである。従って、たとえ最適化レベルが高く設定され所定長よりも長くトレースを生成することが許されていても、周期トレースと線形トレースとが互いに混じるような形でTTグラフを逆方向に探索することはしない。 In this way, the tracing execution environment 226 according to the present invention uses the TT graph to charge the execution time to an appropriate trace and finds the entire hot path. The reason why the search in the reverse direction is not further performed when the periodic trace is reached is that, as described above, only the periodic trace and the linear trace are used as the compilation unit in the present embodiment. Therefore, even if the optimization level is set high and it is allowed to generate a trace longer than the predetermined length, searching the TT graph in the reverse direction in such a way that the periodic trace and the linear trace are mixed with each other is not possible. do not do.
図6は、上記再コンパイルカウンタの更新方法を説明する図である。図6に示すように、ノード608が示すlinear trace 3を実行中にタイマー割り込みが起こりyield flagが設定され、次のノード610が示すlinear trace 4の先頭のyield pointで実行が停まったとする。この場合タイマーティックがあたったトレースはlinear trace 4であるため対応するノード610が出発点となる。ノード610を出発点としてTTグラフを逆方向へ辿っていくと(矢印614参照)、linear trace 1を示すノード602に到達する。ノード602は周期トレースを示すノード600の手前のノードであるため、ノード602で逆方向の探索を終了し、その再コンパイルカウンタを1増加して実行時間をチャージする。
FIG. 6 is a diagram for explaining a method for updating the recompile counter. As shown in FIG. 6, it is assumed that a timer interrupt occurs during execution of
上述したようにTTグラフ内には複数の入ってくるエッジや複数の出ていくエッジをもつノードが存在し得る。TTグラフを逆方向に辿る途中に複数のエッジを有するノードがある場合、TTグラフ更新部221は、その重みが所定の条件を満たすエッジのみを辿る。より具体的には、TTグラフ更新部221は、TTグラフを逆方向に辿る途中に存在するノードに入ってくるエッジが複数ある場合に、該複数のエッジの重みの合計に対するそのエッジの重みの比率が所定の閾値S2を超えるエッジのみを辿る(第1更新方法)。TTグラフ更新部221はまた、次に辿ろうとするノードから出ているエッジが複数ある場合に、該複数のエッジの重みの合計に対する、現在のノードから次のノードへのエッジの重みの比率が所定の閾値S3を超えるエッジのみを辿る(第2更新方法)。これは、複数のエッジの重みの合計値に対する対象のエッジの重みの比率が所定の閾値より小さいということは、そのパス(エッジ)がめったに実行されないパスということになるからである。なお、条件を満たすエッジが複数ある場合はその条件を満たす全てのエッジを辿る。
As described above, there can be a node having a plurality of incoming edges and a plurality of outgoing edges in the TT graph. When there is a node having a plurality of edges in the middle of tracing the TT graph in the reverse direction, the TT
図7は、上記再コンパイルカウンタの更新方法(第1更新方法)を説明する図である。図7に示すように、ノード708が示すlinear trace 3を実行中にタイマー割り込みが起こりyield flagが設定され、次のノード710が示すlinear trace 4の先頭のyield pointで実行が停まったとする。この場合タイマーティックがあたったトレースはlinear trace 4であるため対応するノード710が出発点となる。ノード710を出発点としてTTグラフを逆方向へ辿っていくと2つの入ってくるエッジ714、716を有するノード706に到達する。
FIG. 7 is a diagram for explaining the recompile counter update method (first update method). As shown in FIG. 7, it is assumed that a timer interrupt occurs during execution of
ここで所定の閾値S2を2つの入ってくるエッジ714、716の重みの合計値8(8=6+2)の20%とすると、エッジ714の重み値6もエッジ716の重み値2もどちらも20%を超えるので両方のエッジについて引き続き逆方向の探索が続けられる。するとエッジ714についてはノード700が周期トレースとなるためその手前のノード702で逆方向探索を終了する。そしてノード702の再コンパイルカウンタを1増加して実行時間をlinear trace 1にチャージする。エッジ716についてはノード704に到達した時点で入ってくるエッジがなくなるので、ノード704の再コンパイルカウンタを1増加して実行時間をlinear trace 1’にチャージする。
Here, if the predetermined threshold S2 is 20% of the total weight 8 (8 = 6 + 2) of the two
図8は、上記再コンパイルカウンタの更新方法(第2更新方法)を説明する図である。図8に示すように、TTグラフの逆方向の探索が開始され、現在のノードがlinear trace 4’を示すノード812に到達したとする(矢印818を参照)。すると次に辿ろうとするノード808は複数の出ていくエッジ814、816を有しているので、重みを用いてそのエッジを辿るための条件が満たされるか否か検討する。
FIG. 8 is a diagram for explaining the recompile counter update method (second update method). As shown in FIG. 8, it is assumed that a reverse search of the TT graph is started and the current node reaches a
ここで所定の閾値S3を2つの出ていくエッジ814、816の重みの合計値9(9=8+1)の20%とすると、エッジ816の重み値1は20%より小さいのでエッジ816を辿ることはしない。結果、逆方向の探索はノード812で終了し、ノード812の再コンパイルカウンタを1増加して実行時間をlinear trace 4’チャージする。
Here, when the predetermined threshold value S3 is 20% of the total weight 9 (9 = 8 + 1) of the two
図9(a)は、TTグラフを用いて選択した所定長よりも長いトレースの一例を示す図である。図9(b)は、TTグラフを用いることなく選択した所定長よりも長いトレースの一例を示す図である。なお、図9(b)に示すTTグラフ(トレース916を除く)は、図9(a)に示したTTグラフと同一であり、これは理解を容易にするために提供しているに過ぎないことを理解されたい。 FIG. 9A is a diagram illustrating an example of a trace longer than a predetermined length selected using a TT graph. FIG. 9B is a diagram showing an example of a trace longer than a predetermined length selected without using a TT graph. Note that the TT graph (except for the trace 916) shown in FIG. 9B is the same as the TT graph shown in FIG. 9A, and this is only provided for ease of understanding. Please understand that.
図9(a)に示す所定長よりも長い再コンパイルのためのトレース914は、TTグラフを使用することにより開始位置が適切に選択され生成されたトレースである。そのためトレース914はホットパス全体を含む。これに対し図9(b)に示す所定長よりも長い再コンパイルのためのトレース916は、タイマー割り込みが偶然発生した位置を開始位置として生成されたトレースである。そのため、トレース916はホットパスの一部のみを含む。結果、トレース914に対してはホットパス全体を考慮した最適化を行うことができ、よい実行コードの生成が可能となる。一方トレース916はホットパス全体をカバーしないので、最適化の機会を失う可能性がある。また、トレース916については、ノード902、904が示すlinear trace1、linear trace 2からそれぞれ始まる別の長いトレースが新たに生成される可能性もあり、その場合無駄な重複を発生してしまう。このようにTTグラフを使用してトレースを選択することで、アップグレードのための再コンパイルに相応しいトレースを生成することが可能となる。
The
5.動作説明
次に図10を参照して、本発明の実施の形態に係るマルチレベルのコンパイレーション処理全体の流れを説明する。図10に示すフローチャートは、仮想マシン206により実行対象のプログラムが起動されることによって開始し、トレース選択エンジン218は、インタープリタ208によるプログラムの実行結果に基づき、最大長を所定長以下に制限して頻繁に実行されるパスをトレースとして選択する(ステップ1000)。続いて、動的コンパイラ228は、トレース選択エンジン218によって出力されたトレースに対しyield pointを挿入して、低い最適化レベルでコンパイル処理を行う(ステップ1002)。
5. Description of Operation Next, the flow of the entire multilevel compilation process according to the embodiment of the present invention will be described with reference to FIG. The flowchart shown in FIG. 10 starts when the execution target program is started by the virtual machine 206, and the trace selection engine 218 limits the maximum length to a predetermined length or less based on the execution result of the program by the interpreter 208. A frequently executed path is selected as a trace (step 1000). Subsequently, the dynamic compiler 228 inserts yield points into the trace output by the trace selection engine 218, and performs compilation processing at a low optimization level (step 1002).
続いて、実行部212はコードキャッシュ216からコンパイル済みのトレースを読み出して実行する(ステップ1004)。実行部212によるコンパイル済みのトレースの実行に応答して、トレース選択エンジン218はTTグラフ(基本構造)を作成する(ステップ1006)。続いてトレース選択エンジン218はタイマーベースのサンプリングを用いたプロファイリングを開始する(ステップ1008)。続いて、トレース選択エンジン218はプロファイリング結果に基づきTTグラフを更新し、所定の条件が満たされる場合には新たなトレースを生成して、再コンパイルのため動的コンパイラ228に出力する(ステップ1010)。動的コンパイラ228は、新たなトレースに対し高い最適化レベルで再コンパイルを行う。更新及び再コンパイル処理の詳細は図11及び図12を参照して後述する。そして処理は終了する。
Subsequently, the
次に図11を参照して、図10に示すTTグラフの更新及び再コンパイル処理(ステップ1010)の詳細を説明する。図11に示すフローチャートはタイマー割り込みにより開始し、TTグラフ更新部221は、バーストサンプリングのためのyieldflagを設定する(ステップ1100)。続いて、yield flagの設定に応答して、実行部212が次のyield point で実行を停止する(ステップ1104)。
Next, details of the TT graph update and recompilation process (step 1010) shown in FIG. 10 will be described with reference to FIG. The flowchart shown in FIG. 11 is started by timer interruption, and the TT
続いて、TTグラフ更新部221は、停止位置のyield pointがトレースの先頭に挿入されたyieldpointであるか否かを判定する(ステップ1106)。トレースの先頭に挿入されたyieldpointでない場合(ステップ1106:NO)、即ち、周期トレースのバックエッジに挿入されたyieldpointである場合、TTグラフ更新部221は今回の実行の停止がタイマー割り込み後の最初の実行停止であるか否かを判定する(ステップ1118)。
Subsequently, the TT
最初の実行停止である場合(ステップ1118:YES)、TTグラフ更新部221は、現在のトレース、即ち周期トレースの再コンパイルカウンタを1増加する(ステップ1120)。続いてTTグラフ更新部221は、周期トレースの再コンパイルカウンタの値が所定の閾値S1より大きいか否かを判定する(ステップ1122)。再コンパイルカウンタの値が所定の閾値S1より大きい場合、トレース生成部222は次の実行時に周期トレースの先頭アドレスを開始位置として新たなトレースを生成し、動的コンパイラ228は新たなトレースを高い最適化レベルで再コンパイルする(ステップ1124)。なお、本実施例では周期トレースと線形トレースとを対象とするため、元の周期トレースと同一のトレースが再び生成されることになるが、適用される最適化レベルは前回よりも高いことに留意されたい。ステップ1118で最初の実行停止でない場合、又はステップ1122において周期トレースの再コンパイルカウンタの値が所定の閾値S1より大きくない場合、処理は終了する。
If it is the first execution stop (step 1118: YES), the TT
一方、停止位置のyield pointがトレースの先頭に挿入されたyieldpointである場合(ステップ1106:YES)、TTグラフ更新部221はリンクレジスタを参照して直前に実行されたトレースが判別可能か否かを判定する(ステップ1108)。直前に実行されたトレースが判別可能である場合(ステップ1108:YES)、TTグラフ更新部221は、直前に実行されたトレースから現在のトレースへの遷移を示すTTグラフのエッジの重みを1増加する(ステップ1110)。
On the other hand, when the yield point at the stop position is the yield point inserted at the beginning of the trace (step 1106: YES), the TT
一方、直前に実行されたトレースが判別可能でない場合(ステップ1108:NO)、又はステップ1110の後処理はステップ1112へ進み、TTグラフ更新部221は今回の実行の停止がタイマー割り込み後の最初の実行停止であるか否かを判定する。最初の実行停止である場合(ステップ1112:YES)、TTグラフ更新部221は、TTグラフを用いて再コンパイルカウンタの増加処理を行う(ステップ1114)。再コンパイルカウンタの増加処理の詳細は図12を参照して後述する。
On the other hand, when the trace executed immediately before is not discriminable (step 1108: NO), or the post-processing of step 1110 proceeds to step 1112, and the TT
一方、今回の実行停止がタイマー割り込み後の最初の停止でない場合(ステップ1112:NO)、又は再コンパイルカウンタの増加処理の後処理はステップ1116へ進み、TTグラフ更新部221は、バーストサンプリングの終了条件が満たされるか否かを判定する。終了条件の内容は既に説明済みであるためここでは省略する。バーストサンプリングの終了条件が満されないと判定された場合(ステップ1116:NO)、処理はステップ1104へ戻り一連の処理を繰り返す。一方、バーストサンプリングの終了条件が満された場合(ステップ1116:YES)、又はステップ1124の再コンパイルの後処理は終了する。
On the other hand, when the current stop is not the first stop after the timer interruption (step 1112: NO), the post-processing of the recompile counter increment processing proceeds to step 1116, and the TT
次に図12を参照して、図11に示す再コンパイルカウンタの増加処理(ステップ1114)の詳細を説明する。図12に示すフローチャートはステップ1200から開始し、TTグラフ更新部221は、現在のトレース、即ちその先頭のyieldpointで実行が停止したトレースを、現在の処理対象として選択する。続いてTTグラフ更新部221は、現在の処理対象のトレースがTTグラフ上で入ってくるエッジを有するか否かを判定する(ステップ1202)。
Next, details of the recompile counter increment process (step 1114) shown in FIG. 11 will be described with reference to FIG. The flowchart shown in FIG. 12 starts from Step 1200, and the TT
現在の処理対象のトレースが入ってくるエッジを有する場合(ステップ1202:YES)、続いてTTグラフ更新部221は、その入ってくるエッジの元のトレースが、周期トレース、再コンパイル済みトレース、又は無効化されたトレースのいずれかであるか否かを判定する(ステップ1204)。なお、現在の処理対象のトレースが複数の入ってくるエッジを有する場合、その各々を現在の処理対象のエッジとしてステップ1204以下の処理を行う。
If the current trace to be processed has an incoming edge (step 1202: YES), then the
元のトレースが上記3つのトレースのいずれでもない場合(ステップ1204:NO)、TTグラフ更新部221は、現在の処理対象の入ってくるエッジの重みが小さいか否かを判定する(ステップ1206)。より具体的には、TTグラフ更新部221は、現在の処理対象のトレースに入ってくるエッジが複数ある場合に該複数のエッジの重みの合計に対する現在の処理対象のエッジの重みの比率が所定の閾値S2より小さいか否かを判定する。また、TTグラフ更新部221は、元のトレースが複数の出ていくエッジを有する場合に、該複数のエッジの重みの合計に対する現在の処理対象のエッジの重みの比率が所定の閾値S3より小さいか否かを判定する。
When the original trace is not one of the above three traces (step 1204: NO), the TT
現在の処理対象の入ってくるエッジの重みが小さくない場合(ステップ1206:NO)、TTグラフ更新部221は、元のトレースを次の現在の処理対象のトレースとし(ステップ1208)、ステップ1202の処理に戻る。一方、現在の処理対象の入ってくるエッジの重みが小さい場合(ステップ1206:YES)、現在の処理対象である入ってくるエッジについては処理を終了する。
When the weight of the incoming edge of the current processing target is not small (step 1206: NO), the TT
また、現在の処理対象のトレースに入ってくるエッジがない場合(ステップ1202:NO)、又は、元のトレースが、周期トレース、再コンパイル済みトレース又は無効化済みトレースのいずれかである場合(ステップ1204:YES)、処理はステップ1210へ進み、TTグラフ更新部221は、現在の処理対象のトレースの再コンパイルカウンタを1増加する。
Also, when there is no edge that enters the current trace to be processed (step 1202: NO), or when the original trace is either a periodic trace, a recompiled trace, or a disabled trace (step (1204: YES), the process proceeds to step 1210, and the TT
続いてTTグラフ更新部221は、現在の処理対象のトレースの再コンパイルカウンタの値が所定の閾値S1より大きいか否かを判定する(ステップ1212)。再コンパイルカウンタの値が所定の閾値S1より大きくない場合、処理は終了する。再コンパイルカウンタの値が所定の閾値S1より大きい場合、トレース生成部222は次の実行時に現在処理対象のトレースの先頭アドレスを開始位置として所定長よりも長いトレースの生成を許可して新たなトレースを生成し、動的コンパイラ228は新たなトレースを高い最適化レベルで再コンパイルする(ステップ1214)。その後処理は終了する。
Subsequently, the TT
図13は、これまで説明してきたTTグラフの生成及びTTグラフに基づく再コンパイルの擬似コードの一例である。 FIG. 13 is an example of pseudo code for generating a TT graph and recompiling based on the TT graph described so far.
6. 実験結果
DaCapoベンチマークスイートを用いて本発明によるTTグラフに基づくマルチレベルのコンパイレーションを適用したトレースベースのJITコンパイラの性能を評価した。比較に用いた従来技術は以下の通りである。
従来技術1:長いトレースの生成を許可し、高い最適化レベルでコンパイル。アップグレードのための再コンパイルなし。
従来技術2:トレースの最大長を制限し、低い最適化レベルでコンパイル。アップグレードのための再コンパイルなし。
従来技術3:アップグレードのための再コンパイルあり。但し、TTグラフを使用せずに、単に最大長の制限を緩和。
6). Experimental Results The performance of the trace-based JIT compiler using multi-level compilation based on the TT graph according to the present invention was evaluated using the DaCapo benchmark suite. The prior art used for the comparison is as follows.
Prior Art 1: Allows generation of long traces and compiles at a high optimization level. No recompilation for upgrade.
Prior Art 2: Compile at a low optimization level, limiting the maximum trace length. No recompilation for upgrade.
Prior Art 3: Recompile for upgrade. However, the maximum length is simply relaxed without using the TT graph.
図14は、従来技術と本発明とで起動時間を比較した実験結果を示す。縦軸の起動時間は1イタレーション目の実行時間である。また図に示す値はDaCapoの全ベンチマークの平均値である。従来技術1の起動時間が長いのは、当初より高い最適化レベルでコンパイルしているためである。これに対し本発明を含む残り3つは、起動時は低い最適化レベルでコンパイルを行っているため、起動時間が短い。
FIG. 14 shows the experimental results comparing the start-up time between the prior art and the present invention. The startup time on the vertical axis is the execution time of the first iteration. The values shown in the figure are average values of all DaCapo benchmarks. The reason why the startup time of the
図15は、従来技術と本発明とでピーク性能を比較した実験結果を示す図である。縦軸は実行時間を示す。また、図に示す値はDaCapoの全ベンチマークの平均値である。従来技術2の実行時間が長いのは、トレース長を制限し低い最適化レベルでコンパイルしているためである。またアップグレードのための再コンパイルを行いながらも従来技術3の実行時間が本発明よりも若干長くなっているのは、再コンパイルのためのトレースの選択が適切ではないため、最適化の機会を失ったり、重複したトレースを生成しているためと考えられる。
FIG. 15 is a diagram showing experimental results comparing peak performance between the prior art and the present invention. The vertical axis shows the execution time. The values shown in the figure are average values of all DaCapo benchmarks. The reason for the long execution time of the
図16は、従来技術と本発明とで合計コンパイル時間を比較した実験結果を示す図である。縦軸は合計コンパイル時間を示す。また、図に示す値はDaCapoの全ベンチマークの平均値である。アップグレードのための再コンパイルを行っていないにも関わらず従来技術1の合計コンパイル時間が長いのは、長いトレースの生成を許可して高い最適化レベルでコンパイルしているためである。
FIG. 16 is a diagram showing experimental results comparing the total compile time between the prior art and the present invention. The vertical axis shows the total compilation time. The values shown in the figure are average values of all DaCapo benchmarks. Although the recompilation for the upgrade is not performed, the total compilation time of the
図14〜図16の実験結果から、高速なスタートアップと高いピーク性能を両立させることができるのは、本発明によるTTグラフに基づくマルチレベルのコンパイレーションだけであることが分かる。 From the experimental results of FIGS. 14 to 16, it can be seen that only a multi-level compilation based on the TT graph according to the present invention can achieve both fast startup and high peak performance.
以上、実施形態を用いて本発明の説明をしたが、本発明の技術範囲は上記実施形態に記載の範囲には限定されない。上記の実施形態に、種々の変更または改良を加えることが可能であることが当業者に明らかである。例えば、上記説明した実施例では、起動の高速化を図る観点からは小さく単純なコンパイル単位に区切ることが好ましいことから、コンパイル単位とするトレースは、線形トレースと、周期トレースであり、各トレースは、図3(a)及び図3(b)に示すように、1つの入り口と1以上の出口をもつブロックとした。しかしながら、本発明は、ツリー上のトレース(分岐を含むが合流を含まない)や周期トレースと線形トレースを組み合わせたトレース、更には合流を含むような複雑なトレースなど他のトレースに対しても同様の方法により適用可能である。また上記説明した実施例では、トレースリンキング技術とbranch-and-link命令を使用して、トレース間の遷移があった場合にその直前に実行されたトレースを特定可能とした。しかしながらこれら技術や命令を使用せずに、現在のトレースから次のトレースへジャンプする際にジャンプ前のアドレスを特定のレジスタやメモリに保存する構成としたり、トレース間の遷移はトレースディスパッチャ214を経由する構成とし、トレースディスパッチャ214において必要な情報を収集するようにしたりしてもよい。従って、そのような変更または改良を加えた形態も当然に本発明の技術的範囲に含まれる。
As mentioned above, although this invention was demonstrated using embodiment, the technical scope of this invention is not limited to the range as described in the said embodiment. It will be apparent to those skilled in the art that various modifications or improvements can be added to the above-described embodiments. For example, in the embodiment described above, since it is preferable to divide into small and simple compile units from the viewpoint of speeding up the startup, the traces used as compile units are a linear trace and a periodic trace. As shown in FIGS. 3 (a) and 3 (b), a block having one inlet and one or more outlets was formed. However, the present invention also applies to other traces such as traces on the tree (including branches but not including merging), traces combining periodic and linear traces, and even complex traces including merging. This method can be applied. In the above-described embodiment, the trace linking technique and the branch-and-link instruction are used to specify the trace executed immediately before a transition between traces. However, without using these techniques and instructions, when jumping from the current trace to the next trace, the address before the jump is saved in a specific register or memory, and the transition between traces goes through the
Claims (20)
(a)前記コンピュータが、最大長を所定長以下に制限されたトレースをコンパイルして得られたコンパイル済みトレースの実行に基づいて、トレース間の実行の遷移を表す有向グラフを作成するステップであって、トレースを示す各ノードが再コンパイルカウンタを有する、前記作成するステップと、
(b)前記コンピュータが、前記コンパイル済みトレースの実行中におけるタイマーベースのサンプリングにおいて、タイマーティックがあたったトレースに対応するノードを出発点として前記有向グラフのエッジを逆方向に辿り、周期トレース若しくは再コンパイル済みトレースの手前又はエッジがなくなったところで停止して辿り着いたトレースの前記再コンパイルカウンタを増加するステップと、
(c)前記コンピュータが、いずれかの前記再コンパイルカウンタの値が第1閾値を超えることを条件に、前記第1閾値を超えた前記再コンパイルカウンタを有するノードに対応するトレースの先頭を新たなトレースの先頭として決定し、前記所定長より長いトレースの生成を許可して前記新たなトレースを生成するステップと、
を含むトレース生成方法。 A computer generated trace method,
(A) The computer creates a directed graph representing a transition of execution between traces based on execution of a compiled trace obtained by compiling a trace whose maximum length is limited to a predetermined length or less. The creating step wherein each node exhibiting a trace has a recompile counter;
(B) In the timer-based sampling during execution of the compiled trace, the computer traces the edge of the directed graph in the reverse direction starting from the node corresponding to the trace hit by the timer tick, and performs periodic tracing or recompilation. Increasing the recompilation counter for traces that have stopped and arrived before the end of the trace or when there are no more edges;
(C) On the condition that the value of any one of the recompilation counters exceeds the first threshold, the computer newly sets the head of the trace corresponding to the node having the recompilation counter exceeding the first threshold. Determining the beginning of a trace, allowing the generation of a trace longer than the predetermined length and generating the new trace;
Trace generation method including
(a)前記コンピュータが、最大長を所定長以下に制限して生成されたトレースをコンパイルするステップと、
(b)前記コンピュータが、生成したコンパイル済みのトレースの実行結果を取得するステップと、
(c)前記コンピュータが、取得した実行結果に対して請求項1乃至8いずれか一項に記載の方法の各ステップを実行するステップと、
(d)前記コンピュータが、ステップ(c)の結果生成された前記新たなトレースに対して再コンパイルを実行するステップと、
を含むマルチレベルのコンパイレーション実行方法。 A multi-level compilation execution method by a computer,
(A) Compiling a trace generated by limiting the maximum length to a predetermined length or less by the computer;
(B) the computer obtaining an execution result of the generated compiled trace;
(C) the computer executing each step of the method according to any one of claims 1 to 8 on the acquired execution result;
(D) the computer recompiling the new trace generated as a result of step (c);
Multi-level compilation execution method including
最大長を所定長以下に制限されたトレースをコンパイルして得られたコンパイル済みトレースの実行に基づいて、トレース間の実行の遷移を表す有向グラフを生成する有向グラフ生成部であって、トレースを示す各ノードが再コンパイルカウンタを有する、前記有向グラフ生成部と、
前記コンパイル済みトレースの実行中におけるタイマーベースのサンプリングにおいて、タイマーティックがあたったトレースに対応するノードを出発点として前記有向グラフのエッジを逆方向に辿り、周期トレース若しくは再コンパイル済みトレースの手前又はエッジがなくなったところで停止して辿り着いたトレースの前記再コンパイルカウンタを増加する有向グラフ更新部と、
いずれかの前記再コンパイルカウンタの値が第1閾値を超えることを条件に、前記第1閾値を超えた前記再コンパイルカウンタを有するノードに対応するトレースの先頭を新たなトレースの先頭として決定し、前記所定長より長いトレースの生成を許可して前記新たなトレースを生成する生成部と、
を含むトレース生成装置。 A trace generator,
A directed graph generation unit that generates a directed graph representing a transition of execution between traces based on the execution of a compiled trace obtained by compiling a trace whose maximum length is limited to a predetermined length or less. The directed graph generator, wherein the node has a recompile counter;
In timer-based sampling during execution of the compiled trace, the edge of the directed graph is traced backward starting from the node corresponding to the trace hit by the timer tick, and the front or edge of the periodic trace or the recompiled trace is A directed graph updater that increases the recompilation counter of the trace that has stopped and arrived when it has run out;
On the condition that the value of any one of the recompile counters exceeds a first threshold value, the head of the trace corresponding to the node having the recompile counter exceeding the first threshold value is determined as the head of a new trace; A generation unit that allows generation of a trace longer than the predetermined length and generates the new trace;
Trace generation device including
最大長を所定長以下に制限して生成されたトレースをコンパイルするコンパイラと、
生成されたコンパイル済みのトレースの実行結果を入力とする、請求項12乃至19のいずれか一項に記載されたトレース生成装置とを含み、
前記コンパイラは、前記トレース生成装置により出力された前記新たなトレースに対して再コンパイルを実行する、マルチレベルのコンパイレーション装置。 A multi-level compilation device,
A compiler that compiles traces generated with a maximum length that is less than or equal to a predetermined length;
The trace generation device according to any one of claims 12 to 19, which receives an execution result of the generated compiled trace as an input.
The compiler is a multi-level compilation device that recompiles the new trace output by the trace generation device.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012222362A JP2014075046A (en) | 2012-10-04 | 2012-10-04 | Trace generation method, device, and program, and multilevel compilation using the method |
US14/028,648 US9104433B2 (en) | 2012-10-04 | 2013-09-17 | Trace generation method, trace generation device, trace generation program product, and multi-level compilation using trace generation method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2012222362A JP2014075046A (en) | 2012-10-04 | 2012-10-04 | Trace generation method, device, and program, and multilevel compilation using the method |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2014075046A true JP2014075046A (en) | 2014-04-24 |
Family
ID=50433797
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2012222362A Pending JP2014075046A (en) | 2012-10-04 | 2012-10-04 | Trace generation method, device, and program, and multilevel compilation using the method |
Country Status (2)
Country | Link |
---|---|
US (1) | US9104433B2 (en) |
JP (1) | JP2014075046A (en) |
Families Citing this family (41)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8458670B2 (en) * | 2007-09-27 | 2013-06-04 | Symantec Corporation | Automatically adding bytecode to a software application to determine network communication information |
US9450849B1 (en) | 2013-07-24 | 2016-09-20 | Amazon Technologies, Inc. | Trace backtracking in distributed systems |
US9830193B1 (en) | 2014-09-30 | 2017-11-28 | Amazon Technologies, Inc. | Automatic management of low latency computational capacity |
US9146764B1 (en) | 2014-09-30 | 2015-09-29 | Amazon Technologies, Inc. | Processing event messages for user requests to execute program code |
US9600312B2 (en) | 2014-09-30 | 2017-03-21 | Amazon Technologies, Inc. | Threading as a service |
US9678773B1 (en) | 2014-09-30 | 2017-06-13 | Amazon Technologies, Inc. | Low latency computational capacity provisioning |
US9413626B2 (en) | 2014-12-05 | 2016-08-09 | Amazon Technologies, Inc. | Automatic management of resource sizing |
US9588790B1 (en) | 2015-02-04 | 2017-03-07 | Amazon Technologies, Inc. | Stateful virtual compute system |
US9733967B2 (en) | 2015-02-04 | 2017-08-15 | Amazon Technologies, Inc. | Security protocols for low latency execution of program code |
US9547483B1 (en) * | 2015-11-06 | 2017-01-17 | International Business Machines Corporation | Feedback directed optimized compiling of optimized executable code |
US9910713B2 (en) | 2015-12-21 | 2018-03-06 | Amazon Technologies, Inc. | Code execution request routing |
US11132213B1 (en) | 2016-03-30 | 2021-09-28 | Amazon Technologies, Inc. | Dependency-based process of pre-existing data sets at an on demand code execution environment |
US10102040B2 (en) | 2016-06-29 | 2018-10-16 | Amazon Technologies, Inc | Adjusting variable limit on concurrent code executions |
US10613842B2 (en) * | 2018-04-30 | 2020-04-07 | International Business Machines Corporation | Simplifying a control flow graph based on profiling data |
US10649749B1 (en) * | 2018-06-26 | 2020-05-12 | Amazon Technologies, Inc. | Cross-environment application of tracing information for improved code execution |
US11146569B1 (en) | 2018-06-28 | 2021-10-12 | Amazon Technologies, Inc. | Escalation-resistant secure network services using request-scoped authentication information |
US10949237B2 (en) | 2018-06-29 | 2021-03-16 | Amazon Technologies, Inc. | Operating system customization in an on-demand network code execution system |
US11099870B1 (en) | 2018-07-25 | 2021-08-24 | Amazon Technologies, Inc. | Reducing execution times in an on-demand network code execution system using saved machine states |
US11243953B2 (en) | 2018-09-27 | 2022-02-08 | Amazon Technologies, Inc. | Mapreduce implementation in an on-demand network code execution system and stream data processing system |
US11099917B2 (en) | 2018-09-27 | 2021-08-24 | Amazon Technologies, Inc. | Efficient state maintenance for execution environments in an on-demand code execution system |
US11943093B1 (en) | 2018-11-20 | 2024-03-26 | Amazon Technologies, Inc. | Network connection recovery after virtual machine transition in an on-demand network code execution system |
US10929160B1 (en) * | 2018-12-12 | 2021-02-23 | The Mathworks, Inc. | Composite-trace just-in-time compilation |
US11010188B1 (en) | 2019-02-05 | 2021-05-18 | Amazon Technologies, Inc. | Simulated data object storage using on-demand computation of data objects |
US11861386B1 (en) | 2019-03-22 | 2024-01-02 | Amazon Technologies, Inc. | Application gateways in an on-demand network code execution system |
US11119809B1 (en) | 2019-06-20 | 2021-09-14 | Amazon Technologies, Inc. | Virtualization-based transaction handling in an on-demand network code execution system |
US11190609B2 (en) | 2019-06-28 | 2021-11-30 | Amazon Technologies, Inc. | Connection pooling for scalable network services |
US11115404B2 (en) | 2019-06-28 | 2021-09-07 | Amazon Technologies, Inc. | Facilitating service connections in serverless code executions |
US11159528B2 (en) | 2019-06-28 | 2021-10-26 | Amazon Technologies, Inc. | Authentication to network-services using hosted authentication information |
US11513841B2 (en) * | 2019-07-19 | 2022-11-29 | EMC IP Holding Company LLC | Method and system for scheduling tasks in a computing system |
US11036478B2 (en) * | 2019-08-07 | 2021-06-15 | Sap Se | Automated determination of transformation objects |
US11119826B2 (en) | 2019-11-27 | 2021-09-14 | Amazon Technologies, Inc. | Serverless call distribution to implement spillover while avoiding cold starts |
US11422780B2 (en) | 2020-01-24 | 2022-08-23 | International Business Machines Corporation | Automatically extracting feature engineering knowledge from execution traces |
US11714682B1 (en) | 2020-03-03 | 2023-08-01 | Amazon Technologies, Inc. | Reclaiming computing resources in an on-demand code execution system |
US11188391B1 (en) | 2020-03-11 | 2021-11-30 | Amazon Technologies, Inc. | Allocating resources to on-demand code executions under scarcity conditions |
WO2022054294A1 (en) * | 2020-09-14 | 2022-03-17 | 日本電信電話株式会社 | Bug detection support device, bug detection support method, and bug detection support program |
US11550713B1 (en) | 2020-11-25 | 2023-01-10 | Amazon Technologies, Inc. | Garbage collection in distributed systems using life cycled storage roots |
US11593270B1 (en) | 2020-11-25 | 2023-02-28 | Amazon Technologies, Inc. | Fast distributed caching using erasure coded object parts |
CN115480654A (en) * | 2021-05-29 | 2022-12-16 | 华为技术有限公司 | Line backspacing method of input panel and related device |
US11388210B1 (en) | 2021-06-30 | 2022-07-12 | Amazon Technologies, Inc. | Streaming analytics using a serverless compute system |
US11968280B1 (en) | 2021-11-24 | 2024-04-23 | Amazon Technologies, Inc. | Controlling ingestion of streaming data to serverless function executions |
US12015603B2 (en) | 2021-12-10 | 2024-06-18 | Amazon Technologies, Inc. | Multi-tenant mode for serverless code execution |
Family Cites Families (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6381739B1 (en) * | 1996-05-15 | 2002-04-30 | Motorola Inc. | Method and apparatus for hierarchical restructuring of computer code |
US6971091B1 (en) | 2000-11-01 | 2005-11-29 | International Business Machines Corporation | System and method for adaptively optimizing program execution by sampling at selected program points |
US7185327B2 (en) * | 2001-01-09 | 2007-02-27 | Hewlett-Packard Development Company, L.P. | System and method for optimizing operations via dataflow analysis |
US20020144101A1 (en) * | 2001-03-30 | 2002-10-03 | Hong Wang | Caching DAG traces |
US7107585B2 (en) * | 2002-07-29 | 2006-09-12 | Arm Limited | Compilation of application code in a data processing apparatus |
US7140008B2 (en) * | 2002-11-25 | 2006-11-21 | Microsoft Corporation | Dynamic temporal optimization framework |
US7386686B2 (en) | 2003-03-28 | 2008-06-10 | Intel Corporation | Inlining with stack trace cache-based dynamic profiling |
US7343482B2 (en) * | 2004-10-20 | 2008-03-11 | Arm Limited | Program subgraph identification |
WO2007095642A2 (en) * | 2006-02-16 | 2007-08-23 | The Regents Of The University Of California | Dynamic incremental compiler and method |
US8745606B2 (en) * | 2007-09-28 | 2014-06-03 | Intel Corporation | Critical section ordering for multiple trace applications |
US8612952B2 (en) * | 2010-04-07 | 2013-12-17 | International Business Machines Corporation | Performance optimization based on data accesses during critical sections |
JP5681473B2 (en) * | 2010-12-15 | 2015-03-11 | インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation | Program optimization apparatus, optimization method, and optimization program |
US8756581B2 (en) * | 2011-02-03 | 2014-06-17 | International Business Machines Corporation | Adaptive next-executing-cycle trace selection for trace-driven code optimizers |
US9128732B2 (en) * | 2012-02-03 | 2015-09-08 | Apple Inc. | Selective randomization for non-deterministically compiled code |
US9092568B2 (en) * | 2012-04-30 | 2015-07-28 | Nec Laboratories America, Inc. | Method and system for correlated tracing with automated multi-layer function instrumentation localization |
-
2012
- 2012-10-04 JP JP2012222362A patent/JP2014075046A/en active Pending
-
2013
- 2013-09-17 US US14/028,648 patent/US9104433B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
US20140101643A1 (en) | 2014-04-10 |
US9104433B2 (en) | 2015-08-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP2014075046A (en) | Trace generation method, device, and program, and multilevel compilation using the method | |
JP5473768B2 (en) | Method, system, and computer program for causing a computer to execute multipath dynamic profiling | |
KR101697719B1 (en) | A lightweight service based dynamic binary rewriter framework | |
KR19990036881A (en) | Bytecode program dynamic optimization method and device | |
JP5583514B2 (en) | Compiling method for optimizing binary code, compiler system thereof, and computer program | |
US20130125096A1 (en) | Systems and Methods for Dynamic Collection of Probe Call Sites | |
US20060206884A1 (en) | Late binding of optimization information for just in time compilation | |
US20130305230A1 (en) | Optimization apparatus, optimization method and optimization program | |
JP2011065220A (en) | Compiler program, compilation method and computer system | |
Inoue et al. | Adaptive multi-level compilation in a trace-based java jit compiler | |
JP6080602B2 (en) | Real footprint calculation method, method for determining inline method using the calculation method, apparatus and program | |
D'Elia et al. | Flexible on-stack replacement in LLVM | |
Bebenita et al. | Trace-based compilation in execution environments without interpreters | |
Lorenz et al. | Profiling of OpenMP tasks with Score-P | |
CN111771186B (en) | Compiler-generated asynchronous enumerable objects | |
Majo et al. | Integrating profile caching into the hotspot multi-tier compilation system | |
Béra et al. | Sista: Saving optimized code in snapshots for fast start-up | |
Latifi et al. | CompGen: generation of fast JIT compilers in a multi-language VM | |
JP6127639B2 (en) | Program execution control program and program execution control method | |
Arnold et al. | Adaptive optimization in the Jalapeno JVM | |
CN110187884B (en) | An optimization method for memory access instruction instrumentation in multi-threaded application scenarios | |
Levin et al. | Complementing missing and inaccurate profiling using a minimum cost circulation algorithm | |
Arnold et al. | Architecture and policy for adaptive optimization in virtual machines | |
Ap et al. | FITTCHOOSER: A dynamic feedback based fittest optimization chooser | |
US8387036B2 (en) | Method and system for execution profiling using loop count variance |