JP2004013184A - Program parallelization system and storage medium for program parallelization - Google Patents

Program parallelization system and storage medium for program parallelization Download PDF

Info

Publication number
JP2004013184A
JP2004013184A JP2002161366A JP2002161366A JP2004013184A JP 2004013184 A JP2004013184 A JP 2004013184A JP 2002161366 A JP2002161366 A JP 2002161366A JP 2002161366 A JP2002161366 A JP 2002161366A JP 2004013184 A JP2004013184 A JP 2004013184A
Authority
JP
Japan
Prior art keywords
class
parallelization
definition
program
function
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
JP2002161366A
Other languages
Japanese (ja)
Inventor
Hirohisa Tanaka
田中 裕久
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co 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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP2002161366A priority Critical patent/JP2004013184A/en
Publication of JP2004013184A publication Critical patent/JP2004013184A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a program parallelization system for inputting a program described in an object directing language such as C++language and converting it to a parallelization executable object program. <P>SOLUTION: In a variable/member analyzing step S130, the definition/reference state of a class member is analyzed, and stored in a variable/member information storage part D130. In a parallelization execution step S140, the starting object of a member function is analyzed, parallelization is performed in reference to the variable/member information storage part D130, and the parallelized object program is outputted. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は、オブジェクト指向言語により逐次記述されたプログラムを並列実行可能な目的プログラムに変換するプログラム並列化方式に関する。
【0002】
【従来の技術】
近年、コンピュータ分野において高速化・高性能化への要求がますます強くなり、プロセッサの高速化と共に、プログラムの並列化によって単位処理時間当たりの処理性能を向上させるという取り組みが盛んに行われている。
【0003】
プログラムの並列化には大きく細粒度、中粒度、粗粒度の3つの粒度に分類される。細粒度はVLIW(VeryLong Instruction Word)などの命令レベルでの並列化であり、中粒度はベクトル化などのループイタレーションレベルでの並列化であり、粗粒度はサブルーチンやブロックレベルでの並列化である。
【0004】
従来、細粒度および中粒度の並列化が主に行われていたが、更なる高性能化への要求が高まるにつれ、粗粒度の並列化すなわちサブルーチンやブロックレベルでの最適化が注目されつつある。
【0005】
サブルーチンを含めた並列化を行う従来の並列化方法として、特開平5−143357号公報「プログラム自動並列化方法」がある。この従来技術は、2段階のパスによって構成されており、第一のパスで関数内部で参照、代入が行われた大域変数を検出し、関数内で使用された大域変数の情報を作成する。次に、第二のパスで並列化を行う際、関数呼び出しを検出したとき、第一のパスで作成した大域変数の情報を参照することによって、プログラムの動作を変えることなく、関数呼び出しを含めた並列化を行うものである。
【0006】
【発明が解決しようとする課題】
近年のプログラムの大規模化に伴い、プログラムの開発効率を高め、再利用化を図るため、あるいはプログラムの保守性を向上させるために、オブジェクト指向言語によるプログラム開発が注目されている。オブジェクト指向言語の代表例にC++言語がある。
【0007】
オブジェクト指向言語によるプログラム開発では、従来の手続き型言語によるプログラム開発とは異なり、オブジェクトと、そのオブジェクトに対する操作を表すメソッドとの関係が重要になってくる。
【0008】
しかし、前述の特開平5−143357号公報「プログラム自動並列化方法」では大域変数の関係は考慮されているが、オブジェクトとメソッドとの関係は考慮されていない。
【0009】
例えば、図5(a)に示したプログラムに対する動作を考える。図5(a)のプログラムはオブジェクト指向言語C++言語で記述したプログラムである。図5(a)の1行目から9行目はクラスXの定義を表す。2行目は非静的データメンバxの宣言であり、3行目は静的データメンバyの宣言である。非静的データメンバはクラスオブジェクト毎に持っているメンバであり、静的データメンバはクラスで一つだけ存在するメンバである。
【0010】
5行目はクラスXのデフォルトコンストラクタの宣言であり、6行目、7行目は非静的メンバ関数、8行目は静的メンバ関数の宣言である。非静的メンバ関数と静的メンバ関数を合わせてメンバ関数と呼ぶこともある。5行目のデフォルトコンストラクタもメンバ関数の一つである。10行目から12行目までがクラスXの非静的メンバ関数calcの関数定義(5a1)、13行目から15行目までがクラスXの非静的メンバ関数initの関数定義(5a2)、16行目から18行目までがクラスXのデフォルトコンストラクタの関数定義(5a3)、19行目から21行目までがクラスXの静的メンバ関数setの関数定義(5a4)である。23行目から28行目までが大域関数gの関数定義(5a5)を表している。
【0011】
大域関数gの中には、24行目でクラスXのデフォルトコンストラクタ呼び出しが、25行目でクラスXの静的メンバ関数呼び出しが、26行目でクラスXの非静的メンバ関数呼び出しと大域変数aへの代入文が記述されている。24行目のデフォルトコンストラクタ呼び出しでは、非静的メンバ関数initの呼び出しによってobj1とobj2のメンバxにそれぞれ値を設定している。また、26行目の非静的メンバ関数呼び出しではobj1とobj2のメンバxをそれぞれ参照している。
【0012】
24行目の2つのデフォルトコンストラクタ呼び出しは、obj1とobj2の異なるオブジェクトに対するメンバの値の設定および参照であるため、並列に実行しても良い。また、26行目の2つの非静的メンバ関数呼び出しは、obj1とobj2の異なるオブジェクトに対するメンバの値の設定および参照であるため、並列に実行しても良い。しかし、24行目のobj1のデフォルトコンストラクタ呼び出しと26行目のobj1の非静的メンバ関数呼び出しは、同じオブジェクトに対するメンバの値の設定および参照であるため、並列に実行してはいけない。
【0013】
しかし、従来技術の並列化方法では、クラスXの非静的メンバ関数内で大域変数は存在しないと解釈し、24行目のobj1のデフォルトコンストラクタ呼び出しと26行目のobj1の非静的メンバ関数呼び出しは並列に実行しても良いと誤って解析してしまう。
【0014】
また、一般的に非静的メンバ関数の引数にはメンバが属するクラスへのポインタ型を暗黙的に持ち、実際の非静的メンバ関数の呼び出し時には、起動オブジェクトのアドレスを暗黙的に追加して呼び出す。ポインタ型を引数とする関数では、ポインタが指しているオブジェクトは一般的には不明であるため、その関数呼び出しを他の処理と並列実行可能であるとは判定できない。そのため、ポインタ型を引数として持つ非静的メンバ関数呼び出しは全て並列実行できないとすると、図5(a)の24行目と26行目の非静的メンバ関数呼び出しは全て並列実行することができなくなる。
【0015】
【課題を解決するための手段】
本発明は、上記の課題を解決するために次のような手段を講じる。
【0016】
第1の解決手段として、本発明は、オブジェクト指向言語で記述されたプログラムを入力し、並列実行可能な目的プログラムを出力するプログラム並列化方式であって、さらに、次のように構成してあることを特徴とする。すなわち、前記入力プログラムに記載されているクラスメンバの情報を解析するクラスメンバ解析ステップと、前記クラスメンバ解析ステップにより解析された情報を用いて並列化を行う並列化ステップとを備えた構成としている。
【0017】
この構成によれば、クラスメンバ解析ステップにおいて入力プログラム内のクラスメンバについて解析を行い、並列化ステップにおいて前記の解析結果の情報(クラスメンバ解析情報)に基づいて関数内の各文に対して所要のプログラム並列化を行うため、その並列化を効率良く行うことができる。すなわち、オブジェクト指向言語により逐次記述されたプログラムのクラスメンバ解析情報を考慮した上で並列化するので、並列実行可能な目的プログラムへの変換を効率良く遂行することができる。
【0018】
上記の構成をより具体的レベルで考察すると、次のようにいうことができる。すなわち、上記構成において、前記のクラスメンバ解析ステップが、前記クラスメンバの参照および定義の情報を解析するメンバ参照定義解析ステップを備えている一方、前記並列化ステップが、メンバ関数呼び出しの起動オブジェクトを解析し、メンバ関数呼び出しを含めた各文に対して並列化を行うメンバ関数呼び出し並列化ステップを備えていることである。
【0019】
この構成によれば、クラスメンバの参照および定義の関係を用いてプログラムの動作を変えることなく、メンバ関数呼び出しを含めた文の並列化を効率良く遂行することができる。
【0020】
また、上記のメンバ参照定義解析ステップおよび並列化ステップについてより具体的レベルで考察すると、好ましい態様として、次のような構成を挙げることができる。すなわち、前記のメンバ参照定義解析ステップが、クラスの非静的メンバの参照および定義の情報を解析する非静的メンバ参照定義解析ステップと、大域変数の参照および定義の情報を解析する大域変数参照定義解析ステップを備えている一方、前記の並列化ステップが、メンバ関数呼び出しの起動オブジェクトを解析し、メンバ関数呼び出しを含めた各文に対して並列化を行うメンバ関数呼び出し並列化ステップと、大域関数呼び出しを含めた各文に対して並列化を行う大域関数呼び出し並列化ステップを備えていることである。
【0021】
この構成によれば、クラス毎に存在するメンバである非静的メンバ、および複数の関数から共通に参照および代入が可能な変数である大域変数を考慮した解析を行うことができ、プログラムの動作を変えることなく、メンバ関数呼び出しおよび大域関数呼び出しを含めた文の並列化をより効率良く遂行することができる。
【0022】
また、上記のメンバ参照定義解析ステップおよび並列化ステップについてより具体的レベルでの好ましい別の態様として、次のような構成を挙げることができる。すなわち、前記のメンバ参照定義解析ステップが、クラスの静的メンバの参照および定義の情報を解析する静的メンバ参照定義解析ステップと、大域変数の参照および定義の情報を解析する大域変数参照定義解析ステップを備えている一方、前記の並列化ステップが、メンバ関数呼び出しの起動オブジェクトを解析し、メンバ関数呼び出しを含めた各文に対して並列化を行うメンバ関数呼び出し並列化ステップと、大域関数呼び出しを含めた各文に対して並列化を行う大域関数呼び出し並列化ステップを備えていることである。前述のものとの対比では、クラス毎に存在するメンバである非静的メンバに代えて各クラスに1つしかないメンバである静的メンバを対象とし、これに伴って、非静的メンバ参照定義解析ステップに代えて静的メンバ参照定義解析ステップと記述しているところがポイントである。
【0023】
この構成によれば、各クラスに1つしかないメンバである静的メンバ、および複数の関数から共通に参照および代入が可能な変数である大域変数を考慮した解析を行うことができ、プログラムの動作を変えることなく、メンバ関数呼び出しおよび大域関数呼び出しを含めた文の並列化をより効率良く遂行することができる。
【0024】
第2の解決手段として、本発明は、オブジェクト指向言語で記述されたプログラムを入力し、並列実行可能な目的プログラムを出力するプログラム並列化方式であって、さらに、次のように構成してあることを特徴とする。すなわち、前記入力プログラムに記載されているクラスメンバの参照および定義の情報を解析するメンバ参照定義解析ステップと、前記入力プログラムに記載されているクラス定義を解析するクラス解析ステップと、前記メンバ参照定義解析ステップおよび前記クラス解析ステップにより解析された情報を用いて並列化を行う並列化ステップとを備えた構成としている。
【0025】
この構成によれば、メンバ参照定義解析ステップにおいて入力プログラム内のクラスメンバの参照および定義について解析を行うとともに、クラス解析ステップにおいて入力プログラムに記載されているクラス定義について解析を行い、並列化ステップにおいて前記の解析結果の情報に基づいて関数内の各文に対して所要のプログラム並列化を行うため、その並列化を効率良く行うことができる。すなわち、複数のクラスについて、各クラス定義でクラスどうしの継承関係がある場合において、オブジェクト指向言語により逐次記述されたプログラムのクラスメンバの参照、定義およびクラス定義の解析情報を考慮して並列化を行うため、並列実行可能な目的プログラムへの変換を効率良く遂行することができる。なお、継承とは、あるクラス(基底クラス)を拡張し、別のクラス(派生クラス)を作る仕組みのことである。
【0026】
上記のメンバ参照定義解析ステップおよび並列化ステップについてより具体的レベルで考察すると、好ましい態様として、次のような構成を挙げることができる。すなわち、前記のメンバ参照定義解析ステップが、クラスの非静的メンバの参照および定義の情報を解析する非静的メンバ参照定義解析ステップと、大域変数の参照および定義の情報を解析する大域変数参照定義解析ステップとを備えている一方、前記の並列化ステップが、メンバ関数呼び出しの起動オブジェクトを解析し、メンバ関数呼び出しを含めた各文に対して並列化を行うメンバ関数呼び出し並列化ステップと、大域関数呼び出しを含めた各文に対して並列化を行う大域関数呼び出し並列化ステップを備えていることである。
【0027】
この構成によれば、クラスの非静的メンバと大域変数およびクラス定義の解析情報を考慮した並列化を行うことができ、プログラムの動作を変えることなく、メンバ関数呼び出しおよび大域関数呼び出しを含めた文の並列化をより効率良く遂行することができる。
【0028】
また、上記のメンバ参照定義解析ステップおよび並列化ステップについてより具体的レベルでの好ましい別の態様として、次のような構成を挙げることができる。すなわち、前記のメンバ参照定義解析ステップが、クラスの静的メンバの参照および定義の情報を解析する静的メンバ参照定義解析ステップと、大域変数の参照および定義の情報を解析する大域変数参照定義解析ステップを備えている一方、前記の並列化ステップが、メンバ関数呼び出しの起動オブジェクトを解析し、メンバ関数呼び出しを含めた各文に対して並列化を行うメンバ関数呼び出し並列化ステップと、大域関数呼び出しを含めた各文に対して並列化を行う大域関数呼び出し並列化ステップを備えていることである。前述のものとの対比では、クラス毎に存在するメンバである非静的メンバに代えて各クラスに1つしかないメンバである静的メンバを対象とし、これに伴って、非静的メンバ参照定義解析ステップに代えて静的メンバ参照定義解析ステップと記述しているところがポイントである。
【0029】
この構成によれば、各クラスに1つしかないメンバである静的メンバと複数の関数から共通に参照および代入が可能な変数である大域変数およびクラス定義の解析情報を考慮した並列化を行うことができ、プログラムの動作を変えることなく、メンバ関数呼び出しおよび大域関数呼び出しを含めた文の並列化をより効率良く遂行することができる。
【0030】
また、上記のクラス解析ステップおよび並列化ステップについてより具体的レベルでの好ましい態様として、次のような構成を挙げることができる。すなわち、前記のクラス解析ステップが、クラスの継承関係を解析するクラスツリー解析ステップを備えている一方、前記の並列化ステップが、継承関係にないクラスの1つあるいは複数のメンバ関数呼び出しの間に実行順序の依存がないとして並列化を行うことである。
【0031】
この構成によれば、クラスの継承関係(あるクラスを拡張し、別のクラスを生成する仕組み)を解析してクラスツリーを作成することにより、同一クラスツリーに属さないクラスのメンバ関数呼び出しは並列実行の候補と判定することができ、静的/非静的クラスメンバの関係を解析する必要がないため、処理の高速化を図ることができる。
【0032】
また、上記のクラス解析ステップおよび並列化ステップについてのより具体的レベルでの別の好ましい態様として、次のような構成を挙げることができる。すなわち、前記のクラス解析ステップが、仮想関数の呼び出しで呼び出される可能性のある関数の集合を解析する仮想関数解析ステップを備えている一方、前記の並列化ステップが、前記仮想関数呼び出しステップにより解析された情報を用いて並列化を行う仮想関数呼び出し並列化ステップを備えていることである。仮想関数とは、派生クラスが基底クラスのポインタで示されている場合でも、派生クラスの関数として動作する関数である。
【0033】
この構成によれば、仮想関数呼び出しで呼び出される可能性のある全ての関数を考慮した並列化を行うことができ、より精度の高い並列化を行うことができる。
【0034】
以上、プログラム並列化方式についてのいくつかの解決手段を説明してきたが、別の観点から、本発明をコンピュータ読み取り可能なプログラム並列化用の記録媒体として捉えることも可能である。すなわち、記録媒体についての本発明は、オブジェクト指向言語で記述されたプログラムを入力し、並列実行可能な目的プログラムを出力するプログラムを記録したコンピュータ読み取り可能な記録媒体であって、前記入力プログラムに記載されているクラスメンバの情報を解析するクラスメンバ解析ステップと、前記クラスメンバ解析ステップにより解析された情報を用いて並列化を行う並列化ステップとを含むものである。
【0035】
この記録媒体によれば、クラスメンバ解析ステップにおいて入力プログラム内のクラスメンバについて解析を行い、並列化ステップにおいて前記の解析結果の情報(クラスメンバ解析情報)に基づいて関数内の各文に対して所要のプログラム並列化を行うため、その並列化を効率良く行うことができる。すなわち、オブジェクト指向言語により逐次記述されたプログラムのクラスメンバ解析情報を考慮した上で並列化するので、並列実行可能な目的プログラムへの変換を効率良く遂行することができる。
【0036】
また、別態様のコンピュータ読み取り可能な記録媒体についての本発明は、オブジェクト指向言語で記述されたプログラムを入力し、並列実行可能な目的プログラムを出力するプログラムを記録したコンピュータ読み取り可能な記録媒体であって、前記入力プログラムに記載されているクラスメンバの参照および定義の情報を解析するメンバ参照定義解析ステップと、前記入力プログラムに記載されているクラス定義を解析するクラス解析ステップと、前記クラスメンバ参照定義解析ステップおよび前記クラス解析ステップにより解析された情報を用いて並列化を行う並列化ステップとを含むものである。
【0037】
この記録媒体によれば、メンバ参照定義解析ステップにおいて入力プログラム内のクラスメンバの参照および定義について解析を行うとともに、クラス解析ステップにおいて入力プログラムに記載されているクラス定義について解析を行い、並列化ステップにおいて前記の解析結果の情報に基づいて関数内の各文に対して所要のプログラム並列化を行うため、その並列化を効率良く行うことができる。すなわち、複数のクラスについて、各クラス定義でクラスどうしの継承関係がある場合において、オブジェクト指向言語により逐次記述されたプログラムのクラスメンバの参照、定義およびクラス定義の解析情報を考慮して並列化を行うため、並列実行可能な目的プログラムへの変換を効率良く遂行することができる。
【0038】
【発明の実施の形態】
以下、本発明のプログラム並列化方式の実施の形態の一例について図面を参照しながら説明する。
【0039】
(第一の実施形態)
図1は本発明の第一の実施形態におけるプログラム並列化方式の構成図を表している。
【0040】
図1において、このプログラム並列化ステップは、入力ステップS110、構文解析ステップS120、記憶部D120、変数/メンバ解析ステップS130、変数/メンバ情報記憶部D130、並列化実行ステップS140、最適化ステップS150、コード生成ステップS160から構成されている。
【0041】
プログラム記憶部D100は、並列化を行うプログラムを保持している。
【0042】
入力ステップS110は、プログラム記憶部D100に格納されている全てのプログラムを順次入力し、構文解析ステップS120に渡す。
【0043】
構文解析ステップS120は、入力ステップS110から受けとったプログラムの構文を解析し、シンボルテーブルの生成や構文木の生成などを行い、その解析結果を記憶部D120に格納する。
【0044】
記憶部D120は、構文解析ステップS120から解析結果を受け取り、格納しておく。
【0045】
変数/メンバ解析ステップS130は、記憶部D120に格納されている大域変数やクラスメンバの情報を抽出し、関数内で定義および参照されている大域変数やクラスメンバに関する情報を解析して、解析結果を変数/メンバ情報記憶部D130に格納する。
【0046】
変数/メンバ情報記憶部D130は、変数/メンバ解析ステップS130から解析結果を受け取り、格納しておく。
【0047】
並列化実行ステップS140は、記憶部D120から構文木を受け取り、関数内の各文について並列化を行う。この際、変数/メンバ情報記憶部D130に格納されている大域変数やクラスメンバの定義/参照情報を使用して並列化を行う。
【0048】
最適化ステップS150は、並列化実行ステップS140によって生成された中間コードに対して各種最適化を実行する。
【0049】
コード生成ステップS160は、最適化ステップS150によって最適化された中間コードを目的コードに変換して生成コード記憶部D160に出力する。
【0050】
生成コード記憶部D160は、S110からS160までのプログラム並列化ステップによって変換された目的コードを格納しておく。
【0051】
なお、入力ステップS110、構文解析ステップS120、最適化ステップS150、コード生成ステップS160については、本発明の主眼ではないため、詳細な説明は省略する。
【0052】
次に、変数/メンバ解析ステップS130の処理について、図5(a)に示すプログラムに適用した場合を例にして、図2を参照しながら説明する。
【0053】
図5(a)はC++言語で記述したソースプログラム例1である。また、図5(b)は、図5(a)の大域関数g(5a5)に関する構文解析ステップS120の解析結果の中間コードである。図5(a)の大域関数gの24行目の文の解析結果の中間コードが図5(b)の1および2の中間コードであり、obj1およびobj2に対してデフォルトコンストラクタ呼び出しのコードになっている。25行目の文の解析結果の中間コードが図5(b)の3の中間コードであり、クラスXの静的メンバ関数setの呼び出しのコードになっている。26行目の文の解析結果の中間コードが図5(b)の4、5および6の中間コードであり、それぞれobj1に対する非静的メンバ関数calcの呼び出し、obj2に対する非静的メンバ関数calcの呼び出し、外部変数aへの加算演算結果の設定のコードとなっている。27行目の文の解析結果の中間コードが図5(b)の7の中間コードであり、戻り値用の変数に値を設定するコードとなっている。
【0054】
変数/メンバ解析ステップS130の処理は、記憶部D120に格納されている全ての構文解析データのうち関数定義のデータに対してa1からa9までのステップによって行われる。以下記号の順に説明していく。
【0055】
ステップa1では、記憶部D120に格納されている関数定義データがクラスのメンバ関数に関するものかどうかを判定する。クラスのメンバ関数である場合はYesと判定しステップa2へと処理を移行し、そうでない場合はNoと判定しステップa6へと処理を移行する。図5(a)の非静的メンバ関数calc(5a1)に関してはステップa1でYesと判定され、大域関数gに関してはNoと判定される。
【0056】
ステップa2では、関数内の全ての文についてループ1を繰り返す。
【0057】
ステップa3では、文中で定義および参照されているクラスの非静的メンバを変数/メンバ情報記憶部D130に登録する。図5(a)の非静的メンバ関数init(5a2)に関しては、14行目の文でクラスXの非静的メンバxを定義しているので、ステップa3で関数initの定義非静的メンバにxを登録する。また、非静的メンバ関数calc(5a1)に関しては、11行目の文でクラスXの非静的メンバxを参照しているので、ステップa3で関数calcの参照非静的メンバにxを登録する。
【0058】
ステップa4では、文中で定義および参照されているクラスの静的メンバを変数/メンバ情報記憶部D130に登録する。図5(a)の静的メンバ関数set(5a4)に関しては、20行目の文でクラスXの静的メンバyを定義しているので、ステップa4で関数setの定義静的メンバにyを登録する。また、非静的メンバ関数calc(5a1)に関しては、11行目の文でクラスXの静的メンバyを参照しているので、ステップa4で関数calcの参照静的メンバにyを登録する。
【0059】
ステップa5では、ステップa2に処理を移行し、ループ1の処理を繰り返す。
【0060】
ステップa6では、関数内の全ての文についてループ2を繰り返す。
【0061】
ステップa7では、文中で定義および参照されている大域変数を変数/メンバ情報記憶部D130に登録する。図5(a)の大域関数g(5a5)に関しては、26行目の文で大域変数aを定義しているので、ステップa7で大域関数gの定義大域変数にaを登録する。また、27行目の文で大域変数aを参照しているので、ステップa7で大域関数gの参照大域変数にaを登録する。
【0062】
ステップa8では、文中で呼び出されている関数を変数/メンバ情報記憶部D130に登録する。図5(a)の大域関数g(5a5)に関しては、24行目の文でクラスXのデフォルトコンストラクタXが、25行目の文でクラスXの静的メンバ関数setが、26行目の文でクラスXの非静的メンバ関数calcが呼び出されているので、呼び出し関数にX、set、calcが登録される。
【0063】
ステップa9では、ステップa6に処理を移行し、ループ2の処理を繰り返す。
【0064】
変数/メンバ解析ステップS130の処理を図5(a)に示すプログラムに適用した場合、変数/メンバ情報記憶部D130の内容は図5(c)に示すようになる。
【0065】
次に、並列化実行ステップS140の処理について、図5(a)に示すプログラムの大域関数g(5a5)について適用した場合を例にして図5(b)に示した中間コードを使って、図3を参照しながら説明する。
【0066】
並列化実行ステップS140の処理は、記憶部D120に格納されている全ての構文解析データのうち関数定義のデータに対してb1からb12までのステップによって行われる。以下記号の順に説明していく。
【0067】
ステップb1では、記憶部D120に格納されている関数定義F1内の全ての文について定義/参照文情報を作成する。定義/参照文情報の作成処理の詳細については後述する。ステップb1によって、関数定義F1内の各文において定義/参照される静的/非静的メンバ、定義/参照される大域変数、および非静的メンバ関数の起動オブジェクトを得る。図5(b)の大域関数gの中間コードに対する定義/参照文情報は図6(a)のようになる。
【0068】
ステップb2では、関数定義F1内の全ての文1について、ループ1を繰り返す。
【0069】
ステップb3では、定義/参照文情報から文1に関する情報を抽出し、文1で定義/参照される静的/非静的メンバ、定義/参照される大域変数および非静的メンバ関数の起動オブジェクトMの情報を取得する。図5(b)の中間コード1では、定義非静的メンバとしてクラスXの非静的メンバx、起動オブジェクトMとしてobj1を得る。
【0070】
ステップb4では、文1以降に文1の起動オブジェクトMの定義静的/非静的メンバを定義あるいは参照する文2が存在するかどうかを判定する。存在する場合はYesと判定しステップb5へと処理を移行し、そうでない場合はNoと判定しステップb6へと処理を移行する。図5(b)の中間コード1では、起動オブジェクトMがobj1であり、定義非静的メンバがクラスXのメンバxであるので、中間コード1以降に起動オブジェクトMがobj1であり、メンバxを定義あるいは参照するような中間コードが存在するかどうかを図6(a)の大域関数gの文情報を検索して判定する。図6(a)の文情報を検索した結果、中間コード4で起動オブジェクトがobj1であり、メンバxを参照しているので、ステップb4ではYesと判定される。同様に中間コード2では、起動オブジェクトMがobj2であり、定義非静的メンバがクラスXのメンバxであるので、中間コード5で起動オブジェクトがobj2であり、メンバxを参照しているため、ステップb4ではYesと判定される。また、中間コード3では、定義静的メンバがクラスXのメンバyであるので、中間コード4および5でメンバyを参照しているため、ステップb4ではYesと判定される。
【0071】
ステップb5では、文1と文2の間で実行順序の関係を設定する。この順序関係は文1を実行した後で文2を実行しなければならないことを表す。図5(b)の中間コード1では、中間コード4との実行順序が設定される。同様に、中間コード2と中間コード5との実行順序、中間コード3と中間コード4との実行順序、中間コード3と中間コード5との実行順序が設定される。
【0072】
ステップb6では、文1以降に文1の起動オブジェクトMの参照静的/非静的メンバを定義する文2が存在するかどうかを判定する。存在する場合はYesと判定しステップb7へと処理を移行し、そうでない場合はNoと判定しステップb8へと処理を移行する。図5(b)の中間コード4では、起動オブジェクトMがobj1であり参照非静的メンバがクラスXのメンバxであるので、中間コード4以降に起動オブジェクトMがobj1であり、メンバxを定義するような中間コードが存在するかどうかを図6(a)の大域関数gの文情報を検索して判定する。図6(a)の文情報を検索した結果、起動オブジェクトがobj1であり、メンバxを定義している中間コードは存在しないため、ステップb6ではNoと判定される。
【0073】
ステップb7では、ステップb5と同様に文1と文2の間で実行順序の関係を設定する。
【0074】
ステップb8では、文1以降に文1で定義する大域変数を定義あるいは参照する文2が存在するかどうかを判定する。存在する場合はYesと判定しステップb9へと処理を移行し、そうでない場合はNoと判定しステップb10へと処理を移行する。図5(b)の中間コード6では、定義する大域変数がaであるので、中間コード6以降に大域変数を定義あるいは参照するような中間コードが存在するかどうかを図6(a)の大域関数gの文情報を検索して判定する。図6(a)の文情報を検索した結果、中間コード7で大域変数aを参照しているので、ステップb8ではYesと判定される。
【0075】
ステップb9では、ステップb5、ステップb7と同様に、文1と文2の間で実行順序の関係を設定する。図5(b)の中間コード3では、中間コード6との実行順序が設定される。同様に中間コード6と中間コード7との実行順序が設定される。
【0076】
ステップb10では、文1以降に文1で参照する大域変数を定義する文2が存在するかどうかを判定する。存在する場合はYesと判定しステップb11へと処理を移行し、そうでない場合はNoと判定しステップb12へと処理を移行する。図5(b)の中間コード3では、参照する大域変数がaであるので、中間コード3以降に大域変数を定義するような中間コードが存在するかどうかを図6(a)の大域関数gの文情報を検索して判定する。図6(a)の文情報を検索した結果、中間コード6で大域変数aを定義しているので、ステップb10ではYesと判定される。
【0077】
ステップb11では、ステップb9、ステップb5、ステップb7と同様に、文1と文2の間で実行順序の関係を設定する。図5(b)の中間コード3と中間コード6の間に実行順序が設定される。
【0078】
ステップb12では、ステップb2に処理を移行し、ループ1の処理を繰り返す。
【0079】
なお、クラスメンバ、大域変数以外の自動変数などの実行順序に関しては、通常の依存関係の解析により順序付けられる。通常の依存関係の解析については、本発明の主眼ではないため、詳細な説明は省略する。通常の依存関係の解析によって、局所変数の間の実行順序が設定され、中間コード4と中間コード6の実行順序が設定される。また、同様に中間コード5と中間コード6の実行順序が設定される。
【0080】
次に、関数の定義/参照文情報作成ステップの処理について、図5(a)に示すプログラムの大域変数g(5a5)について適用した場合を例にして図5(b)に示した中間コードを使って、図4を参照しながら説明する。
【0081】
定義/参照文情報作成ステップの処理は、記憶部D120に格納されている全ての構文解析データのうち関数定義のデータに対してc1からc9までのステップによって行われる。以下記号の順に説明していく。
【0082】
ステップc1では、関数定義F1内の全ての文1について、ループ1を繰り返す。
【0083】
ステップc2では、文1が関数呼び出しを含む文であるかどうかを判定する。文1が関数呼び出しを含む場合はYesと判定しステップc3へと処理を移行し、そうでない場合はNoと判定しステップc7へと処理を移行する。図5(b)の中間コード1および2では、クラスXのデフォルトコンストラクタの呼び出しを含んでいるため、ステップc2ではYesと判定される。中間コード3では、クラスXのメンバ関数setの呼び出しを含んでいるため、Yesと判定される。また、中間コード4および5では、クラスXのメンバ関数calcの呼び出しを含んでいるため、同様にYesと判定される。図5(b)のその他の中間コードはNoと判定される。
【0084】
ステップc3では、文1に含まれている呼び出し関数F2がクラスのメンバ関数であるかどうかを判定する。関数F2がクラスのメンバ関数である場合はYesと判定しステップc4へと処理を移行し、そうでない場合はNoと判定しステップc6へと処理を移行する。図5(b)の中間コード1、2、3、4、5に関しては呼び出される関数が全てメンバ関数であるため、ステップc3でYesと判定される。
【0085】
ステップc4では、メンバ関数呼び出しの式から起動オブジェクトMを取得し、文情報に登録する。図5(b)の中間コード1、2に関しては、デフォルトコンストラクタの起動オブジェクトMは、それぞれobj1、obj2であるため、中間コード1および2に対する文情報の起動オブジェクトの欄にそれぞれobj1、obj2を登録する。中間コード3に関しては呼び出される関数が静的メンバ関数であるため、起動オブジェクトMを持たないため、文情報の起動オブジェクトの欄には何も登録しない。
【0086】
ステップc5では、変数/メンバ情報記憶部D130から関数F2の定義/参照非静的メンバ、定義/参照静的メンバ、呼び出し関数の情報を取得し、文中で定義および参照される非静的メンバ、および静的メンバを計算し、文情報に登録する。図5(b)の中間コード1に関しては、クラスXのデフォルトコンストラクタXの呼び出しが含まれているので、図5(c)の変数/メンバ情報記憶部D130を参照し、呼び出し関数内で定義、参照される非静的、静的メンバおよび呼び出し関数を取得する。デフォルトコンストラクタX中では定義、参照される非静的、静的メンバはなく、クラスXのメンバ関数initが含まれている。呼び出し関数が含まれている場合は再帰的に図5(c)の変数/メンバ情報記憶部D130を参照し、定義、参照される非静的、静的メンバと呼び出し関数を取得する。クラスXのメンバ関数initでは、参照非静的メンバ、参照静的メンバ、定義静的メンバはなく、定義非静的メンバとしてxがあるため、図5(b)の中間コード1では定義非静的メンバとしてxという結果が得られ、中間コード1の定義非静的メンバの欄にクラスXのメンバxを登録する。
【0087】
ステップc6では、変数/メンバ情報記憶部D130から関数F2の定義大域変数、参照大域変数、呼び出し関数の情報を取得し、文中で定義および参照される大域変数を計算し、文情報に登録する。図5(b)の中間コード1に関しては、クラスXのデフォルトコンストラクタXの呼び出しが含まれているので、図5(c)の変数/メンバ情報記憶部D130を参照し、呼び出し関数内で定義、参照される大域変数と呼び出し関数を取得する。デフォルトコンストラクタX中では定義、参照される大域変数はなく、クラスXのメンバ関数initが含まれている。呼び出し関数が含まれている場合は再帰的に図5(c)の変数/メンバ情報記憶部D130を参照し、定義、参照される大域変数と呼び出し関数を取得する。クラスXのメンバ関数initでは、参照、定義される大域変数は存在しないため、図5(b)の中間コード1の定義大域変数、参照大域変数には何も登録されない。
【0088】
ステップc7では、文1の中で関数呼び出し以外の式で定義および参照されている非静的メンバ、静的メンバを計算し、文情報に登録する。図5(b)の中間コード1から6では、関数呼び出し以外の式で定義および参照されているメンバは存在しないため、中間コード1から中間コード6の文情報の定義メンバおよび参照メンバの欄には何も登録されない。図5(a)のメンバ関数calc(5a1)の関数定義の11行目の中間コードの場合では、クラスXの非静的メンバxと静的メンバyを参照しているのでメンバ関数calcの11行目の中間コードに対する文情報には参照非静的メンバの欄にメンバxが、参照静的メンバの欄にはメンバyが登録される。なお、メンバ関数calc(5a1)の関数定義の中間コードは図示していない。
【0089】
ステップc8では、文1の中で関数呼び出し以外の式で定義および参照されている大域変数を計算し、文情報に登録する。図5(b)の中間コード5では、関数呼び出し以外の式で大域変数aが定義されているため、中間コード5の定義大域変数の欄に大域変数aを登録する。また、中間コード3では、関数呼び出しの引数として大域変数aが参照されている。この場合も中間コード3の参照大域変数の欄に大域変数aを登録する。
【0090】
ステップc9では、ステップc1に処理を移行し、ループ1の処理を繰り返す。
【0091】
定義/参照文情報作成ステップの処理を大域関数gに対して適用した結果、図6(a)に示すような文情報が得られる。
【0092】
並列化実行ステップS140の処理を大域関数gに対して適用した結果、大域関数gの中間コード1から7までの実行順序の関係を有向グラフで表すと、図6(b)に示すようになる。中間コード1と中間コード2と中間コード3、および中間コード4と中間コード5は実行順序に関する依存関係は存在しないため、それぞれ並列して実行することが可能であると判断でき、大域関数gの実行ステップ数は、中間コードの実行ステップ数で表すと4ステップで実行することが可能である。大域関数gの中間コードを従来技術の方法で並列化を行うと、図6(c)に示すようにクラスメンバに対応していないため、いずれの中間コードも並列に実行することができないため、7ステップ要することになる。
【0093】
図6(b)と図6(c)との比較で明かなように、本実施の形態によれば、従来技術に比べて、各文の並列化をより効率良く遂行することができる。
【0094】
(第二の実施形態)
図7は本発明の第二の実施形態におけるプログラム並列化方式の構成図を表している。
【0095】
図7において、このプログラム並列化ステップは、入力ステップS210、構文解析ステップS220、記憶部D220、変数/メンバ解析ステップS230、クラス解析ステップS240、クラス/変数/メンバ情報記憶部D240、並列化実行ステップS250、最適化ステップS260、コード生成ステップS270から構成されている。
【0096】
第二の実施形態におけるプログラム並列化方式の入力ステップS210、構文解析ステップS220、記憶部D220、変数/メンバ解析ステップS230、最適化ステップS260、コード生成ステップS270については、それぞれ第一の実施形態における入力ステップS110、構文解析ステップS120、記憶部D120、変数/メンバ解析ステップS130、最適化ステップS150、コード生成ステップS160と同じであるので説明を省略する。
【0097】
クラス解析ステップS240は、記憶部D220に格納されているクラス情報を抽出し、クラスの継承関係やメンバ関数に関する情報を解析して、解析結果をクラス/変数/メンバ情報記憶部D240のクラス情報記憶部D242に格納する。
【0098】
クラス/変数/メンバ情報記憶部D240は、変数/メンバ情報記憶部D241とクラス情報記憶部D242から構成されており、変数/メンバ解析ステップS230およびクラス解析ステップS240から解析結果を受け取り、それぞれ変数/メンバ情報記憶部D241とクラス情報記憶部D242に格納しておく。
【0099】
並列化実行ステップS250は、記憶部D220から構文木を受け取り、関数内の各文について並列化を行う。この際、クラス/変数/メンバ情報記憶部D240に格納されているクラスツリーや大域変数、クラスメンバの定義/参照情報などを使用して並列化を行う。
【0100】
図11(a)はC++言語で記述したソースプログラム例2である。
【0101】
図11(a)の1行目から15行目まではクラスA、クラスB、クラスCのクラス定義である。クラスBはクラスAを継承しており、クラスCはクラスBを継承している。また、4行目、9行目、14行目のvirtual指定子が指定されたメンバ関数は仮想関数であることを表しており、クラスAのメンバ関数calc(11a1)、クラスBのメンバ関数calc(11a2)、クラスCのメンバ関数calc(11a3)がそれぞれ定義されている。更に、クラスBの仮想関数calc(11a2)は基底クラスAの仮想関数calc(11a1)を上書きし、クラスCの仮想関数calc(11a3)は基底クラスBの仮想関数calc(11a2)を上書きする。
【0102】
18行目から31行目まではクラスX、クラスY、クラスZのクラス定義である。クラスYおよびクラスZは、それぞれクラスXを継承している。20行目、25行目、30行目のvirtual指定子が指定されたメンバ関数は仮想関数であることを表しており、クラスXのメンバ関数calc(11a4)、クラスYのメンバ関数calc(11a5)、クラスZのメンバ関数calc(11a6)がそれぞれ定義されている。クラスYの仮想関数calc(11a5)は基底クラスXの仮想関数calc(11a4)を上書きし、クラスZの仮想関数calc(11a6)は基底クラスXの仮想関数calc(11a4)を上書きする。
【0103】
32行目から35行目までは大域関数gの関数定義(11a7)を表しており、33行目および34行目でそれぞれ、クラスAへのポインタ変数に対する仮想関数calcの呼び出しと、クラスXへのポインタ変数に対する仮想関数calcの呼び出しが記述されている。
【0104】
次に、クラス解析ステップS240の処理について、図11(a)に示すプログラムに適用した場合を例にして図8を参照しながら説明する。
【0105】
クラス解析ステップS240の処理は、記憶部D220に格納されている全ての構文解析データのうちクラス定義のデータに対してd1からd10までのステップによって行われる。以下記号の順に説明していく。
【0106】
ステップd1では、記憶部D220に格納されている全てのクラスT1について、ループ1を繰り返す。
【0107】
ステップd2では、クラスT1が基底クラスT2を持つかどうかを判定する。基底クラスT2を持つ場合はYesと判定しステップd3へと処理を移行し、そうでない場合はNoと判定しステップd4へと処理を移行する。図11(a)のプログラムではクラスB、クラスC、クラスY、クラスZについては、それぞれ基底クラスを持つため、ステップd2でYesと判定され、クラスA、クラスXは基底クラスを持たないため、Noと判定される。
【0108】
ステップd3では、クラスT1をクラスT2の属するクラスツリーに追加し、クラスT2の派生クラスとして設定し、クラスツリーを更新する。図11(a)のプログラムでは、クラスBに関しては、基底クラスであるクラスAの属するクラスツリーにクラスBを追加し、クラスAの派生クラスとして設定する。同様にクラスCに関しては、クラスBの属するクラスツリーに追加し、クラスBの派生クラスと設定し、クラスY、クラスZに関しては、それぞれクラスXの属するクラスツリーに追加し、クラスXの派生クラスと設定する。
【0109】
ステップd4では、クラスT1の属するクラスツリーを新たに生成し、クラスT1をクラスツリーに追加する。図11(a)のプログラムでは、クラスA、クラスXに関してそれぞれクラスツリーを新たに生成し、クラスA、クラスXを追加する。
【0110】
ステップd5では、クラスT1の全ての仮想関数F1について、ループ2を繰り返す。
【0111】
ステップd6では、クラスT1が基底クラスT2を持ち、かつ仮想関数F1が基底クラスT2の仮想関数F2を上書きするかどうかを判定する。仮想関数F1が基底クラスの仮想関数F2を上書きする場合はYesと判定しステップd7へと処理を移行し、そうでない場合はNoと判定しステップd8へと処理を移行する。図11(a)のプログラムでは、クラスBに関しては、基底クラスとしてクラスAを持ち、クラスBの仮想関数calc(11a2)がクラスAの仮想関数calc(11a1)を上書きするので、ステップd6でYesと判定される。同様にクラスCの仮想関数calc(11a3)、クラスYの仮想関数calc(11a5)、クラスZの仮想関数calc(11a6)でもYesと判定される。クラスAおよびクラスXの仮想関数calcに関しては、クラスAおよびクラスXが基底クラスを持たないため、Noと判定される。
【0112】
ステップd7では、仮想関数F2の属する仮想関数集合に仮想関数F1を追加する。図11(a)のプログラムでは、クラスBの仮想関数calcに関しては、クラスAの仮想関数calc(11a1)の属する仮想関数集合に追加し、クラスCの仮想関数calcに関しては、クラスBの仮想関数calc(11a2)の属する仮想関数集合に追加する。同様に、クラスYの仮想関数calc(11a5)、クラスZの仮想関数calc(11a6)に関しては、共にクラスXの仮想関数calc(11a4)の属する仮想関数集合に追加する。
【0113】
ステップd8では、仮想関数F1の属する仮想関数集合を新たに生成し、仮想関数F1を仮想関数集合に追加する。図11(a)のプログラムでは、クラスAの仮想関数calcおよびクラスXの仮想関数calcに関しては、それぞれ新たに仮想関数集合を生成して仮想関数を追加する。
【0114】
ステップd9では、ステップd5に処理を移行し、ループ2の処理を繰り返す。
【0115】
ステップd10では、ステップd1に処理を移行し、ループ1の処理を繰り返す。
【0116】
クラス解析ステップS240の処理を図11(a)に示すプログラムに適用した場合、クラス/変数/メンバ情報記憶部D240のクラス情報記憶部D242の内容は図12(b)に示すようになる。
【0117】
次に、並列化実行ステップS250の処理について、図11(a)に示すプログラムの大域関数g(11a7)について適用した場合を例にして図11(b)に示した中間コードを使って、図9を参照しながら説明する。
【0118】
並列化実行ステップS250の処理は、記憶部D220に格納されている全ての構文解析データのうち関数定義のデータに対してe1からe16までのステップによって行われる。以下記号の順に説明していく。
【0119】
ステップe1では、記憶部D220に格納されている関数定義F1内の全ての文について定義/参照文情報を作成する。定義/参照文情報の作成処理の詳細については後述する。ステップe1によって、関数定義F1内の各文において定義/参照される静的/非静的メンバ、定義/参照される大域変数、および非静的メンバ関数の起動オブジェクトを得る。図11(b)の大域関数gの中間コードに対する定義/参照文情報は図13(a)のようになる。
【0120】
ステップe2では、関数定義F1内の全ての文1について、ループ1を繰り返す。
【0121】
ステップe3では、定義/参照文情報から文1に関する情報を抽出し、文1で定義/参照される静的/非静的メンバ、定義/参照される大域変数および非静的メンバ関数の起動オブジェクトM1の情報を取得する。図11(b)の中間コード1では、図13(a)の文情報より、参照非静的メンバとしてクラスBの非静的メンバbとクラスCの非静的メンバcを得るとともに、定義静的メンバおよび参照静的メンバとしてクラスAの静的メンバaを得、起動オブジェクトM1としてpa1を得る。
【0122】
ステップe4では、文1以降の全ての文2について、ループ2を繰り返す。
【0123】
ステップe5では、定義/参照文情報から文2に関する情報を抽出し、文2で定義/参照される静的/非静的メンバ、定義/参照される大域変数および非静的メンバ関数の起動オブジェクトM2の情報を取得する。図11(b)の中間コード2では、図13(a)の文情報より、参照非静的メンバとしてクラスYの非静的メンバyとクラスZの非静的メンバz、定義大域変数および参照大域変数としてval、起動オブジェクトM2としてpx1を得る。
【0124】
ステップe6では、クラス/変数/メンバ情報記憶部D240のクラス情報記憶部D242の内容を参照し、起動オブジェクトM1とM2のクラスが同一のクラスツリーに属するかどうかを判定する。同一のクラスツリーに属する場合はYesと判定しステップe7へと処理を移行し、そうでない場合はNoと判定しステップe11へと処理を移行する。図11(b)で文1が中間コード1で文2が中間コード2の場合では、図13(a)の文情報より、中間コード1と中間コード2の起動オブジェクトpa1、px1について判定する。pa1およびpx1の型はポインタ型であるので、ポインタが指している型、すなわち、pa1ではクラスA、px1ではクラスXについて調べる。クラスAとクラスXが同一のクラスツリーに属するかどうかを図12(b)のクラスツリー集合を検索して判定した場合、同一のクラスツリーには属さないため、ステップe6ではNoと判定される。
【0125】
一方、文1が中間コード1で文2が中間コード4の場合では、図13(a)の文情報より、起動オブジェクトはそれぞれpa1、pa2であり、共にポインタ型であるので、ポインタが指している型について調べる。pa1、pa2が指している型は共にクラスAであるため、同一のクラスツリーに属し、ステップe6ではYesと判定される。
【0126】
ステップe7では、文1の起動オブジェクトM1の定義静的/非静的メンバを文2で定義あるいは参照するかどうかを判定する。定義あるいは参照する場合はYesと判定しステップe8へと処理を移行し、そうでない場合はNoと判定しステップe9へと処理を移行する。図11(b)の中間コード1が文1、中間コード4が文2である場合では、図13(a)の文情報より、文1である中間コード1の起動オブジェクトM1がpa1であり、定義静的メンバがクラスAのメンバaであるので、文2である中間コード4でpa1のメンバaを定義あるいは参照するかどうかを判定する。中間コード4でクラスAのメンバaを定義/参照しているので、ステップe7ではYesと判定される。
【0127】
なお、中間コード1と中間コード4の起動オブジェクトは共にポインタ型であるため、起動オブジェクトが同一かどうかは不明であるが、中間コード1と中間コード4では共に非静的メンバは参照のみであるので影響はない。
【0128】
同様に文1が中間コード4の場合では、図13(a)の文情報より、起動オブジェクトM1がpx2であり、定義静的メンバがクラスAのメンバaであるが、文2が中間コード5、6のいずれの場合でもメンバaを定義/参照していないため、ステップe7ではNoと判定される。
【0129】
ステップe8では、文1と文2の間で実行順序の関係を設定する。この順序関係は文1を実行した後で文2を実行しなければならないことを表す。図11(b)の中間コード1と中間コード4との実行順序が設定される。
【0130】
ステップe9では、文1の起動オブジェクトM1の参照静的/非静的メンバを文2で定義するかどうかを判定する。定義する場合はYesと判定しステップe10へと処理を移行し、そうでない場合はNoと判定しステップe11へと処理を移行する。図11(b)の中間コード1が文1、中間コード4が文2である場合では、図13(a)の文情報より、中間コード1の起動オブジェクトM1がpa1であり参照静的メンバがクラスAのメンバaであるので、中間コード4でpa1のメンバaを定義するかどうかを判定する。中間コード4でクラスAのメンバaを定義しているので、ステップe9ではYesと判定される。
【0131】
なお、中間コード1と中間コード4の起動オブジェクトは共にポインタ型であるため、起動オブジェクトが同一かどうかは不明であるが、中間コード1と中間コード4では共に非静的メンバは参照のみであるので影響はない。
【0132】
ステップe10では、ステップe8と同様に文1と文2の間で実行順序の関係を設定する。図11(b)の中間コード1と中間コード4との実行順序が設定される。
【0133】
ステップe11では、文1で定義する大域変数を文2で定義あるいは参照するかどうかを判定する。定義あるいは参照する場合はYesと判定しステップe12へと処理を移行し、そうでない場合はNoと判定しステップe13へと処理を移行する。図11(b)で文1が中間コード2、文2が中間コード3である場合では、図13(a)の文情報より、中間コード2で定義する大域変数がvalであり、中間コード3で大域変数valを定義しているので、ステップe11ではYesと判定される。同様に文1が中間コード2、文2が中間コード5の場合、文1が中間コード3、文2が中間コード5の場合もステップe11でYesと判定される。
【0134】
ステップe12では、ステップe8、ステップe10と同様に、文1と文2の間で実行順序の関係を設定する。図11(b)の中間コード2では、中間コード3との実行順序が設定される。同様に中間コード2と中間コード5との実行順序および中間コード3と中間コード5との実行順序が設定される。
【0135】
ステップe13では、文1で参照する大域変数を文2で定義するかどうかを判定する。定義する場合はYesと判定しステップe14へと処理を移行し、そうでない場合はNoと判定しステップe15へと処理を移行する。図11(b)で文1が中間コード2、文2が中間コード3である場合では、図13(a)の文情報より、中間コード2で参照する大域変数がvalであり、中間コード3で大域変数valを定義しているので、ステップe13ではYesと判定される。
【0136】
ステップe14では、ステップe8、ステップe10、ステップe12と同様に、文1と文2の間で実行順序の関係を設定する。図11(b)の中間コード2と中間コード3の間に実行順序が設定される。
【0137】
ステップe15では、ステップe4に処理を移行し、ループ2の処理を繰り返す。
【0138】
ステップe16では、ステップe2に処理を移行し、ループ1の処理を繰り返す。
【0139】
なお、クラスメンバ、大域変数以外の自動変数などの実行順序に関しては、通常の依存関係の解析により順序付けられる。通常の依存関係の解析については、本発明の主眼ではないため、詳細な説明は省略する。通常の依存関係の解析によって、局所変数の間の実行順序が設定され、中間コード1と中間コード3の実行順序、中間コード2と中間コード3の実行順序、中間コード4と中間コード6の実行順序、中間コード5と中間コード6の実行順序が設定される。
【0140】
次に、関数の定義/参照文情報作成ステップの処理について、図11(a)に示すプログラムの大域変数g(11a7)について適用した場合を例にして図11(b)に示した中間コードを使って、図10を参照しながら説明する。
【0141】
定義/参照文情報作成ステップの処理は、記憶部D220に格納されている全ての構文解析データのうち関数定義のデータに対してf1からf11までのステップによって行われる。以下記号の順に説明していく。
【0142】
ステップf1では、関数定義F1内の全ての文1について、ループ1を繰り返す。
【0143】
ステップf2では、文1が関数呼び出しを含む文であるかどうかを判定する。文1が関数呼び出しを含む場合はYesと判定しステップf3へと処理を移行し、そうでない場合はNoと判定しステップf9へと処理を移行する。図11(b)の中間コード1および4では、クラスAのメンバ関数calcの呼び出しを含んでいるため、ステップf2ではYesと判定される。また、中間コード2および5では、クラスXのメンバ関数calcの呼び出しを含んでいるため、Yesと判定される。図11(b)のその他の中間コードはNoと判定される。
【0144】
ステップf3では、文1に含まれている呼び出し関数F2がクラスのメンバ関数であるかどうかを判定する。関数F2がクラスのメンバ関数である場合はYesと判定しステップf4へと処理を移行し、そうでない場合はNoと判定しステップf8へと処理を移行する。図11(b)の中間コード1、2、4、5に関しては呼び出される関数が全てメンバ関数であるため、ステップf3でYesと判定される。
【0145】
ステップf4では、メンバ関数呼び出しの式から起動オブジェクトMを取得し、文情報に登録する。図11(b)の中間コード1、2、4、5に関しては、起動オブジェクトMは、それぞれpa1、px1、pa2、px2であるため、対応する文情報の起動オブジェクトの欄にそれぞれpa1、px1、pa2、px2を登録する。
【0146】
ステップf5では、起動オブジェクトMがポインタ型あるいはリファレンス型で、かつ関数F2が仮想関数であるかどうかを判定する。起動オブジェクトMがポインタ型あるいはリファレンス型で関数F2が仮想関数である場合はYesと判定しステップf6へと処理を移行し、そうでない場合はNoと判定しステップf7へと処理を移行する。図11(b)の中間コード1、2、4、5は起動オブジェクトがそれぞれpa1、px1、pa2、px2であり、全てポインタ型である。また、呼び出し関数はそれぞれ仮想関数であるため、図11(b)の中間コード1、2、4、5ではステップf5でYesと判定される。
【0147】
ステップf6では、クラス/変数/メンバ情報記憶部D240のクラス情報記憶部D242から仮想関数集合から関数F2が属する集合を取得し、その集合に含まれる全ての関数の定義/参照非静的メンバ、定義/参照静的メンバ、定義/参照大域変数、呼び出し関数の情報をクラス/変数/メンバ情報記憶部D240の変数/メンバ情報記憶部D241から取得し、文中で定義および参照される非静的メンバ、静的メンバおよび大域変数を計算し、文情報に登録する。図11(b)の中間コード2に関しては、クラスXの仮想関数calcが属する集合を仮想関数集合から取得し、集合VF2を得る。次に集合VF2に含まれる全ての関数、すなわち、X::calc、Y::calc、Z::calcに関する定義/参照非静的メンバ、定義/参照静的メンバ、定義/参照大域変数、呼び出し関数の情報を図12(a)より取得して文情報に登録する。X::calcでは参照大域変数に大域変数valを登録し、Y::calcでは参照非静的メンバにY::yを、定義大域変数に大域変数valを登録し、Z::calcでは参照非静的メンバにY::y、Z::zを、参照大域変数に大域変数valを登録する。その結果、図13(a)の中間コード2の文情報が得られる。図11(b)の中間コード1、4および5に関しても同様である。
【0148】
ステップf7では、クラス/変数/メンバ情報記憶部D240の変数/メンバ情報記憶部D241から関数F2の定義/参照非静的メンバ、定義/参照静的メンバ、定義/参照大域変数、呼び出し関数の情報を取得し、文中で定義および参照される非静的メンバ、静的メンバ、および大域変数を計算し、文情報に登録する。図11(b)の中間コードに関しては、ステップf5でNoと判定される場合がないため、ステップf7は実行されない。
【0149】
ステップf8では、クラス/変数/メンバ情報記憶部D240の変数/メンバ情報記憶部D241から関数F2の定義大域変数、参照大域変数、呼び出し関数の情報を取得し、文中で定義および参照される大域変数を計算し、文情報に登録する。図11(b)の中間コードでは、メンバ関数でない(クラスの中にない関数である)大域関数の呼び出しを含む中間コードを含まないため、いずれの中間コードでもステップf8は実行されない。
【0150】
ステップf9では、文1の中で関数呼び出し以外の式で定義および参照されている非静的メンバ、静的メンバを計算し、文情報に登録する。図11(b)の中間コード1から中間コード6では、関数呼び出し以外の式で定義および参照されているメンバは存在しないため、中間コード1から中間コード6の文情報の定義メンバおよび参照メンバの欄には何も登録されない。図11(a)の4行目のクラスAのメンバ関数calcの関数定義の中間コードの場合では、静的メンバaを参照しているのでメンバ関数calc(11a1)の中間コードに対する文情報には参照静的メンバの欄にはメンバaが登録される。なお、クラスAのメンバ関数calc(11a1)の関数定義の中間コードは図示していない。
【0151】
ステップf10では、文1の中で関数呼び出し以外の式で定義および参照されている大域変数を計算し、文情報に登録する。図11(b)の中間コード3では、関数呼び出し以外の式で大域変数valが定義されているため、中間コード3の定義大域変数の欄に大域変数valを登録する。
【0152】
ステップf11では、ステップf1に処理を移行し、ループ1の処理を繰り返す。
【0153】
定義/参照文情報作成ステップの処理を大域関数gに対して適用した結果、図13(a)に示すような文情報が得られる。
【0154】
並列化実行ステップS250の処理を大域関数gに対して適用した結果、大域関数gの中間コード1から6までの実行順序の関係を有向グラフで表すと、図13(b)に示すようになる。中間コード1と中間コード2、および中間コード4と中間コード5は実行順序に関する依存関係は存在しないため、それぞれ並列して実行することが可能であると判断でき、大域関数gの実行ステップ数は、中間コードの実行ステップ数で表すと4ステップで実行することが可能である。大域関数gの中間コードを従来技術の方法で並列化を行うと、図13(c)に示すようにクラスメンバに対応していないため、いずれの中間コードも並列に実行することができないため、6ステップ要することになる。
【0155】
図13(b)と図13(c)との比較で明かなように、本実施の形態によれば、複数のクラスについて、各クラス定義でクラスどうしの継承関係がある場合において、クラスメンバの参照、定義およびクラス定義の解析情報を考慮して並列化を行うため、従来技術に比べて、各文の並列化をより効率良く遂行することができる。
【0156】
【発明の効果】
以上のように、本発明のプログラム並列化方式によれば、入力プログラム中のクラスメンバの情報を解析するクラスメンバ解析ステップと、解析された情報を用いて並列化を行う並列化ステップを備えたものであり、クラスメンバの情報を考慮して、効率の良い並列化を行うことができる。
【0157】
また、メンバ参照定義解析ステップ、並列化ステップを備えることにより、クラスメンバの参照および定義の関係を用いてプログラムの動作を変えることなく、メンバ関数呼び出しを含めた文を効率良く並列化することができる。
【0158】
また、非静的メンバ参照定義解析ステップ、大域変数参照定義解析ステップ、メンバ関数呼び出し並列化ステップおよび大域関数呼び出し並列化ステップを備えることにより、クラスの非静的メンバおよび大域変数を考慮した解析をすることができ、プログラムの動作を変えることなく、メンバ関数呼び出しおよび大域関数呼び出しを含めた文をより効率良く並列化することができる。
【0159】
また、静的メンバ参照定義解析ステップ、大域変数参照定義解析ステップ、メンバ関数呼び出し並列化ステップおよび大域関数呼び出し並列化ステップを備えることにより、クラスの静的メンバおよび大域変数を考慮した解析をすることができ、プログラムの動作を変えることなく、メンバ関数呼び出しおよび大域関数呼び出しを含めた文をより効率良く並列化することができる。
【0160】
また、別態様の本発明によれば、入力プログラム中のクラスメンバの参照および定義の情報を解析するメンバ参照定義解析ステップと、入力プログラムに記載されているクラス定義を解析するクラス解析ステップと、メンバ参照定義解析ステップおよびクラス解析ステップにより解析された情報を用いて並列化を行う並列化ステップを備えることにより、クラスメンバの参照、定義およびクラス定義の解析情報を考慮した並列化を行うことができ、より効率良く並列化することができる。
【0161】
また、非静的メンバ参照定義解析ステップ、大域変数参照定義解析ステップ、メンバ関数呼び出し並列化ステップおよび大域関数呼び出し並列化ステップを備えることにより、クラスの非静的メンバと大域変数およびクラス定義の解析情報を考慮した並列化を行うことができ、プログラムの動作を変えることなく、メンバ関数呼び出しおよび大域関数呼び出しを含めた文をより効率良く並列化することができる。
【0162】
また、静的メンバ参照定義解析ステップ、大域変数参照定義解析ステップ、メンバ関数呼び出し並列化ステップおよび大域関数呼び出し並列化ステップを備えることにより、クラスの静的メンバと大域変数およびクラス定義の解析情報を考慮した並列化行うことができ、プログラムの動作を変えることなく、メンバ関数呼び出しおよび大域関数呼び出しを含めた文をより効率良く並列化することができる。
【0163】
また、クラスの継承関係を解析するクラスツリー解析ステップを備え、継承関係にないクラスの1つあるいは複数のメンバ関数呼び出しの間に実行順序の依存がないとして並列化を行うことにより、クラスの継承関係を解析してクラスツリーを作成することにより、同一クラスツリーに属さないクラスのメンバ関数呼び出しは並列実行の候補と判定することができ、静的/非静的クラスメンバの関係を解析する必要がないため、処理の高速化を図ることができる。
【0164】
また、仮想関数解析ステップおよび仮想関数呼び出し並列化ステップを備えることにより、仮想関数呼び出しで呼び出される可能性のある全ての関数を考慮した並列化を行うことができ、より精度の高い並列化を行うことができる。
【0165】
また、プログラム並列化用の記録媒体についての本発明によれば、クラスメンバの情報を考慮して、効率の良い並列化を行うことができる。あるいは、クラスメンバの参照、定義およびクラス定義の解析情報を考慮した並列化を行うことができ、より効率良く並列化することができる。
【図面の簡単な説明】
【図1】本発明の第一の実施形態におけるプログラム並列化方式の構成図
【図2】第一の実施形態における変数/メンバ解析ステップの処理を示すフローチャート
【図3】第一の実施形態における並列化実行ステップの処理を示すフローチャート
【図4】第一の実施形態における定義/参照文情報作成ステップの処理を示すフローチャート
【図5】第一の実施形態において、(a)プログラム記憶部に格納されているプログラムを示す図、(b)記憶部に格納されている大域関数に関する中間コードを示す図、および(c)変数/メンバ情報記憶部に格納されている、関数毎の定義/参照メンバ、定義/参照大域変数および呼び出し関数の一覧を示す図
【図6】第一の実施形態において、(a)定義/参照情報作成ステップの処理を大域関数に適用した結果の文毎の定義/参照メンバ、定義/参照大域変数および起動オブジェクトの一覧を示す図、(b)プログラム並列化方式実行順序の依存関係を示す図、および(c)従来技術のプログラム並列化方式実行順序の依存関係を示す図
【図7】本発明の第二の実施形態におけるプログラム並列化方式の構成図
【図8】第二の実施形態におけるクラス解析ステップの処理を示すフローチャート
【図9】第二の実施形態における並列化実行ステップの処理を示すフローチャート
【図10】第二の実施形態における定義/参照文情報作成ステップの処理を示すフローチャート
【図11】第二の実施形態において、(a)プログラム記憶部に格納されているプログラムを示す図、(b)記憶部に格納されている大域関数に関する中間コードを示す図
【図12】第二の実施形態において、(a)変数/メンバ情報記憶部に格納されている、関数毎の定義/参照メンバ、定義/参照大域変数および呼び出し関数の一覧を示す図、(b)クラス情報記憶部に格納されているクラスツリー集合、仮想関数集合を示す図
【図13】第二の実施形態において、(a)定義/参照情報作成ステップの処理を大域関数に適用した結果の文毎の定義/参照メンバ、定義/参照大域変数および起動オブジェクトの一覧を示す図、(b)プログラム並列化方式実行順序の依存関係を示す図、および(c)従来技術のプログラム並列化方式実行順序の依存関係を示す図
【符号の説明】
S110 入力ステップ
S120 構文解析ステップ
S130 変数/メンバ解析ステップ
S140 並列化実行ステップ
S150 最適化ステップ
S160 コード生成ステップ
S210 入力ステップ
S220 構文解析ステップ
S230 変数/メンバ解析ステップ
S240 クラス解析ステップ
S250 並列化実行ステップ
S260 最適化ステップ
S270 コード生成ステップ
D100 プログラム記憶部
D120 記憶部
D130 変数/メンバ情報記憶部
D160 生成コード記憶部
D220 記憶部
D240 クラス/変数/メンバ情報記憶部
D241 変数/メンバ情報記憶部
D242 クラス情報記憶部
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a program parallelization method for converting a program sequentially described in an object-oriented language into a target program that can be executed in parallel.
[0002]
[Prior art]
In recent years, the demand for higher speed and higher performance in the computer field has been increasing, and efforts have been made actively to improve the processing performance per unit processing time by increasing the speed of processors and parallelizing programs. .
[0003]
Parallelization of programs is roughly classified into three granularities: fine, medium, and coarse. Fine grain is parallelism at the instruction level such as VLIW (VeryLong Instruction Word), medium grain is parallelism at the loop iteration level such as vectorization, and coarse grain is parallelism at the subroutine or block level. is there.
[0004]
Conventionally, fine-grained and medium-grained parallelization has been mainly performed, but as the demand for higher performance increases, attention has been paid to coarse-grained parallelization, that is, subroutine and block-level optimization. .
[0005]
As a conventional parallelization method for performing parallelization including a subroutine, there is Japanese Patent Application Laid-Open No. 5-143357, entitled "Program Automatic Parallelization Method". This conventional technique is configured by a two-stage pass, detects a global variable that has been referenced and assigned inside a function in a first pass, and creates information on the global variable used in the function. Next, when parallelization is performed in the second pass, when a function call is detected, the function call is included without changing the operation of the program by referring to the information of the global variable created in the first pass. Parallelization.
[0006]
[Problems to be solved by the invention]
With the recent increase in the scale of programs, attention has been paid to program development using an object-oriented language in order to increase the efficiency of program development and reuse, or to improve the maintainability of programs. A typical example of an object-oriented language is the C ++ language.
[0007]
In program development using an object-oriented language, unlike the conventional program development using a procedural language, the relationship between objects and methods representing operations on the objects becomes important.
[0008]
However, in the above-mentioned Japanese Patent Application Laid-Open No. 5-143357, "Program Automatic Parallelizing Method", the relationship between global variables is considered, but the relationship between objects and methods is not considered.
[0009]
For example, consider the operation for the program shown in FIG. The program in FIG. 5A is a program described in the object-oriented language C ++. The first to ninth lines in FIG. 5A represent the definition of the class X. The second line is a declaration of a non-static data member x, and the third line is a declaration of a static data member y. Non-static data members are members that each class object has, and static data members are members that exist only once in a class.
[0010]
The fifth line is a declaration of a default constructor of class X, the sixth and seventh lines are declarations of non-static member functions, and the eighth line is declarations of static member functions. A non-static member function and a static member function may be collectively called a member function. The default constructor on line 5 is also one of the member functions. Lines 10 to 12 define the function definition of the non-static member function calc of class X (5a1), lines 13 to 15 define the function definition of the non-static member function init of class X (5a2), Lines 16 to 18 are the function definition of the default constructor of class X (5a3), and lines 19 to 21 are the function definition of the static member function set of class X (5a4). Lines 23 to 28 represent the function definition (5a5) of the global function g.
[0011]
In the global function g, the default constructor call of class X is on line 24, the static member function call of class X is on line 25, and the non-static member function call of class X is on line 26. An assignment statement to a is described. In the default constructor call on line 24, a value is set for each of the members x of obj1 and obj2 by calling the non-static member function init. Also, the non-static member function call on line 26 refers to the member x of obj1 and obj2, respectively.
[0012]
The two default constructor calls on line 24 are for setting and referencing member values for different objects of obj1 and obj2, and therefore may be executed in parallel. Also, the two non-static member function calls on line 26 are for setting and referencing member values for objects different from obj1 and obj2, and therefore may be executed in parallel. However, the call to the default constructor of obj1 on line 24 and the call to the non-static member function of obj1 on line 26 are for setting and referencing the value of a member for the same object, and therefore must not be executed in parallel.
[0013]
However, the conventional parallelization method interprets that there is no global variable in the non-static member function of class X, and calls the default constructor of obj1 on line 24 and the non-static member function of obj1 on line 26. Calls are erroneously analyzed as being able to be executed in parallel.
[0014]
In general, the argument of a non-static member function implicitly has a pointer type to the class to which the member belongs, and when the actual non-static member function is called, the address of the activation object is implicitly added. call. In a function having a pointer type as an argument, since the object pointed to by the pointer is generally unknown, it cannot be determined that the function call can be executed in parallel with other processing. Therefore, if all non-static member function calls having a pointer type as an argument cannot be executed in parallel, all non-static member function calls on lines 24 and 26 in FIG. 5A can be executed in parallel. Disappears.
[0015]
[Means for Solving the Problems]
The present invention takes the following measures to solve the above-mentioned problems.
[0016]
As a first solution, the present invention is a program parallelization method for inputting a program described in an object-oriented language and outputting a target program that can be executed in parallel, and is further configured as follows. It is characterized by the following. That is, the configuration includes a class member analysis step of analyzing information of class members described in the input program, and a parallelization step of performing parallelization using the information analyzed by the class member analysis step. .
[0017]
According to this configuration, in the class member analysis step, analysis is performed on the class members in the input program, and in the parallelization step, each statement in the function is required based on the information on the analysis result (class member analysis information). Therefore, the parallelization can be efficiently performed. That is, since the parallelization is performed in consideration of the class member analysis information of the program sequentially described in the object-oriented language, the conversion into the target program that can be executed in parallel can be efficiently performed.
[0018]
Considering the above configuration at a more specific level, the following can be said. That is, in the above-described configuration, the class member analyzing step includes a member reference definition analyzing step of analyzing reference and definition information of the class member, while the parallelizing step includes setting an activation object of the member function call. The method includes a member function call parallelizing step of analyzing and parallelizing each statement including the member function call.
[0019]
According to this configuration, it is possible to efficiently parallelize a statement including a member function call without changing the operation of the program using the relation between the reference and the definition of the class member.
[0020]
Considering the above-mentioned member reference definition analysis step and parallelization step at a more specific level, the following configuration can be cited as a preferred embodiment. That is, the member reference definition analysis step includes a non-static member reference definition analysis step of analyzing reference and definition information of a non-static member of a class, and a global variable reference analysis step of analyzing reference and definition information of a global variable. A definition function analysis step, wherein the parallelization step analyzes a startup object of the member function call, and performs a parallelization for each statement including the member function call; A global function call parallelizing step for parallelizing each statement including a function call is provided.
[0021]
According to this configuration, it is possible to perform analysis in consideration of non-static members that are members existing for each class and global variables that are variables that can be commonly referred to and assigned from a plurality of functions. Can be performed more efficiently without changing the statement, including the parallelization of statements including member function calls and global function calls.
[0022]
Further, as another preferred mode on a more specific level regarding the member reference definition analysis step and the parallelization step, the following configuration can be mentioned. That is, the member reference definition analysis step includes a static member reference definition analysis step of analyzing reference and definition information of a static member of a class, and a global variable reference definition analysis step of analyzing information of a global variable reference and definition. A parallelizing step for analyzing the activation object of the member function call and performing parallelization for each statement including the member function call; and a global function call. Is included in a global function call parallelizing step for performing parallelization on each statement including. In contrast to the above, instead of the non-static member, which is a member existing for each class, a static member, which is a member having only one in each class, is targeted, and accordingly, a non-static member reference The point is that it is described as a static member reference definition analysis step instead of the definition analysis step.
[0023]
According to this configuration, it is possible to perform analysis in consideration of a static member, which is a single member in each class, and a global variable, which is a variable that can be referenced and assigned in common from a plurality of functions. Parallelization of statements including member function calls and global function calls can be performed more efficiently without changing the operation.
[0024]
As a second solving means, the present invention is a program parallelization method for inputting a program described in an object-oriented language and outputting a target program which can be executed in parallel, and further configured as follows. It is characterized by the following. That is, a member reference definition analyzing step of analyzing reference and definition information of class members described in the input program, a class analyzing step of analyzing class definitions described in the input program, and the member reference definition An analysis step and a parallelization step of performing parallelization using the information analyzed by the class analysis step are provided.
[0025]
According to this configuration, in the member reference definition analysis step, analysis is performed on the reference and definition of the class members in the input program, and in the class analysis step, the class definition described in the input program is analyzed, and in the parallelization step, Since necessary program parallelization is performed for each statement in the function based on the information on the analysis result, the parallelization can be performed efficiently. In other words, when there is an inheritance relationship between classes in each class definition for a plurality of classes, parallelization is performed in consideration of the reference and definition of the class members of the program sequentially described in the object-oriented language and the analysis information of the class definition. Therefore, conversion to a target program that can be executed in parallel can be efficiently performed. Note that inheritance is a mechanism for extending a certain class (base class) and creating another class (derived class).
[0026]
Considering the above-mentioned member reference definition analysis step and parallelization step at a more specific level, the following configuration can be cited as a preferred embodiment. That is, the member reference definition analysis step includes a non-static member reference definition analysis step of analyzing reference and definition information of a non-static member of a class, and a global variable reference analysis step of analyzing reference and definition information of a global variable. A definition function analysis step, wherein the parallelization step analyzes a startup object of the member function call, and performs a parallelization on each statement including the member function call; A global function call parallelizing step for parallelizing each statement including the global function call is provided.
[0027]
According to this configuration, parallelization can be performed in consideration of non-static members of classes, analysis information of global variables and class definitions, and member function calls and global function calls can be included without changing the operation of the program. Statement parallelization can be performed more efficiently.
[0028]
Further, as another preferred mode on a more specific level regarding the member reference definition analysis step and the parallelization step, the following configuration can be mentioned. That is, the member reference definition analysis step includes a static member reference definition analysis step of analyzing reference and definition information of a static member of a class, and a global variable reference definition analysis step of analyzing information of a global variable reference and definition. A parallelizing step for analyzing the activation object of the member function call and performing parallelization for each statement including the member function call; and a global function call. Is included in a global function call parallelizing step for performing parallelization on each statement including. In contrast to the above, instead of the non-static member, which is a member existing for each class, a static member, which is a member having only one in each class, is targeted, and accordingly, a non-static member reference The point is that it is described as a static member reference definition analysis step instead of the definition analysis step.
[0029]
According to this configuration, parallelization is performed in consideration of analysis information of a static member, which is a single member in each class, and a global variable, which is a variable that can be commonly referred to and assigned by a plurality of functions, and class definition. Therefore, parallelization of statements including member function calls and global function calls can be performed more efficiently without changing the operation of the program.
[0030]
In addition, the following configuration can be cited as a preferable mode on a more specific level with respect to the class analysis step and the parallelization step. That is, while the class analyzing step includes a class tree analyzing step of analyzing a class inheritance relationship, the parallelizing step includes a step of calling one or more member functions of a class having no inheritance relationship. That is, parallelization is performed assuming that there is no dependence on the execution order.
[0031]
According to this configuration, a class tree is created by analyzing the inheritance relationship of a class (a mechanism for extending a class and generating another class), so that member function calls of classes not belonging to the same class tree can be performed in parallel. Since it can be determined as a candidate for execution and there is no need to analyze the relationship between static / non-static class members, the processing can be sped up.
[0032]
Further, as another preferable mode at a more specific level of the class analysis step and the parallelization step, the following configuration can be mentioned. That is, while the class analysis step includes a virtual function analysis step of analyzing a set of functions that may be called by a virtual function call, the parallelization step is performed by the virtual function call step. And a virtual function call parallelizing step of performing parallelization using the obtained information. A virtual function is a function that operates as a function of a derived class even when the derived class is indicated by a pointer of a base class.
[0033]
According to this configuration, parallelization can be performed in consideration of all functions that may be called by a virtual function call, and more accurate parallelization can be performed.
[0034]
As described above, some solutions for the program parallelization method have been described. However, from another viewpoint, the present invention can be regarded as a computer-readable recording medium for program parallelization. That is, the present invention for a recording medium is a computer-readable recording medium that records a program for inputting a program described in an object-oriented language and outputting a target program that can be executed in parallel, and the program described in the input program. A class member analyzing step of analyzing the information of the class members being performed, and a parallelizing step of performing parallelization using the information analyzed by the class member analyzing step.
[0035]
According to this recording medium, the class members in the input program are analyzed in the class member analysis step, and each statement in the function is analyzed in the parallelization step based on the information of the analysis result (class member analysis information). Since the required program parallelization is performed, the parallelization can be performed efficiently. That is, since the parallelization is performed in consideration of the class member analysis information of the program sequentially described in the object-oriented language, the conversion into the target program that can be executed in parallel can be efficiently performed.
[0036]
In another aspect, the present invention relates to a computer-readable recording medium, which is a computer-readable recording medium that stores a program that inputs a program described in an object-oriented language and outputs a target program that can be executed in parallel. A member reference definition analyzing step of analyzing reference and definition information of class members described in the input program; a class analyzing step of analyzing class definitions described in the input program; And a parallelization step of performing parallelization using information analyzed by the class analysis step.
[0037]
According to this recording medium, in the member reference definition analysis step, reference and definition of class members in the input program are analyzed, and in the class analysis step, the class definition described in the input program is analyzed, and the parallelization step is performed. In the above, the required program parallelization is performed for each statement in the function based on the information of the analysis result, so that the parallelization can be performed efficiently. In other words, when there is an inheritance relationship between classes in each class definition for a plurality of classes, parallelization is performed in consideration of the reference and definition of the class members of the program sequentially described in the object-oriented language and the analysis information of the class definition. Therefore, conversion to a target program that can be executed in parallel can be efficiently performed.
[0038]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, an example of an embodiment of a program parallelization method of the present invention will be described with reference to the drawings.
[0039]
(First embodiment)
FIG. 1 shows a configuration diagram of a program parallelization method according to the first embodiment of the present invention.
[0040]
In FIG. 1, this program parallelization step includes an input step S110, a syntax analysis step S120, a storage unit D120, a variable / member analysis step S130, a variable / member information storage unit D130, a parallelization execution step S140, an optimization step S150, It comprises a code generation step S160.
[0041]
The program storage unit D100 holds a program for performing parallelization.
[0042]
In the input step S110, all programs stored in the program storage unit D100 are sequentially input and passed to the syntax analysis step S120.
[0043]
The syntax analysis step S120 analyzes the syntax of the program received from the input step S110, generates a symbol table, generates a syntax tree, and the like, and stores the analysis result in the storage unit D120.
[0044]
The storage unit D120 receives the analysis result from the syntax analysis step S120 and stores it.
[0045]
The variable / member analysis step S130 extracts information on global variables and class members stored in the storage unit D120, analyzes information on global variables and class members defined and referenced in the function, and analyzes results. Is stored in the variable / member information storage unit D130.
[0046]
The variable / member information storage unit D130 receives the analysis result from the variable / member analysis step S130 and stores it.
[0047]
The parallelization execution step S140 receives the syntax tree from the storage unit D120, and performs parallelization on each statement in the function. At this time, parallelization is performed using global variable and class member definition / reference information stored in the variable / member information storage unit D130.
[0048]
The optimization step S150 performs various optimizations on the intermediate code generated in the parallel execution step S140.
[0049]
In the code generation step S160, the intermediate code optimized in the optimization step S150 is converted into a target code and output to the generated code storage unit D160.
[0050]
The generated code storage unit D160 stores the target code converted in the program parallelizing steps from S110 to S160.
[0051]
It should be noted that the input step S110, the syntax analysis step S120, the optimization step S150, and the code generation step S160 are not the focus of the present invention, and thus detailed descriptions thereof are omitted.
[0052]
Next, the process of the variable / member analysis step S130 will be described with reference to FIG. 2 by taking as an example a case where the process is applied to the program shown in FIG.
[0053]
FIG. 5A is a source program example 1 described in the C ++ language. FIG. 5B is an intermediate code of the analysis result of the syntax analysis step S120 for the global function g (5a5) in FIG. 5A. The intermediate code of the analysis result of the statement on the 24th line of the global function g in FIG. 5A is the intermediate code of 1 and 2 in FIG. 5B, and is the code of the default constructor call for obj1 and obj2. ing. The intermediate code of the analysis result of the statement on the 25th line is the intermediate code of 3 in FIG. 5B, which is the code for calling the static member function set of the class X. The intermediate code of the analysis result of the statement on the 26th line is the intermediate code of 4, 5 and 6 in FIG. 5B, and calls the non-static member function calc for obj1 and the non-static member function calc for obj2, respectively. It is a code for calling and setting an addition operation result to the external variable a. The intermediate code of the analysis result of the statement on the 27th line is the intermediate code of 7 in FIG. 5B, and is a code for setting a value for a variable for a return value.
[0054]
The process of the variable / member analysis step S130 is performed on the data of the function definition among all the syntax analysis data stored in the storage unit D120 by steps a1 to a9. The description will be made in the order of the symbols.
[0055]
In step a1, it is determined whether the function definition data stored in the storage unit D120 is related to a member function of a class. If it is a member function of the class, it is determined as Yes and the process proceeds to step a2. Otherwise, it is determined as No and the process proceeds to step a6. For the non-static member function calc (5a1) of FIG. 5A, the determination is Yes in step a1, and the determination is No for the global function g.
[0056]
In step a2, loop 1 is repeated for all statements in the function.
[0057]
In step a3, non-static members of the class defined and referenced in the sentence are registered in the variable / member information storage unit D130. Regarding the non-static member function init (5a2) in FIG. 5A, the non-static member x of the class X is defined in the statement on the 14th line. Is registered in x. As for the non-static member function calc (5a1), since the statement on the eleventh line refers to the non-static member x of the class X, x is registered in the reference non-static member of the function calc in step a3. I do.
[0058]
In step a4, the static members of the class defined and referenced in the sentence are registered in the variable / member information storage unit D130. Regarding the static member function set (5a4) shown in FIG. 5A, the statement on line 20 defines the static member y of the class X. Therefore, in step a4, y is added to the definition static member of the function set. register. As for the non-static member function calc (5a1), since the statement on the eleventh line refers to the static member y of the class X, y is registered in the reference static member of the function calc in step a4.
[0059]
In step a5, the process proceeds to step a2, and the process of loop 1 is repeated.
[0060]
In step a6, loop 2 is repeated for all statements in the function.
[0061]
In step a7, global variables defined and referenced in the sentence are registered in the variable / member information storage unit D130. Regarding the global function g (5a5) in FIG. 5A, since the global variable a is defined in the statement on the 26th line, a is registered in the definition global variable of the global function g in step a7. Further, since the global variable a is referred to in the statement on the 27th line, a is registered in the reference global variable of the global function g in step a7.
[0062]
In step a8, the function called in the statement is registered in the variable / member information storage unit D130. Regarding the global function g (5a5) in FIG. 5A, the default constructor X of the class X is described in the statement on the 24th line, the static member function set of the class X is described in the statement on the 25th line, and the statement on the 26th line. Calls the non-static member function calc of the class X, so that X, set, and calc are registered in the calling function.
[0063]
In step a9, the process proceeds to step a6, and the process of loop 2 is repeated.
[0064]
When the processing of the variable / member analysis step S130 is applied to the program shown in FIG. 5A, the contents of the variable / member information storage unit D130 are as shown in FIG.
[0065]
Next, the processing of the parallelization execution step S140 will be described by using an intermediate code shown in FIG. 5B by taking as an example a case where the processing is applied to the global function g (5a5) of the program shown in FIG. 3 will be described.
[0066]
The process of the parallel execution step S140 is performed on the data of the function definition among all the syntax analysis data stored in the storage unit D120 by steps b1 to b12. The description will be made in the order of the symbols.
[0067]
In step b1, definition / reference statement information is created for all statements in the function definition F1 stored in the storage unit D120. Details of the definition / reference statement information creation processing will be described later. In step b1, a static / non-static member defined / referenced in each statement in the function definition F1, a global variable defined / referenced, and an activation object of a non-static member function are obtained. The definition / reference statement information for the intermediate code of the global function g in FIG. 5B is as shown in FIG.
[0068]
In step b2, loop 1 is repeated for all statements 1 in the function definition F1.
[0069]
In step b3, information on statement 1 is extracted from the definition / reference statement information, and the static / non-static member defined / referenced in statement 1, the global variable defined / referenced, and the activation object of the non-static member function Obtain M information. In the intermediate code 1 of FIG. 5B, a non-static member x of the class X is obtained as a definition non-static member, and obj1 is obtained as the activation object M.
[0070]
In step b4, it is determined whether or not a statement 2 that defines or refers to the definition static / non-static member of the activation object M of the statement 1 exists after the statement 1. If it exists, it is determined as Yes, and the process proceeds to Step b5; otherwise, it is determined as No, and the process proceeds to Step b6. In the intermediate code 1 of FIG. 5B, the activation object M is obj1, and the nonstatic member defined is the member x of the class X. Therefore, the activation object M is obj1 after the intermediate code 1, and the member x is Whether or not there is an intermediate code to be defined or referred to is determined by searching the sentence information of the global function g in FIG. As a result of searching the sentence information of FIG. 6A, since the activation object is obj1 in the intermediate code 4 and refers to the member x, it is determined to be Yes in step b4. Similarly, in the intermediate code 2, since the activation object M is obj2 and the definition non-static member is the member x of the class X, the activation object is obj2 in the intermediate code 5, and the member x is referred to. In step b4, it is determined as Yes. In the intermediate code 3, since the defined static member is the member y of the class X, the intermediate code 4 and 5 refer to the member y.
[0071]
In step b5, the relationship of the execution order between statement 1 and statement 2 is set. This order relationship indicates that statement 2 must be executed after statement 1 is executed. In the intermediate code 1 of FIG. 5B, the execution order with the intermediate code 4 is set. Similarly, the execution order of the intermediate codes 2 and 5, the execution order of the intermediate codes 3 and 4, and the execution order of the intermediate codes 3 and 5 are set.
[0072]
In step b6, it is determined whether or not a statement 2 defining a reference static / non-static member of the activation object M of the statement 1 exists after the statement 1. If it exists, it is determined as Yes, and the process proceeds to Step b7; otherwise, it is determined as No, and the process proceeds to Step b8. In the intermediate code 4 of FIG. 5B, since the activation object M is obj1 and the reference non-static member is the member x of the class X, the activation object M is obj1 after the intermediate code 4, and the member x is defined. It is determined by searching the sentence information of the global function g in FIG. As a result of searching the sentence information of FIG. 6A, the activation object is obj1 and there is no intermediate code defining the member x, so that it is determined as No in step b6.
[0073]
In step b7, the execution order relationship is set between statement 1 and statement 2 as in step b5.
[0074]
In step b8, it is determined whether or not there is a statement 2 that defines or refers to the global variable defined in statement 1 after statement 1. If it exists, it is determined as Yes, and the process proceeds to Step b9; otherwise, it is determined as No, and the process proceeds to Step b10. In the intermediate code 6 of FIG. 5B, since the global variable to be defined is a, it is determined whether or not there is an intermediate code that defines or refers to the global variable after the intermediate code 6 in the global code of FIG. The sentence information of the function g is searched and determined. As a result of searching the sentence information of FIG. 6A, the global variable a is referred to by the intermediate code 7, so that it is determined to be Yes in step b8.
[0075]
In step b9, the execution order relationship between statement 1 and statement 2 is set as in step b5 and step b7. In the intermediate code 3 of FIG. 5B, the execution order with the intermediate code 6 is set. Similarly, the execution order of the intermediate codes 6 and 7 is set.
[0076]
At step b10, it is determined whether or not a sentence 2 defining a global variable referred to by the sentence 1 exists after the sentence 1. If it exists, it is determined as Yes and the process proceeds to step b11. Otherwise, it is determined as No and the process proceeds to step b12. In the intermediate code 3 of FIG. 5B, since the global variable to be referred to is a, it is determined whether there is an intermediate code that defines the global variable after the intermediate code 3 or not. Is determined by searching for sentence information. As a result of searching the sentence information of FIG. 6A, since the global variable a is defined by the intermediate code 6, it is determined to be Yes in step b10.
[0077]
In step b11, the execution order relationship is set between statement 1 and statement 2, as in step b9, step b5, and step b7. The execution order is set between the intermediate code 3 and the intermediate code 6 in FIG.
[0078]
In step b12, the process proceeds to step b2, and the process of loop 1 is repeated.
[0079]
The order of execution of class members, automatic variables other than global variables, and the like is determined by ordinary dependency analysis. Since the analysis of the normal dependency is not the focus of the present invention, a detailed description is omitted. By the ordinary analysis of the dependency, the execution order between the local variables is set, and the execution order of the intermediate codes 4 and 6 is set. Similarly, the execution order of the intermediate code 5 and the intermediate code 6 is set.
[0080]
Next, the intermediate code shown in FIG. 5B is used for the processing of the function definition / reference sentence information creation step in a case where it is applied to the global variable g (5a5) of the program shown in FIG. This will be described with reference to FIG.
[0081]
The processing of the definition / reference sentence information creation step is performed on the function definition data among all the syntax analysis data stored in the storage unit D120 by steps c1 to c9. The description will be made in the order of the symbols.
[0082]
In step c1, loop 1 is repeated for all statements 1 in the function definition F1.
[0083]
At step c2, it is determined whether or not statement 1 is a statement including a function call. If statement 1 includes a function call, the determination is Yes, and the process proceeds to step c3; otherwise, the determination is No, and the process proceeds to step c7. In the intermediate codes 1 and 2 in FIG. 5B, since the call to the default constructor of the class X is included, it is determined to be Yes in step c2. Since the intermediate code 3 includes a call to the member function set of the class X, it is determined to be Yes. In addition, since the intermediate codes 4 and 5 include a call to the member function calc of the class X, the determination is similarly Yes. The other intermediate codes in FIG. 5B are determined to be No.
[0084]
At step c3, it is determined whether or not the calling function F2 included in the statement 1 is a member function of the class. If the function F2 is a member function of the class, the determination is Yes, and the process proceeds to step c4. Otherwise, the determination is No, and the process proceeds to step c6. Regarding the intermediate codes 1, 2, 3, 4, and 5 in FIG. 5B, since all the called functions are member functions, it is determined to be Yes in step c3.
[0085]
In step c4, the activation object M is acquired from the expression of the member function call, and registered in the statement information. Regarding the intermediate codes 1 and 2 in FIG. 5B, the activation objects M of the default constructor are obj1 and obj2, respectively. Therefore, obj1 and obj2 are registered in the columns of the activation objects of the statement information for the intermediate codes 1 and 2, respectively. I do. Regarding the intermediate code 3, since the function to be called is a static member function and does not have the activation object M, nothing is registered in the activation object column of the statement information.
[0086]
In step c5, information on the definition / reference non-static member, definition / reference static member, and call function of the function F2 is acquired from the variable / member information storage unit D130, and the non-static member defined and referenced in the statement And calculate static members and register them in statement information. Since the intermediate code 1 in FIG. 5B includes a call to the default constructor X of the class X, the intermediate code 1 is defined in the calling function by referring to the variable / member information storage unit D130 in FIG. 5C. Get referenced non-static, static members and calling functions. There are no non-static and static members defined and referenced in the default constructor X, and a member function init of class X is included. When a call function is included, the variable / member information storage unit D130 in FIG. 5C is recursively obtained, and the non-static and static members to be defined and referred to and the call function are acquired. In the member function init of the class X, there is no reference non-static member, reference static member, and definition static member, and there is x as the definition non-static member. Therefore, in the intermediate code 1 in FIG. The result x is obtained as the target member, and the member x of the class X is registered in the column of the definition non-static member of the intermediate code 1.
[0087]
In step c6, the information of the definition global variable, the reference global variable, and the calling function of the function F2 is acquired from the variable / member information storage unit D130, the global variables defined and referenced in the statement are calculated, and registered in the statement information. Since the intermediate code 1 in FIG. 5B includes a call to the default constructor X of the class X, the intermediate code 1 is defined in the calling function by referring to the variable / member information storage unit D130 in FIG. 5C. Get referenced global variables and calling functions. There is no global variable defined and referenced in the default constructor X, and a member function init of class X is included. When the call function is included, the variable / member information storage unit D130 shown in FIG. 5C is recursively obtained, and the global variables and the call function to be defined and referred to are obtained. In the member function init of the class X, since there is no global variable to be referenced and defined, nothing is registered in the defined global variable and the reference global variable of the intermediate code 1 in FIG. 5B.
[0088]
In step c7, non-static members and static members defined and referred to by expressions other than the function call in statement 1 are calculated and registered in the statement information. In the intermediate codes 1 to 6 in FIG. 5B, since there are no members defined and referenced by expressions other than the function call, the definition members and the reference members of the statement information of the intermediate code 1 to the intermediate code 6 are displayed. Is not registered. In the case of the intermediate code in the eleventh line of the function definition of the member function calc (5a1) in FIG. 5A, since the non-static member x and the static member y of the class X are referred to, the 11 In the sentence information for the intermediate code on the line, the member x is registered in the column of reference non-static member, and the member y is registered in the column of reference static member. The intermediate code of the function definition of the member function calc (5a1) is not shown.
[0089]
In step c8, global variables defined and referred to in expressions other than the function call in statement 1 are calculated and registered in the statement information. In the intermediate code 5 of FIG. 5B, since the global variable a is defined by an expression other than the function call, the global variable a is registered in the column of the defined global variable of the intermediate code 5. In the intermediate code 3, the global variable a is referred to as an argument of the function call. Also in this case, the global variable a is registered in the column of the reference global variable of the intermediate code 3.
[0090]
In step c9, the process proceeds to step c1, and the process of loop 1 is repeated.
[0091]
As a result of applying the processing of the definition / reference sentence information creation step to the global function g, sentence information as shown in FIG. 6A is obtained.
[0092]
As a result of applying the processing of the parallel execution step S140 to the global function g, the relationship of the execution order of the intermediate codes 1 to 7 of the global function g is represented by a directed graph as shown in FIG. 6B. Since the intermediate code 1, the intermediate code 2, and the intermediate code 3, and the intermediate code 4 and the intermediate code 5 do not depend on the execution order, it can be determined that they can be executed in parallel. When the number of execution steps is represented by the number of execution steps of the intermediate code, it can be executed in four steps. When the intermediate code of the global function g is parallelized by the method of the related art, none of the intermediate codes can be executed in parallel because they do not correspond to the class members as shown in FIG. It takes 7 steps.
[0093]
As is clear from the comparison between FIG. 6B and FIG. 6C, according to the present embodiment, parallelization of each sentence can be performed more efficiently than in the related art.
[0094]
(Second embodiment)
FIG. 7 shows a configuration diagram of a program parallelization method according to the second embodiment of the present invention.
[0095]
In FIG. 7, this program parallelization step includes an input step S210, a syntax analysis step S220, a storage unit D220, a variable / member analysis step S230, a class analysis step S240, a class / variable / member information storage unit D240, and a parallel execution step. It comprises S250, optimization step S260, and code generation step S270.
[0096]
The input step S210, the syntax analysis step S220, the storage unit D220, the variable / member analysis step S230, the optimization step S260, and the code generation step S270 of the program parallelization method in the second embodiment are respectively the same as those in the first embodiment. Since these are the same as the input step S110, the syntax analysis step S120, the storage unit D120, the variable / member analysis step S130, the optimization step S150, and the code generation step S160, the description is omitted.
[0097]
The class analysis step S240 extracts the class information stored in the storage unit D220, analyzes the information on the class inheritance relationship and the member functions, and stores the analysis result in the class information storage of the class / variable / member information storage unit D240. It is stored in the section D242.
[0098]
The class / variable / member information storage unit D240 includes a variable / member information storage unit D241 and a class information storage unit D242. The class / variable / member information storage unit D240 receives analysis results from the variable / member analysis step S230 and the class analysis step S240. It is stored in the member information storage unit D241 and the class information storage unit D242.
[0099]
The parallelization execution step S250 receives the syntax tree from the storage unit D220, and performs parallelization on each statement in the function. At this time, parallelization is performed using the class tree, global variables, and definition / reference information of the class members stored in the class / variable / member information storage unit D240.
[0100]
FIG. 11A shows a source program example 2 described in the C ++ language.
[0101]
The first to fifteenth lines in FIG. 11A are the class definitions of class A, class B, and class C. Class B inherits class A, and class C inherits class B. Also, the member function specified by the virtual specifier in the fourth, ninth, and fourteenth lines is a virtual function. The member function calc (11a1) of the class A and the member function calc of the class B are indicated. (11a2) and a member function calc (11a3) of the class C are defined. Further, the virtual function calc (11a2) of the class B overwrites the virtual function calc (11a1) of the base class A, and the virtual function calc (11a3) of the class C overwrites the virtual function calc (11a2) of the base class B.
[0102]
The 18th to 31st lines are class definitions of class X, class Y, and class Z. Class Y and class Z each inherit class X. The member functions to which the virtual specifiers on the 20th, 25th, and 30th lines are designated are virtual functions. The member function calc (11a4) of the class X and the member function calc (11a5) of the class Y are designated. ), And a member function calc (11a6) of the class Z are defined. The virtual function calc (11a5) of the class Y overwrites the virtual function calc (11a4) of the base class X, and the virtual function calc (11a6) of the class Z overwrites the virtual function calc (11a4) of the base class X.
[0103]
Lines 32 to 35 represent the function definition (11a7) of the global function g. Lines 33 and 34 call the virtual function calc for the pointer variable to class A and call the class X, respectively. Of the virtual function calc for the pointer variable of FIG.
[0104]
Next, the process of the class analysis step S240 will be described with reference to FIG. 8 by taking as an example a case where the process is applied to the program shown in FIG.
[0105]
The process of the class analysis step S240 is performed by the steps d1 to d10 for the class definition data among all the syntax analysis data stored in the storage unit D220. The description will be made in the order of the symbols.
[0106]
In step d1, loop 1 is repeated for all classes T1 stored in storage unit D220.
[0107]
At step d2, it is determined whether or not the class T1 has a base class T2. If it has the base class T2, the determination is Yes, and the process proceeds to step d3. Otherwise, the determination is No, and the process proceeds to step d4. In the program of FIG. 11A, class B, class C, class Y, and class Z each have a base class. Therefore, the determination is Yes in step d2, and class A and class X do not have a base class. It is determined as No.
[0108]
In step d3, the class T1 is added to the class tree to which the class T2 belongs, set as a derived class of the class T2, and the class tree is updated. In the program shown in FIG. 11A, the class B is added to the class tree to which the base class A belongs, and is set as a derived class of the class A. Similarly, the class C is added to the class tree to which the class B belongs, and is set as a derived class of the class B. The classes Y and Z are respectively added to the class tree to which the class X belongs, and the derived classes of the class X are added. And set.
[0109]
In step d4, a class tree to which the class T1 belongs is newly generated, and the class T1 is added to the class tree. In the program of FIG. 11A, a class tree is newly generated for each of the classes A and X, and the classes A and X are added.
[0110]
In step d5, loop 2 is repeated for all virtual functions F1 of class T1.
[0111]
In step d6, it is determined whether the class T1 has the base class T2 and whether the virtual function F1 overwrites the virtual function F2 of the base class T2. When the virtual function F1 overwrites the virtual function F2 of the base class, the determination is Yes and the process proceeds to Step d7. Otherwise, the determination is No and the process proceeds to Step d8. In the program of FIG. 11A, the class B has the class A as a base class, and the virtual function calc (11a2) of the class B overwrites the virtual function calc (11a1) of the class A. Is determined. Similarly, the virtual function calc (11a3) of the class C, the virtual function calc (11a5) of the class Y, and the virtual function calc (11a6) of the class Z are also determined as Yes. Regarding the virtual function calc of the class A and the class X, since the class A and the class X do not have a base class, it is determined to be No.
[0112]
In step d7, the virtual function F1 is added to the virtual function set to which the virtual function F2 belongs. In the program of FIG. 11A, the virtual function calc of class B is added to the virtual function set to which the virtual function calc (11a1) of class A belongs, and the virtual function calc of class C is added to the virtual function calc of class B. calc (11a2) is added to the virtual function set to which it belongs. Similarly, the virtual function calc (11a5) of class Y and the virtual function calc (11a6) of class Z are both added to the virtual function set to which the virtual function calc (11a4) of class X belongs.
[0113]
In step d8, a virtual function set to which the virtual function F1 belongs is newly generated, and the virtual function F1 is added to the virtual function set. In the program of FIG. 11A, a virtual function set is newly generated for the virtual function calc of class A and the virtual function calc of class X, and the virtual function is added.
[0114]
In step d9, the process proceeds to step d5, and the process of loop 2 is repeated.
[0115]
In step d10, the process proceeds to step d1, and the process of loop 1 is repeated.
[0116]
When the process of the class analysis step S240 is applied to the program shown in FIG. 11A, the contents of the class information storage unit D242 of the class / variable / member information storage unit D240 are as shown in FIG.
[0117]
Next, the processing of the parallelization execution step S250 will be described by using an intermediate code shown in FIG. 11B by taking as an example a case where the processing is applied to the global function g (11a7) of the program shown in FIG. This will be described with reference to FIG.
[0118]
The processing of the parallelization execution step S250 is performed on the function definition data among all the syntax analysis data stored in the storage unit D220 by steps e1 to e16. The description will be made in the order of the symbols.
[0119]
In step e1, definition / reference statement information is created for all statements in the function definition F1 stored in the storage unit D220. Details of the definition / reference statement information creation processing will be described later. In step e1, static / non-static members defined / referenced in each statement in the function definition F1, global variables defined / referenced, and activation objects of non-static member functions are obtained. The definition / reference statement information for the intermediate code of the global function g in FIG. 11B is as shown in FIG.
[0120]
In step e2, loop 1 is repeated for all statements 1 in the function definition F1.
[0121]
In step e3, information on statement 1 is extracted from the definition / reference statement information, and the static / non-static member defined / referenced in statement 1, the global variable defined / referenced, and the activation object of the non-static member function The information of M1 is obtained. In the intermediate code 1 of FIG. 11B, the non-static member b of the class B and the non-static member c of the class C are obtained as the reference non-static members from the statement information of FIG. The static member a of the class A is obtained as the target member and the reference static member, and pa1 is obtained as the activation object M1.
[0122]
At step e4, the loop 2 is repeated for all the sentences 2 after the sentence 1.
[0123]
In step e5, information on statement 2 is extracted from the definition / reference statement information, and the static / non-static member defined / referenced in statement 2, the global variable defined / referenced, and the activation object of the non-static member function The information of M2 is obtained. In the intermediate code 2 of FIG. 11B, the non-static member y of the class Y and the non-static member z of the class Z, the definition global variable, and the reference Val is obtained as a global variable, and px1 is obtained as an activation object M2.
[0124]
In step e6, it is determined whether the classes of the activation objects M1 and M2 belong to the same class tree by referring to the contents of the class information storage unit D242 of the class / variable / member information storage unit D240. If they belong to the same class tree, the determination is Yes and the process proceeds to step e7; otherwise, the determination is No and the process proceeds to step e11. In the case where the sentence 1 is the intermediate code 1 and the sentence 2 is the intermediate code 2 in FIG. 11B, determination is made on the activation objects pa1 and px1 of the intermediate code 1 and the intermediate code 2 based on the sentence information of FIG. Since the types of pa1 and px1 are pointer types, the type indicated by the pointer, that is, class A is checked for pa1, and class X is checked for px1. When it is determined whether the class A and the class X belong to the same class tree by searching the class tree set in FIG. 12B, the class tree does not belong to the same class tree. .
[0125]
On the other hand, when the sentence 1 is the intermediate code 1 and the sentence 2 is the intermediate code 4, the activation objects are pa1 and pa2, respectively, from the sentence information in FIG. Find out what type is. Since the types pointed to by pa1 and pa2 are both class A, they belong to the same class tree and are determined to be Yes in step e6.
[0126]
In step e7, it is determined whether the definition static / non-static member of the activation object M1 of statement 1 is defined or referred to in statement 2. If the definition or reference is made, the determination is Yes, and the process proceeds to step e8. Otherwise, the determination is No, and the process proceeds to step e9. When the intermediate code 1 in FIG. 11B is sentence 1 and the intermediate code 4 is sentence 2, the activation object M1 of the intermediate code 1 which is sentence 1 is pa1 according to the sentence information in FIG. Since the definition static member is the member a of the class A, it is determined whether or not the member a of pa1 is defined or referenced by the intermediate code 4 which is the statement 2. Since the intermediate code 4 defines / references the member a of the class A, it is determined to be Yes in step e7.
[0127]
Since the activation objects of the intermediate code 1 and the intermediate code 4 are both pointer type, it is unknown whether the activation objects are the same. However, in the intermediate code 1 and the intermediate code 4, the non-static members are only reference. So there is no effect.
[0128]
Similarly, when the sentence 1 is the intermediate code 4, the activation object M1 is px2 and the defined static member is the member a of the class A from the sentence information in FIG. , 6, the member a is not defined / referenced, so that it is determined as No in step e7.
[0129]
In step e8, the relationship of the execution order between the statements 1 and 2 is set. This order relationship indicates that statement 2 must be executed after statement 1 is executed. The execution order of the intermediate code 1 and the intermediate code 4 in FIG. 11B is set.
[0130]
In step e9, it is determined whether or not the reference static / non-static member of the activation object M1 of statement 1 is defined by statement 2. If it is defined, the determination is Yes, and the process proceeds to step e10. Otherwise, the determination is No, and the process proceeds to step e11. When the intermediate code 1 in FIG. 11B is sentence 1 and the intermediate code 4 is sentence 2, the activation object M1 of the intermediate code 1 is pa1 and the reference static member is based on the sentence information in FIG. Since the member a is a member of the class A, it is determined whether or not the member a of the pa1 is defined by the intermediate code 4. Since the intermediate code 4 defines the member a of the class A, it is determined to be Yes in step e9.
[0131]
Since the activation objects of the intermediate code 1 and the intermediate code 4 are both pointer type, it is unknown whether the activation objects are the same. However, in the intermediate code 1 and the intermediate code 4, the non-static members are only reference. So there is no effect.
[0132]
In step e10, the execution order relation is set between the statements 1 and 2 as in step e8. The execution order of the intermediate code 1 and the intermediate code 4 in FIG. 11B is set.
[0133]
In step e11, it is determined whether the global variable defined in statement 1 is defined or referenced in statement 2. If the definition or reference is made, the determination is Yes, and the process proceeds to Step e12. Otherwise, the determination is No, and the process proceeds to Step e13. In the case where the sentence 1 is the intermediate code 2 and the sentence 2 is the intermediate code 3 in FIG. 11B, the global variable defined by the intermediate code 2 is val from the sentence information of FIG. Defines the global variable val, so that it is determined to be Yes in step e11. Similarly, when the sentence 1 is the intermediate code 2 and the sentence 2 is the intermediate code 5, when the sentence 1 is the intermediate code 3 and the sentence 2 is the intermediate code 5, it is determined as Yes in the step e11.
[0134]
In step e12, the execution order relationship between statement 1 and statement 2 is set as in step e8 and step e10. In the intermediate code 2 of FIG. 11B, the execution order with the intermediate code 3 is set. Similarly, the execution order of the intermediate codes 2 and 5 and the execution order of the intermediate codes 3 and 5 are set.
[0135]
In step e13, it is determined whether or not the global variable referred to in statement 1 is defined in statement 2. If it is defined, the determination is Yes, and the process proceeds to step e14. Otherwise, the determination is No, and the process proceeds to step e15. In the case where the sentence 1 is the intermediate code 2 and the sentence 2 is the intermediate code 3 in FIG. 11B, the global variable referred to by the intermediate code 2 is val from the sentence information of FIG. Defines the global variable val, so that it is determined to be Yes in step e13.
[0136]
In step e14, the execution order relationship is set between sentence 1 and sentence 2 as in steps e8, e10, and e12. The execution order is set between the intermediate code 2 and the intermediate code 3 in FIG.
[0137]
In step e15, the process proceeds to step e4, and the process of loop 2 is repeated.
[0138]
In step e16, the process proceeds to step e2, and the process of loop 1 is repeated.
[0139]
The order of execution of class members, automatic variables other than global variables, and the like is determined by ordinary dependency analysis. Since the analysis of the normal dependency is not the focus of the present invention, a detailed description is omitted. The execution order between the local variables is set by the ordinary analysis of the dependency, the execution order of the intermediate code 1 and the intermediate code 3, the execution order of the intermediate code 2 and the intermediate code 3, and the execution of the intermediate code 4 and the intermediate code 6. The execution order of the intermediate code 5 and the intermediate code 6 is set.
[0140]
Next, the intermediate code shown in FIG. 11B is used for the processing of the function definition / reference sentence information creation step in a case where it is applied to the global variable g (11a7) of the program shown in FIG. This will be described with reference to FIG.
[0141]
The process of the definition / reference sentence information creation step is performed on the function definition data among all the syntax analysis data stored in the storage unit D220 by the steps from f1 to f11. The description will be made in the order of the symbols.
[0142]
In step f1, loop 1 is repeated for all statements 1 in the function definition F1.
[0143]
In step f2, it is determined whether or not statement 1 is a statement including a function call. If statement 1 includes a function call, the determination is Yes, and the process proceeds to step f3; otherwise, the determination is No, and the process proceeds to step f9. Since the intermediate codes 1 and 4 in FIG. 11B include the call of the member function calc of the class A, the determination is Yes in step f2. In addition, since the intermediate codes 2 and 5 include the call of the member function calc of the class X, it is determined to be Yes. The other intermediate codes in FIG. 11B are determined to be No.
[0144]
In step f3, it is determined whether or not the calling function F2 included in statement 1 is a member function of the class. If the function F2 is a member function of the class, the determination is Yes, and the process proceeds to step f4; otherwise, the determination is No, and the process proceeds to step f8. Regarding the intermediate codes 1, 2, 4, and 5 in FIG. 11B, since all called functions are member functions, it is determined to be Yes in step f3.
[0145]
In step f4, the activation object M is acquired from the expression of the member function call, and registered in the statement information. Regarding the intermediate codes 1, 2, 4, and 5 in FIG. 11B, since the activation objects M are pa1, px1, pa2, and px2, respectively, pa1, px1, and Register pa2 and px2.
[0146]
In step f5, it is determined whether the activation object M is a pointer type or a reference type, and whether the function F2 is a virtual function. If the activation object M is the pointer type or the reference type and the function F2 is a virtual function, the determination is Yes and the process proceeds to Step f6. Otherwise, the determination is No and the process proceeds to Step f7. In the intermediate codes 1, 2, 4, and 5 in FIG. 11B, the activation objects are pa1, px1, pa2, and px2, respectively, and are all pointer types. In addition, since the calling functions are virtual functions, the intermediate codes 1, 2, 4, and 5 in FIG. 11B are determined to be Yes in step f5.
[0147]
In step f6, the set to which the function F2 belongs is acquired from the virtual function set from the class information storage unit D242 of the class / variable / member information storage unit D240, and the definitions / reference non-static members of all the functions included in the set are obtained. Information on definition / reference static members, definition / reference global variables, and call functions is obtained from the variable / member information storage unit D241 of the class / variable / member information storage unit D240, and non-static members defined and referenced in the statement , Static members and global variables are calculated and registered in the statement information. As for the intermediate code 2 in FIG. 11B, a set to which the virtual function calc of class X belongs is obtained from the virtual function set, and a set VF2 is obtained. Next, all functions included in the set VF2, that is, definitions / reference non-static members, definitions / reference static members, definitions / reference global variables, definitions / reference global variables, and calls for X :: calc, Y :: calc, and Z :: calc Function information is acquired from FIG. 12A and registered in statement information. In X :: calc, the global variable val is registered as a reference global variable, in Y :: calc, Y :: y is registered in a reference non-static member, in the defined global variable, global variable val is registered, and in Z :: calc, reference is made Register Y :: y, Z :: z in the non-static member and register global variable val in the reference global variable. As a result, the sentence information of the intermediate code 2 in FIG. The same applies to the intermediate codes 1, 4 and 5 in FIG.
[0148]
In step f7, information on the definition / reference non-static member, definition / reference static member, definition / reference global variable, definition / reference global variable, and call function from the variable / member information storage unit D241 of the class / variable / member information storage unit D240 Is calculated, and non-static members, static members, and global variables defined and referenced in the statement are calculated and registered in the statement information. Regarding the intermediate code in FIG. 11B, there is no case where No is determined in step f5, so step f7 is not executed.
[0149]
In step f8, the information of the definition global variable, the reference global variable, and the call function of the function F2 is acquired from the variable / member information storage unit D241 of the class / variable / member information storage unit D240, and the global variable defined and referenced in the statement is obtained. Is calculated and registered in the sentence information. Since the intermediate code in FIG. 11B does not include an intermediate code including a call to a global function that is not a member function (a function that is not in a class), step f8 is not performed for any intermediate code.
[0150]
In step f9, non-static members and static members defined and referenced in statement 1 by expressions other than function calls are calculated and registered in statement information. In the intermediate code 1 to the intermediate code 6 in FIG. 11B, there are no members defined and referenced by expressions other than the function call, and therefore, the definition members and the reference members of the statement information of the intermediate code 1 to the intermediate code 6 do not exist. Nothing is registered in the column. In the case of the intermediate code of the function definition of the member function calc of the class A on the fourth line in FIG. 11A, since the static member a is referred to, the statement information for the intermediate code of the member function calc (11a1) is The member a is registered in the column of the reference static member. The intermediate code of the function definition of the member function calc (11a1) of the class A is not shown.
[0151]
In step f10, global variables defined and referred to by expressions other than the function call in statement 1 are calculated and registered in the statement information. In the intermediate code 3 of FIG. 11B, since the global variable val is defined by an expression other than the function call, the global variable val is registered in the column of the defined global variable of the intermediate code 3.
[0152]
In step f11, the process proceeds to step f1, and the process of loop 1 is repeated.
[0153]
As a result of applying the processing of the definition / reference sentence information creation step to the global function g, sentence information as shown in FIG. 13A is obtained.
[0154]
As a result of applying the processing of the parallel execution step S250 to the global function g, the relationship of the execution order of the intermediate codes 1 to 6 of the global function g is represented by a directed graph as shown in FIG. 13B. Since the intermediate code 1 and the intermediate code 2 and the intermediate code 4 and the intermediate code 5 do not depend on the execution order, it can be determined that they can be executed in parallel, and the number of execution steps of the global function g is , It can be executed in four steps in terms of the number of execution steps of the intermediate code. When the intermediate code of the global function g is parallelized by the method of the related art, none of the intermediate codes can be executed in parallel because they do not correspond to the class members as shown in FIG. Six steps are required.
[0155]
As is clear from the comparison between FIG. 13B and FIG. 13C, according to the present embodiment, when there is an inheritance relationship between classes in each class definition, the class member Since the parallelization is performed in consideration of the analysis information of the reference, the definition, and the class definition, the parallelization of each sentence can be performed more efficiently than in the related art.
[0156]
【The invention's effect】
As described above, according to the program parallelization method of the present invention, there are provided a class member analysis step of analyzing class member information in an input program, and a parallelization step of performing parallelization using the analyzed information. Therefore, efficient parallelization can be performed in consideration of class member information.
[0157]
Also, by providing a member reference definition analysis step and a parallelization step, it is possible to efficiently parallelize statements including member function calls without changing the operation of the program using the relation between class member references and definitions. it can.
[0158]
In addition, by providing a non-static member reference definition analysis step, a global variable reference definition analysis step, a member function call parallelization step, and a global function call parallelization step, analysis considering non-static members and global variables of a class can be performed. The statement including the member function call and the global function call can be more efficiently parallelized without changing the operation of the program.
[0159]
In addition, by providing a static member reference definition analysis step, a global variable reference definition analysis step, a member function call parallelization step, and a global function call parallelization step, analysis is performed in consideration of static members and global variables of a class. Thus, statements including member function calls and global function calls can be more efficiently parallelized without changing the operation of the program.
[0160]
According to another aspect of the present invention, a member reference definition analyzing step of analyzing reference and definition information of class members in an input program, and a class analyzing step of analyzing a class definition described in the input program, By providing a parallelization step of performing parallelization using information analyzed by the member reference definition analysis step and the class analysis step, parallelization in consideration of class member reference and definition and analysis information of the class definition can be performed. And can be parallelized more efficiently.
[0161]
In addition, by providing a non-static member reference definition analysis step, a global variable reference definition analysis step, a member function call parallelization step, and a global function call parallelization step, analysis of non-static members of classes, global variables, and class definitions is performed. Parallelization in consideration of information can be performed, and statements including member function calls and global function calls can be parallelized more efficiently without changing the operation of the program.
[0162]
In addition, by providing a static member reference definition analysis step, a global variable reference definition analysis step, a member function call parallelization step, and a global function call parallelization step, analysis information of static members of classes, global variables and class definitions can be obtained. Parallelization can be performed in consideration of the above, and a statement including a member function call and a global function call can be more efficiently parallelized without changing the operation of the program.
[0163]
In addition, the method includes a class tree analysis step for analyzing the inheritance relation of the classes, and performs parallelization assuming that there is no dependence on the execution order between one or a plurality of member function calls of the class having no inheritance relation. By analyzing the relationship and creating a class tree, member function calls of classes that do not belong to the same class tree can be determined as candidates for parallel execution, and the relationship between static and non-static class members needs to be analyzed. Therefore, the processing can be speeded up.
[0164]
In addition, by providing a virtual function analysis step and a virtual function call parallelization step, parallelization can be performed in consideration of all functions that may be called by a virtual function call, and more accurate parallelization is performed. be able to.
[0165]
Further, according to the present invention regarding a recording medium for program parallelization, efficient parallelization can be performed in consideration of class member information. Alternatively, parallelization can be performed in consideration of class member reference and definition and class definition analysis information, and parallelization can be performed more efficiently.
[Brief description of the drawings]
FIG. 1 is a configuration diagram of a program parallelization method according to a first embodiment of the present invention;
FIG. 2 is a flowchart showing a variable / member analysis step in the first embodiment;
FIG. 3 is a flowchart illustrating processing of a parallel execution step according to the first embodiment;
FIG. 4 is a flowchart illustrating processing of a definition / reference sentence information creation step according to the first embodiment;
5A is a diagram illustrating a program stored in a program storage unit, FIG. 5B is a diagram illustrating an intermediate code relating to a global function stored in a storage unit, and FIG. Diagram showing a list of definition / reference members, definition / reference global variables, and call functions for each function stored in the variable / member information storage unit
FIG. 6 shows a list of definitions / reference members, definitions / reference global variables, and activation objects for each statement as a result of applying the processing of the definition / reference information creation step to a global function in the first embodiment. FIG. 2B is a diagram showing the dependency of the execution order of the program parallelization method, and FIG.
FIG. 7 is a configuration diagram of a program parallelization method according to a second embodiment of the present invention;
FIG. 8 is a flowchart illustrating processing of a class analysis step according to the second embodiment.
FIG. 9 is a flowchart illustrating processing of a parallel execution step according to the second embodiment;
FIG. 10 is a flowchart illustrating processing of a definition / reference sentence information creation step according to the second embodiment.
FIGS. 11A and 11B are diagrams illustrating (a) a program stored in a program storage unit and (b) an intermediate code relating to a global function stored in the storage unit according to the second embodiment;
12A is a diagram showing a list of definition / reference members, definition / reference global variables, and call functions for each function stored in a variable / member information storage unit according to the second embodiment; FIG. A) Class tree set and virtual function set stored in the class information storage unit
FIG. 13 shows a list of definitions / reference members, definitions / reference global variables, and activation objects for each statement as a result of applying the processing of the definition / reference information creation step to a global function in the second embodiment. FIG. 1B is a diagram illustrating the dependency of the execution order of the program parallelization method, and FIG.
[Explanation of symbols]
S110 Input step
S120 Syntax analysis step
S130 Variable / member analysis step
S140 Parallelization execution step
S150 Optimization step
S160 Code generation step
S210 input step
S220 syntax analysis step
S230 Variable / member analysis step
S240 Class analysis step
S250 Parallelization execution step
S260 optimization step
S270 Code generation step
D100 Program storage unit
D120 storage unit
D130 Variable / member information storage unit
D160 Generated code storage unit
D220 storage unit
D240 Class / variable / member information storage unit
D241 Variable / member information storage unit
D242 Class information storage unit
.

Claims (11)

オブジェクト指向言語で記述されたプログラムを入力し、並列実行可能な目的プログラムを出力するプログラム並列化方式であって、
前記入力プログラムに記載されているクラスメンバの情報を解析するクラスメンバ解析ステップと、
前記クラスメンバ解析ステップにより解析された情報を用いて並列化を行う並列化ステップとを備えることを特徴とするプログラム並列化方式。
A program parallelization method for inputting a program described in an object-oriented language and outputting a target program that can be executed in parallel,
A class member analysis step of analyzing class member information described in the input program;
A parallelization step of performing parallelization using information analyzed by the class member analysis step.
前記クラスメンバ解析ステップは、前記クラスメンバの参照および定義の情報を解析するメンバ参照定義解析ステップを備え、
前記並列化ステップは、メンバ関数呼び出しの起動オブジェクトを解析し、メンバ関数呼び出しを含めた各文に対して並列化を行うメンバ関数呼び出し並列化ステップを備えることを特徴とする請求項1記載のプログラム並列化方式。
The class member analysis step includes a member reference definition analysis step of analyzing reference and definition information of the class member,
2. The program according to claim 1, wherein the parallelizing step includes a member function call parallelizing step of analyzing an activation object of the member function call and performing parallelization on each statement including the member function call. Parallelization method.
前記メンバ参照定義解析ステップは、クラスの非静的メンバの参照および定義の情報を解析する非静的メンバ参照定義解析ステップと、
大域変数の参照および定義の情報を解析する大域変数参照定義解析ステップとを備え、
前記並列化ステップは、メンバ関数呼び出しの起動オブジェクトを解析し、メンバ関数呼び出しを含めた各文に対して並列化を行うメンバ関数呼び出し並列化ステップと、
大域関数呼び出しを含めた各文に対して並列化を行う大域関数呼び出し並列化ステップとを備えることを特徴とする請求項2記載のプログラム並列化方式。
The member reference definition analysis step is a non-static member reference definition analysis step of analyzing information on the reference and definition of non-static members of the class,
A global variable reference definition analysis step of analyzing reference and definition information of the global variable,
The parallelization step analyzes the activation object of the member function call, and performs a parallelization on each statement including the member function call.
3. The program parallelization method according to claim 2, further comprising a global function call parallelization step of performing parallelization on each statement including the global function call.
前記メンバ参照定義解析ステップは、クラスの静的メンバの参照および定義の情報を解析する静的メンバ参照定義解析ステップと、
大域変数の参照および定義の情報を解析する大域変数参照定義解析ステップとを備え、
前記並列化ステップは、メンバ関数呼び出しの起動オブジェクトを解析し、メンバ関数呼び出しを含めた各文に対して並列化を行うメンバ関数呼び出し並列化ステップと、
大域関数呼び出しを含めた各文に対して並列化を行う大域関数呼び出し並列化ステップとを備えることを特徴とする請求項2記載のプログラム並列化方式。
The member reference definition analysis step includes: a static member reference definition analysis step of analyzing reference and definition information of a static member of the class;
A global variable reference definition analysis step of analyzing reference and definition information of the global variable,
The parallelization step analyzes the activation object of the member function call, and performs a parallelization on each statement including the member function call.
3. The program parallelization method according to claim 2, further comprising a global function call parallelization step of performing parallelization on each statement including the global function call.
オブジェクト指向言語で記述されたプログラムを入力し、並列実行可能な目的プログラムを出力するプログラム並列化方式であって、
前記入力プログラムに記載されているクラスメンバの参照および定義の情報を解析するメンバ参照定義解析ステップと、
前記入力プログラムに記載されているクラス定義を解析するクラス解析ステップと、
前記メンバ参照定義解析ステップおよび前記クラス解析ステップにより解析された情報を用いて並列化を行う並列化ステップとを備えることを特徴とするプログラム並列化方式。
A program parallelization method for inputting a program described in an object-oriented language and outputting a target program that can be executed in parallel,
A member reference definition analyzing step of analyzing reference and definition information of class members described in the input program,
A class analysis step of analyzing a class definition described in the input program,
A program parallelization method comprising: a parallelization step of performing parallelization using information analyzed by the member reference definition analysis step and the class analysis step.
前記メンバ参照定義解析ステップは、クラスの非静的メンバの参照および定義の情報を解析する非静的メンバ参照定義解析ステップと、
大域変数の参照および定義の情報を解析する大域変数参照定義解析ステップとを備え、
前記並列化ステップは、メンバ関数呼び出しの起動オブジェクトを解析し、メンバ関数呼び出しを含めた各文に対して並列化を行うメンバ関数呼び出し並列化ステップと、
大域関数呼び出しを含めた各文に対して並列化を行う大域関数呼び出し並列化ステップとを備えることを特徴とする請求項5記載のプログラム並列化方式。
The member reference definition analysis step is a non-static member reference definition analysis step of analyzing information on the reference and definition of non-static members of the class,
A global variable reference definition analysis step of analyzing reference and definition information of the global variable,
The parallelization step analyzes the activation object of the member function call, and performs a parallelization on each statement including the member function call.
6. The program parallelization method according to claim 5, further comprising a global function call parallelization step of performing parallelization on each statement including the global function call.
前記メンバ参照定義解析ステップは、クラスの静的メンバの参照および定義の情報を解析する静的メンバ参照定義解析ステップと、
大域変数の参照および定義の情報を解析する大域変数参照定義解析ステップを備え、
前記並列化ステップは、メンバ関数呼び出しの起動オブジェクトを解析し、メンバ関数呼び出しを含めた各文に対して並列化を行うメンバ関数呼び出し並列化ステップと、
大域関数呼び出しを含めた各文に対して並列化を行う大域関数呼び出し並列化ステップを備えることを特徴とする請求項5記載のプログラム並列化方式。
The member reference definition analysis step includes: a static member reference definition analysis step of analyzing reference and definition information of a static member of the class;
A global variable reference definition analysis step for analyzing global variable reference and definition information,
The parallelization step analyzes the activation object of the member function call, and performs a parallelization on each statement including the member function call.
6. The program parallelization method according to claim 5, further comprising a global function call parallelization step of performing parallelization on each statement including the global function call.
前記クラス解析ステップは、クラスの継承関係を解析するクラスツリー解析ステップを備え、
前記並列化ステップは、継承関係にないクラスの1つあるいは複数のメンバ関数呼び出しの間に実行順序の依存がないとして並列化を行うことを特徴とする請求項5から請求項7までのいずれかに記載のプログラム並列化方式。
The class analysis step includes a class tree analysis step of analyzing a class inheritance relationship,
8. The parallelization step according to claim 5, wherein the parallelization step is performed assuming that there is no dependence on the execution order between one or a plurality of member function calls of a class having no inheritance relationship. The program parallelization method described in 1.
前記クラス解析ステップは、仮想関数の呼び出しで呼び出される可能性のある関数の集合を解析する仮想関数解析ステップを備え、
前記並列化ステップは、前記仮想関数呼び出しステップにより解析された情報を用いて並列化を行う仮想関数呼び出し並列化ステップを備えることを特徴とする請求項5から請求項8までのいずれかに記載のプログラム並列化方式。
The class analysis step includes a virtual function analysis step of analyzing a set of functions that may be called by a virtual function call,
The method according to any one of claims 5 to 8, wherein the parallelization step includes a virtual function call parallelization step of performing parallelization using information analyzed in the virtual function call step. Program parallelization method.
オブジェクト指向言語で記述されたプログラムを入力し、並列実行可能な目的プログラムを出力するプログラムを記録したコンピュータ読み取り可能な記録媒体であって、
前記入力プログラムに記載されているクラスメンバの情報を解析するクラスメンバ解析ステップと、
前記クラスメンバ解析ステップにより解析された情報を用いて並列化を行う並列化ステップとを含むことを特徴とするプログラム並列化用の記録媒体。
A computer-readable recording medium that records a program that inputs a program described in an object-oriented language and outputs a target program that can be executed in parallel,
A class member analysis step of analyzing class member information described in the input program;
A parallelizing step of performing parallelization using information analyzed by the class member analyzing step.
オブジェクト指向言語で記述されたプログラムを入力し、並列実行可能な目的プログラムを出力するプログラムを記録したコンピュータ読み取り可能な記録媒体であって、
前記入力プログラムに記載されているクラスメンバの参照および定義の情報を解析するメンバ参照定義解析ステップと、
前記入力プログラムに記載されているクラス定義を解析するクラス解析ステップと、
前記クラスメンバ参照定義解析ステップおよび前記クラス解析ステップにより解析された情報を用いて並列化を行う並列化ステップとを含むことを特徴とするプログラム並列化用の記録媒体。
A computer-readable recording medium that records a program that inputs a program described in an object-oriented language and outputs a target program that can be executed in parallel,
A member reference definition analyzing step of analyzing reference and definition information of class members described in the input program,
A class analysis step of analyzing a class definition described in the input program,
A recording medium for program parallelization, comprising: a class member reference definition analysis step; and a parallelization step of performing parallelization using information analyzed by the class analysis step.
JP2002161366A 2002-06-03 2002-06-03 Program parallelization system and storage medium for program parallelization Pending JP2004013184A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002161366A JP2004013184A (en) 2002-06-03 2002-06-03 Program parallelization system and storage medium for program parallelization

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002161366A JP2004013184A (en) 2002-06-03 2002-06-03 Program parallelization system and storage medium for program parallelization

Publications (1)

Publication Number Publication Date
JP2004013184A true JP2004013184A (en) 2004-01-15

Family

ID=30430461

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002161366A Pending JP2004013184A (en) 2002-06-03 2002-06-03 Program parallelization system and storage medium for program parallelization

Country Status (1)

Country Link
JP (1) JP2004013184A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011257872A (en) * 2010-06-07 2011-12-22 Mitsubishi Electric Corp Information processor, and information processing method and program

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011257872A (en) * 2010-06-07 2011-12-22 Mitsubishi Electric Corp Information processor, and information processing method and program

Similar Documents

Publication Publication Date Title
US9122539B2 (en) Methods and systems for forming an adjusted perform range
EP1178404B1 (en) Method and system for compiling multiple languages
US7657878B2 (en) Compiler, method of compiling and program development tool
US6233733B1 (en) Method for generating a Java bytecode data flow graph
US5815719A (en) Method and apparatus for easy insertion of assembler code for optimization
US20060200796A1 (en) Program development apparatus, method for developing a program, and a computer program product for executing an application for a program development apparatus
US20060195828A1 (en) Instruction generator, method for generating instructions and computer program product that executes an application for an instruction generator
US7185327B2 (en) System and method for optimizing operations via dataflow analysis
JPH10187463A (en) Compiler
JP2001167060A (en) Task paralleling method
JP2001166949A (en) Method and device for compiling source code by using symbolic execution
US7480901B2 (en) System and method for producing per-processor optimized executables
US6072950A (en) Pointer analysis by type inference combined with a non-pointer analysis
US20030056083A1 (en) Expression reduction during compilation through routine cloning
US7747991B2 (en) Program converting method
US6728953B1 (en) Selectively enabling expression folding during program compilation
US6973645B2 (en) Compiler, operation processing system and operation processing method
JP2004013184A (en) Program parallelization system and storage medium for program parallelization
CN108920149B (en) Compiling method and compiling device
Schildt The art of java
JP2007226589A (en) Program conversion system
Dillig et al. SAIL: Static analysis intermediate language with a two-level representation
WO2011090032A1 (en) Parallel processing program generation method, parallel processing program generation program, and parallel processing program generation apparatus
JP6458196B1 (en) Program conversion system, conversion program execution system, information processing system, program conversion method, conversion program execution method, and information processing method
Pham et al. Typable fragments of polynomial automatic amortized resource analysis