JP2527055B2 - Shared variable detection processing method in task - Google Patents

Shared variable detection processing method in task

Info

Publication number
JP2527055B2
JP2527055B2 JP1327754A JP32775489A JP2527055B2 JP 2527055 B2 JP2527055 B2 JP 2527055B2 JP 1327754 A JP1327754 A JP 1327754A JP 32775489 A JP32775489 A JP 32775489A JP 2527055 B2 JP2527055 B2 JP 2527055B2
Authority
JP
Japan
Prior art keywords
task
program
shared variable
unit
shared
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.)
Expired - Lifetime
Application number
JP1327754A
Other languages
Japanese (ja)
Other versions
JPH03188529A (en
Inventor
恭子 羽中田
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.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP1327754A priority Critical patent/JP2527055B2/en
Publication of JPH03188529A publication Critical patent/JPH03188529A/en
Application granted granted Critical
Publication of JP2527055B2 publication Critical patent/JP2527055B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明はマルチプロセッサでの実行を記述可能な高級
プログラミング言語で記述された原始プログラムからタ
スク内共有変数とみなせるタスク間共有変数を検出して
タスク内共有変数に置き換える処理方式に関するもので
ある。
DETAILED DESCRIPTION OF THE INVENTION [Industrial application] The present invention detects inter-task shared variables that can be regarded as in-task shared variables from a source program written in a high-level programming language capable of describing execution by a multiprocessor. The present invention relates to a processing method for replacing with a shared variable in a task.

〔従来の技術〕[Conventional technology]

複数のプログラム単位から構成される原始プログラム
では、複数(配列)のために割り当てられる記憶領域を
削減したり、プログラム単位間でのデータのやりとりを
簡易化したりする目的で、共通ブロック化の手法が多く
用いられる。例えば、FORTRAN言語ではCOMMON文が用い
られる。
In a source program consisting of multiple program units, a common block method is used to reduce the storage area allocated for multiple (arrays) and to simplify the exchange of data between program units. Mostly used. For example, the FORTRAN language uses the COMMON statement.

ところで、マルチプロセッサでの実行を記述可能な高
級プログラミング言語、例えばFORTRAN言語で記述され
た原始プログラムにおいて、COMMON文により宣言された
変数は、その宣言の含まれるプログラム単位が属する複
数のタスクによって共有されるタスク間共有変数とな
り、プログラムの実行時においては複数のタスクからの
参照・書込に対して内容の正当性を保持するために排他
制御が行われる。
By the way, in a high-level programming language capable of describing execution by a multiprocessor, for example, a source program written in FORTRAN language, a variable declared by COMMON statement is shared by a plurality of tasks to which the program unit including the declaration belongs. The variable becomes a shared variable between tasks, and exclusive control is performed at the time of execution of the program in order to maintain the validity of the contents for reference / writing from a plurality of tasks.

しかしながら、原始プログラム中で宣言されたタスク
間共有変数の全ての要素が複数のタスクによって現実に
共有されているとは限られず、多分に無用な宣言を含ん
でおり、これがため、無用な排他制御によってプログラ
ムの実行効率が低下するという問題がある。
However, not all the elements of the inter-task shared variable declared in the source program are actually shared by multiple tasks, and probably contain unnecessary declarations, which is why unnecessary exclusive control is performed. Therefore, there is a problem that the execution efficiency of the program is reduced.

上記の問題を解決するには、原始プログラム中で宣言
されたタスク間共有変数が実質的に特定のタスク内のプ
ログラム単位間でしか共有されない変数(タスク内供有
変数)であることが明らかである場合には、TASKCOMMON
文によるタスク内共有変数の宣言に置き換えたり、無用
な宣言を解除するのが効果的である。
To solve the above problem, it is clear that the inter-task shared variable declared in the source program is a variable that is shared only among program units within a specific task (in-task owned variable). In some cases, TASKCOMMON
It is effective to replace it with the declaration of the shared variable in the task by the statement or to remove the unnecessary declaration.

従来、上記の処理は専ら人間によって行われており、
原始プログラムのタスク構成を調べつつ、プログラム単
位毎の変数の参照情報リスト等を目視で比較し、実質的
なタスク内共有変数を発見した場合、エディタ等により
原始プログラムに修正を加えるようにしていた。
Conventionally, the above processing is performed exclusively by humans,
While checking the task configuration of the source program, the reference information lists of variables for each program unit were visually compared, and if a substantial shared variable in the task was found, the source program was modified by an editor etc. .

〔発明が解決しようとする課題〕[Problems to be Solved by the Invention]

上述したように、従来、原始プログラムからタスク内
共有変数とみなせるタスク間共有変数を検出してタスク
内共有変数に置き換える等の処理は人手にまかされてい
たため、作業が煩雑で担当者の負担が重いと共に、処理
に時間がかかるという欠点があった。また、人間の作業
であるため、検出漏れ,修正漏れ等が発生することもあ
り、充分な実行時間短縮の効果が上げられない欠点もあ
った。
As described above, conventionally, processing such as detecting inter-task shared variables that can be regarded as in-task shared variables from the source program and replacing them with in-task shared variables has been left to humans, which makes the work complicated and burdens the person in charge. Has a drawback that it is heavy and takes a long time to process. Further, since it is a human work, there are cases in which detection omissions, correction omissions, etc. occur, and there is a drawback that the effect of sufficiently shortening the execution time cannot be obtained.

本発明は上記の点に鑑み提案されたものであり、その
目的とするところは、原始プログラムからタスク内共有
変数とみなせるタスク間共有変数を検出してタスク内共
有変数に置き換える処理を全て自動的に行えるタスク内
共有変数検出処理方式を提供することにある。
The present invention has been proposed in view of the above points, and an object of the present invention is to automatically perform the process of detecting an inter-task shared variable that can be regarded as an in-task shared variable from a source program and replacing it with the in-task shared variable. It is to provide a shared variable detection processing method in a task that can be performed.

〔課題を解決するための手段〕[Means for solving the problem]

本発明は上記の目的を達成するため、マルチプロセッ
サでの実行を記述可能な高級プログラミング言語で記述
された原始プログラムからタスク内共有変数とみなせる
タスク間共有変数を検出してタスク内共有変数に置き換
える処理方式において、原始プログラムを入力して、プ
ログラム単位毎に、そのプログラム単位内で宣言されて
いるタスク間共有変数がそのプログラム単位内の実行文
で参照されているか否かを示すプログラム単位共有変数
情報を生成すると共に、そのプログラム単位からタスク
として起動されるプログラム単位と手続きとして呼び出
されるプログラム単位の名前およびその起動方法に関す
るプログラム構成情報を生成するプログラム単位解析処
理手段と、 前記プログラム構成情報を参照して、各々のプログラ
ム単位をそれが属するタスク単位毎に分離し、且つ、前
記プログラム単位共有変数情報を参照して、各タスク単
位毎に、そのタスク単位内で宣言されているタスク間共
有変数がそのタスク単位内で参照されているか否かを示
すタスク単位共有変数情報を生成するタスク単位解析処
理手段と、 前記タスク単位共有変数情報を参照して、各々のタス
ク間共有変数が何れのタスク単位で参照されているかを
示すタスク間共有変数情報を生成するタスク間解析処理
手段と、 前記タスク間共有変数情報を参照して、原始プログラ
ム中の各プログラム単位毎に、それに含まれるタスク間
共有変数の宣言のうち、そのプログラム単位が属するタ
スクのタスク内共有変数とみなせるものはタスク内共有
変数の宣言に置き換えるかタスク内共有変数であること
の指示行を原始プログラム中に挿入し、別タスクのタス
ク内共有変数とみなせるものは原始プログラム中から削
除して、新たな原始プログラムを生成するプログラム変
換処理手段とを備えるようしている。
In order to achieve the above object, the present invention detects an inter-task shared variable that can be regarded as an in-task shared variable from a source program written in a high-level programming language capable of describing execution by a multiprocessor and replaces it with an in-task shared variable. In the processing method, a source program is input, and for each program unit, a program unit shared variable that indicates whether or not the task-to-task shared variable declared in the program unit is referenced by the executable statement in that program unit. Program unit analysis processing means for generating information, and generating program configuration information about a program unit that is started as a task from the program unit and a program unit that is called as a procedure, and its startup method, and refer to the program configuration information. The program unit It is separated for each task unit to which it belongs, and the inter-task shared variable declared in the task unit is referred to in each task unit by referring to the program unit shared variable information. Task-unit shared variable information indicating whether or not the task-unit shared variable information is referred to, and which task-unit shared variable is referred to by each task-related shared variable information by referring to the task-unit shared variable information. Inter-task analysis processing means for generating inter-task shared variable information, and referring to the inter-task shared variable information, for each program unit in the source program, among the declarations of inter-task shared variables included in the program, What can be regarded as the in-task shared variable of the task to which the unit belongs is replaced with the declaration of the in-task shared variable or the instruction line indicating that it is the in-task shared variable is displayed. Inserted into start program, which can be regarded as another task in a task shared variable is deleted from in the source program, and so and a program conversion processing means for generating a new source program.

〔作用〕[Action]

本発明のタスク内共有変数検出処理方式にあっては、
プログラム単位解析処理手段が原始プログラムを入力し
てプログラム単位共有変数情報およびプログラム構成情
報を生成し、生成されたプログラム単位共有変数情報お
よびプログラム構成情報をタスク単位解析処理手段が参
照してタスク単位共有変数情報を生成し、生成されたタ
スク単位共有変数情報をタスク間解析処理手段が参照し
てタスク間共有変数情報を生成し、生成されたタスク間
共有変数情報をプログラム変換処理手段が参照し、原始
プログラム中のタスク間共有変数の宣言のうち、自タス
クのタスク内共有変数とみなせるものはタスク内共有変
数の宣言に置き換えるかタスク内共有変数であることの
指示行を原始プログラム中に挿入し、別タスクのタスク
内共有変数とみなせるものは原始プログラム中から削除
して、新たな原始プログラムを生成する。
In the in-task shared variable detection processing method of the present invention,
The program unit analysis processing unit inputs a source program to generate program unit shared variable information and program configuration information, and the task unit analysis processing unit refers to the generated program unit shared variable information and program configuration information to share task units. Variable information is generated, and the generated task unit shared variable information is referenced by the inter-task analysis processing means to generate inter-task shared variable information, and the generated inter-task shared variable information is referenced by the program conversion processing means, Of the declarations of shared variables between tasks in the source program, those that can be regarded as shared variables within the task of the invoking task should be replaced with the declaration of shared variables within the task, or a directive line indicating that they are shared variables within the task should be inserted into the source program. , What can be regarded as the shared variable in the task of another task is deleted from the source program and a new source is created. To generate a program.

〔実施例〕〔Example〕

以下、本発明の実施例につき図面を参照して説明す
る。
Embodiments of the present invention will be described below with reference to the drawings.

第1図は本発明のタスク内共有変数検出処理方式の一
実施例を示す構成図である。第1図において、本発明の
タスク内共有変数検出処理方式は、プログラム解析・生
成機構2として具体化され、このプログラム解析・生成
機構2はマルチプロセッサでの実行を記述可能な高級プ
ログラミング言語、例えばFORTRAN言語で記述された原
始プログラム1を入力し、タスク内共有変数とみなせる
タスク間共有変数をタスク内共有変数に置き換えた新た
な原始プログラム3および共有変数情報リスト4を出力
するようになっている。なお、プログラム解析・生成機
構2は、機能部として、プログラム解析機構21とプログ
ラム生成機構25とを有し、情報格納領域として、構成情
報領域28と共有変数情報領域29とを有している。また、
プログラム解析機構21はプログラム単位解析処理手段22
とタスク単位解析処理手段23とタスク間解析処理手段24
とから構成され、プログラム生成機構25は共有変数情報
編集・出力処理手段26とプログラム変換処理手段27とか
ら構成されている。各部の構成は後述の動作を通して説
明することとする。
FIG. 1 is a block diagram showing an embodiment of the in-task shared variable detection processing method of the present invention. In FIG. 1, the in-task shared variable detection processing method of the present invention is embodied as a program analysis / generation mechanism 2, and this program analysis / generation mechanism 2 can describe execution by a multiprocessor, for example, a high-level programming language. A source program 1 written in FORTRAN language is input, and a new source program 3 and shared variable information list 4 in which inter-task shared variables that can be regarded as in-task shared variables are replaced with in-task shared variables are output. . The program analysis / generation mechanism 2 has a program analysis mechanism 21 and a program generation mechanism 25 as functional units, and a configuration information area 28 and a shared variable information area 29 as information storage areas. Also,
The program analysis mechanism 21 is a program unit analysis processing means 22.
And task unit analysis processing means 23 and inter-task analysis processing means 24
The program generation mechanism 25 is composed of shared variable information editing / output processing means 26 and program conversion processing means 27. The configuration of each unit will be described through the operation described below.

第2図はFORTRAN言語で記述した原始プログラム1の
一例を示したものであり、5つのプログラム単位100,20
0,300,400,500から構成されているものとする。
FIG. 2 shows an example of the source program 1 written in the FORTRAN language.
It shall consist of 0,300,400,500.

プログラム単位100は、名前付き共通ブロックである
タスク間共有変数AA,CC,DDを宣言するタスク間共有変数
宣言文110,111,112と、タスク間共有変数DDの要素DM2と
配列Cの領域結合を宣言するEQUIVALENCE文113と、プロ
グラム単位300の手続き副プログラムAをタスクとして
起動するタスク起動文120と、プログラム単位200の手続
き副プログラムDを呼び出す手続き呼び出し文121と、
タスク間共有変数の要素AM3,DM1,Cの参照を含む共有変
数参照文130,131,132とを含んでいる。
The program unit 100 declares inter-task shared variable declaration statements 110, 111, 112 that declare inter-task shared variables AA, CC, DD, which are named common blocks, and EQUIVALENCE that declares area coupling of element DM2 and array C of inter-task shared variable DD. A statement 113, a task activation statement 120 that activates the procedure subprogram A of the program unit 300 as a task, and a procedure call statement 121 that calls the procedure subprogram D of the program unit 200,
It includes shared variable reference statements 130, 131 and 132 including references to elements AM3, DM1 and C of shared variables between tasks.

プログラム単位200は、名前付き共通ブロックである
タスク間共有変数DDを宣言するタスク間共有変数宣言文
210と、タスク間共有変数の要素DD1,DD2の参照を含む共
有変数参照文230,231とを含んでいる。
The program unit 200 is an inter-task shared variable declaration statement that declares an inter-task shared variable DD that is a named common block.
210 and shared variable reference statements 230 and 231 including references to the elements DD1 and DD2 of the inter-task shared variable.

プログラム単位300は、名前付き共通ブロックである
タスク間共有変数AA,CCを宣言するタスク間共有変数宣
言文310,311と、プログラム単位400の手続き副プログラ
ムBを呼び出す手続き呼び出し文320およびプログラム
単位500の手続き副プログラムCを呼び出す手続き呼び
出し文321と、タスク間共有変数の要素CA3,CA2,CA1,AA1
の参照を含む共有変数参照文330,331,332,333とを含ん
でいる。
The program unit 300 includes inter-task shared variable declaration statements 310 and 311 that declare inter-task shared variables AA and CC that are named common blocks, a procedure call statement 320 that calls the procedure subprogram B of the program unit 400, and a procedure of the program unit 500. Procedure call statement 321 that calls subprogram C, and elements CA3, CA2, CA1, AA1 of inter-task shared variables
Shared variable reference sentences 330, 331, 332, 333 including the reference of.

プログラム単位400は、名前付き共通ブロックである
タスク間共有変数AAを宣言するタスク間共有変数宣言文
410と、タスク間共有変数の要素AB2の参照を含む共有変
数参照文430とを含んでいる。
The program unit 400 is an inter-task shared variable declaration statement that declares an inter-task shared variable AA that is a named common block.
410 and a shared variable reference statement 430 including a reference to the element AB2 of the inter-task shared variable.

プログラム単位400は、名前付き共通ブロックである
タスク間共有変数AA,CCを宣言するタスク間共有変数宣
言文510,511と、タスク間共有変数の要素AC1,AC2,CC1の
参照を含む共有変数参照文530,531,532とを含んでい
る。
The program unit 400 includes inter-task shared variable declaration statements 510 and 511 that declare inter-task shared variables AA and CC that are named common blocks, and shared variable reference statements 530, 531 and 532 that include references to elements AC1, AC2, and CC1 of inter-task shared variables. Includes and.

以下、第2図に示した原始プログラム1を例にとり、
第1図に示した実施例の動作を説明する。
Taking the source program 1 shown in FIG. 2 as an example,
The operation of the embodiment shown in FIG. 1 will be described.

プログラム解析・生成機構2は、プログラム単位100,
200,300,400,500から構成される原始プログラム1をを
入力する。
The program analysis / generation mechanism 2 is a program unit 100,
Input the source program 1 consisting of 200,300,400,500.

プログラム解析機構21のプログラム単位解析処理手段
22は、各プログラム単位に出現する文の種類に応じて以
下の処理を行う。すなわち、プログラム単位100のタス
ク間共有変数宣言文110を検出すると、第3図に示すプ
ログラム単位共有変数情報101の一部として、共有変数
名AAと、その要素名(名前)AM1,AM2,AM3と、その要素
長(長さ)4,8,8を含む共有変数AAにかかる情報を共有
変数情報領域29に格納する。なお、参照情報は初期値と
して未参照としておく。タスク間共有変数宣言文111,11
2についても同様の処理を行い、タスク間共有変数CC,DD
にかかる情報を共有変数情報領域29に格納する。
Program unit analysis processing means of the program analysis mechanism 21
22 performs the following processing according to the type of sentence appearing in each program unit. That is, when the inter-task shared variable declaration statement 110 of the program unit 100 is detected, the shared variable name AA and its element names (name) AM1, AM2, AM3 are included as part of the program unit shared variable information 101 shown in FIG. And information related to the shared variable AA including the element length (length) 4, 8, 8 is stored in the shared variable information area 29. The reference information is unreferenced as an initial value. Inter-task shared variable declaration statement 111,11
The same process is performed for 2, and the task-to-task shared variables CC and DD are
The information related to the above is stored in the shared variable information area 29.

次いで、プログラム単位解析処理手段22はタスク間共
有変数DDの要素DM2と並列Cの領域を結合するEQUIVALEN
CE文113を検出すると、この領域結合によりタスク間共
有変数の他の要素が領域結合されるか否かを調べる。こ
の場合、配列Cは複素型なので要素長が40であり、要素
長20の要素DM2と要素長20の要素DM3の両領域に対応する
ので、要素DM3も配列Cと領域結合され、要素DM2,DM3は
1要素となる。そこで、共有変数情報領域29内のプログ
ラム単位共有変数情報101(第3図参照)の共有変数DD
の情報を、要素名DM1をもつ長さ4の要素と要素名DM2,D
M3,Cをもつ長さ40の要素とから構成されるように変更す
る。
Next, the program unit analysis processing means 22 connects the element DM2 of the inter-task shared variable DD and the area of parallel C to EQUIVALEN.
When the CE statement 113 is detected, it is checked whether or not other elements of the inter-task shared variable are area-joined by this area joining. In this case, since the array C is a complex type, the element length is 40, and since it corresponds to both areas of the element DM2 having the element length 20 and the element DM3 having the element length 20, the element DM3 is also area-combined with the array C, and the element DM2, DM3 is one element. Therefore, the shared variable DD of the program unit shared variable information 101 (see FIG. 3) in the shared variable information area 29.
Information of the elements of length 4 with element name DM1 and element names DM2, D
Change to consist of 40 elements with length M3, C.

次いで、プログラム単位解析処理手段22はタスク起動
文120を検出すると、手続き名,引数情報およびタスク
起動であるというプログラム構成情報を構成情報領域28
に格納する。手続き呼び出し文121についても同様に処
理する。
Next, when the program unit analysis processing means 22 detects the task activation statement 120, the program name information, the argument information, and the program configuration information indicating that the task is activated are provided in the configuration information area 28.
To be stored. The procedure call statement 121 is similarly processed.

次いで、プログラム単位解析処理手段22はタスク間共
有変数AAの要素AM3を参照する共有変数参照文130を検出
すると、プログラム単位共有変数情報101(第3図参
照)のタスク間共有変数AAの要素AM3の参照情報を参照
有に変更する。共有変数参照文131,132についても同様
に処理する。
Next, when the program unit analysis processing unit 22 detects the shared variable reference statement 130 that refers to the element AM3 of the inter-task shared variable AA, the element AM3 of the inter-task shared variable AA of the program unit shared variable information 101 (see FIG. 3). Change the reference information of to refer to. The shared variable reference sentences 131 and 132 are similarly processed.

これらの処理を他のプログラム単位200,300,400,500
に対しても実行し、第3図に示す如きプログラム単位共
有変数情報201,301,401,501を共有変数情報領域29上に
生成する。
These processes are processed by other program units 200,300,400,500
To generate the program unit shared variable information 201, 301, 401, 501 as shown in FIG. 3 in the shared variable information area 29.

次に、プログラム解析機構21のタスク単位解析処理手
段23は、構成情報領域28のプログラム構成情報を参照
し、プログラム単位をタスク毎に分類する。すなわち、
プログラム名MAINのプログラム単位100は手続き副プロ
グラム名Dであるプログラム単位200を呼び出してお
り、プログラム単位200は他の手続き副プログラムを呼
び出していないので、プログラム単位100とプログラム
単位200とは同一のタスクに属すると判定し、そのよう
に分類する。同様に、プログラム単位100からタスク起
動される手続き副プログラム名Aのプログラム単位300
は手続き副プログラム名B,Cのプログラム単位400,500を
呼び出しており、プログラム単位400,500は他の手続き
を呼び出していないので、プログラム単位300,400,500
は同一のタスクに属すると判定し、そのように分類す
る。すなわち、プログラム単位100,200により構成され
るタスク(以下、タスク10と呼ぶ。)と、プログラム単
位300,400,500により構成されるタスク(以下、タスク2
0と呼ぶ。)と2つのタスクに分類される。
Next, the task unit analysis processing means 23 of the program analysis mechanism 21 refers to the program configuration information in the configuration information area 28 and classifies the program units for each task. That is,
The program unit 100 with the program name MAIN calls the program unit 200 with the procedure subprogram name D, and the program unit 200 does not call another procedure subprogram, so the program unit 100 and the program unit 200 have the same task. It is determined that it belongs to and is classified as such. Similarly, the program unit 300 of the procedure subprogram name A whose task is started from the program unit 100
Is calling program unit 400,500 with procedure subprogram name B, C, and program unit 400,500 is not calling another procedure, so program unit 300,400,500
Determine that they belong to the same task and classify them as such. That is, a task composed of program units 100 and 200 (hereinafter referred to as task 10) and a task composed of program units 300, 400 and 500 (hereinafter task 2).
Call it 0. ) And two tasks.

これらのタスク毎にプログラム単位を分類する処理が
終了すると、タスク単位解析処理手段23は、タスク10を
構成するプログラム単位100,200のプログラム単位共有
変数情報101,201(第3図参照)を参照し、宣言されて
いるタスク間共有変数AA,CC,DDのタスク内での要素の再
構成を行い、共有変数情報領域29上にタスク単位共有変
数情報11の生成を行う。この場合、タスク間共有変数A
A,CCは、単一のプログラム単位100でのみ宣言されてい
るので、参照したプログラム単位共有変数情報101の情
報をそのまま使用し、第4図に示すように、タスク単位
共有変数情報11を生成する。一方、タスク間共有変数DD
は、複数のプログラム単位100,200で宣言されているの
で、各々の要素を対応させる。すなわち、要素の対応の
結果、2番目の要素の重なりが不一致なので、領域の重
なりの最大値を1要素とするように情報を変更する。こ
れにより、タスク間共有変数DDは、長さ4でタスク内で
参照有の要素と長さ40で参照有の要素としてタスク単位
共有変数情報11が生成される。
When the processing for classifying the program units for each of these tasks ends, the task unit analysis processing means 23 refers to the program unit shared variable information 101, 201 (see FIG. 3) of the program units 100, 200 constituting the task 10 and is declared. Reconfiguring the elements of the inter-task shared variables AA, CC, DD within the task, and generating the task-unit shared variable information 11 on the shared variable information area 29. In this case, the shared variable A between tasks
Since A and CC are declared only in a single program unit 100, the information in the referenced program unit shared variable information 101 is used as it is, and task unit shared variable information 11 is generated as shown in FIG. To do. On the other hand, the task shared variable DD
Is declared in multiple program units 100 and 200, so each element is associated. That is, as a result of the correspondence of the elements, the overlap of the second element does not match, so the information is changed so that the maximum value of the overlap of the areas is one element. As a result, the task-unit shared variable information 11 is generated as an inter-task shared variable DD with an element having a length of 4 and having a reference in the task and an element having a length of 40 and having a reference.

他のタスク20についても同様の処理を行い、第4図に
示すようなタスク単位共有変数情報21を生成する。
The same process is performed for the other tasks 20 to generate task unit shared variable information 21 as shown in FIG.

次に、プログラム解析機構21のタスク間解析処理手段
24は、共有変数情報領域29のタスク単位共有変数情報1
1,21(第4図参照)を参照し、タスク間共有変数AA,CC,
DDを1つずつ抽出し、そのタスク間共有変数の部分毎に
参照情報を付したタスク間共有変数情報31を共有変数情
報領域29上に生成する。すなわち、タスク間共有変数AA
を抽出した際には、このタスク間共有変数AAを参照する
タスクを部分毎に検索し、この場合、タスク間共有変数
AAの先頭から長さ12の部分がプログラム単位300,400,50
0から構成されるタスク20でのみ参照され、次の長さ8
の部分がプログラム単位100,200から構成されるタスク1
0とプログラム単位300,400,500から構成されるタスク20
との両者で参照されているため、第5図に示すように、
その旨の情報を共有変数名AAと対応付けてタスク間共有
変数情報31を生成する。
Next, the inter-task analysis processing means of the program analysis mechanism 21
24 is task-unit shared variable information 1 in the shared variable information area 29
1,21 (see Fig. 4), refer to the inter-task shared variables AA, CC,
The DDs are extracted one by one, and the inter-task shared variable information 31 with reference information attached to each of the inter-task shared variable parts is generated on the shared variable information area 29. That is, the shared variable AA between tasks
When extracting, the task that refers to this inter-task shared variable AA is searched for each part, and in this case, the inter-task shared variable
A unit of length 12 from the beginning of AA is a program unit 300,400,50
Referenced only in task 20 consisting of 0 and of length 8
Task 1 whose part consists of 100,200 program units
Task 20 consisting of 0 and program units 300,400,500
Since both are referred to, as shown in FIG.
The inter-task shared variable information 31 is generated by associating the information to that effect with the shared variable name AA.

他のタスク間共有変数CC,DDについても同様の処理を
行う。
The same processing is performed for other inter-task shared variables CC and DD.

次に、プログラム生成機構25の共有変数情報編集・出
力処理手段26は、共有変数情報領域29のプログラム単位
共有変数情報101,201,301,401,501,タスク単位共有変数
情報11,21,タスク間共有変数情報31を参照し、所定の形
式に編集した上で、第6図に示す如き共有変数情報リス
ト4を出力する。これは、プログラム開発者等の参考に
供される。
Next, the shared variable information editing / output processing means 26 of the program generation mechanism 25 refers to the program unit shared variable information 101, 201, 301, 401, 501, the task unit shared variable information 11, 21, and the task shared variable information 31 in the shared variable information area 29. , And outputs it as a shared variable information list 4 as shown in FIG. This is used as a reference for program developers.

最後に、プログラム生成機構25のプログラム変換処理
手段27は、原始プログラム1を再度入力し、共有変数情
報領域29のタスク間共有変数情報31(第5図参照)を参
照して原始プログラム1中の各プログラム単位中のタス
ク間共有変数の宣言のうち、自タスクのタスク内共有変
数とみなせるものはタスク内共有変数の宣言に置き換え
るかタスク内共有変数であることの指示行を原始プログ
ラム1中に挿入し、別タスクのタスク内共有変数とみな
せるものは原始プログラム1中から削除して、新たな原
始プログラム3を生成する。
Finally, the program conversion processing means 27 of the program generation mechanism 25 inputs the source program 1 again and refers to the inter-task shared variable information 31 (see FIG. 5) in the shared variable information area 29 to refer to the source program 1 in the source program 1. Of the declarations of shared variables between tasks in each program unit, those that can be regarded as shared variables within the task of the invoking task should be replaced with the declaration of shared variables within the task, or a directive line indicating that they are shared variables within the task is specified in the source program 1. What is inserted and can be regarded as an in-task shared variable of another task is deleted from the source program 1 to generate a new source program 3.

すなわち、プログラム単位100(第2図参照)中のタ
スク間共有変数宣言文110を検出すると、タスク間共有
変数情報31を参照し、当該タスク間共有変数AAがタスク
内共有変数であるか否かを判定する。この場合、タスク
間共有変数宣言文110のタスク間共有変数AAの3要素AM
1,AM2,AM3の中で要素AM1,AM2に相当する先頭から長さ12
の部分が、プログラム単位100の属するタスク10とは別
のタスク20の実質的なタスク内共有変数であることが判
明するため、タスク間共有変数AAから要素AM1,AM2を削
除し、第7図に示すように、1つの要素AM3から構成さ
れるタスク間共有変数AAのタスク間共有変数宣言文110a
をプログラム単位100中に生成する。
That is, when the inter-task shared variable declaration statement 110 in the program unit 100 (see FIG. 2) is detected, the inter-task shared variable information 31 is referenced to determine whether the inter-task shared variable AA is an intra-task shared variable. To judge. In this case, the three-element AM of the inter-task shared variable AA in the inter-task shared variable declaration statement 110
Length 12 from the beginning corresponding to elements AM1 and AM2 among 1, AM2 and AM3
Since it is found that the part of is a substantial in-task shared variable of the task 20 other than the task 10 to which the program unit 100 belongs, the elements AM1 and AM2 are deleted from the inter-task shared variable AA, and FIG. As shown in, the inter-task shared variable declaration statement 110a of the inter-task shared variable AA composed of one element AM3
Is generated in program unit 100.

次いで、プログラム単位100(第2図参照)中からタ
スク間共有変数宣言文111を検出すると、タスク間共有
変数CCは全要素がプログラム単位100の属するタスク10
とは別のタスク20の実質的なタスク内共有変数なので、
この宣言文111を削除する。
Next, when an inter-task shared variable declaration statement 111 is detected in the program unit 100 (see FIG. 2), all elements of the inter-task shared variable CC are assigned to the task 10 to which the program unit 100 belongs.
Since it is a shared variable in the actual task of task 20 which is different from
This declaration statement 111 is deleted.

次いで、プログラム単位100(第2図参照)中からタ
スク間共有変数宣言文112を検出すると、タスク間共有
変数DDは全要素がプログラム単位100の属するタスク10
の実質的なタスク内共有変数なので、この宣言文112を
第7図に示すようにタスク内共有変数宣言文112aに変更
する。
Next, when an inter-task shared variable declaration statement 112 is detected in the program unit 100 (see FIG. 2), all elements of the inter-task shared variable DD are assigned to the task 10 to which the program unit 100 belongs.
Since it is an in-task shared variable, the declaration statement 112 is changed to an in-task shared variable declaration statement 112a as shown in FIG.

同様の処理を他のプログラム単位についても実行し、
最終的に第7図全体のような原始プログラム3を生成す
る。
Perform the same process for other program units,
Finally, the source program 3 as shown in FIG. 7 is generated.

〔発明の効果〕〔The invention's effect〕

以上説明したように、本発明のタスク内共有変数検出
処理方式にあっては、原始プログラムからタスク内共有
変数とみなせるタスク間共有変数を検出してタスク内共
有変数に置き換える等の処理が自動的に行えるため、煩
雑な作業から人間が解放されると共に、処理時間が大幅
に短縮される効果がある。また、検出漏れ等が発生しな
いため、プログラム実行時の効率も充分に高めることが
できる。
As described above, in the in-task shared variable detection processing method of the present invention, processing such as detecting an inter-task shared variable that can be regarded as an in-task shared variable from the source program and replacing it with the in-task shared variable is automatically performed. Therefore, it is possible to relieve the human from complicated work and to significantly shorten the processing time. Moreover, since no omission of detection occurs, the efficiency at the time of executing the program can be sufficiently improved.

【図面の簡単な説明】[Brief description of drawings]

第1図は本発明のタスク内共有変数検出処理方式の一実
施例を示す構成図、 第2図は原始プログラムの例を示す図、 第3図はプログラム単位共有変数情報の例を示す図、 第4図はタスク単位共有変数情報の例を示す図、 第5図はタスク間共有変数情報を例を示す図、 第6図は共有変数情報リストの例を示す図および、 第7図は変換後の原始プログラムの例を示す図である。 図において、 1……原始プログラム 2……プログラム解析・生成機構 21……プログラム解析機構 22……プログラム単位解析処理手段 23……タスク単位解析処理手段 24……タスク間解析処理手段 25……プログラム生成構成 26……共有変数情報編集・出力処理手段 27……プログラム変換処理手段 28……構成情報領域 29……共有変数情報領域 3……原始プログラム 4……共有変数情報リスト
FIG. 1 is a block diagram showing an embodiment of the in-task shared variable detection processing method of the present invention, FIG. 2 is a diagram showing an example of a source program, FIG. 3 is a diagram showing an example of program unit shared variable information, FIG. 4 is a diagram showing an example of task-unit shared variable information, FIG. 5 is a diagram showing an example of inter-task shared variable information, FIG. 6 is a diagram showing an example of a shared variable information list, and FIG. 7 is a conversion. It is a figure which shows the example of a later source program. In the figure, 1 ... Primitive program 2 ... Program analysis / generation mechanism 21 ... Program analysis mechanism 22 ... Program unit analysis processing means 23 ... Task unit analysis processing means 24 ... Intertask analysis processing means 25 ... Program Generation configuration 26 …… Shared variable information editing / output processing means 27 …… Program conversion processing means 28 …… Configuration information area 29 …… Shared variable information area 3 …… Primitive program 4 …… Shared variable information list

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】マルチプロセッサでの実行を記述可能な高
級プログラミング言語で記述された原始プログラムから
タスク内共有変数とみなせるタスク間共有変数を検出し
てタスク内共有変数に置き換える処理方式において、 原始プログラムを入力して、プログラム単位毎に、その
プログラム単位内で宣言されているタスク間共有変数が
そのプログラム単位内の実行文で参照されているか否か
を示すプログラム単位共有変数情報を生成すると共に、
そのプログラム単位からタスクとして起動されるプログ
ラム単位と手続きとして呼び出されるプログラム単位の
名前およびその起動方法に関するプログラム構成情報を
生成するプログラム単位解析処理手段と、 前記プログラム構成情報を参照して、各々のプログラム
単位をそれが属するタスク単位毎に分離し、且つ、前記
プログラム単位共有変数情報を参照して、各タスク単位
毎に、そのタスク単位内で宣言されているタスク間共有
変数がそのタスク単位内で参照されているか否かを示す
タスク単位共有変数情報を生成するタスク単位解析処理
手段と、 前記タスク単位共有変数情報を参照して、各々のタスク
間共有変数が何れのタスク単位で参照されているかを示
すタスク間共有変数情報を生成するタスク間解析処理手
段と、 前記タスク間共有変数情報を参照して、原始プログラム
中の各プログラム単位毎に、それに含まれるタスク間共
有変数の宣言のうち、そのプログラム単位が属するタス
クのタスク内共有変数とみなせるものはタスク内共有変
数の宣言に置き換えるかタスク内共有変数であることの
指示行を原始プログラム中に挿入し、別タスクのタスク
内共有変数とみなせるものは原始プログラム中から削除
して、新たな原始プログラムを生成するプログラム変換
処理手段とを備えたことを特徴とするタスク内共有変数
検出処理方式。
1. A processing method for detecting an inter-task shared variable, which can be regarded as an intra-task shared variable, from a source program written in a high-level programming language capable of describing execution by a multiprocessor, and replacing the inter-task shared variable with the in-task shared variable. By inputting to generate program unit shared variable information indicating whether or not the inter-task shared variable declared in the program unit is referenced in the executable statement in the program unit for each program unit,
Program unit analysis processing means for generating the program unit name that is started as a task from the program unit and the program unit name that is called as a procedure and the program structure information regarding the starting method, and each program with reference to the program structure information. The unit is divided for each task unit to which it belongs, and with reference to the program unit shared variable information, the task-to-task shared variable declared in each task unit is shared in each task unit. A task unit analysis processing unit that generates task unit shared variable information indicating whether or not it is referenced, and in which task unit each intertask shared variable is referenced with reference to the task unit shared variable information. Between-task analysis processing means for generating inter-task shared variable information indicating With reference to the variable information, for each program unit in the source program, among the declarations of the inter-task shared variables included in it, those that can be regarded as the intra-task shared variable of the task to which the program unit belongs are Program conversion that creates a new source program by replacing it with a declaration or inserting a directive line indicating that it is a shared variable in a task in the source program and deleting what can be regarded as a shared variable in a task of another task from the source program. A shared variable detection processing method in a task, comprising: a processing means.
JP1327754A 1989-12-18 1989-12-18 Shared variable detection processing method in task Expired - Lifetime JP2527055B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1327754A JP2527055B2 (en) 1989-12-18 1989-12-18 Shared variable detection processing method in task

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1327754A JP2527055B2 (en) 1989-12-18 1989-12-18 Shared variable detection processing method in task

Publications (2)

Publication Number Publication Date
JPH03188529A JPH03188529A (en) 1991-08-16
JP2527055B2 true JP2527055B2 (en) 1996-08-21

Family

ID=18202615

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1327754A Expired - Lifetime JP2527055B2 (en) 1989-12-18 1989-12-18 Shared variable detection processing method in task

Country Status (1)

Country Link
JP (1) JP2527055B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6102968A (en) * 1998-05-21 2000-08-15 Lucent Technologies Inc. Method for automatically closing open reactive systems

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62216042A (en) * 1986-03-17 1987-09-22 Nec Corp Memory allocating system for data area
JP2871693B2 (en) * 1988-05-23 1999-03-17 日本電気株式会社 Critical section optimization method

Also Published As

Publication number Publication date
JPH03188529A (en) 1991-08-16

Similar Documents

Publication Publication Date Title
US5142681A (en) APL-to-Fortran translators
US7725883B1 (en) Program interpreter
AU775007B2 (en) Method and apparatus for building a calling convention prolog and epilog code using a register allocator
JP2666847B2 (en) Heterogeneous language communication method
JPH03172936A (en) Method and apparatus for compiling program requiring interprocedual register allocation
JPH06324881A (en) Compiler device with superposition deciding function of memory data
JPS6325733A (en) Compiler processing system
Thimbleby Delaying commitment (programming strategy)
JP2527055B2 (en) Shared variable detection processing method in task
JP3318051B2 (en) Translation processing method
Schwan et al. A system for parallel programming
JPS58149567A (en) Processing system of merging of vector length control range
JP2539070B2 (en) Compiler processor
JP3085309B2 (en) Debug system
EP0252229A2 (en) Apl-to-fortran translator
JPH04287121A (en) Tuple space system
EP0215001B1 (en) Higher order language-directed computer
JP2682215B2 (en) Procedure call method during parallel processing
JP3167386B2 (en) Automatic program parallelization method
JPH0196741A (en) Common section system in debugger
Shen et al. Optimized parallel execution of declarative programs on distributed memory multiprocessors
JPS61127044A (en) Test system for single unit program
JPH02205930A (en) Interface check processing method
JPH07239789A (en) Data code processing system
JPH0293948A (en) Computer system