JP3364952B2 - Compiler device, information processing system, object code generation method, and information processing method - Google Patents

Compiler device, information processing system, object code generation method, and information processing method

Info

Publication number
JP3364952B2
JP3364952B2 JP15814192A JP15814192A JP3364952B2 JP 3364952 B2 JP3364952 B2 JP 3364952B2 JP 15814192 A JP15814192 A JP 15814192A JP 15814192 A JP15814192 A JP 15814192A JP 3364952 B2 JP3364952 B2 JP 3364952B2
Authority
JP
Japan
Prior art keywords
variable
processing
access
processing unit
copy
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 - Fee Related
Application number
JP15814192A
Other languages
Japanese (ja)
Other versions
JPH064497A (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.)
Seiko Epson Corp
Original Assignee
Seiko Epson 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 Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP15814192A priority Critical patent/JP3364952B2/en
Publication of JPH064497A publication Critical patent/JPH064497A/en
Application granted granted Critical
Publication of JP3364952B2 publication Critical patent/JP3364952B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、マルチプロセッサでの
実行を前提として高級言語によって記述されたプログラ
ムにおいて、ソースコード中のある処理手続きを別のプ
ロセッサに分散することで、処理速度を向上させる技術
に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention improves the processing speed by distributing a processing procedure in a source code to another processor in a program written in a high-level language on the assumption of execution by a multiprocessor. Regarding technology.

【0002】[0002]

【従来の技術】ある目的プログラムの実行にあたり、そ
の処理速度を向上させる方法として、プログラムの処理
単位の中で並列に実行できる部分を、複数のプロセッサ
を使用して、並列実行する方法がある。この分野での従
来発明は、主にベクトルプロセッサを付加した大型コン
ピュータを実行環境として考案されたものである。また
発明は、従来より広く使用されてきた高級言語のコンパ
イル結果の実行処理速度を改善することを目的としてな
された(例えば、特開昭62−34275号「ベクトル
化コンパイラ」など)ものが多い。
2. Description of the Related Art As a method for improving the processing speed in executing a certain target program, there is a method in which a plurality of processors can be executed in parallel by using a plurality of processors. The conventional invention in this field is devised mainly as a large-scale computer to which a vector processor is added as an execution environment. Many of the inventions have been made for the purpose of improving the execution processing speed of the compilation result of a high-level language which has been widely used (for example, JP-A-62-34275, "Vectorizing Compiler").

【0003】目的プログラムが、一部分ずつの処理単位
に分散され、複数のプロセッサによって実行される場
合、処理速度の向上を図るためには、処理単位間で共有
される変数のアクセスを調停する手段の処理時間が問題
となる。なぜなら、複数個のプロセッサのメモリ空間
に、それぞれ配置されたプログラムの実行単位は、局所
的な変数については自プログラムの作業領域に配置し、
共有変数は共有メモリ領域に配置するように設計される
場合が多いためである。
When the object program is divided into processing units and is executed by a plurality of processors, in order to improve the processing speed, a means for arbitrating access to variables shared among the processing units is provided. Processing time becomes a problem. This is because the execution units of the programs allocated in the memory spaces of multiple processors are allocated to the work area of the own program for local variables.
This is because the shared variable is often designed to be placed in the shared memory area.

【0004】さらに近年は、処理系のダウンサイジング
の傾向が強まり、従来発明の方法をマルチマイクロプロ
セッサシステムにも用いる場合が多い。複数個のマイク
ロプロセッサを用いた並列処理システムは、構成上安価
でありながら高い処理速度が得られるものとして期待さ
れている。
Further, in recent years, the tendency of downsizing of processing systems has become stronger, and the method of the prior art is often used in a multi-microprocessor system. A parallel processing system using a plurality of microprocessors is expected to obtain a high processing speed while being inexpensive in structure.

【0005】一般に、複数のマイクロプロセッサからな
る処理系を構成するには、およそ2種類の基本的な形態
が有る。図15aのように、複数のマイクロプロセッサ
1に対し、1つ以上の共有のメモリ3を配置した構成
と、図15bのように複数のマイクロプロセッサ1を、
通信制御手段4を用いて、通信経路5に接続した構成で
ある。どちらの構成においても、マイクロプロセッサ1
の処理速度を維持するために、局所メモリ2が使用され
るのが通常である。
Generally, there are about two basic modes for constructing a processing system including a plurality of microprocessors. A configuration in which one or more shared memories 3 are arranged for a plurality of microprocessors 1 as shown in FIG. 15a and a plurality of microprocessors 1 as shown in FIG.
The communication control means 4 is used to connect to the communication path 5. In either configuration, the microprocessor 1
The local memory 2 is usually used in order to maintain the processing speed of.

【0006】従来発明によると、プログラムの処理単位
間で共有される変数が存在する場合、図15aの様な密
結合のマルチマイクロプロセッサシステムでは、共有変
数の格納場所として必要なメモリは、共有メモリ3に配
置されることが多い。この場合は、共有変数に対するア
クセス調停のため、排他制御が行われる。一方、図15
bの様に粗結合のマルチマイクロプロセッサシステムで
は、処理単位間の共有変数は、この共有変数を宣言した
処理単位が実行されるマイクロプロセッサの局所メモリ
2に配置せざるをえない。この場合、共有変数に対する
アクセス調停は、通信経路5を用いて行われる通信で実
現される。通信経路5としては、先入れデータを先に取
り出すことが出来るように構成された順序付きメモリで
あるFIFOを用いた構成や、ネットワークが使用される。
According to the conventional invention, when there is a variable shared between processing units of a program, in a tightly coupled multi-microprocessor system as shown in FIG. 15a, the memory required for storing the shared variable is the shared memory. Often placed at 3. In this case, exclusive control is performed for arbitrating access to the shared variable. On the other hand, FIG.
In a coarsely coupled multi-microprocessor system like b, the shared variable between processing units must be placed in the local memory 2 of the microprocessor in which the processing unit in which this shared variable is declared is executed. In this case, access arbitration for the shared variable is realized by communication performed using the communication path 5. As the communication path 5, a configuration using a FIFO, which is an ordered memory configured to be able to take out the first-in first-out data first, or a network is used.

【0007】従って図15bのシステムでは、1度共有
変数へのアクセス調停が必要とされると、マイクロプロ
セッサ1は、通信制御手段4および通信経路5を使用し
た通信処理プログラムを実行することを要求され、実行
中の目的プログラムから見たとき大きなオーバーヘッド
となる。
Therefore, in the system shown in FIG. 15b, once access arbitration to the shared variable is required, the microprocessor 1 requests execution of the communication processing program using the communication control means 4 and the communication path 5. This is a large overhead when viewed from the target program being executed.

【0008】また図15aのシステムについても、排他
制御の処理時間は無視できない。この場合、共有変数へ
のアクセスは、共有メモリに接続されたバスを通して複
数のプロセッサ間の競合を伴って行なわれる事になる。
排他制御の機構によって、ある実行単位がこの共有変数
にアクセスしている間、他の実行単位が同じ共有変数
(あるいは共有変数を含む同一のメモリ管理単位)にア
クセスしようととすると、この実行単位の処理は待機さ
せられる。従って、共有変数の数が多く、極めて頻繁に
アクセス調停が行われるとしたら、処理速度向上を図る
上で不都合である。
Also in the system of FIG. 15a, the processing time of exclusive control cannot be ignored. In this case, access to the shared variable is performed with contention among a plurality of processors through the bus connected to the shared memory.
Due to the mechanism of exclusive control, if another execution unit attempts to access the same shared variable (or the same memory management unit that contains the shared variable) while this execution unit is accessing this shared variable, this execution unit Processing is put on hold. Therefore, if the number of shared variables is large and access arbitration is performed very frequently, it is inconvenient for improving the processing speed.

【0009】この問題を除くために、不必要な処理単位
間の共有変数をできるだけ減らす方法が考案された。す
なわち、FORTRAN等の高級言語を用いて人手によって記
述されたソースコードから、不必要に宣言された共有変
数を取り除く翻訳処理系の前処理プログラム(プリプロ
セッサ)などが有る。
In order to eliminate this problem, a method has been devised to reduce unnecessary shared variables between processing units. That is, there is a preprocessing program (preprocessor) for a translation processing system that removes unnecessarily declared shared variables from a source code manually written using a high-level language such as FORTRAN.

【0010】この方法による公知例として、特開平3−
188529号「タスク内共有変数検出処理方式」があ
る。しかし、元々不必要に宣言された共有変数をプリプ
ロセッサによってソースコードから取り除き、新たなソ
ースコードを生成する方法は、プログラムが設計された
段階からアルゴリズム上存在する共有変数を取り除くこ
とはできないので、本質的に共有変数へのアクセス調停
の発生度数を減少させることにはならない。
As a publicly known example of this method, Japanese Patent Laid-Open No.
There is No. 188529 “Intra-task shared variable detection processing method”. However, the method of removing the originally unnecessarily declared shared variable from the source code by the preprocessor and generating a new source code cannot remove the shared variable existing in the algorithm from the stage when the program was designed. However, it does not reduce the frequency of access arbitration to shared variables.

【0011】実際に記述されたソースコードの中に現わ
れる変数の内、共有変数は複数の実行単位(例えばFORT
RANのSUBROUTINE等)で使用されるものである。従来の
逐次処理向けの言語では、共有変数の中には、ある実行
単位に限って着目した場合、参照されるだけの変数が存
在する。この実行単位にとって、参照しか行なわない変
数は、その局所的な領域では定数の値を参照する場合と
等価である。また、配列変数であっても、ある一連の繰
り返し操作の中で、添字の値が一定である場合は、この
繰り返し操作の内側の局所的な領域では、配列の一つの
要素は単一の変数と等価である。
Among the variables that appear in the actually described source code, shared variables are a plurality of execution units (for example, FORT
RAN SUBROUTINE etc.) is used. In a conventional language for sequential processing, among shared variables, when attention is paid only to a certain execution unit, there are variables that can be referred to. For this execution unit, a variable that is referred to is equivalent to a case where the value of a constant is referred to in its local area. Moreover, even if it is an array variable, if the value of the subscript is constant in a certain series of repeated operations, one element of the array is a single variable in the local area inside this repeated operation. Is equivalent to

【0012】以上の様な場合、共有変数であっても、そ
の使用状況によっては、局所的な変数あるいは、局所的
な定数として取り扱うことが可能となる。この点に着目
し、従来のシングルプロセッサ向きにコーディングされ
たソースプログラムから、並列システムに適した実行効
率の高いオブジェクトコードを生成することを目的とし
てなされた発明として、特開平2−132525号「コ
ンパイル方法」がある。
In the above case, even a shared variable can be treated as a local variable or a local constant depending on the usage. Focusing on this point, as an invention made with the object of generating an object code having a high execution efficiency suitable for a parallel system from a source program coded for a conventional single processor, Japanese Patent Laid-Open No. 132325/1990 “Compile”. There is a way.

【0013】この発明は、複数の実行単位において使用
されるいわゆる共有変数を、その使用状況に従い幾つか
の類型に分類し、ある実行単位の範囲内で、値の変わら
ない変数や配列の要素を、それらを参照する可能性のあ
るすべてのプロセッサのローカルメモリに配置するとし
ている。この結果、ローカルメモリに配置された変数か
らの参照には、アクセス調停のための排他制御が不要と
なり、実行時の処理速度を向上させる効果がある。
According to the present invention, so-called shared variables used in a plurality of execution units are classified into several types according to their usage conditions, and variables or array elements whose values do not change within a certain execution unit are classified. I'm trying to put them in the local memory of every processor that may reference them. As a result, the reference from the variable arranged in the local memory does not require the exclusive control for access arbitration, which has the effect of improving the processing speed at the time of execution.

【0014】しかしこの発明は、主としてFORTRAN等の
高級言語により記述されたループ内の配列演算などの並
列性を抽出し、実行速度の向上を図ることを目的とした
ものである。その目的からも明らかな通り、シングルプ
ロセッサ向けにコーディングされた従来プログラムの自
動並列化処理を行なうものであるため、並列処理に関す
る記述が可能な言語仕様(以下これを並列処理言語と書
く)で記述されたプログラムでは、動作の保証が得られ
ないと言う問題点が有った。
However, the present invention is mainly intended to extract parallelism such as array operation in a loop described in a high-level language such as FORTRAN to improve the execution speed. As is clear from that purpose, it is used to perform automatic parallelization processing of a conventional program coded for a single processor, so it is described in a language specification that allows description of parallel processing (hereinafter referred to as parallel processing language). There was a problem that the operation guarantee could not be obtained in the created program.

【0015】既存のプログラム言語について、その言語
仕様を拡張し並列処理言語とした処理系がある。ここで
は簡単のため言語Pascalに並列処理のための2つの文を
拡張した言語仕様を取り上げ説明する。拡張された文
は、cobeginとcoendであって、それぞれ、並列実行すべ
きブロックの開始と終了を示す文である。すなわち、co
beginとcoendの間の記述は、並行して実行されると言う
意味を持つ。
For existing programming languages, there is a processing system in which the language specification is extended to be a parallel processing language. Here, for the sake of simplicity, a language specification in which two statements for parallel processing are extended to the language Pascal will be taken up and explained. The extended statements are cobegin and coend, which indicate the start and end of blocks to be executed in parallel, respectively. I.e. co
The description between begin and coend has the meaning of being executed in parallel.

【0016】図16は、従来方法では動作の保証が得ら
れないループ処理を含むソースコードの一例を示す説明
図である。ソースコード407は、上記の拡張された言
語仕様で記述されている。ここで400は、2つの手続
き401、402を持つプログラムである。プログラム
400の中で、整数型の変数AAは大域変数であり、手
続き401、402のどちらにおいても使用される。文
403から、文404までの間の記述内容が並行して実
行されるため、手続き401、402は同時に実行さ
れ、2つ以上のプロセッサを使用したマルチプロセッサ
システムで実行された場合、処理分散が行なわれれば、
それぞれ異なるプロセッサの局所メモリに実行コードが
配置され、実行される。
FIG. 16 is an explanatory diagram showing an example of a source code including a loop process which cannot guarantee the operation by the conventional method. The source code 407 is written in the extended language specification described above. Here, 400 is a program having two procedures 401 and 402. In the program 400, the integer type variable AA is a global variable and is used in both the procedures 401 and 402. Since the description contents from the statement 403 to the statement 404 are executed in parallel, the procedures 401 and 402 are executed at the same time, and when executed in a multiprocessor system using two or more processors, the processing distribution is If done,
Execution code is placed in the local memory of different processors and executed.

【0017】大域変数AAは、手続き401の中では読
み取り(参照)しか行なわれないことが構文解析の結果
判断できる。このため、従来方法によれば、大域変数A
Aは、処理開始時での値(この場合は文403直後の値
である1)が、手続き401を実行するプロセッサの局
所メモリ内の変数AAの値として複写され用いられる。
他方手続き402では、矩形406の処理結果を、続く
条件判断文で判断し、変数AAの値を代入する。しか
し、この値はすでに実行中である手続き401の局所メ
モリにある変数AAの値を更新する手段を持たないた
め、手続き401は、矩形405で示した処理を永久に
繰り返すことになる。
As a result of the syntactic analysis, it can be determined that the global variable AA can only be read (referenced) in the procedure 401. Therefore, according to the conventional method, the global variable A
A is used by copying the value at the start of processing (in this case, the value 1 immediately after the sentence 403) as the value of the variable AA in the local memory of the processor that executes the procedure 401.
On the other hand, in the procedure 402, the processing result of the rectangle 406 is judged by the subsequent condition judgment sentence, and the value of the variable AA is substituted. However, since this value has no means for updating the value of the variable AA in the local memory of the procedure 401 that is already being executed, the procedure 401 will repeat the processing indicated by the rectangle 405 forever.

【0018】これは、明らかにプログラム設計時の意図
とは異なった動作であり、従来方法が、このような並列
処理言語で記述されたプログラムの動作を保証できない
ことを示すものである。
This is an operation which is obviously different from the intention at the time of designing the program, and shows that the conventional method cannot guarantee the operation of the program written in such a parallel processing language.

【0019】[0019]

【発明が解決しようとする課題】複数のプロセッサから
構成された並列処理システムに対し、与えられたソース
コードから並列実行可能な部分を取り出し、並列化する
技術の中で、大域変数の値をそれぞれのプロセッサの局
所メモリに配置する方法は、メモリのアクセス調停に消
費する処理時間を削減し、プログラムの実行速度を向上
する効果があるため幾つかの従来発明が有った。
In a parallel processing system composed of a plurality of processors, the value of a global variable is individually extracted in a technique of extracting a part that can be executed in parallel from a given source code and parallelizing it. The method of arranging the memory in the local memory of the processor has the effect of reducing the processing time consumed for arbitration of the memory and improving the execution speed of the program.

【0020】しかし上記から明らかな様に、並列処理言
語により記述されたソースコードに対し、従来方法によ
る大域変数の分散を行なった場合は、正常動作が保証で
きないという問題点が有った。
However, as is apparent from the above, when the global variables are distributed by the conventional method to the source code written in the parallel processing language, there is a problem that the normal operation cannot be guaranteed.

【0021】本発明は、このような従来方法の問題点に
着目して考案されたものである。その目的とするところ
は、並列処理言語により記述されたソースコードに対
し、大域変数の局所領域への複写を行ない、処理速度の
向上を得るシステムにおいて、逐次処理システムで実行
した場合と等価な動作保証のできる並列処理系を実現す
ることにある。
The present invention was devised by focusing on the problems of such a conventional method. The purpose is to copy the source code written in the parallel processing language into the local area of the global variable and obtain the processing speed. It is to realize a guaranteed parallel processing system.

【0022】[0022]

【課題を解決するための手段】本発明の第1のコンパイ
ラ装置は、ソースコード(原始プログラム)内で定義さ
れた変数が、複数の処理単位の中でどの処理単位内で使
用されたかを表すと共に、この使用が、変数に対する代
入か参照かを表す変数参照テーブルを生成する構文解析
手段と、生成された前記変数参照テーブルに基づいて、
処理単位毎に参照すべき変数領域を指定する共有変数管
理テーブルを作成するテーブル作成手段と、処理単位毎
に実行時のオブジェクトコードを複数のプロセッサに独
立に配置する実行コードを含む一時ファイルを生成する
コード生成手段と、前記共有変数管理テーブルにおいて
指定された変数を、この変数を参照するすべての実行単
位が配置されるプロセッサの局所メモリに複写する第1
の実行コードと、前記共有変数管理テーブルにおいて指
定された変数の各プロセッサ局所メモリへ複写された値
を書き換える際のアクセス調停を行なう第2の実行コー
ドと、を含む実行時ライブラリと、前記コード生成手段
により生成された一時ファイルと、前記実行時ライブラ
と、を入力として読み取り、実行可能なオブジェクト
コードを出力として生成するリンカと、を備えることを
要旨とする。本発明の第2のコンパイラ装置は、並列処
理に関する記述が可能な言語仕様で記述されたソースコ
ードからオブジェクトコードを生成するコンパイラ装置
であって、前記ソースコード内に含まれる複数の処理単
位のうち、第1の処理単位が第2の処理単位を含み、且
つ、該第2の処理単位が並列処理の対象となる場合に、
前記第1の処理単位内にある変数のうち、前記第2の処
理単位からアクセスされ得ると共に、該第2の処理単位
からのアクセスが値の参照のみである特定変数につい
て、前記第2の処理単位の並列処理が実行される際に、
該第2の処理単位の並列実行時のプロセスの存在するメ
モリ領域に、前記特定変数を複写変数として複写する第
1の実行コードを生成する第1のコード生成手段と、
記第1の処理単位の処理が実行された際に、前記第1の
処理単位から前記特定変数にアクセスがあり、そのアク
セスが値の代入である場合に、該特定変数の複写である
前記複写変数に対する前記プロセスからのアクセスを待
機させ、前記特定変数へ代入された値を前複写変数に代
入し、その後、前記複写変数へのアクセスの待機を解除
する第2の実行コードを生成する第2のコード生成手段
と、を備え、前記ソースコードから前記第1及び第2の
実行コードを含むオブジェクトコードを生成することを
要旨とする。本発明の情報処理システムは、第1のメモ
リ領域に存在する第1のプロセスと第2のメモリ領域に
存在する第2のプロセスを並列に実行することが可能な
情報処理システムであって、前記第1のメモリ領域に存
在し、前記第1のプロセスによってアクセスされる変数
のうち、前記第2のプロセスからもアクセスされ得ると
共に、前記第2のプロセスからのアクセスが値の参照の
みである特定変数について、該特定変数を第2のメモリ
領域に複写変数として複写する変数複写手段と、前記第
1のプロセスによって前記特定変数にアクセスがあり、
そのアクセスが値の代入であった場合に、該特定変数の
複写である前記複写変数に対する前記第2のプロセスか
らのアクセスを待機させ、前記特定変数へ代入された値
を前複写変数に代入し、その後、前記複写変数へのアク
セスの待機を解除する変数代入手段と、を備えることを
要旨とする。本発明の第1のオブジェクトコード生成方
法は、ソースコードからオブジェクトコードに生成する
ためのオブジェクトコード生成方法であって、 (a)前記ソースコード(原始プログラム)内で定義さ
れた変数が、複数の処理単位の中でどの処理単位内で使
用されたかを表すと共に、この使用が、変数に対する代
入か参照かを表す変数参照テーブルを生成する工程と、 (b)生成された前記変数参照テーブルに基づいて、処
理単位毎に参照すべき変数領域を指定する共有変数管理
テーブルを作成する工程と、 (c)処理単位毎に実行時のオブジェクトコードを複数
のプロセッサに独立に 配置する実行コードを含む一時フ
ァイルを生成する工程と、 (d)前記共有変数管理テーブルにおいて指定された変
数を、この変数を参照するすべての実行単位が配置され
るプロセッサの局所メモリに複写する第1の実行コード
と、前記共有変数管理テーブルにおいて指定された変数
の各プロセッサ局所メモリへ複写された値を書き換える
際のアクセス調停を行なう第2の実行コードと、を含む
実行時ライブラリを用意する工程と、 (e)生成された前記一時ファイルと、用意された前記
実行時ライブラリと、を入力として読み取り、実行可能
なオブジェクトコードを生成する工程と、を備えること
を要旨とする。本発明の第2のオブジェクトコード生成
方法は、並列処理に関する記述が可能な言語仕様で記述
されたソースコードからオブジェクトコードを生成する
ためのオブジェクトコード生成方法であって、 (a)前記ソースコード内に含まれる複数の処理単位の
うち、第1の処理単位が第2の処理単位を含み、且つ、
該第2の処理単位が並列処理の対象となる場合に、前記
第1の処理単位内にある変数のうち、前記第2の処理単
位からアクセスされ得ると共に、該第2の処理単位から
のアクセスが値の参照のみである特定変数について、前
記第2の処理単位の並列処理が実行される際に、該第2
の処理単位の並列実行時のプロセスの存在するメモリ領
域に、前記特定変数を複写変数として複写する第1の実
行コードを生成する工程と、 (b)前記第1の処理単位の処理が実行された際に、前
記第1の処理単位から前記特定変数にアクセスがあり、
そのアクセスが値の代入である場合に、該特定変数の複
写である前記複写変数に対する前記プロセスからのアク
セスを待機させ、前記特定変数へ代入された値を前複写
変数に代入し、その後、前記複写変数へのアクセスの待
機を解除する第2の実行コードを生成する工程と、を備
え、前記ソースコードから前記第1及び第2の実行コー
ドを含むオブジェクトコードを生成することを要旨とす
る。本発明の情報処理方法は、第1のメモリ領域に存在
する第1のプロセスと第2のメモリ領域に存在する第2
のプロセスを並列に実行する情報処理方法であって (a)前記第1のメモリ領域に存在し、前記第1のプロ
セスによってアクセスされる変数のうち、前記第2のプ
ロセスからもアクセスされ得ると共に、前記第2のプロ
セスからのアクセスが値の参照のみである特定変数につ
いて、該特定変数を第2のメモリ領域に複写変数として
複写する工程と、 (b)前記第1のプロセスによって前記特定変数にアク
セスがあり、そのアクセスが値の代入であった場合に、
該特定変数の複写である前記複写変数に対する前記第2
のプロセスからのアクセスを待機させ、前記特定変数へ
代入された値を前複写変数に代入し、その後、前記複写
変数へのアクセスの待機を解除する工程と、を備えるこ
とを要旨とする。
According to a first aspect of the compiler of the present invention
La apparatus, variable defined in the source code (source program) is, along with indicating whether used within which processing unit in a plurality of processing units, the use, a variable indicating whether or references the variable assignment and parsing means for generating a reference table, based on the generated variable reference table,
A table creating means for creating a shared variable management table for designating a variable area to be referred to for each processing unit, and a temporary file containing an execution code for independently allocating an object code at execution time to a plurality of processors for each processing unit are generated. and <br/> code generating means for the variables the designated in shared variable management table, the copied to the local memory of the processor all execution units that references this variable is placed 1
And the second execution code for performing access arbitration when rewriting the value of the variable specified in the shared variable management table copied to each processor local memory.
A runtime library that includes a de, a temporary and files generated by the code generating means, said reading and runtime library, as inputs, in that it comprises a linker that generates as output an object code executable, a
Use as a summary. The second compiler apparatus of the present invention is a parallel processing unit.
Source code written in a language specification that can describe science
Compiler device for generating object code from code
However, a plurality of processing units included in the source code are included.
The first processing unit includes a second processing unit, and
When the second processing unit is a target of parallel processing,
Among the variables in the first processing unit, the second processing
And a second processing unit that can be accessed from the physical processing unit.
For a specific variable whose access from
Then, when the parallel processing of the second processing unit is executed,
The memory in which the process at the time of parallel execution of the second processing unit exists
Copy the specific variable as a copy variable to the memory area.
A first code generating means for generating a first execution code, before
When the processing of the first processing unit is executed, the first
There is access to the specific variable from the processing unit, and the access
Is a copy of the specific variable when the set is a value substitution.
Wait for access from the process to the copied variable
And replace the value assigned to the specific variable with the pre-copy variable.
Then wait for access to the copied variable.
Second code generation means for generating second execution code
And, from the source code to the first and second
To generate object code that contains the execution code
Use as a summary. The information processing system of the present invention is the first memo.
In the first process and second memory area existing in the memory area
It is possible to execute the existing second process in parallel
An information processing system, wherein the information is stored in the first memory area.
Variable that exists and is accessed by the first process
Of these, it can be accessed from the second process as well.
In both cases, the access from the second process is a value reference.
The specific variable which is only the second variable in the second memory
A variable copy means for copying as a copy variable to the area;
Access to the specific variable by one process,
If the access is substitution of a value,
Is the second process for the copy variable that is a copy?
The value assigned to the specific variable by waiting for access from
To the pre-copy variable and then
And a variable assigning means for releasing the waiting of the process.
Use as a summary. First Object Code Generation Method of the Present Invention
Method to generate object code from source code
An object code generation method for: (a) defined in the source code (source program)
Variable is used in which processing unit among multiple processing units.
Is used, and this use
Generating a variable reference table indicating input or reference; and (b) processing based on the generated variable reference table.
Shared variable management that specifies the variable area to be referenced for each physical unit
The process of creating a table, and (c) multiple execution object code for each processing unit.
Temporary code containing executable code to be placed independently on
And (d) a variable specified in the shared variable management table.
A number is placed for all run units that reference this variable.
First executable code to be copied to the local memory of the processor
And the variables specified in the shared variable management table
Rewrite the value copied to each processor's local memory of
Second execution code for performing access arbitration at the time of
A step of preparing a runtime library, (e) the generated temporary file, and the prepared
Run-time library and can read and execute as input
And a step of generating a unique object code.
Is the gist. Second object code generation of the present invention
The method is described in the language specification that can describe parallel processing.
Object code from generated source code
An object code generation method for: (a) a plurality of processing units included in the source code
Of which the first processing unit includes the second processing unit, and
When the second processing unit is a target of parallel processing,
Of the variables in the first processing unit, the second processing unit
From the second processing unit
For specific variables whose only access is to reference the value,
When the parallel processing of the second processing unit is executed, the second processing unit
Memory area of the process during parallel execution of each processing unit
In the area, the first actual copy of the specific variable as a copy variable.
A step of generating a line code, and (b) before the processing of the first processing unit is executed,
There is access to the specific variable from the first processing unit,
If the access is substitution of a value, the
Access from the process to the copied variable that is a copy
Process, and the value assigned to the specific variable is copied.
Assign to a variable, and then wait for access to the copied variable.
And a step of generating a second execution code for canceling the machine.
From the source code, the first and second execution code
The main idea is to generate an object code that includes code
It The information processing method of the present invention exists in the first memory area.
The first process and the second existing in the second memory area
An information processing method for executing the processes of (1) in parallel, wherein : (a) the first program exists in the first memory area;
Of the variables accessed by the process
It can be accessed from the
Access to specific variables whose value is only referenced by
The specified variable as a copy variable in the second memory area.
Copying, and (b) accessing the specific variable by the first process.
If the access is a value assignment,
The second for the copied variable that is a copy of the specific variable.
Waits for access from the process
Assign the assigned value to the pre-copy variable and then copy
Releasing the waiting for access to the variable.
And are the gist.

【0023】[0023]

【実施例】図1は、本発明の一実施例として好適な、高
級言語用のコンパイラの構成図である。本実施例のコン
パイラは、ソースコードから、マルチマイクロプロセッ
サシステムで並列実行可能なオブジェクトコードを発生
する。本実施例の扱うプログラム言語仕様は、言語Pasc
al に対し、cobegin,coendの2語を拡張した仕様であ
る。ここでcobegin,coendはそれぞれ並列実行を認める
ブロックの開始文および終了文である。以下の説明は、
次の項目にしたがって行なう。
DESCRIPTION OF THE PREFERRED EMBODIMENTS FIG. 1 is a block diagram of a high-level language compiler suitable as an embodiment of the present invention. The compiler of this embodiment generates object code that can be executed in parallel in a multi-microprocessor system from source code. The programming language specification handled in this embodiment is the language Pasc.
It is a specification in which two words of cobegin and coend are extended with respect to al. Here, cobegin and coend are the start statement and end statement of the block that allows parallel execution, respectively. The following explanation
Follow the steps below.

【0024】1.ソースプログラムのコンパイル 1−1.ブロック構造の取り出し 1−2.変数の処理 1−3.変数クラス構造体使用の目的 2.テーブル作成手段108の動作 2−1.テーブル作成手段108の概要 2−2.ブロック実行管理表の作成 3.大域変数にアクセスするオブジェクトコードの生成
方法 3−1.排他制御の方法 3−2.排他制御プログラム113の処理 3−3.並列化プログラム112の処理 3−4.オブジェクトコード発生の方法 4.処理単位を他のプロセッサの局所領域において実行
する方法 4−1.非局所変数が参照のみの場合 4−2.非局所変数への代入が行なわれる場合 1.ソースプログラムのコンパイル 以下に図1に従い本実施例の処理系が、ソースプログラ
ムから、実行可能なオブジェクトコードを生成するまで
の処理の流れを説明する。本実施例の主な構成要素はコ
ンパイラ102、実行時ライブラリ111、リンカ11
4である。
1. Compile Source Program 1-1. Extraction of block structure 1-2. Variable processing 1-3. Purpose of using variable class structure 2. Operation of table creating means 2-1. Outline of table creating means 108 2-2. 2. Creation of block execution management table Method of Generating Object Code for Accessing Global Variable 3-1. Exclusive control method 3-2. Process of exclusive control program 113 3-3. Process of parallelization program 112 3-4. Method of generating object code 4. Method of executing processing unit in local area of other processor 4-1. When non-local variable is reference only 4-2. When substitution to a non-local variable is performed 1. Compilation of Source Program The processing flow of the processing system of this embodiment from the source program to the generation of an executable object code will be described below with reference to FIG. The main components of this embodiment are a compiler 102, a runtime library 111, and a linker 11.
It is 4.

【0025】1−1.ブロック構造の取り出し ソースコード101を読み取ったコンパイラ102は、
字句解析手段103により、字句解析を行なう。ここで
は、ソースコード101に中に現われる文字列を順次読
み取ることによって、手続き、変数、定数、文字定数、
データ型定義、文字列等の名前と値、さらに演算子、特
種記号、プログラム言語の予約語の取り出しを行なう。
この読み取り結果は、コンパイラ102の作業領域内に
記録される。
1-1. The compiler 102 that has read the block structure extraction source code 101
The lexical analysis means 103 performs lexical analysis. Here, by sequentially reading the character string appearing in the source code 101, the procedure, variable, constant, character constant,
Extracts data type definitions, names and values such as character strings, operators, special symbols, and reserved words for programming languages.
The read result is recorded in the work area of the compiler 102.

【0026】次に、字句解析手段103の読み取り結果
のデータを入力として、構文解析手段104が実施され
る。本実施例では説明の簡単のため、言語Pascalの文法
の中で、procedure文またはfunction文で開始される副
プログラムをブロックと呼び、代入文と、if、while、r
epeat、for等の出発記号で開始される文をステートメン
トと呼ぶ。またbegin...endで囲まれた「文」の並び
は、通常は「複合文(compound statement)」と呼ぶ
が、ここではこれもステートメントと呼ぶ。本実施例の
構文解析符は、言語Pascalの文法がLL(1)と呼ばれ
る性質の文法であるため、周知の下降解析を行なう。
Next, the syntax analysis unit 104 is executed by inputting the data of the read result of the lexical analysis unit 103. In the present embodiment, for simplicity of explanation, in the grammar of the language Pascal, a subprogram started by a procedure statement or a function statement is called a block, and an assignment statement and if, while, r
A statement that starts with a departure symbol such as epeat or for is called a statement. The sequence of "statements" enclosed by begin ... end is usually called a "compound statement", but this is also called a statement here. The parsing code of this embodiment performs well-known descending analysis because the Pascal grammar has a property called LL (1).

【0027】通常、構文解析処理では、ソースプログラ
ム中に現われる予約語以外の名前は、定数名、変数名、
手続き名、関数名、変数型名を区別せず名前表に登録
し、この表中に名前と共に、そのオブジェクトタイプを
記録する方法を採る場合が多い。これは、名前の多重定
義(関数名と定数名が同一など)の不都合を未然に検出
する上で、合理的な方法である。本実施例も、構文解析
手段104における名前(識別子)の管理はこの方法に
よった。
Normally, in the parsing process, names other than reserved words appearing in the source program are constant names, variable names,
In many cases, the procedure name, function name, and variable type name are registered in the name table without distinction, and the object type is recorded together with the name in this table. This is a rational method for detecting the inconvenience of name overloading (the function name and the constant name are the same). Also in this embodiment, the management of the name (identifier) in the syntax analysis unit 104 is performed by this method.

【0028】また、本実施例では言語仕様に並列記述を
認めているため、並列実行すべき部分は、ソースコード
中に明示的にに記述することを要求している。言い換え
ると、cobegin,coendで囲まれた範囲に含まれない処理
ブロックは、単一プロセッサ環境での実行コードが生成
される。これを、構文解析手段104、コード生成手段
107の立場から見れば、cobegin,coendで並列実行を
指定された処理単位以外のブロックの実行コードは、通
常のコンパイル処理時と同じコード生成を行うことにな
る。
Since parallel description is allowed in the language specification in this embodiment, the portion to be executed in parallel is required to be explicitly described in the source code. In other words, for the processing blocks not included in the range enclosed by cobegin and coend, the execution code in the single processor environment is generated. From the standpoints of the syntax analysis unit 104 and the code generation unit 107, the execution code of the block other than the processing unit for which parallel execution is designated by cobegin and coend should generate the same code as in the normal compilation process. become.

【0029】このため、本実施例の構文解析手段104
が従来の方法と異なっている第1の点は次の処理であ
る。すなわち、コンパイル処理に要する時間を少しでも
短縮する為に、構文解析手段104でまずソースコード
のスキャンをし、cobegin、coendの存在と、cobegin、c
oendの範囲で呼び出される関数または手続きの名称を、
並列実行手続き名テーブル116に記録する。これに続
く実際の構文解析処理の中で、ブロックを検出する毎
に、そのブロック(手続きか、関数)が、並列実行手続
き名テーブル116に記録された名前と一致するか調
べ、一致するときだけ、並列実行に必要な処理手順を実
施する。
Therefore, the syntax analysis means 104 of the present embodiment.
The first difference from the conventional method is the following processing. That is, in order to reduce the time required for the compilation process as much as possible, the syntax analysis unit 104 first scans the source code, and the presence of cobegin and coend and cobegin and c exist.
The name of the function or procedure called in the range of oend,
Record in the parallel execution procedure name table 116. Every time a block is detected in the actual parsing process that follows, it is checked whether the block (procedure or function) matches the name recorded in the parallel execution procedure name table 116, and only when it matches. , Perform the processing steps required for parallel execution.

【0030】本実施例の構文解析手段104が従来の方
法と異なっている第2の点は、変数有効範囲検出手段1
05と変数代入検出手段106の処理結果を、テーブル
作成手段108に用いる点である。この処理を、図5の
流れ図を用いて以下に説明する。図6は処理の流れを補
足するために用いるソースコード例の説明図である。言
語Pascal等のブロック構造を持つ言語においては、変数
は宣言されたブロック内を有効範囲とする。このため、
変数の値の決定、参照にはブロックの深さと、(ブロッ
クの深さが同じ場合は)ブロックの登場順序を表す情報
が必要である。構文解析手段104では、プログラム開
始のレベルをブロックレベル=0とみなして処理を進め
る。
The second difference of the syntax analysis means 104 of this embodiment from the conventional method is that the variable effective range detection means 1 is used.
05 and the processing result of the variable substitution detection means 106 are used for the table creation means 108. This process will be described below with reference to the flowchart of FIG. FIG. 6 is an explanatory diagram of an example of source code used to supplement the flow of processing. In languages such as Pascal, which has a block structure, variables are scoped within the declared block. For this reason,
To determine and refer to the value of a variable, the depth of the block and the information indicating the order of appearance of the blocks (when the depths of the blocks are the same) are required. The syntactic analysis unit 104 proceeds with the processing by regarding the program start level as block level = 0.

【0031】図6の例ではプログラム601の主プログ
ラムの位置がブロックレベル=0である。この後、ブロ
ックの入れ子の状態が1段深くなる度にブロックレベル
の値は+1される。同じく、入れ子の構造を1段抜け出
す度に、ブロックレベルの値は−1される。主プログラ
ム文中に宣言されるブロックは、ブロックレベル=1で
ある。図6の例で、手続きp1(602)、p2(60
4)、p3(605)はブロックレベル=1とみなされ
る。
In the example of FIG. 6, the position of the main program of the program 601 is block level = 0. After that, the value of the block level is incremented by 1 every time the nested state of the block becomes one step deeper. Similarly, the block level value is decremented by 1 each time the nested structure is exited one step. The block declared in the main program statement has block level = 1. In the example of FIG. 6, the procedures p1 (602), p2 (60
4) and p3 (605) are regarded as block level = 1.

【0032】同じブロックレベルにある異なるブロック
間で、変数の宣言に区別を与えるため、構文解析手段1
04はさらにブロック番号を情報として持つ。ブロック
番号は単純に、構文解析で現われた順に、個々のブロッ
クに連続した番号を割り当てるものである。図6のソー
スプログラムの例について、個々の手続き、関数のブロ
ック構造の関連とブロック番号を示すと図7aの様にな
る。
In order to distinguish variable declarations between different blocks at the same block level, the parsing means 1
04 further has a block number as information. The block numbers simply assign consecutive numbers to the individual blocks in the order they appear in the syntactic analysis. Regarding the example of the source program shown in FIG. 6, the relationship between the block structures of individual procedures and functions and the block numbers are shown in FIG. 7a.

【0033】構文解析手段104は、ブロックの開始を
検出すると(S500)、ブロックレベル+1を行ない
(S501)、次にブロック番号+1を行う(S50
2)。ブロック定義の予約語の後には、(もし使用する
変数が有れば)変数宣言が続くので、図8の802に示
すブロック内変数表を作成する(S503)。さらに、
次に述べるような変数表指定構造体801の新たなデー
タフィールドを生成し、その要素であるテーブルエント
リ811に、作成したブロック内変数表へのポインタを
記録する。
When the start of a block is detected (S500), the syntactic analysis means 104 performs block level + 1 (S501), and then performs block number + 1 (S50).
2). A variable declaration (if there is a variable to be used) follows the reserved word of the block definition, so that an in-block variable table shown in 802 of FIG. 8 is created (S503). further,
A new data field of the variable table designation structure 801 as described below is created, and a pointer to the created in-block variable table is recorded in the table entry 811 that is the element.

【0034】変数表指定構造体801は、ブロックレベ
ル810、テーブルエントル811、連鎖アドレス81
2の3つの要素からなるデータ構造を一つの要素とし、
その要素の配列である。このデータ構造は、各ブロック
において、非局所変数の関係を維持する為に生成され
る。続く処理S504は、配列構造である変数表指定構
造体801の現要素から始め、一つずつ前の要素にさか
のぼり、ブロックレベルの値が自分のブロックレベルの
値より一つ小さくなった要素を見つけ出し、自分の要素
の連鎖アドレス812の内容を、ここで見つけ出した要
素の配列のインデックスで置き換える。この結果、81
3に示す様な要素間の連鎖が生成される。さらに処理
は、ブロックの名前(関数名か手続き名)が並列実行手
続き名テーブル116に記録されているかどうかを検索
する(S505)。ここで、並列実行の対象外の手続
き、関数であれば、通常の構文解析処理を行う。他方、
並列実行の対象となる手続き、関数であれば、テーブル
作成手段108が呼び出され、続いて、再び処理S50
1以降が繰り返され、構文解析全体は再帰的に続けられ
る。一方、通常の構文解析処理に入った場合でも、ブロ
ック開始を検出したときは、前出の処理S500に戻り
処理を繰り返す。
The variable table designation structure 801 includes a block level 810, a table entry 811, and a chain address 81.
A data structure consisting of three elements of 2 is made one element,
An array of its elements. This data structure is created in each block to maintain the relationship of non-local variables. In the following step S504, an element whose block level value is one smaller than its own block level value is found, starting from the current element of the variable table designation structure 801 which is an array structure and tracing back one element at a time. , Replaces the contents of the chain address 812 of its own element with the index of the array of elements found here. As a result, 81
A chain between elements as shown in 3 is generated. Further, the process searches whether the block name (function name or procedure name) is recorded in the parallel execution procedure name table 116 (S505). Here, if the procedure or function is not the target of parallel execution, normal syntax analysis processing is performed. On the other hand,
If it is a procedure or function to be executed in parallel, the table creating means 108 is called, and then the process S50 is performed again.
After 1 is repeated, the whole parsing is continued recursively. On the other hand, even when the normal parsing process is started, when the start of the block is detected, the process returns to the process S500 and the process is repeated.

【0035】変数表指定構造体801の連鎖アドレス8
12から連鎖813を生成する処理S504について説
明を補足する。
Chain address 8 of variable table designation structure 801
A supplementary description will be given to the processing S504 for generating the chain 813 from 12.

【0036】この処理によって各ブロックは、一つ小さ
なブロックレベルのブロック(親となるブロック)の変
数表指定構造体801の要素を取り出し、さらにその要
素のテーブルエントリ811からブロック内変数表80
2へのポインタを取得することができる。図6のソース
プログラムに例をとり、この連鎖の様子を図7bに示し
た。但し、より解り易くするため、配列のインデックス
と同値であるブロック番号を併記した。例えば関数p313
は、ブロック番号9の位置にあり、その連鎖アドレスは
ブロック番号6の手続きp31の位置を指し示している。
また、p31の連鎖アドレスはブロック番号5の手続きp3
の位置を示している。この変数表指定構造体801の連
鎖を辿って変数へのアクセスが行われるため、異なるブ
ロック構造間の誤った参照の発生を防ぐことができる。
By this processing, each block takes out the element of the variable table specifying structure 801 of the block (parent block) of one small block level, and further, from the table entry 811 of the element, the in-block variable table 80.
A pointer to 2 can be obtained. Taking the example of the source program of FIG. 6, the state of this chain is shown in FIG. 7b. However, in order to make it easier to understand, the block number that is the same value as the array index is also shown. For example the function p313
Is at the position of block number 9, and its chain address points to the position of procedure p31 at block number 6.
The chained address of p31 is the procedure p3 of block number 5.
Shows the position of. Since the variables are accessed by following the chain of the variable table designating structure 801, it is possible to prevent erroneous reference between different block structures.

【0037】処理S500の判断内容が、ブロック開始
以外であれば、その他の構文処理が行なわれ、コード生
成手段107の呼び出しが行なわれる。本実施例におい
て、変数の取り扱い以外の構文(S515)は、従来の
構文処理と同様であるため、変数処理に関してのみ説明
する。
If the content of the judgment in the process S500 is other than the block start, other syntax processing is performed and the code generation means 107 is called. In the present embodiment, the syntax (S515) other than the handling of variables is the same as the conventional syntax processing, and therefore only variable processing will be described.

【0038】1−2.変数の処理 構文中に名前(識別子)が現われた場合(S506)、
この名前が変数の名前であり、かつ変数がブロック内の
局所的な変数であるかを検出するためのフラグに値0が
代入される(S507)。さらに現在のブロックレベル
が一時保存され(S508)た後、検出された名前が、
S504で作成したブロック内変数表に存在するかどう
か検査される(S509)。変数表にある場合この変数
はブロック内の変数であるため、後にテーブル作成手段
108で参照するためのデータ構造である変数クラスが
作成される(S510)。次に、構文の内容が、この変
数に対し代入を行なう操作であるかが判断され(S51
1)、イエスであれば書き換え有りの情報が前記変数ク
ラスに追加される(S512)。またノーであれば、変
数クラスに参照のみの情報が追加される(S513)。
この変数クラス情報および、フラグの内容がテーブル作
成手段108に渡され後述する処理が行なわれる。続い
て、コード生成手段107が実行され、コンパイル結果
のコード生成が行なわれる。この後、S508で一時保
存したブロックレベルの値が復旧され(S514)、次
の構文の処理に移る。
1-2. If a name (identifier) appears in the variable processing syntax (S506),
This name is the name of the variable, and the value 0 is assigned to the flag for detecting whether the variable is a local variable in the block (S507). After the current block level is temporarily saved (S508), the detected name is
It is inspected whether it exists in the block variable table created in S504 (S509). If it is in the variable table, since this variable is a variable in the block, a variable class that is a data structure to be referred to later by the table creating means 108 is created (S510). Next, it is determined whether the content of the syntax is an operation for assigning to this variable (S51
1) If yes, the rewritten information is added to the variable class (S512). On the other hand, if the determination is No, information only for reference is added to the variable class (S513).
The variable class information and the contents of the flag are passed to the table creating means 108, and the processing described later is performed. Then, the code generation means 107 is executed and the code of the compilation result is generated. After this, the block level value temporarily saved in S508 is restored (S514), and the process proceeds to the next syntax.

【0039】一方、処理対象の名前がブロック内変数表
に無い場合(S509)、局所的な変数であるかを検出
するためのフラグに値1が代入され(S516)、ブロ
ックレベルが−1される(S517)。
On the other hand, if the name of the object to be processed is not in the in-block variable table (S509), the value 1 is assigned to the flag for detecting whether it is a local variable (S516), and the block level is decremented by one. (S517).

【0040】ブロックレベルの値が変更されたため、処
理S508で退避されたブロックレベルの値が、更新さ
れる(S518)。この時ブロックレベルの値が0より
小さいかどうかが、検査される(S519)。ブロック
レベルの値が0より小さい場合は、主プログラムまでさ
かのぼっても、処理中の変数名と一致する変数名が変数
表に無かった事を意味し、取り出された名前が、変数名
以外の識別子で有る場合についての処理(S520)と
なる。
Since the block level value has been changed, the block level value saved in step S508 is updated (S518). At this time, it is checked whether the value of the block level is smaller than 0 (S519). If the block level value is less than 0, it means that there is no variable name that matches the variable name being processed in the variable table, even when tracing back to the main program, and the retrieved name is an identifier other than the variable name. If so, the process (S520) is performed.

【0041】それ以外は、1つ外側のブロックでの変数
宣言が検査される。まずブロックレベルの値が−1され
たことに従って、処理は変数表指定構造体801の連鎖
アドレス812を一つ前の連鎖にさかのる。ここで、テ
ーブルエントリ811から取り出したポインタによっ
て、そのブロックレベルでのブロック内変数表802へ
のアクセスを行い、再び処理S509以降の繰り返しが
行なわれる。但し、フラグ=1となっているため、変数
クラスのデータ構造を作成する段階でブロック内の局所
変数でないことが記録され(S510)、この情報はテ
ーブル作成手段108に参照される。
Otherwise, the variable declaration in the outer block is checked. First, as the value of the block level is decremented by one, the process traces the chain address 812 of the variable table designation structure 801 to the immediately preceding chain. Here, the pointer extracted from the table entry 811 is used to access the in-block variable table 802 at the block level, and the process S509 and subsequent steps are repeated again. However, since flag = 1, it is recorded that the variable is not a local variable in the block at the stage of creating the data structure of the variable class (S510), and this information is referred to the table creating means 108.

【0042】変数以外の構文の処理の内、ブロック終了
が検出された場合(S521)は、ブロックレベルの値
が−1され(S522)、ブロックレベル<0となるま
で処理S506以降の反復が行なわれる。ブロックレベ
ル<0の時は、構文解析処理が主プログラムのレベルま
で含めて完結したことを示し、プログラムの正常終了が
検査され、処理終了となる。
If the end of the block is detected (S521) among the processes of the syntax other than the variable, the value of the block level is decremented by 1 (S522), and the processes from S506 onward are repeated until the block level becomes <0. Be done. When the block level is <0, it indicates that the syntax analysis processing is completed up to the level of the main program, the normal termination of the program is checked, and the processing is terminated.

【0043】図5の流れ図で示した処理のうち、ブロッ
ク内変数表802の検索を行なう処理S509以降のル
ープが、図1の構成の変数有効範囲検出手段105を実
現する。また、処理S511からS513が、図1の構
成の変数代入検出手段106を実現する。
Of the processing shown in the flowchart of FIG. 5, the loop after the processing S509 for searching the in-block variable table 802 realizes the variable effective range detecting means 105 having the configuration of FIG. Further, the processes S511 to S513 implement the variable substitution detection means 106 having the configuration of FIG.

【0044】1−3.変数クラス構造体使用の目的 変数クラス構造体は、個々の変数のアクセス状況の記録
として生成されるデータ構造であり、図10の900に
示す構造を有する。すなわち、注目する変数が、処理対
象のブロックに対し、外部で宣言されたか、あるいは内
部で宣言されたかを示すフラグ901と、変数を指定す
るデータ構造902、アクセスを指定するデータ構造9
03により構成される。変数指定のデータ構造902は
さらに、変数名、変数の宣言されたブロック番号、ブロ
ックレベルの要素を持つ。フラグ901の内容は、変数
が、処理対象のブロックの内部で宣言された場合に論理
[真]であり、この時は、アクセス指定のデータ構造9
03は不要である。アクセス指定のデータ構造903
は、変数がアクセスされるブロック(すなわち現在処理
中のブロック)のブロック番号、ブロックレベルと、変
数に対する操作が、書き換えを伴うか、参照のみかを判
別するフラグを持つ。
1-3. Purpose of Using Variable Class Structure The variable class structure is a data structure generated as a record of the access status of each variable, and has a structure 900 shown in FIG. That is, a flag 901 indicating whether the variable of interest is declared externally or internally to the block to be processed, the data structure 902 for specifying the variable, and the data structure 9 for specifying the access.
03. The variable designation data structure 902 further has a variable name, a block number in which the variable is declared, and a block level element. The content of the flag 901 is logical [true] when the variable is declared inside the block to be processed. At this time, the data structure 9 of the access specification is set.
03 is unnecessary. Access specification data structure 903
Has a block number of the block to which the variable is accessed (that is, the block currently being processed), a block level, and a flag that determines whether the operation for the variable involves rewriting or only referencing.

【0045】言うまでもなく、ひとつの変数が同一ブロ
ック中で、何回もアクセスされる場合が有り、変数クラ
ス構造体900は同一変数に対し複数生成されうる。ブ
ロック内の構文解析がすべて終了するまでは、注目する
変数が参照されるだけか、代入を伴うのか知ることがで
きない。これを解決するのは、次に説明する2つの連鎖
アドレスである。
Needless to say, one variable may be accessed many times in the same block, and a plurality of variable class structures 900 can be generated for the same variable. Until the parsing in the block is completed, it is impossible to know whether the variable of interest is referred to or is accompanied by assignment. The solution to this is the two chained addresses described below.

【0046】先に、構文解析手段104の処理S509
において生成されたブロック内変数表802には、各変
数毎に4つの要素が有る。それらは、変数名、変数型、
連鎖アドレス803、連鎖アドレス804である。ここ
で、2つの連鎖アドレス803、804の初期値は0で
ある。これら、2つの連鎖アドレスは、変数のアクセス
状況の情報を管理するデータ構造である。
First, the processing S509 of the syntax analysis unit 104.
There are four elements for each variable in the in-block variable table 802 generated in. They are variable name, variable type,
A chain address 803 and a chain address 804. Here, the initial values of the two chain addresses 803 and 804 are 0. These two chained addresses are a data structure that manages information on the access status of variables.

【0047】2.テーブル作成手段108の動作 2−1.テーブル作成手段108の概要 テーブル作成手段108は、並列実行に関する2種類の
テーブルを作成する。第1のテーブルは、個々の変数に
注目したとき、それらがどの処理ブロックからアクセス
されるかの記録を保持するテーブルであり、図8にブロ
ック内変数表802として図示した。第2のテーブル
は、上記と逆の構造で、個々の処理ブロックに注目した
場合、その処理ブロックがどのブロックで宣言された変
数にアクセスするかを記録したテーブルである。このテ
ーブルの構造は図9の、ブロック実行管理表806で図
示した。ブロック管理表806は、データ構造815を
要素とする配列である。
2. Operation of table creating means 2-1. Overview of table creating means 108 The table creating means 108 creates two types of tables related to parallel execution. The first table is a table that keeps a record of which processing block accesses each variable when paying attention to each variable, and is illustrated as an in-block variable table 802 in FIG. The second table has a structure opposite to the above, and is a table in which, when attention is paid to each processing block, which block the processing block accesses a variable declared in is recorded. The structure of this table is illustrated by the block execution management table 806 in FIG. The block management table 806 is an array whose elements are the data structure 815.

【0048】ブロック内変数表802を作る目的は、並
列実行される他の処理単位によって変数がアクセスされ
る際、排他制御を行なうためのコード生成をするため
の、判断の条件を与える事である。このブロック内変数
表802のデータ構造は、変数の代入、参照の起きる場
合毎に、コンパイラ102のコード生成手段107と、
リンカ114によって参照される。
The purpose of creating the in-block variable table 802 is to provide a judgment condition for generating a code for performing exclusive control when a variable is accessed by another processing unit which is executed in parallel. . The data structure of the in-block variable table 802 is the same as that of the code generation means 107 of the compiler 102 for each case where variable substitution or reference occurs.
Referenced by the linker 114.

【0049】ブロック実行管理表806を作る目的は、
並列処理対象のブロックを、他のプロセッサの局所メモ
リに配置する際の、判断の条件を与える事である。この
データは、リンカ114により参照される。従って、並
列実行の対象とならない処理ブロックについては不要で
あり、データ生成されない。
The purpose of creating the block execution management table 806 is to
This is to give a judgment condition when arranging a block for parallel processing in a local memory of another processor. This data is referenced by the linker 114. Therefore, processing blocks that are not the target of parallel execution are unnecessary and data is not generated.

【0050】図5の流れ図に示したように、テーブル作
成手段108には、ブロックの開始を検出した後、処理
S505に引き続き呼び出される場合と、変数へのアク
セスが検出された後、処理S512、S513に引き続
き呼び出される場合の2通りの呼び出しが有る。
As shown in the flow chart of FIG. 5, the table creating means 108 is called after the start of a block and is called in the process S505, and after the access to the variable is detected, the process S512, There are two types of calls when they are called after S513.

【0051】2−2.ブロック実行管理表の作成 テーブル作成手段108は、処理S505に引き続き呼
び出された場合、図11の手順で処理を行なう。ブロッ
ク実行管理表806の新しい要素815を指定し、ブロ
ック番号を記録する(S1001)。次に、変数表指定
構造体801の連鎖を検索し、自ブロックの上位構造に
位置するブロックが有ればそのブロックのブロック番号
を取り出し(S1002)、ブロック番号の値をキーと
して、並列実行手続き名テーブル116を検索する(S
1003)。名前(ブロック番号)が有れば、自分の上
位構造のブロックが並列実行の対象となると判断でき
る。この時は、この検出された上位構造のブロックのブ
ロック番号から、ブロック実行管理表806の中の該当
する要素815を取り出し、そのデータ814から始ま
る連結リストのデータ構造819を辿り、連鎖の終端
に、自ブロックが配列806の中で占める位置のインデ
ックスの値を記録する。これによって、上位構造のブロ
ックのデータ814に、下位ブロックへの連鎖が生成さ
れる(S1005)。
2-2. Creation of Block Execution Management Table The table creating means 108 performs the process according to the procedure of FIG. 11 when it is continuously called in step S505. A new element 815 of the block execution management table 806 is designated and the block number is recorded (S1001). Next, the chain of the variable table designation structure 801 is searched, and if there is a block located in the upper structure of its own block, the block number of that block is taken out (S1002), and the parallel execution procedure is performed using the value of the block number as a key. Search the name table 116 (S
1003). If there is a name (block number), it is possible to determine that the block of its upper structure is the target of parallel execution. At this time, the corresponding element 815 in the block execution management table 806 is extracted from the block number of the detected upper structure block, and the data structure 819 of the linked list starting from the data 814 is traced to the end of the chain. , The value of the index of the position occupied by the own block in the array 806 is recorded. As a result, a chain to the lower block is generated in the data 814 of the block of the upper structure (S1005).

【0052】次に、コンパイラの現在の処理状態から計
算される現ブロックの開始番地の、プログラム先頭番地
からのオフセットの値をデータ807に記録する(S1
006)。続いて、手続きあるいは関数の呼び出し時の
引数のリストを解析し、パラメータ渡しで消費されるス
タックの深さを計算し、その値をデータ809に記録す
る(S1007)。
Next, the offset value from the program start address of the start address of the current block calculated from the current processing state of the compiler is recorded in the data 807 (S1).
006). Subsequently, the argument list at the time of calling the procedure or function is analyzed, the stack depth consumed by passing the parameter is calculated, and the value is recorded in the data 809 (S1007).

【0053】一方、並列実行手続き名テーブル116を
検索し、上位ブロックが並列実行の対象でないと判断で
きたときは、ブロック番号=1であるか検査し、[偽]
の時、さらに上位構造のブロックの検査を行なうためS
1002から繰り返す。これに対し、ブロック番号=1
であれば、最上位のブロック(主プログラム)まで検査
しても、自ブロックが並列実行の対象となるブロックに
従属しないと判断できる。この場合、ブロック実行管理
表806への登録は不要であるから、表へ登録したブロ
ック番号を削除し、処理を終了する。
On the other hand, when the parallel execution procedure name table 116 is searched and it is determined that the upper block is not the target of parallel execution, it is checked whether the block number is 1 and [False].
At the time of S, in order to further inspect the block of the upper structure, S
Repeat from 1002. On the other hand, block number = 1
In this case, even if the highest block (main program) is inspected, it can be determined that the own block does not depend on the block to be executed in parallel. In this case, since registration in the block execution management table 806 is unnecessary, the block number registered in the table is deleted and the process ends.

【0054】2−3.ブロック内変数表の作成 変数へのアクセスが検出された後、処理S512、S5
13に引き続き呼び出される場合、テーブル作成手段1
08は、変数クラス構造体900の各要素の値に基づい
て図12の流れ図に示した処理を行なう。
2-3. After the access to the creation variable of the block variable table is detected, the processes S512 and S5 are performed.
When it is called again after 13, the table creating means 1
08 performs the processing shown in the flowchart of FIG. 12 based on the value of each element of the variable class structure 900.

【0055】外部で宣言されたか、あるいは内部で宣言
されたかを示すフラグ901が検査され、アクセスされ
る変数が内部で宣言された変数である場合処理を終了す
る(S1011)。これ以外の場合は、変数指定のデー
タ構造902から、ブロック番号、ブロックレベルの値
を取り出す(S1012)。この値をキーとして、変数
表指定構造体801の連鎖を検索し、一致した場合のテ
ーブルエントリの値を取り出し(S1013)、ブロッ
ク内変数表802にアクセスし、表中の、変数名の一致
するフィールドを取り出す(S1014)。
A flag 901 indicating whether it is declared externally or internally is checked, and if the variable to be accessed is a variable declared internally, the process is terminated (S1011). In other cases, the block number and the block level value are extracted from the variable-designated data structure 902 (S1012). Using this value as a key, the chain of the variable table designation structure 801 is searched, the value of the table entry in the case of matching is retrieved (S1013), the in-block variable table 802 is accessed, and the variable names in the table match. The field is taken out (S1014).

【0056】ここで、前記変数クラス構造体900の、
アクセスを指定するデータ構造903が参照され、書き
換えフラグの値が検査される(S1015)。この値
が、[真]であるときアクセス指定データ構造903の
ブロック番号、ブロックレベルの値が取り出され、ブロ
ック内変数表802の連鎖アドレス803からの連鎖と
して、図8の805に示すデータ構造の連鎖が生成され
る(S1016)。次に、ブロック番号をキーとして、
ブロック実行管理表806の、該当する要素815が指
定され、連鎖アドレス817からの連鎖として図9の8
20に示すデータ構造の連鎖が生成される(S101
8)。また、判断S1015の内容が[偽]であると
き、ブロック内変数表802の連鎖アドレス804から
の連鎖が生成され(S1017)、続いて、ブロック実
行管理表806の連鎖アドレス818からの連鎖820
が生成される(S1019)。連鎖の生成にあたり、ブ
ロック番号の同一の要素が連鎖中に既に存在している場
合、新たな連鎖の追加の必要は無く処理はスキップされ
る。
Here, in the variable class structure 900,
The data structure 903 designating access is referred to, and the value of the rewrite flag is checked (S1015). When this value is [true], the block number and the block level value of the access designation data structure 903 are extracted, and as a chain from the chain address 803 of the in-block variable table 802, the data structure 805 of FIG. A chain is generated (S1016). Next, using the block number as a key,
The corresponding element 815 of the block execution management table 806 is designated, and a chain from the chain address 817 is designated as 8 in FIG.
A data structure chain shown in 20 is generated (S101).
8). When the content of the determination S1015 is [false], a chain from the chain address 804 of the in-block variable table 802 is generated (S1017), and subsequently, a chain 820 from the chain address 818 of the block execution management table 806.
Is generated (S1019). When generating a chain, if an element having the same block number already exists in the chain, it is not necessary to add a new chain and the process is skipped.

【0057】この結果、連鎖アドレス803には、この
変数に対し、書き換え操作を行うブロックの情報を記録
した構造体805の先頭アドレスが記録され、以下複数
のブロックが連結リストで保持される。また、連鎖アド
レス804には、この変数の参照(読み取り)だけを行
うブロックの情報を記録した構造体805の先頭アドレ
スが記録され、以下複数のブロックが連結リストで保持
される。
As a result, in the chain address 803, the head address of the structure 805 in which the information of the block to be rewritten for this variable is recorded is recorded, and a plurality of blocks are held in the linked list. Further, the chain address 804 records the start address of the structure 805 in which the information of the block only referring to (reading) this variable is recorded, and thereafter, a plurality of blocks are held in the linked list.

【0058】一つのブロック内で、同一の変数に対し、
参照、代入がそれぞれ複数存在したとしても、この連鎖
803、804の管理によって重複が取り除かれ、正し
い使用状況が把握できる。
Within one block, for the same variable,
Even if there are a plurality of references and substitutions, duplication is removed by the management of the chains 803 and 804, and the correct usage status can be grasped.

【0059】テーブル作成手段108の発生したデータ
は、構文解析処理が、ソースコード終了まで処理した時
点で、共有変数管理テーブル110としてファイル出力
される。
The data generated by the table creating means 108 is output to the file as the shared variable management table 110 when the syntax analysis process is completed until the end of the source code.

【0060】3.大域変数にアクセスするオブジェクト
コードの生成方法 3−1.排他制御の方法 本実施例では、並列実行されるプログラムの実行単位
(例えば手続きのブロック)は、別のプロセッサの局所
メモリに転送され実行される。(もちろん、並列実行す
べきブロック数が多く、使用可能なプロセッサ数を上回
った時は、単一のプロセッサの局所メモリ上で複数の処
理単位が並列実行されても構わない。)この時、異なる
プロセッサ間に共有メモリが有る場合でも、無い場合で
も、アクセスの競合が発生する変数に対してはアクセス
の排他制御が行われる。この排他制御の実行コードは、
実行時ライブラリ111で供給される。
3. Method of Generating Object Code for Accessing Global Variable 3-1. Exclusive Control Method In this embodiment, execution units (for example, procedure blocks) of programs to be executed in parallel are transferred to the local memory of another processor and executed. (Of course, if the number of blocks to be executed in parallel is large and exceeds the number of available processors, multiple processing units may be executed in parallel on the local memory of a single processor.) At this time, different Whether or not there is a shared memory between the processors, exclusive access control is performed on variables for which access conflict occurs. The execution code of this exclusive control is
Supplied by the runtime library 111.

【0061】本実施例の排他制御は、セマフォを用い
た。セマフォは、テストと値の書き換えを一連の操作に
おいて実行できるような特権化された機械語命令か、特
権化されたモードからだけアクセス可能なメモリを必要
とする。ここでは、特権化されたメモリSを用いた。
A semaphore was used for exclusive control in this embodiment. Semaphores require privileged machine language instructions that can perform tests and value rewrites in a series of operations, or memory accessible only in privileged mode. Here, the privileged memory S is used.

【0062】セマフォへの操作は、特殊な2つの組とな
る処理で行われる。一つは、ウエイト処理、他の一つは
シグナル処理である。ウエイト処理は、S>0であれ
ば、S:=S−1を実行し、そうでなければウエイトを
呼び出した処理を(一時停止)サスペンドする。シグナ
ル処理は、先にサスペンドされていた処理が待ち行列に
有ったときは、その処理を再起動する。そうでないとき
はS:=S+1を実行する。
The operation on the semaphore is performed by a special two-group process. One is weight processing and the other is signal processing. In the wait process, if S> 0, S: = S-1 is executed, and if not, the process that called the wait is (temporarily stopped) suspended. The signal process restarts the previously suspended process if it is in the queue. If not, execute S: = S + 1.

【0063】マルチプロセッサのシステムでは、特に共
有メモリを持たない場合、セマフォの実現のため、特権
化されたメモリSを、複数のプロセッサのメモリ空間の
どこに配置するかが問題となる。本実施例では、アクセ
スされる変数の状態をルール分けし、個々のルールに応
じてメモリSの配置を決めた。このために、排他制御プ
ログラム113には、図13bに挙げた7つの処理ルー
チンを用意した。また、並列化プログラムには図13a
に挙げた3つの処理ルーチンを用意した。以下説明のた
め、セマフォに使用されるメモリSを、簡単に”セマフ
ォS”と書く。 3−2.排他制御プログラム113の処理 まず排他制御プログラム113の個々の処理ルーチンに
ついて次に説明する。処理中のプロセッサから見て、セ
マフォSが他のプロセッサの局所メモリに存在する時、
ウエイト及びシグナル処理はプロセッサ間の通信経路を
経て行われる。この処理を、リモート・ウエイトとリモ
ート・シグナルの2つの処理ルーチンで行う。これに対
し、セマフォSが、自らの局所メモリに配置されたと
き、これをアクセスするのにローカル・ウエイトとロー
カル・シグナルの処理を使用する。当然のことながら、
通信を伴わないローカル・ウエイトとローカル・シグナ
ルはリモート処理に比較し遥に高速に実行できる。ま
た、他のプロセッサの局所メモリに配置された変数に対
し、値の代入を行う処理としてリモート・ライト処理を
使用する。同様に、他のプロセッサの局所メモリ上の変
数の値を読み取る為に、リモート・リード処理を使用す
る。さらに、並列実行のため、他のプロセッサの局所メ
モリに配置され、他のプロセッサによって実行される処
理単位が、この局所メモリにコピーされた非局所変数の
値を参照するために、ローカル・リード処理を使用す
る。
In a multiprocessor system, particularly when there is no shared memory, it becomes a problem to arrange the privileged memory S in the memory space of a plurality of processors in order to realize the semaphore. In this embodiment, the states of variables to be accessed are divided into rules, and the arrangement of the memory S is determined according to each rule. For this purpose, the exclusive control program 113 is provided with the seven processing routines shown in FIG. 13b. Also, the parallelized program is shown in FIG.
The three processing routines listed in 1. were prepared. For the following description, the memory S used for the semaphore will be simply referred to as "semaphore S". 3-2. Processing of Exclusive Control Program 113 First, individual processing routines of the exclusive control program 113 will be described below. From the perspective of the processing processor, when the semaphore S exists in the local memory of another processor,
The weight and signal processing is performed via the communication path between the processors. This processing is performed by two processing routines of remote wait and remote signal. On the other hand, when the semaphore S is placed in its local memory, it uses local wait and local signal processing to access it. As a matter of course,
Local weights and local signals without communication can be executed much faster than remote processing. Further, the remote write process is used as a process for assigning a value to a variable arranged in the local memory of another processor. Similarly, remote read processing is used to read the value of a variable in the local memory of another processor. In addition, the local read processing is performed so that a processing unit placed in the local memory of another processor for parallel execution and executed by the other processor can refer to the value of the non-local variable copied to this local memory. To use.

【0064】3−3.並列化プログラム112の処理 実行時ライブラリ111に含まれる並列化プログラム1
12の中の処理について説明する。変数・実行オブジェ
クト複写処理1101は、並列に実行されるブロックを
他のプロセッサの局所メモリに配置し実行するための前
処理ルーチンである。本実施例において目的プログラム
の実行コードが生成され実行されるときの最小単位はプ
ロセスである。プロセスは、プロセスの識別子及び実行
管理、メモリ管理のための情報を含むプロセスヘッダ
と、中断の際に現在のプロセッサのレジスタの状態を保
存するための領域と、オブジェクトコード領域、スタッ
ク領域からなる管理単位である。変数・実行オブジェク
ト複写処理1101は、指定された手続きあるいは関数
の処理ブロックを実行するプロセスを生成し、このプロ
セスが従属するプロセッサの番号を実行時の作業領域に
記録する。
3-3. Parallelization program 1 included in the processing runtime library 111 of the parallelization program 112
The process in 12 will be described. The variable / execution object copy processing 1101 is a pre-processing routine for arranging blocks to be executed in parallel in the local memory of another processor and executing them. In this embodiment, the minimum unit when the execution code of the target program is generated and executed is the process. A process consists of a process header containing process identifiers, execution management, and memory management information, an area for saving the current processor register status at the time of suspension, an object code area, and a stack area. It is a unit. The variable / execution object copy processing 1101 creates a process that executes the processing block of the specified procedure or function, and records the number of the processor on which this process depends on the work area at the time of execution.

【0065】遠隔起動処理1102は、変数・実行オブ
ジェクト複写処理1101の生成したプロセスについ
て、そのプロセスを管理するプロセッサ番号を取り出
し、このプロセッサの処理要求待ち行列に対し、プロセ
スの実行要求をエンキュウする。この処理は、並列実行
される処理単位を他のプロセッサの局所メモリに配置し
た後、起動する場合と、リモート・シグナル処理におい
て、停止中の処理を再起動する場合に使用される。
The remote activation process 1102 extracts the processor number for managing the process generated by the variable / execution object copy process 1101 and enqueues the process execution request to the process request queue of this processor. This processing is used when the processing units to be executed in parallel are arranged in the local memory of another processor and then activated, and in the remote signal processing, when the suspended processing is restarted.

【0066】サスペンド1103処理は、局所メモリ上
で実行中のプロセスを、一時停止し、待機処理へのジャ
ンプを発生する。
The suspend 1103 process suspends the process being executed on the local memory and causes a jump to the standby process.

【0067】3−4.オブジェクトコード発生の方法 次に、コード生成手段107が、大域変数へのアクセス
を伴う場合のオブジェクトコードをどのように生成する
かについて説明する。
3-4. Method of Generating Object Code Next, how the code generation means 107 generates an object code in the case of accessing a global variable will be described.

【0068】図5の流れ図でS512、S513に引き
続きテーブル作成処理108が呼び出された後、引き続
きコード生成手段107が実行される。この時、変数ク
ラス構造体900のデータが参照される。非局所変数へ
のアクセスを行っている場合には、実行時ライブラリ1
11に含まれる排他制御プログラム113へのジャンプ
のための命令語スペースの確保が行われる。命令語スペ
ースとして確保されたデータ列中には、排他制御のため
の実行時ライブラリのコードをリンクする必要が有るこ
とを示すシンボルが記録される。この処理結果は、コー
ド生成手段107から、一時ファイル109として出力
される。
After the table creation processing 108 is called after S512 and S513 in the flowchart of FIG. 5, the code generation means 107 is subsequently executed. At this time, the data of the variable class structure 900 is referenced. Run-time library 1 if you are accessing non-local variables
An instruction word space for jumping to the exclusive control program 113 included in 11 is secured. A symbol indicating that it is necessary to link the code of the runtime library for exclusive control is recorded in the data string secured as the instruction word space. The processing result is output as a temporary file 109 from the code generation unit 107.

【0069】このスペースに対し、実際の排他制御プロ
グラムへのジャンプ命令を埋め込み、実行可能なオブジ
ェクトコードとするのは次に述べるリンカ114の処理
である。リンカ114は、一時ファイル109及び、共
有変数管理テーブル110を入力ファイルとして、一時
ファイル109の中に、実行時ライブラリ111のコー
ドへの分岐を必要とするシンボルを検出すると、その指
定内容に従った実際のコード生成を行う。リンカ114
は、既に述べた排他制御プログラム113に含まれる6
つの処理ルーチンの中から、必要な処理ルーチンだけを
取り出し、実行時のオブジェクトコードに付加する。ま
た、リンカ114は、ソースコードから作られる目的プ
ログラムのオブジェクトコードの中に、これら処理ルー
チンへの分岐が指定される場所を見つけると、実際の相
対番地のアドレス計算に基づき、分岐コードの機械語命
令を生成し、オブジェクトコード115を完成する。
It is the processing of the linker 114 described below that embeds a jump instruction to the actual exclusive control program into this space and makes it an executable object code. When the linker 114 uses the temporary file 109 and the shared variable management table 110 as input files and detects a symbol in the temporary file 109 that requires a branch to the code of the runtime library 111, the linker 114 follows the specified content. Do the actual code generation. Linker 114
Is included in the exclusive control program 113 described above.
From the one processing routine, only the required processing routine is extracted and added to the object code at runtime. Further, when the linker 114 finds a place where a branch to these processing routines is designated in the object code of the target program created from the source code, it calculates the machine code of the branch code based on the actual address calculation of the relative address. The instruction is generated and the object code 115 is completed.

【0070】変数のアクセスコードについてリンカ11
4は、図4の表に示したルールに従って排他制御プログ
ラム内の各処理への分岐コードを実行コード中に生成す
る。ルールは次の通りである。自分から見て内側で宣言
された手続き、関数が並列実行の対象になる場合、区分
401の処理ルールを適用する。図6の例では、手続き
p32が並列実行の対象であることから、処理p3にこのル
ールが適用される。 まず、自ブロックの注目する変数に
対し、並列実行されるブロックからのアクセスが無い場
合、通常のコード生成を行う(403)。自ブロック内
の注目する変数に対し並列実行されるブロックからの
クセスが有るが、そのアクセスが参照のみである場合、
ブロック内の実行コードにおいて注目する上記変数に
対し通常の参照または代入処理を行なうと、その処理内
容が代入処理であれば、その代入処理を行った後に、
モート・ウエイト、リモート・ライト、リモート・シグ
ナルの順に処理コードを発生する(404)。自ブロッ
ク内の注目する変数に対し並列実行されるブロックから
のアクセスが有り、そのアクセスが代入である場合は、
ローカルウエイト、通常の参照または代入、ローカル
・シグナルの順にコード生成する(405)。次に、自
分が並列実行されるブロックであるか、またはより内側
のブロックであるときは、区分402のルールに従った
コード生成が行われる。これは、図6の例の、手続きp3
2,p321等から非局所変数にアクセスする場合に当たる。
Linker 11 for access code of variable
4 is an exclusive control program according to the rules shown in the table of FIG.
Generate branch code for each process in the ram in the execution code
It The rules are as follows. Declared inside from my own perspective
If the specified procedure or function is subject to parallel execution,
The processing rule 401 is applied. In the example of FIG. 6, the procedure
Since p32 is the target of parallel execution, this rule is added to process p3.
Rules are applied. First, to the variable of interest in your block
On the other hand, if there is no access from the block that is executed in parallel
If so, normal code generation is performed (403). In own block
For the variable of interest inFrom blocks executed in parallelA
There are some habits,That accessIf it's just a reference,
SelfIn the above variable to be noted in the execution code in the block
ToNormal reference or assignment processIf you do
If the content is an assignment process, after performing the assignment process,Re
Mote weight, remote light, remote sig
Processing codes are generated in the order of null (404). Own block
For the variable of interest inFrom blocks that are executed in parallel
Is accessed, and that access is an assignmentIf
localWeight, ordinary reference or assignment, local
Generate code in the order of signals (405). Next,
Min is a block that runs in parallel, or more inside
If it is a block of
Code generation is done. This is the procedure p3 in the example of FIG.
This is for accessing non-local variables from 2, p321, etc.

【0071】まず、処理対象の変数が非局所変数でなけ
れば、通常のコード生成が行われる(406)。コード
生成のため注目している変数が、非局所変数であるが参
照しか行わない場合は、ローカル・ウエイト、ローカル
・リード、ローカル・シグナルの順でコード生成される
(407)。他方、コード生成のため注目している変数
が、非局所変数であり、しかもブロック中で少なくとも
1回以上のは代入を行う場合は、まずリモート・ウエイ
トを行い、次にリモート・ライトまたはリモート・リー
ド、その後リモート・シグナルという順にコード生成さ
れる(408)。
First, if the variable to be processed is not a non-local variable, normal code generation is performed (406). If the variable of interest for code generation is a non-local variable but only referenced, the code is generated in the order local wait, local read, local signal (407). On the other hand, if the variable of interest for code generation is a non-local variable and the assignment is performed at least once in the block, remote wait is performed first, and then remote write or remote write is performed. Codes are generated in the order of read and then remote signal (408).

【0072】共有変数に対して、並列実行される処理ブ
ロックから参照しか行なわれない場合は、区分404、
407の組み合わせで処理が行なわれる。また、並列実
行される処理ブロックから、非局所変数への代入がある
場合は、区分405、408の組み合わせによる処理が
行なわれる。区分403、406の場合は、仮にブロッ
クが並列実行されても、生成されるコードは単一プロセ
ッサシステムの場合のコード生成と何ら変わるところが
無い。
If the shared variable is referenced only from the processing blocks that are executed in parallel, the partition 404,
Processing is performed with 407 combinations. Further, when there is an assignment to a non-local variable from the processing blocks that are executed in parallel, the processing by the combination of the sections 405 and 408 is performed. In the case of the partitions 403 and 406, even if the blocks are executed in parallel, the generated code is no different from the code generation in the case of the single processor system.

【0073】4.処理単位を他のプロセッサの局所領域
において実行する方法 4−1.非局所変数が参照のみの場合 共有変数に対して、並列実行される処理ブロックから参
照しか行なわれない場合について、そのオブジェクトの
配置と実行の様子を図2を用いて説明する。図2は、2
つのプロセッサが使用され、それぞれの局所メモリ20
1上に目的プログラムがロードされ実行される場合を図
示している。主プログラム203は、単一のプロセスで
あり、その変数領域としてプロセス内のスタック204
を使用する。プログラム中のある実行コード208は、
スタック中にとられた変数207へのアクセスを行うコ
ードである。一方、主プログラム内で定義される実行単
位205は、並列実行の対象となる実行単位である。
4. Method of executing processing unit in local area of other processor 4-1. When Non-Local Variable is Reference Only When a shared variable is referenced only from parallel processing blocks, the arrangement and execution of the object will be described with reference to FIG. 2 is 2
One processor is used, each local memory 20
1 illustrates a case in which the target program is loaded and executed on the device 1. The main program 203 is a single process, and the stack 204 in the process is used as its variable area.
To use. Some execution code 208 in the program is
This is a code for accessing the variable 207 taken in the stack. On the other hand, the execution unit 205 defined in the main program is an execution unit targeted for parallel execution.

【0074】主プログラム203の実行コード中には、
予約語であるcobeginとcoendの間で生成されたコードが
含まれている。通常のプログラム内での処理単位の起動
は、処理単位が手続きあるいは関数といったブロックで
あることから、このブロックに対するサブルーチン呼び
出しの機械語命令を生成する。これに対し、本実施例の
並列実行の際の手続き、関数の呼び出しを図14を用い
て説明する。ここで、1201は実行オブジェクトのメ
モリマップを示している。まず第1の引数から、第Nの
引数までをスタックに積む。次にブロック実行管理表8
06のインデックスをスタックに積む。続いて変数・実
行オブジェクト複写処理1101を呼び出す。変数・実
行オブジェクト複写処理1101は、実行時ライブラリ
111から読み込まれ、プログラムの実行オブジェクト
の一部としてメモリ201にリンクされている。この処
理1101は、ブロック実行管理表806の指定に従
い、実行コードへのオフセット807から、並列実行さ
れるブロックである205のオブジェクトの開始位置を
取り出す。次に、下位ブロックへの連鎖アドレス814
を次々に辿り、ブロック実行管理表806中の下位ブロ
ックのデータを取り出し、順次実行コードのオブジェク
トを取り出す。すべての連鎖を辿った後、これら実行コ
ードを他のプロセッサの局所メモリ202に転送し、新
たなプロセス210を生成する。次に、プロセス中のス
タック211に、ブロック205の呼び出しに先立ちプ
ロセス203のスタックに積まれた引数の内容をコピー
する。このコピーの際、スタックのどの深さまでをコピ
ーするかは、ブロック実行管理表806内の、スタック
の深さ809のデータを使用する。これによって処理1
202までに渡された引数の内容が、プロセス210の
スタック211にも引き継がれる。さらに変数・実行オ
ブジェクト複写処理1101は、連鎖アドレス818以
降に連鎖820があるか調べる。連鎖820がある場合
は、連鎖の中で指定された変数は、プロセス210から
参照だけが行なわれる変数である。図2の例では、変数
207は処理ブロック205から参照される。従って、
処理ブロック205の並列実行時の実体であるプロセス
210から参照が行なわれるため、処理1101は変数
207のコピーをメモリ202上の213に作る。さら
に、この変数へのアクセス調停を行なうために、実行時
ライブラリのローカル・ウエイト、ローカル・シグナ
ル、ローカル・リードをメモリ202上の214にロー
ドする。加えて、処理1101はセマフォ215をメモ
リ202上に配置する。
In the execution code of the main program 203,
It contains code generated between the reserved words cobegin and coend. In order to activate a processing unit in a normal program, since the processing unit is a block such as a procedure or a function, a machine language instruction for calling a subroutine for this block is generated. On the other hand, a procedure and a function call at the time of parallel execution of this embodiment will be described with reference to FIG. Here, 1201 has shown the memory map of an execution object. First, the stack from the first argument to the Nth argument is stacked. Next, block execution management table 8
The index of 06 is put on the stack. Subsequently, the variable / execution object copy processing 1101 is called. The variable / execution object copy processing 1101 is read from the runtime library 111 and linked to the memory 201 as a part of the execution object of the program. This processing 1101 extracts the start position of the object of the block 205 that is executed in parallel from the offset 807 to the execution code according to the designation of the block execution management table 806. Next, the chain address 814 to the lower block
Sequentially, the data of the lower block in the block execution management table 806 is taken out, and the object of the sequential execution code is taken out. After tracing all the chains, these execution codes are transferred to the local memory 202 of another processor, and a new process 210 is created. Next, the contents of the arguments stacked on the stack of the process 203 are copied to the stack 211 in the process before calling the block 205. In this copy, the depth of the stack 809 in the block execution management table 806 is used to determine the depth of the stack to be copied. Processing 1 by this
The contents of the arguments passed up to 202 are also inherited to the stack 211 of the process 210. Further, the variable / execution object copy processing 1101 checks whether or not there is a chain 820 after the chain address 818. If there is a chain 820, the variables specified in the chain are variables that are only referenced by process 210. In the example of FIG. 2, the variable 207 is referenced by the processing block 205. Therefore,
Since the process 210, which is the substance of the parallel execution of the processing block 205, makes a reference, the processing 1101 makes a copy of the variable 207 in 213 on the memory 202. Furthermore, in order to arbitrate access to this variable, the local wait, local signal, and local read of the runtime library are loaded into 214 on the memory 202. In addition, the process 1101 places the semaphore 215 on the memory 202.

【0075】変数207のコピーとして新しく作られた
変数213の値を参照する場合、プロセス210は図4
の407に示した通り、 ローカル・ウエイト ローカル・リード ローカル・シグナル の順に実行する。このため、変数213の実際のアドレ
スは実行時ライブラリの一つの処理であるローカル・リ
ードが知っていれば良い。この理由から、処理1101
は変数213のアドレスを実行時ライブラリ214及び
209の作業領域に記録しておく。
When referencing the value of the newly created variable 213 as a copy of the variable 207, the process 210 is shown in FIG.
407, local wait local read local signal is executed in this order. Therefore, the actual address of the variable 213 may be known by the local read, which is one process of the runtime library. For this reason, process 1101
Records the address of the variable 213 in the work area of the runtime libraries 214 and 209.

【0076】次に、図14に示す様に遠隔起動処理11
02が呼び出される。遠隔起動処理1102は、プロセ
ス210の実行要求を、このプロセスを管理するプロセ
ッサの待ち行列にエンキュウする。以上が、処理ブロッ
ク205を遠隔起動するまでの処理である。遠隔起動さ
れたブロック210は、実行が終了すると、終了シグナ
ルによって主プログラム作業領域の並列実行フラグの書
き換えを発生する。すべての並列実行中のブロックに関
するフラグが終了状態に書き換えられると、並列実行が
終了し、coendが処理されたと見なされ、続く処理が継
続される。
Next, as shown in FIG. 14, the remote start processing 11
02 is called. The remote start processing 1102 enqueues the execution request of the process 210 in the queue of the processor that manages this process. The above is the processing until the processing block 205 is remotely activated. When the execution is completed, the remotely activated block 210 rewrites the parallel execution flag of the main program work area by the completion signal. When the flags related to all the blocks in parallel execution are rewritten to the end state, the parallel execution ends, it is considered that the coend has been processed, and the subsequent processing is continued.

【0077】図2の例では、処理ブロック205の並列
実行時のプロセス210は、ブロック203(主プログ
ラムもブロックである)の変数207にアクセスするも
のの、参照のみである。参照の方法は既に述べた通り、
変数207のコピーである213に対し行なわれる。し
かし、ブロック203は、実行コード208において変
数207への代入を行なう。本実施例の並列処理言語の
仕様から、変数207の値の変更はプロセス210に正
しく反映される必要がある。そこで、実行コード208
では、図4の404に示したコード生成が行なわれてい
る。すなわち、変数207への代入の後、実行時ライブ
ラリ209から、 リモート・ウエイト リモート・ライト リモート・シグナル の順に処理が呼びだされ実行される。ここで、実行時ラ
イブラリ209の作業領域には、変数207のコピーで
ある変数213のアドレスが記録されているため、変数
213の値と、207の値の間の一致が保証できる。
In the example of FIG. 2, the process 210 in parallel execution of the processing block 205 accesses the variable 207 of the block 203 (the main program is also a block), but is only for reference. As for the reference method, as already mentioned,
This is performed for 213 which is a copy of the variable 207. However, the block 203 substitutes the variable 207 in the execution code 208. From the specification of the parallel processing language of this embodiment, it is necessary that the change of the value of the variable 207 be reflected correctly in the process 210. Therefore, the execution code 208
Then, the code generation shown at 404 in FIG. 4 is performed. That is, after the substitution to the variable 207, the processing is called from the runtime library 209 in the order of remote wait remote write remote signal and executed. Here, since the address of the variable 213, which is a copy of the variable 207, is recorded in the work area of the runtime library 209, a match between the value of the variable 213 and the value of 207 can be guaranteed.

【0078】さらに、図4の404に示すように変数2
07へのアクセスが、処理ブロック203において参照
だけである場合、実行コード216からは、排他制御を
伴わない全く通常の変数参照のコード生成が行なわれる
ため、そのアクセスは極めて高速に処理できる。一方、
変数207のコピー213を参照するプロセス210内
部の実行コード212も、排他制御は通信を伴わずに局
所的なセマフォで行なわれる。このため、通信経路を隔
てた並列処理であるにも拘わらず、実行速度は共有メモ
リをもつ場合の処理速度に匹敵する。処理全体を見通し
た時は、実行コード216などにおいて、排他制御不要
となることから、変数アクセスの処理時間平均値では、
むしろ共有メモリを用いた場合を上回ると言える。この
ため、本実施例の方法を、そのまま共有メモリをもつ図
15aの形態の処理系に適用しても処理速度の改善が得
られる。
Further, as shown by 404 in FIG.
When the access to 07 is only a reference in the processing block 203, since the execution code 216 performs code generation of a quite normal variable reference without exclusive control, the access can be processed at extremely high speed. on the other hand,
Even in the execution code 212 inside the process 210 that refers to the copy 213 of the variable 207, exclusive control is performed by a local semaphore without communication. For this reason, the execution speed is comparable to the processing speed in the case of having a shared memory, despite the parallel processing with the communication paths separated. When the entire processing is viewed, the execution code 216 or the like does not require exclusive control, so the average processing time of variable access is
Rather, it can be said that it exceeds the case of using shared memory. Therefore, the processing speed can be improved even if the method of the present embodiment is applied to the processing system of the form of FIG. 15a having the shared memory as it is.

【0079】4−2.非局所変数への代入が行なわれる
場合 並列実行される処理ブロックから、非局所変数への代入
がある場合について、そのオブジェクトの配置と実行の
様子を図3を用いて説明する。
4-2. When Assignment to Non-Local Variable is Performed With reference to FIG. 3, the arrangement and execution of the object will be described for the case where assignment to a non-local variable is performed from a processing block that is executed in parallel.

【0080】図3の状態は、ブロック203内部で宣言
された処理ブロック301が、並列実行の対象となり、
他のプロセッサの管理する局所メモリ上で実行された場
合を示している。プロセス304は、ブロック301
が、メモリ202上で実行された時の実体である。ブロ
ック203の変数302は、ブロック203のスタック
である204の中に配置される。この時、プロセス30
4から変数302への書き換えも行なわれる。この場合
は、セマフォ303がブロック203の実行コードの存
在するメモリ201上に配置される。
In the state shown in FIG. 3, the processing block 301 declared inside the block 203 is the target of parallel execution,
It shows the case where it is executed on the local memory managed by another processor. Process 304 is block 301
Is an entity when executed on the memory 202. The variable 302 of the block 203 is arranged in the stack 204 of the block 203. At this time, process 30
Rewriting from 4 to the variable 302 is also performed. In this case, the semaphore 303 is arranged on the memory 201 where the execution code of the block 203 exists.

【0081】前述したルールに従い、ブロック203の
中から、変数302にアクセスするコードは、実行時ラ
イブラリ306を使用し排他制御をともなってアクセス
を行なう。同じく、プロセス304の中から変数302
にアクセスする実行コード305は、実行時ライブラリ
307を使用した排他制御をともなってアクセスを行な
う。この時、変数302の実際のアドレスは、実行時ラ
イブラリ306、307の作業領域に保持される。
In accordance with the rules described above, the code for accessing the variable 302 from the block 203 uses the runtime library 306 to perform access with exclusive control. Similarly, from the process 304, the variable 302
The execution code 305 that accesses the file is accessed with exclusive control using the runtime library 307. At this time, the actual address of the variable 302 is held in the work area of the runtime libraries 306 and 307.

【0082】並列実行される処理ブロックから、非局所
変数への代入がある場合に関する処理は、以上のように
従来の変数アクセスの方法と等価である。
The processing relating to the case where a non-local variable is assigned from the processing blocks executed in parallel is equivalent to the conventional variable access method as described above.

【0083】これまで述べた方法によって本実施例で
は、並列処理言語により記述されたソースプログラムに
対し、読み取り参照しか行なわれない変数を局所メモリ
に割り当てた場合にも、動作の保証を得ることができ
る。
In the present embodiment, the method described above can guarantee the operation even when a variable which is only read-referenced is assigned to the local memory for the source program written in the parallel processing language. it can.

【0084】言語Pascalの仕様を拡張して定義される並
列記述言語のコンパイルにおいて、ソースコード中で予
約語cobegin...coendを検出したとしたら、その内側で
使用される手続き(関数)は、先立って定義されてお
り、既にコンパイルコード生成されている。単一プロセ
ッサ向きの通常のコンパイル処理を行いつつ、既に生成
済みコードに対し、cobeginを検出した後、後戻りし並
列実行に必要なコードの埋め込みを行うという煩雑な処
理を除くため、前述の実施例は並列実行手続き名テーブ
ル116を用いた。
When the reserved words cobegin ... coend are detected in the source code in the compilation of the parallel description language defined by extending the specification of the language Pascal, the procedure (function) used inside is It was defined in advance and already has compiled code generated. In order to remove the complicated process of performing a normal compile process for a single processor and detecting cobegin for already generated code, then returning and embedding the code required for parallel execution, the above-mentioned embodiment Used the parallel execution procedure name table 116.

【0085】別の実施例として、次の方法が有る。それ
は、並列実行手続き名テーブル116の記録に従い、構
文処理手段104の作業メモリ上にある、字句解析手段
103から渡されたデータ列の一部を書き換える方法で
ある。このために、通常の手続き、関数を示すシンボル
とは別に、並列実行される手続き、関数のシンボルを定
義しておき、字句解析手段103の出力したデータ列中
から、並列実行すべき手続き名(あるいは関数名)の位
置を検出し、この手続き(あるいは関数)に対するシン
ボルを通常の値から、並列実行すべきシンボルの値に差
し替えるという手段をとる。
As another embodiment, there is the following method. It is a method of rewriting a part of the data string passed from the lexical analysis means 103 on the working memory of the syntax processing means 104 according to the record of the parallel execution procedure name table 116. Therefore, in addition to the normal procedure and the symbol indicating the function, the symbol of the procedure and the function to be executed in parallel are defined, and the procedure name (the procedure name to be executed in parallel in the data string output from the lexical analysis unit 103 ( Alternatively, the position of the function name) is detected, and the symbol for this procedure (or function) is replaced from the normal value to the value of the symbol to be executed in parallel.

【0086】これに続く構文解析処理では、並列実行す
べきシンボルを検出した段階で、並列実行に必要なコー
ドの発生を行う。
In the subsequent parsing process, the code required for parallel execution is generated at the stage when a symbol to be executed in parallel is detected.

【0087】さらに別の実施例として、手続き、関数の
宣言についての言語仕様を拡張し、並列実行する手続き
は予約語procedureにより宣言せず、例えばco-procedur
eと宣言することで解決する等の実現方法も有る。これ
は言語設計の段階で、どのような仕様を持たせるかに大
きく依存するものである。しかし、前記した本発明の実
施例が用いた方法は、特定の言語仕様によらず、並列記
述言語のマルチプロセッサ上での実行コードの生成に有
効なものである。
As yet another embodiment, the language specifications for procedure and function declarations are expanded, and the procedure to be executed in parallel is not declared by the reserved word procedure, but for example co-procedur.
There is also a realization method such as declaring e to solve. This largely depends on what specifications are provided at the language design stage. However, the method used by the embodiment of the present invention described above is effective for generating an execution code on a multiprocessor of a parallel description language regardless of a specific language specification.

【0088】[0088]

【発明の効果】上記構成の本発明によれば、局所領域に
複写された参照のみの変数に対しても、排他制御プログ
ラムにより並列実行時の値の更新結果が反映される。こ
の結果、従来方法では動作の保証が得られなかった並列
記述言語によって記述されたソースコードであっても、
正しい動作が得られるという効果がある。この場合、本
発明の変数有効範囲検出手段、変数代入検出手段によっ
て検出された参照しか行なわれない変数が、並列化プロ
グラムによって、他のプロセッサの局所領域にも複写さ
れる。この働きにより、共有変数を読み取る際のアクセ
ス調停の度数が減少するため、実行速度が向上する効果
を併せ持つ。
According to the present invention having the above-described structure, the result of updating the value at the time of parallel execution is reflected by the exclusive control program even for the variable of reference only copied to the local area. As a result, even if the source code is written in the parallel description language, the operation of which cannot be guaranteed by the conventional method,
There is an effect that a correct operation can be obtained. In this case, the variable detected only by the variable effective range detecting means and the variable substitution detecting means of the present invention and only referred to is copied to the local area of another processor by the parallelized program. This function reduces the frequency of access arbitration when reading the shared variable, and thus has the effect of improving the execution speed.

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

【図1】本発明の一実施例の構成図。FIG. 1 is a configuration diagram of an embodiment of the present invention.

【図2】非局所変数の参照の手順の説明図。FIG. 2 is an explanatory diagram of a procedure for referring to a non-local variable.

【図3】非局所変数の代入の手順の説明図。FIG. 3 is an explanatory diagram of a procedure of substituting a non-local variable.

【図4】排他制御のためのプログラムコード生成のルー
ルの説明図。
FIG. 4 is an explanatory diagram of a rule of program code generation for exclusive control.

【図5】変数検出処理の流れ図。FIG. 5 is a flowchart of variable detection processing.

【図6】ブロックの例の説明図。FIG. 6 is an explanatory diagram of an example of a block.

【図7】ブロックの関係と、変数表指定構造体の例の説
明図。
FIG. 7 is an explanatory diagram of an example of a relationship between blocks and a variable table designation structure.

【図8】ブロック内変数表と、ブロック実行管理表の説
明図。
FIG. 8 is an explanatory diagram of a block variable table and a block execution management table.

【図9】ブロック内変数表と、ブロック実行管理表の説
明図。
FIG. 9 is an explanatory diagram of an in-block variable table and a block execution management table.

【図10】変数クラス構造体の説明図。FIG. 10 is an explanatory diagram of a variable class structure.

【図11】テーブル作成手段の処理の流れ図。FIG. 11 is a flow chart of processing of table creating means.

【図12】テーブル作成手段の処理の流れ図。FIG. 12 is a flow chart of processing of table creating means.

【図13】実行時ライブラリの処理の説明図。FIG. 13 is an explanatory diagram of processing of a runtime library.

【図14】並列実行時の実行コードの説明図。FIG. 14 is an explanatory diagram of an execution code during parallel execution.

【図15】マルチプロセッサシステムの構成例を示す説
明図。
FIG. 15 is an explanatory diagram showing a configuration example of a multiprocessor system.

【図16】従来方法で、動作の保証が得られないソース
コードの一例を示した説明図。
FIG. 16 is an explanatory diagram showing an example of source code for which a guarantee of operation cannot be obtained by a conventional method.

【符号の説明】[Explanation of symbols]

1… マイクロプロセッサユニット 2… 局所メモリ 3… 共有メモリ 4… 通信制御手段 5… 通信経路 101… ソースコード 102… コンパイラ 103… 字句解析手段 104… 構文解析手段 105… 変数有効範囲検出手段 106… 変数代入検出手段 107… コード生成手段 108… テーブル作成手段 109… 一時ファイル 110… 共有変数管理テーブル 111… 実行時ライブラリ 112… 並列化プログラム 113… 排他制御プログラム 114… リンカ 115… オブジェクトコード 213… 参照しかされない変数のコピー 215… セマフォ 303… セマフォ 801… 変数表指定構造体 802… ブロック内変数表 806… ブロック実行管理表 900… 変数クラス構造体 1 ... Microprocessor unit 2. Local memory 3 Shared memory 4 ... Communication control means 5 ... Communication path 101 ... Source code 102 ... Compiler 103 ... Lexical analysis means 104 ... Syntax analysis means 105 ... Variable effective range detecting means 106 ... Variable substitution detection means 107 ... Code generation means 108 ... Table creating means 109 ... Temporary file 110 ... Shared variable management table 111 ... Runtime library 112 ... Parallelization program 113 ... Exclusive control program 114 ... Linker 115 ... Object code 213 ... Copying variables that can only be referenced 215 ... Semaphore 303 ... Semaphore 801 ... Variable table designation structure 802 ... In-block variable table 806 ... Block execution management table 900 ... Variable class structure

───────────────────────────────────────────────────── フロントページの続き (56)参考文献 特開 平2−132525(JP,A) 特開 平4−102159(JP,A) 特開 平3−52033(JP,A) 特開 平2−311949(JP,A) 特開 平3−6751(JP,A) 特開 平2−87258(JP,A) 特開 昭63−156257(JP,A) 特開 昭63−67669(JP,A) 特開 昭55−74656(JP,A) (58)調査した分野(Int.Cl.7,DB名) G06F 15/16 - 15/177 ─────────────────────────────────────────────────── --- Continuation of the front page (56) References JP-A-2-132525 (JP, A) JP-A-4-102159 (JP, A) JP-A-3-52033 (JP, A) JP-A-2- 311949 (JP, A) JP 3-6751 (JP, A) JP 2-87258 (JP, A) JP 63-156257 (JP, A) JP 63-67669 (JP, A) JP-A-55-74656 (JP, A) (58) Fields investigated (Int.Cl. 7 , DB name) G06F 15/16-15/177

Claims (5)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 並列処理に関する記述が可能な言語仕様
で記述されたソースコードからオブジェクトコードを生
成するコンパイラ装置であって、 前記ソースコード内に含まれる複数の処理単位のうち、
第1の処理単位が第2の処理単位を含み、且つ、該第2
の処理単位が並列処理の対象となる場合に、前記第1の
処理単位内にある変数のうち、前記第2の処理単位から
アクセスされ得ると共に、該第2の処理単位からのアク
セスが値の参照のみである特定変数について、前記第2
の処理単位の並列処理が実行される際に、該第2の処理
単位の並列実行時のプロセスの存在するメモリ領域に、
前記特定変数を複写変数として複写する第1の実行コー
ドを生成する第1のコード生成手段と、 前記第1の処理単位の処理が実行された際に、前記第1
の処理単位から前記特定変数にアクセスがあり、そのア
クセスが値の代入である場合に、該特定変数の複写であ
る前記複写変数に対する前記プロセスからのアクセスを
待機させ、前記特定変数へ代入された値を前複写変数に
代入し、その後、前記複写変数へのアクセスの待機を解
除する第2の実行コードを生成する第2のコード生成手
段と、 を備え、 前記ソースコードから前記第1及び第2の実行コードを
含むオブジェクトコードを生成することを特徴とするコ
ンパイラ装置。
1. A compiler apparatus for generating an object code from a source code written in a language specification capable of describing parallel processing, wherein: a plurality of processing units included in the source code;
The first processing unit includes a second processing unit, and
Of the variables in the first processing unit can be accessed from the second processing unit, and the access from the second processing unit is a value when the processing unit is subject to parallel processing. Regarding the specific variable that is only for reference, the second
When parallel processing of the second processing unit is executed, in the memory area in which the process at the time of parallel execution of the second processing unit exists,
First code generation means for generating a first execution code for copying the specific variable as a copy variable; and the first code generation means for executing the first processing unit when the processing of the first processing unit is executed.
When there is an access to the specific variable from the unit of processing and the access is a value substitution, the access from the process to the copy variable, which is a copy of the specific variable, is made to wait, and the specific variable is assigned. Second code generating means for generating a second execution code for substituting a value into a pre-copy variable and then releasing a wait for access to the copy variable; and A compiler device for generating an object code including two execution codes.
【請求項2】 第1のメモリ領域に存在する第1のプロ
セスと第2のメモリ領域に存在する第2のプロセスを並
列に実行することが可能な情報処理システムであって、 前記第1のメモリ領域に存在し、前記第1のプロセスに
よってアクセスされる変数のうち、前記第2のプロセス
からもアクセスされ得ると共に、前記第2のプロセスか
らのアクセスが値の参照のみである特定変数について、
該特定変数を第2のメモリ領域に複写変数として複写す
る変数複写手段と、 前記第1のプロセスによって前記特定変数にアクセスが
あり、そのアクセスが値の代入であった場合に、該特定
変数の複写である前記複写変数に対する前記第2のプロ
セスからのアクセスを待機させ、前記特定変数へ代入さ
れた値を前複写変数に代入し、その後、前記複写変数へ
のアクセスの待機を解除する変数代入手段と、を備える
情報処理システム。
2. An information processing system capable of executing in parallel a first process existing in a first memory area and a second process existing in a second memory area, wherein: Of the variables existing in the memory area and accessed by the first process, the specific variables that can also be accessed by the second process and are accessed only from the second process,
Variable copying means for copying the specific variable to the second memory area as a copy variable; and if the specific variable is accessed by the first process and the access is substitution of a value, the specific variable A variable assignment that waits for an access from the second process to the duplicated variable that is a copy, assigns the value assigned to the specific variable to a pre-duplicated variable, and then releases the wait for access to the duplicated variable An information processing system comprising:
【請求項3】 請求項に記載の情報処理システムにお
いて、 少なくとも、第1及び第2のプロセッサを備えると共
に、 前記第1のプロセスは前記第1のプロセッサで実行さ
れ、前記第2のプロセスは第2のプロセッサで実行され
ることを特徴とする情報処理システム。
3. The information processing system according to claim 2 , further comprising at least first and second processors, wherein the first process is executed by the first processor, and the second process is executed by the first process. An information processing system characterized by being executed by a second processor.
【請求項4】 コンパイラ装置を用いて並列処理に関す
る記述が可能な言語仕様で記述されたソースコードから
オブジェクトコードを生成するためのオブジェクトコー
ド生成方法であって、 (a)前記ソースコード内に含まれる複数の処理単位の
うち、第1の処理単位が第2の処理単位を含み、且つ、
該第2の処理単位が並列処理の対象となる場合に、前記
第1の処理単位内にある変数のうち、前記第2の処理単
位からアクセスされ得ると共に、該第2の処理単位から
のアクセスが値の参照のみである特定変数について、前
記第2の処理単位の並列処理が実行される際に、該第2
の処理単位の並列実行時のプロセスの存在するメモリ領
域に、前記特定変数を複写変数として複写する第1の実
行コードを、前記コンパイラ装置が生成する工程と、 (b)前記第1の処理単位の処理が実行された際に、前
記第1の処理単位から前記特定変数にアクセスがあり、
そのアクセスが値の代入である場合に、該特定変数の複
写である前記複写変数に対する前記プロセスからのアク
セスを待機させ、前記特定変数へ代入された値を前複写
変数に代入し、その後、前記複写変数へのアクセスの待
機を解除する第2の実行コードを、前記コンパイラ装置
生成する工程と、 を備え、前記コンパイラ装置を用いて 前記ソースコードから前記
第1及び第2の実行コードを含むオブジェクトコードを
生成することを特徴とするオブジェクトコード生成方
法。
4. An object code generation method for generating an object code from a source code described in a language specification capable of describing parallel processing by using a compiler device, comprising: (a) included in the source code. The first processing unit includes the second processing unit, and
When the second processing unit is a target of parallel processing, it can be accessed from the second processing unit among variables in the first processing unit, and can be accessed from the second processing unit. When the parallel processing of the second processing unit is executed for a specific variable whose value is only a value reference,
The compiler device generates a first execution code for copying the specific variable as a copy variable in a memory area in which a process exists in parallel execution of the processing unit of (b) the first processing unit. When the processing of is executed, there is access to the specific variable from the first processing unit,
If the access is a value substitution, the process waits for an access from the process to the copy variable, which is a copy of the specific variable, and the value assigned to the specific variable is assigned to the pre-copy variable. The second execution code for releasing the waiting for access to the copy variable is the compiler device.
And a step of: generating an object code including the first and second execution codes from the source code using the compiler apparatus .
【請求項5】 第1のプロセッサによって第1のメモリ
領域に存在する第1のプロセスを、第2のプロセッサに
よって第2のメモリ領域に存在する第2のプロセスを
それぞれ並列に実行する情報処理方法であって、 (a)前記第1のメモリ領域に存在し、前記第1のプロ
セスによってアクセスされる変数のうち、前記第2のプ
ロセスからもアクセスされ得ると共に、前記第2のプロ
セスからのアクセスが値の参照のみである特定変数につ
いて、前記第1のプロセッサが、前記特定変数を第2の
メモリ領域に複写変数として複写する工程と、 (b)前記第1のプロセスによって前記特定変数にアク
セスがあり、そのアクセスが値の代入であった場合に、
前記第1のプロセッサが、前記特定変数の複写である前
記複写変数に対する前記第2のプロセスからのアクセス
を待機させ、前記特定変数へ代入された値を前複写変数
に代入し、その後、前記複写変数へのアクセスの待機を
解除する工程と、 を備える情報処理方法。
5. The first process existing in the first memory area by the first processor is transferred to the second processor.
Thus the second process that exists in the second memory area,
A respective information processing method to be executed in parallel, (a) present in the first memory area, among the variables accessed by said first process, with may be accessed by the second process, With respect to a specific variable whose access from the second process is only a value reference, the first processor copies the specific variable to a second memory area as a copy variable, and (b) the first variable If there is access to the specific variable by the process of and the access is substitution of value,
The first processor waits for an access from the second process to the copy variable, which is a copy of the specific variable, substitutes the value assigned to the specific variable into a pre-copy variable, and then the copy An information processing method comprising a step of canceling a wait for access to a variable.
JP15814192A 1992-06-17 1992-06-17 Compiler device, information processing system, object code generation method, and information processing method Expired - Fee Related JP3364952B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP15814192A JP3364952B2 (en) 1992-06-17 1992-06-17 Compiler device, information processing system, object code generation method, and information processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP15814192A JP3364952B2 (en) 1992-06-17 1992-06-17 Compiler device, information processing system, object code generation method, and information processing method

Publications (2)

Publication Number Publication Date
JPH064497A JPH064497A (en) 1994-01-14
JP3364952B2 true JP3364952B2 (en) 2003-01-08

Family

ID=15665167

Family Applications (1)

Application Number Title Priority Date Filing Date
JP15814192A Expired - Fee Related JP3364952B2 (en) 1992-06-17 1992-06-17 Compiler device, information processing system, object code generation method, and information processing method

Country Status (1)

Country Link
JP (1) JP3364952B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5119590B2 (en) * 2005-11-10 2013-01-16 富士通セミコンダクター株式会社 Task distribution program and task distribution device for processor device having multiprocessor

Also Published As

Publication number Publication date
JPH064497A (en) 1994-01-14

Similar Documents

Publication Publication Date Title
JP5284103B2 (en) Software transactional memory optimization
US5768596A (en) System and method to efficiently represent aliases and indirect memory operations in static single assignment form during compilation
JP3602857B2 (en) Multi-model compatible information processing system and method
US6993754B2 (en) Annotations to executable images for improved dynamic optimization functions
US9471291B2 (en) Multi-processor code for modification for storage areas
US6202204B1 (en) Comprehensive redundant load elimination for architectures supporting control and data speculation
US8234635B2 (en) Program processing device, parallel processing program, program processing method, parallel processing compiler, recording medium containing the parallel processing compiler, and multi-processor system
JP4833206B2 (en) Generation of unwind information for optimized programs
JP3311462B2 (en) Compile processing unit
JP5893038B2 (en) Compile-time boundary checking for user-defined types
JPH06266683A (en) Parallel processor
US20190079805A1 (en) Execution node selection method and information processing apparatus
KR100738777B1 (en) Coarse grained determination of data dependence between parallel executed jobs in an information processing system
Loidl Granularity in large-scale parallel functional programming
Horwat Concurrent Smalltalk on the message-driven processor
Taft et al. Safe parallel programming in Ada with language extensions
JP3364952B2 (en) Compiler device, information processing system, object code generation method, and information processing method
Midkiff Automatic generation of synchronization instructions for parallel processors
Rogers et al. Supporting SPMD execution for dynamic data structures
Raman Compiler support for work-stealing parallel runtime systems
Åkesson An LLVM Back-end for REPLICA: Code Generation for a Multi-core VLIWProcessor with Chaining
US20200409746A1 (en) Information processing apparatus and recording medium
JPH064498A (en) Multiprocessor
Vandierendonck et al. Hyperqueues: Design and implementation of deterministic concurrent queues
JPH0660047A (en) Multiprocessor processor

Legal Events

Date Code Title Description
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20071101

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20081101

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091101

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091101

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101101

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees