[go: up one dir, main page]

JP3921722B2 - Compiler processing device - Google Patents

Compiler processing device Download PDF

Info

Publication number
JP3921722B2
JP3921722B2 JP01230397A JP1230397A JP3921722B2 JP 3921722 B2 JP3921722 B2 JP 3921722B2 JP 01230397 A JP01230397 A JP 01230397A JP 1230397 A JP1230397 A JP 1230397A JP 3921722 B2 JP3921722 B2 JP 3921722B2
Authority
JP
Japan
Prior art keywords
initial value
initial values
program
storage method
work area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP01230397A
Other languages
Japanese (ja)
Other versions
JPH10207715A (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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP01230397A priority Critical patent/JP3921722B2/en
Publication of JPH10207715A publication Critical patent/JPH10207715A/en
Application granted granted Critical
Publication of JP3921722B2 publication Critical patent/JP3921722B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、FORTRANなどコンパイラのDATA文(DATA宣言命令)の初期値をオブジェクト・プログラムに変換する技術に関する。
【0002】
【従来の技術】
FORTRANなどコンパイラのDATA文の初期値割り付けの方法には、従来、次のような二つの方法があった。
【0003】
その第一の方法(以下、一括保存法と呼ぶ)を、図11に示すようなプログラム例1をもとに説明する。同図(1)はその一例としてFORTRANプログラムの一部であるDATA文による初期値設定部分のソースプログラムを示しており、プログラム例1とするが、説明の便宜上、以降プログラム例に於ける初期値は、全て符号付4バイトとする。
【0004】
▲1▼の「INTEGER 」は整数の作業域(領域)確保のための宣言命令であり、▲2▼〜▲4▼の「DATA」は作業域への初期値設定のための宣言命令であり、▲5▼の「END 」は原始プログラムの終了命令を示している。
【0005】
同図( 2 )は当プログラム例1の初期値設定及び出力の過程を示したもので、先ず、▲1▼のINTEGER 命令により(1)に示す作業域が確保される。続いて▲2▼〜▲4▼のDATA命令により、それぞれ(2)、(3)を経て(4)の初期値設定がなされ、全ての初期値設定が終了する。
【0006】
しかし、この方法に於いては、図12に示す(1) のプログラム例2のような場合、即ち▲1▼のINTEGER 命令により10,000,000個分の作業域を確保し、▲2▼、▲3▼のDATA命令により、先頭の要素B(1)作業域に初期値「1 」を設定し、最後の要素B(10000000) 作業域に初期値「2 」をそれぞれ設定するような巨大配列( 変数) の場合には、(2) の初期値出力結果に示すように、その間の領域が無駄になる上、作業域を獲得するのに時間が掛かるという問題がある。更に、作業域を確保出来ずに、コンパイルを失敗してしまうケースさえ生ずることもある。尚、この一括保存法による初期値設定に於いて、図では省略・表現していないが、この初期値を管理するための管理ブロック(後述)が存在する。
【0007】
次に第二の方法(以下、分割保存法と呼ぶ)として、先ず初期値が与えられると、その初期値を設定管理するための管理ブロック(4バイト×5項目=20バイトの大きさ)を作成する。図13(1)はこの管理ブロックの内容と初期値設定作業域との関係を示したもので、管理ブロックの内容としては、「次の管理ブロックへのポインタ」、「初期値へのポインタ」、「初期値の割り付け位置」、「作業域の大きさ」、及び「初期値の繰返し回数」を記憶・保持しており、この「初期値へのポインタ」により初期値設定作業域(可変長)に連鎖されている。そして初期値が与えられる都度、即ち初期値の数だけ管理ブロックが作成され、これ等は割り付け位置順に前述の「管理ブロックへのポインタ」により連鎖されて初期値を管理するものである。但し、同じ値の初期値が連続する時は、前述の管理ブロックの「初期値の繰返し回数」を所要数設定するだけで、一つの管理ブロックにより初期値を管理することが出来る。(プログラム例4)
そして、これ等管理ブロックを参照しながら、割り付け位置順にオブジェクトプログラムを出力して完結する。
【0008】
図13(2)は先のプログラム例1について、この分割保存法により初期値出力した時の図であり、初期値の数の三個の管理ブロックが作成され、これ等は割り付け位置順(DATA文に現れた順番を位置順にソートしたもの)に「管理ブロックのポインタ」により連鎖されている。又、初期値「1 」、「2 」、「3 」は「初期値へのポインタ」により初期値設定作業域に連鎖され、設定・記憶されることを示している。
【0009】
しかし、この方法に於いては、初期値の数が多くなると、初期値を保存管理する管理ブロックが増加し、管理ブロックの作業域が大きくなる上、初期値が割り付け位置順に与えられていないようなケースでは、管理ブロックを割り付け位置順にソートする時間も増大し、強いてはコンパイル時間が長くなるという問題が生ずる。
【0010】
このように、DATA文の初期値設定方法には一括保存法と分割保存法とがあり、一括保存法では初期値が連続の作業域上に一括記憶・保存されるよう管理され管理ブロックは一つであるが、分割保存法では初期値が与えられる都度、初期値設定作業域とその管理ブロックが確保・設定されるため初期値が連続の作業域に設定されるとは限らず、初期値設定作業域と管理ブロックの数も基本的に複数となる。但し前述したように同じ値の初期値が連続する時は、管理ブロックの「初期値の繰返し回数」設定により、一つの管理ブロックで初期値を管理することが出来る。
【0011】
【発明が解決しようとする課題】
DATA文による初期値設定に際し、従来は前述の一括保存法に依るか分割保存法に依るか、システム(コンパイラ)によって固定化されている。従ってDATA文の初期値設定の構造に依っては、無駄な作業域が生じたり、作業域を獲得する時間が掛かり、又初期値の数が多くなると、その管理ブロックのための作業域が大きくなる上、初期値が割り付け位置順に与えられていないようなケースでは、管理ブロックを割り付け位置順にソートする時間も増大し、強いてはコンパイル時間が長くなるという問題があった。
【0012】
本発明はこのような点にかんがみて、システム内に複数の初期値設定手段を保持し、DATA文による初期値設定の構造に依って初期値設定手段を選択出来る手段を提供することを目的とする。
【0013】
【課題を解決するための手段】
上記の課題は下記の如くに構成されたコンパイラ処理装置によって解決される。
【0014】
図1は、本発明の構成図である。即ち、
コンピュータプログラムのコンパイラ処理装置に於いて、
初期値設定を表現する文を認識する認識手段と、該文の構造を解析する解析手段と、解析の結果により前記初期値の保存法を選択する保存法選択手段と、該保存法により初期値設定を実行、出力する初期値設定手段とを備えることにより、文の構造に即した初期値の保存法が選択可能となり、作業域の節減に繋がると同時に、より高速な初期値設定が実現出来る。
【0015】
【発明の実施の形態】
以下、DATA文の初期値設定の方法について、幾つかのFORTRANプログラムの例を使用して説明して行くが、その前段として図1を基に初期値設定の全体の流れを概略説明しておく。
【0016】
先ず、同図中の認識手段10 により(ソース)プログラム中の初期値設定を表現する文、即ち初期値を格納する主メモリ上の領域を確保する「INTEGER 」などの宣言命令と、それに続いて前記確保領域に、パラメータで与えられた初期値をセットする「DATA」宣言命令とを認識する。
【0017】
この認識された宣言命令(以下、単に命令と呼ぶ)のパラメータ構造を解析手段11により解析し、解析の結果、複数の初期値保存法、即ち一括保存法と分割保存法の何れの方法に依り初期値を設定・保存するか保存法選択手段12により選択される。
【0018】
そして選択された保存法により、実際の初期値設定が初期値設定手段13により実行、出力され、目的の初期値の設定が完了するというものである。
続いて、これ等処理を具体的なプログラム例を挙げて、どの様な場合に何れの方法を選択するのが有利かを説明し、本発明の構造を示すものとする。
【0019】
図2は、具体的なプログラム例を引用するに当たり、その一般形を示したものであり、▲1▼「INTEGER 」命令の直後のパラメータでは、確保する領域の名称とその大きさ20を指定する。尚、ここでは便宜上、「INTEGER 」命令で代表して説明するが、「REAL」命令など、その他同類の宣言命令でも同様である。
【0020】
又、▲2▼「DATA」命令のパラメータは、「/ 」で区切られた二つの項目から成っており、前項目は「INTEGER 」命令で確保された領域の位置を表現するもので、第一パラメータ21と呼び、後項目は設定する初期値を表現するもので、第二パラメータ22と呼ぶこととする。
【0021】
図3のプログラム例2( 従来の技術の項で引用) は、B 領域のB(1)位置へ初期値「1 」を設定し、B(10000000) 位置へ初期値「2 」を設定するものである。これを一括保存法で初期値設定した場合には、管理ブロックは1 個であるが、初期値設定作業域のB(1)領域とB(10000000) 領域以外はムダな領域となる。又、これを分割保存法で初期値設定した場合には、管理ブロックは2 個となるが、初期値設定作業域は4 バイトの領域が2 個で済む。従ってプログラム例2のような巨大変数の場合には分割保存法で初期値設定するのが、領域上も処理速度上も得策といえる。
【0022】
図4 のプログラム例3 は、マトリックス形式で「2000×2000」の要素をとり、第一パラメータによりC(I,I)の「I 」を「1 」から「2000」まで「2 」増分(1つ置き) しながら、第二パラメータにより「1000」個の要素C(I,I)に初期値「1 」を設定するものである。これを一括保存法で初期値設定した場合には、管理ブロックは1 個であり、初期値設定作業域には1 つ置きに初期値「1 」が設定されるが、膨大な領域を必要とする。これを分割保存法で初期値設定した場合には、管理ブロック1000個に対して各々4 バイトの初期値設定作業域が必要となるが、前者に比べ必要とする領域は少なくて済む。
【0023】
この様に、巨大変数又はマトリックス形式の変数のような、経験値Nに比べて膨大な領域を必要とするプログラムに於いては、分割保存法を採用した方が有利であると言える。
【0024】
図5 のプログラム例4 は、D(20000)から成る各要素に同じ値の初期値「1 」を連続的に設定するものである。これを一括保存法で初期値設定した場合には、管理ブロックは1 個であり、初期値設定作業域には連続的に初期値「1 」が設定されるが、これを分割保存法で初期値設定した場合には、前述した分割保存法の特例とも言うべき、同じ値の初期値を連続的な割付け位置に設定する場合には管理ブロック上の「初期値の繰返し回数」欄を「20000 」までカウントアップし、管理ブロックと初期値設定作業域は新たに作成せず、それぞれ1 個の管理ブロックと初期値設定作業域で初期値設定が可能である。従って当ケースのようなプログラムでは分割保存法が有利である。
【0025】
図6 のプログラム例5 は、E(20000)の各要素順に、異なった初期値「1 」、「2 」、・・・・、「19999 」、「20000 」を設定するものである。これを一括保存法で初期値設定した場合には、管理ブロックは1 個であり、初期値設定作業域の割付け位置順にE(1)からE(20000)に、初期値「1 」から「20000 」が設定される。これを分割保存法で初期値設定した場合には、初期値の数、即ち「20000 」個の膨大な管理ブロックが必要となり、異なった初期値が経験値Mより多い場合には使用領域のみならず、管理ブロックのチェーン処理など処理時間上も一括保存法の方が有利である。
【0026】
図7 のプログラム例6 は、第一パラメータによりF(I)の「I 」を「1 」から「20000 」まで「2 」増分(1つ置き) しながら、第二パラメータにより「10000 」個の要素F(I)に初期値「1 」を設定するものである。これを一括保存法で初期値設定した場合には、管理ブロックは1 個であり、初期値設定作業域には1 つ置きに初期値「1 」が設定されが、これを分割保存法で初期値設定した場合には、管理ブロック10000 個に対して各々4 バイトの初期値設定作業域が必要となり、前者に比べ領域は大きくなる。従って、この様なDO型並び( 第一パラメータによる範囲内繰返し動作指示) の増分値指定により非連続的に初期値設定を行い、且つ初期値設定の要素個数が経験値Pより多い場合には一括保存法が有利である。
【0027】
以上、幾つかの具体的なプログラム例を挙げて、一括保存法と分割保存法による初期値設定の優劣を、主に占有する作業域の側面から説明してきたが、これ等状況を纏めたものが図8 である。同図は、前述の各プログラム例毎に「管理ブロックの数」、「管理ブロックの大きさ」、「初期値設定作業域の大きさ」、そして両者を加えた「合計作業域の大きさ」を一括保存法と分割保存法について比較した表である。尚、同表中の領域の大きさの単位はバイト数である。
【0028】
プログラム例2 、プログラム例3 は経験値Nに対して巨大変数である例であり、この様なプログラムでは分割保存法で処理するのが得策である。プログラム例4 は同じ値の初期値を連続的な割付け位置に設定するもので、同じく分割保存法で処理するのが得策である。プログラム例5 は経験値Mに対して異なった初期値の数が多いプログラムであり、この様なプログラムでは一括保存法で処理するのが得策である。次のプログラム例6 は、同一の初期値を非連続的な要素位置に設定し、且つ経験値Pに対して初期値設定の要素個数が多いプログラムであり、この様なプログラムも一括保存法で処理するのが得策である。
【0029】
以上の様に本発明の構造は、システム内に一括保存法と分割保存法の複数の初期値設定手段を保持し、DATA文による初期値設定の構造を経験値N、M、P等により解析し、適切な初期値設定手段を選択出来るように構成されている。
【0030】
続いて、これ等の処理手順について図9、図10により順次説明する。図9はソースプログラムに於ける命令の解析と、それに伴う保存法の選択に関するフローチャートであり、先ずステップ50に於いて、一括保存法選択を示すフラグを初期設定としてOFF にセットして置き、ステップ51で「INTEGER 」などの宣言命令から、変数の使用する作業域の大きさSを算出する。
【0031】
次にステップ52で、この算出されたSが、メモリに記憶された従来からの経験値Nより大きいか判別され、大きい場合には分割保存法による処理が行われ、否の場合にはステップ53で「DATA」などの宣言命令に於ける第二パラメータの内容が解読され、異なった初期値の数Xが求められる。このXが、メモリに記憶された従来からの経験値Mより大きいかステップ54で判別され、大きい場合には一括保存法による準備処理に移り、否の場合にはステップ55により、第一、第二パラメータの内容解読の結果、初期値割付け構造が増分値指定などにより不連続で、且つ初期値設定位置の要素個数が、メモリに記憶された従来からの経験値Pより大きいか判別され、大きい場合には一括保存法による準備処理に移り、否の場合には分割保存法による処理が行われる。
【0032】
前記ステップ54、ステップ55に於いて、一括保存法による準備処理に入った場合には、ステップ56で一括保存法選択を示すフラグをONにセットし、ステップ57に於いて一括保存法の管理ブロックを作成すると同時に、作業域を確保する。
【0033】
この様にして一括保存法と分割保存法の何れによる処理か選択されたら、次に各保存法による初期値設定作業が図10に示す様なフローチャートの手順に従って実行される。
【0034】
先ず、ステップ60で初期値を一つ取得し、ステップ61で一括保存法フラグがONか判別され、一括保存法の場合( フラグON) には、当該要素割り付け位置に初期値を設定した後、次の初期値処理であるステップ66に移る。一方、分割保存法の場合( フラグOFF)にはステップ62に於いて、同じ値の初期値を連続的な割付け位置に設定するプログラムであるかを判別( 既存管理ブロックの初期値と同一かを判別) し、YES の場合にはステップ64にて、管理ブロックの「初期値の繰返回数」をカウントアップして次の初期値処理であるステップ66に移る。又、否の場合にはステップ63に於いて新規管理ブロックと作業域を確保・作成し初期値設定した後、次の初期値処理であるステップ66に移る。そしてステップ66で初期値設定が終了でなければ、ステップ60へ戻り新たな初期値を取得し、同様の処理を繰り返すことにより、順次初期値を設定して行くものである。
【0035】
尚、本発明に関する説明では、プログラム言語として「FORTRAN」を例に述べてきたが、その他の言語、例えばPL/1などに於いても共有出来るものである。
【0036】
【発明の効果】
以上の説明から明らかなように本発明によれば、システム内に複数の初期値設定手段を保持し、DATA文による初期値設定の構造に依って初期値設定手段が選択出来ることにより、より少ない作業域で、しかも高速にDATA文の初期値設定が可能となり、強いてはコンパイル時間も短く出来るという著しい工業的効果がある。
【図面の簡単な説明】
【図1】 本発明の構成図
【図2】 命令の一般形の説明
【図3】 プログラム例2の保存法比較
【図4】 プログラム例3の保存法比較
【図5】 プログラム例4の保存法比較
【図6】 プログラム例5の保存法比較
【図7】 プログラム例6 の保存法比較
【図8】 各プログラム例の保存法比較表
【図9】 命令の解析と保存法選択のフローチャート
【図10】保存法の実行フローチャート
【図11】従来のDATA文の初期値出力方法( その1) 説明図
【図12】初期値出力方法( その1) の問題点
【図13】従来のDATA文の初期値出力方法( その2) 説明図
【符号の説明】
10 認識手段
11 解析手段
12 保存法選択手段
13 初期値設定手段
20 領域名と領域の大きさ
21 領域の位置( 第一パラメータ)
22 初期値( 第二パラメータ)
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a technique for converting an initial value of a DATA statement (DATA declaration instruction) of a compiler such as FORTRAN into an object program.
[0002]
[Prior art]
Conventionally, there are the following two methods for assigning initial values of DATA statements of compilers such as FORTRAN.
[0003]
The first method (hereinafter referred to as a batch saving method) will be described based on a program example 1 as shown in FIG. FIG. 1A shows a source program of an initial value setting portion by a DATA statement that is a part of the FORTRAN program as an example, and is assumed to be program example 1, but for the sake of convenience of explanation, initial values in the program examples will be hereinafter described. Are all 4 bytes with a sign.
[0004]
“INTEGER” in (1) is a declaration command for securing an integer work area (area), and “DATA” in (2) to (4) is a declaration command for setting an initial value in the work area. , “END” in {circle around (5)} indicates an end instruction of the source program.
[0005]
FIG. 2B shows the initial value setting and output process of the first program example. First, the work area shown in (1) is secured by the INTEGER instruction (1). Subsequently, initial values are set in (4) through (2) and (3) by the DATA commands (2) to (4), and all initial values are set.
[0006]
However, in this method, in the case of the program example 2 of (1) shown in FIG. 12, that is, 10,000,000 work areas are secured by the INTEGER instruction (1), and (2) and (3) A large array (variable) that sets the initial value "1" in the first element B (1) work area and the initial value "2" in the last element B (10000000) work area by the DATA instruction In this case, as shown in the initial value output result of (2), there is a problem that the area between them is wasted and it takes time to acquire the work area. Furthermore, there may be a case where the compilation fails because the work area cannot be secured. Note that, in the initial value setting by the collective storage method, although not omitted or expressed in the figure, there is a management block (described later) for managing the initial value.
[0007]
Next, as a second method (hereinafter referred to as a divided storage method), when an initial value is first given, a management block (4 bytes × 5 items = size of 20 bytes) for setting and managing the initial value is set. create. FIG. 13A shows the relationship between the contents of the management block and the initial value setting work area. The contents of the management block include “pointer to next management block” and “pointer to initial value”. , "Initial value allocation position", "Work area size", and "Initial value repeat count" are stored and retained, and the "Initial value pointer" is used to set the initial value setting work area (variable length). ). Each time an initial value is given, that is, as many management blocks as the initial value are created, these are chained by the above-mentioned “pointer to the management block” in the order of allocation positions to manage the initial values. However, when the initial values of the same value continue, the initial value can be managed by one management block only by setting the required number of “number of repetitions of the initial value” of the management block. (Program example 4)
Then, while referring to these management blocks, the object program is output in the order of the allocation position and completed.
[0008]
FIG. 13 (2) is a diagram when initial values are output by the divided storage method for the previous program example 1, and three management blocks of the number of initial values are created. The order in which the sentences appear in the sentence is sorted in the order of position), and is chained by a “management block pointer”. The initial values “1”, “2”, and “3” are chained to the initial value setting work area by “pointer to initial value”, and are set and stored.
[0009]
However, in this method, as the number of initial values increases, the number of management blocks for storing and managing the initial values increases, the work area of the management block increases, and the initial values are not given in the order of allocation positions. In such a case, the time for sorting the management blocks in the order of the allocation position also increases, which causes a problem that the compilation time becomes longer.
[0010]
As described above, the initial value setting method of the DATA statement includes the batch saving method and the divided saving method. In the batch saving method, the initial value is managed and stored in a continuous work area, and the management block is one. However, in the split storage method, each time an initial value is given, the initial value setting work area and its management block are secured and set, so the initial value is not always set to a continuous work area. The number of setting work areas and management blocks is basically plural. However, as described above, when the same initial value continues, the initial value can be managed in one management block by setting the “number of initial value repetitions” in the management block.
[0011]
[Problems to be solved by the invention]
When setting an initial value by a DATA statement, conventionally, the system (compiler) fixes whether to use the batch saving method or the divided saving method. Therefore, depending on the initial value setting structure of the DATA statement, a wasteful work area occurs, it takes time to acquire the work area, and if the number of initial values increases, the work area for the management block becomes large. In addition, in the case where the initial values are not given in the order of the allocation positions, the time for sorting the management blocks in the order of the allocation positions also increases, resulting in a problem that the compilation time becomes longer.
[0012]
In view of these points, the present invention aims to provide a means for holding a plurality of initial value setting means in the system and selecting the initial value setting means depending on the structure of the initial value setting by the DATA statement. To do.
[0013]
[Means for Solving the Problems]
The above problem is solved by a compiler processing device configured as follows.
[0014]
FIG. 1 is a block diagram of the present invention. That is,
In a computer program compiler processor,
Recognizing means for recognizing a sentence expressing initial value setting, analyzing means for analyzing the structure of the sentence, storing method selecting means for selecting a storing method of the initial value according to the result of analysis, and initial value by the storing method By providing an initial value setting means for executing and outputting settings, it is possible to select an initial value storage method according to the structure of the sentence, which leads to a reduction in work area and at the same time a faster initial value setting can be realized. .
[0015]
DETAILED DESCRIPTION OF THE INVENTION
In the following, the method for setting the initial value of the DATA statement will be described using some examples of the FORTRAN program. The entire flow of the initial value setting will be schematically described based on FIG. .
[0016]
First, a statement expressing the initial value setting in the (source) program by the recognition means 10 in the figure, that is, a declaration instruction such as “INTEGER” for securing an area in the main memory for storing the initial value, followed by It recognizes a “DATA” declaration command that sets an initial value given by a parameter in the reserved area.
[0017]
The parameter structure of the recognized declaration instruction (hereinafter simply referred to as an instruction) is analyzed by the analysis means 11, and as a result of the analysis, a plurality of initial value storage methods, that is, the batch storage method and the divided storage method are used. The initial value is set / stored or selected by the storage method selection means 12.
[0018]
Then, according to the selected storage method, the actual initial value setting is executed and output by the initial value setting means 13, and the setting of the target initial value is completed.
Subsequently, these processes will be described by giving specific program examples to explain which method is advantageous in which case and to show the structure of the present invention.
[0019]
FIG. 2 shows the general form of quoting a specific program example. (1) The name of the area to be secured and its size 20 are specified in the parameter immediately after the “INTEGER” instruction. . Here, for convenience, the “INTEGER” instruction is representatively described, but the same applies to other similar declaration instructions such as the “REAL” instruction.
[0020]
(2) The parameter of the “DATA” command consists of two items separated by “/”. The previous item expresses the position of the area secured by the “INTEGER” command. It is called a parameter 21 and the subsequent item expresses an initial value to be set and is called a second parameter 22.
[0021]
Program example 2 in Figure 3 (quoted in the prior art section) sets the initial value "1" to the B (1) position in the B area and sets the initial value "2" to the B (10000000) position. It is. If the initial value is set using the batch save method, there is one management block, but the B (1) and B (10000000) areas of the initial value setting work area are wasteful areas. In addition, when the initial value is set by the divided storage method, there are two management blocks, but the initial value setting work area only needs two 4-byte areas. Therefore, in the case of a huge variable such as program example 2, it can be said that it is a good idea to set an initial value by the divided storage method in terms of both area and processing speed.
[0022]
Program example 3 in Fig. 4 takes an element of `` 2000 x 2000 '' in matrix format, and increments `` I '' of C (I, I) from `` 1 '' to `` 2000 '' by the first parameter (1) However, the initial value “1” is set to “1000” elements C (I, I) by the second parameter. When this is set as the initial value using the batch save method, there is one control block, and an initial value of “1” is set every other initial value setting work area. To do. When the initial value is set by the divided storage method, an initial value setting work area of 4 bytes is required for each of the 1000 management blocks, but the required area is smaller than the former.
[0023]
In this way, it can be said that it is more advantageous to adopt the divided storage method for a program that requires a vast area compared to the experience value N, such as a huge variable or a matrix variable.
[0024]
Program example 4 in FIG. 5 is for continuously setting the same initial value “1” to each element consisting of D (20000). When this is set to the initial value using the batch save method, there is one control block, and the initial value setting work area is continuously set to the initial value “1”. When the value is set, it can be said that it is a special case of the above-mentioned divided storage method. When setting the initial value of the same value as the continuous allocation position, set the “Repetition number of initial value” field in the management block to “20000”. The management block and the initial value setting work area are not newly created, and the initial value can be set with one management block and the initial value setting work area. Therefore, the split storage method is advantageous for a program like this case.
[0025]
Program example 5 in FIG. 6 sets different initial values “1”, “2”,..., “19999”, “20000” in the order of each element of E (20000). If this is set to the initial value using the batch save method, there is one control block, and the initial value setting work area is assigned from E (1) to E (20000) in the order of the assigned position, and the initial value “1” to “20000”. Is set. When the initial value is set by the divided storage method, an enormous number of initial values, that is, “20000” management blocks are required. In addition, the batch storage method is more advantageous in terms of processing time such as chain processing of management blocks.
[0026]
In program example 6 in Fig. 7, "I" of F (I) is incremented from "1" to "20000" by "2" (every other) by the first parameter, and "10000" by the second parameter. An initial value “1” is set in the element F (I). If this is set to the initial value using the batch save method, there is one control block, and an initial value of “1” is set in the initial value setting work area. When the value is set, an initial value setting work area of 4 bytes is required for each 10000 management blocks, and the area becomes larger than the former. Therefore, when the initial value is set discontinuously by specifying the increment value of such a DO type array (instruction for repeated operation within the range by the first parameter) and the number of elements of the initial value setting is greater than the experience value P, The batch storage method is advantageous.
[0027]
In the above, some specific program examples have been given to explain the superiority or inferiority of the initial value setting by the batch storage method and the divided storage method, mainly from the aspect of the occupied work area. Figure 8 shows. The figure shows the “number of management blocks”, “size of management blocks”, “size of the initial value setting work area”, and “total work area size” in which both are added for each of the above program examples. Is a table comparing the batch storage method and the divided storage method. The unit of the size of the area in the table is the number of bytes.
[0028]
Program example 2 and program example 3 are examples in which the experience value N is a huge variable. In such a program, it is a good idea to perform processing by the divided storage method. Program example 4 sets the initial value of the same value as a continuous allocation position, and it is also a good idea to process it using the same division preservation method. Program example 5 is a program having a large number of different initial values with respect to the experience value M. In such a program, it is a good idea to process by the batch storage method. The following program example 6 is a program in which the same initial value is set at discontinuous element positions, and the number of elements of the initial value setting is large relative to the experience value P. Such a program is also a batch storage method. It is a good idea to handle it.
[0029]
As described above, the structure of the present invention holds a plurality of initial value setting means of the batch storage method and the divided storage method in the system, and analyzes the structure of initial value setting by the DATA statement by the experience values N, M, P, etc. In addition, an appropriate initial value setting means can be selected.
[0030]
Subsequently, these processing procedures will be sequentially described with reference to FIGS. FIG. 9 is a flowchart relating to the analysis of instructions in the source program and the selection of the storage method associated therewith. First, in step 50, the flag indicating the batch storage method selection is set to OFF as an initial setting, and the step is set. In 51, the size S of the work area used by the variable is calculated from the declaration instruction such as “INTEGER”.
[0031]
Next, in step 52, it is determined whether or not this calculated S is larger than the conventional experience value N stored in the memory. If it is larger, the processing by the divided storage method is performed, and if not, step 53 is performed. The contents of the second parameter in the declaration command such as “DATA” are decoded, and a different number X of initial values is obtained. Whether X is larger than the conventional experience value M stored in the memory is determined in step 54. If it is larger, the process proceeds to a preparatory process by the batch storage method. As a result of decoding the contents of the two parameters, it is determined whether the initial value assignment structure is discontinuous by specifying an incremental value, etc., and the number of elements at the initial value setting position is larger than the conventional experience value P stored in the memory. In some cases, the process proceeds to a preparatory process based on the batch storage method.
[0032]
If the preparatory processing by the batch storage method is entered in step 54 and step 55, the flag indicating batch storage method selection is set to ON in step 56, and the batch storage method management block in step 57 A work area is secured at the same time.
[0033]
When either the batch storage method or the divided storage method is selected in this way, the initial value setting operation by each storage method is executed according to the procedure of the flowchart as shown in FIG.
[0034]
First, one initial value is acquired in step 60, and it is determined in step 61 whether the batch storage method flag is ON. In the case of the batch storage method (flag ON), after setting an initial value in the element allocation position, The process proceeds to step 66 which is the next initial value process. On the other hand, in the case of the division saving method (flag OFF), in step 62, it is determined whether the program is a program for setting the same initial value to the continuous allocation position (whether it is the same as the initial value of the existing management block). If YES, in step 64, the “initial value repeat count” of the management block is counted up and the process proceeds to step 66 which is the next initial value process. If NO in step 63, a new management block and work area are secured and created, and initial values are set. Then, the process proceeds to step 66, which is the next initial value process. If the initial value setting is not completed in step 66, the process returns to step 60 to acquire a new initial value, and the initial value is sequentially set by repeating the same processing.
[0035]
In the description related to the present invention, “FORTRAN” is described as an example of the program language, but it can be shared in other languages such as PL / 1.
[0036]
【The invention's effect】
As is clear from the above description, according to the present invention, a plurality of initial value setting means are held in the system, and the initial value setting means can be selected according to the structure of initial value setting by the DATA statement, so that the number is smaller. In the work area, the initial value of the DATA statement can be set at high speed, and there is a remarkable industrial effect that compiling time can be shortened.
[Brief description of the drawings]
[Fig. 1] Configuration diagram of the present invention [Fig. 2] Description of general form of instruction [Fig. 3] Comparison of saving methods of program example 2 [Fig. 4] Comparison of saving methods of program example 3 [Fig. 5] Saving of program example 4 Method comparison [Fig. 6] Preservation method comparison of program example 5 [Fig. 7] Preservation method comparison of program example 6 [Fig. 8] Preservation method comparison table of each program example [Fig. 9] Flow chart of instruction analysis and selection of preservation method [Fig. Fig. 10 Flowchart of execution of storage method Fig. 11 Conventional value output method of DATA statement (Part 1) Explanatory diagram Fig. 12 Problems of initial value output method (Part 1) Fig. 13 Conventional DATA statement Initial value output method (part 2)
10 Recognition means
11 Analytical means
12 Preservation method selection method
13 Initial value setting method
20 Area name and area size
21 Area position (first parameter)
22 Initial value (second parameter)

Claims (3)

ソースプログラムに記述されたコンピュータへの指示を定義する命令文の列から、コンピュータが解釈実行できる命令語の列であるオブジェクトプログラムを生成するコンパイラ処理装置に於いて、
前記オブジェクトプログラムがコンピュータにより実行される際に使用するメモリ領域である変数領域を確保し前記確保した変数領域に初期値を設定して前記オブジェクトプログラムを出力する旨を前記コンパイラ装置に指示する宣言命令文を、前記ソースプログラムの中から検出して認識する認識手段と、
前記宣言命令文の定義に基づいて、前記変数領域に設定する1以上の初期値の設定構造を解析する解析手段と、
前記宣言命令文の定義に対応して、前記解析手段による解析結果を基に、前記変数領域に設定する1以上の初期値を一括して1個の連続した作業領域に格納して保存する一括保存法と、前記変数領域に設定する1以上の初期値に対して、1個の初期値毎に1個の管理ブロックに管理される1個の作業領域を割り当てて前記1以上の初期値を前記作業領域の各々へ分割格納して保存する分割保存法とのいずれかの保存法を、前記作業領域の総量が小さくなるように選択する保存法選択手段と、
前記宣言命令文に対応して、前記保存法選択手段により選択された保存法により前記1以上の初期値を前記作業領域に保存し、前記作業領域に保存された前記1以上の初期値を前記変数領域に設定して前記オブジェクトプログラムを出力する初期値設定手段と、
を備えたことを特徴とするコンパイラ処理装置。
In a compiler processing apparatus for generating an object program that is a sequence of instruction words that can be interpreted and executed by a computer from a sequence of command statements that define instructions to a computer described in a source program,
Declaration instruction for instructing the compiler apparatus to reserve a variable area that is a memory area used when the object program is executed by a computer, set an initial value in the reserved variable area, and output the object program Recognition means for detecting and recognizing a sentence from the source program;
Analyzing means for analyzing a setting structure of one or more initial values set in the variable area based on the definition of the declaration statement;
Corresponding to the definition of the declaration command statement, one or more initial values set in the variable area are collectively stored in one continuous work area and saved based on the analysis result by the analyzing means. For the storage method and one or more initial values set in the variable area, one work area managed by one management block is assigned to each initial value, and the one or more initial values are set. A storage method selecting means for selecting any one of the storage methods for storing the divided and stored in each of the work areas so as to reduce the total amount of the work areas;
Corresponding to the declaration statement, the one or more initial values are stored in the work area by the storage method selected by the storage method selection means, and the one or more initial values stored in the work area are stored in the work area. Initial value setting means for setting the variable area and outputting the object program;
A compiler processing apparatus characterized by comprising:
前記解析手段による前記1以上の初期値の設定構造の解析は、前記宣言命令文で定義される変数領域の大きさ、前記1以上の初期値の数、前記1以上の初期値の連続性、及び、前記変数領域に対する設定位置の数を基に行う
ことを特徴とする請求項1に記載のコンパイラ処理装置。
The analysis of the setting structure of the one or more initial values by the analyzing means includes a size of a variable area defined by the declaration statement, a number of the one or more initial values, a continuity of the one or more initial values, The compiler processing apparatus according to claim 1, wherein the compiler processing apparatus performs the processing based on the number of set positions for the variable area.
前記ソースプログラムはFORTRANプログラムであり、
前記宣言命令文は初期値指定のある型宣言文、および、DATA文である
ことを特徴とする請求項1又は請求項2に記載のコンパイラ処理装置。
The source program is a FORTRAN program;
The compiler processing apparatus according to claim 1, wherein the declaration instruction statement is a type declaration statement with an initial value specification and a DATA statement.
JP01230397A 1997-01-27 1997-01-27 Compiler processing device Expired - Lifetime JP3921722B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP01230397A JP3921722B2 (en) 1997-01-27 1997-01-27 Compiler processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP01230397A JP3921722B2 (en) 1997-01-27 1997-01-27 Compiler processing device

Publications (2)

Publication Number Publication Date
JPH10207715A JPH10207715A (en) 1998-08-07
JP3921722B2 true JP3921722B2 (en) 2007-05-30

Family

ID=11801565

Family Applications (1)

Application Number Title Priority Date Filing Date
JP01230397A Expired - Lifetime JP3921722B2 (en) 1997-01-27 1997-01-27 Compiler processing device

Country Status (1)

Country Link
JP (1) JP3921722B2 (en)

Also Published As

Publication number Publication date
JPH10207715A (en) 1998-08-07

Similar Documents

Publication Publication Date Title
US7065634B2 (en) Methods and systems for developing data flow programs
US9009690B1 (en) Code generation
EP2062175B1 (en) Hardware definition language generation for frame-based processing
US5854930A (en) System, method, and computer program product for script processing
US5920723A (en) Compiler with inter-modular procedure optimization
JP3032031B2 (en) Loop optimization method and apparatus
DE69722138T2 (en) Code optimizer for pipeline computers
US8527971B2 (en) Parallel program generation method
US7331037B2 (en) Static memory allocation in a graphical programming system
US20020083423A1 (en) List scheduling algorithm for a cycle-driven instruction scheduler
EP0428560A4 (en) Machine process for translating programs in binary machine language into another binary machine language
JPH06103463B2 (en) Code generation method
JP2006154971A (en) Program conversion apparatus, program conversion execution apparatus, program conversion method, and program conversion execution method
KR20140131200A (en) Apparatus and Method for translating multithreaded program code
JP3921722B2 (en) Compiler processing device
US5848262A (en) Simulating digital systems by using vector processing
US11556357B1 (en) Systems, media, and methods for identifying loops of or implementing loops for a unit of computation
JP3032030B2 (en) Loop optimization method and apparatus
JPS62217325A (en) Assembler code optimization method
JPH06230804A (en) Program creation device
JP2004021425A (en) Memory allocation method in compiler
US9304770B2 (en) Method and system adapted for converting software constructs into resources for implementation by a dynamically reconfigurable processor
JP3464019B2 (en) Register allocation method
Otto et al. A language-based tuning mechanism for task and pipeline parallelism
JP2001243077A (en) Method for optimally compiling application program

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20060707

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060718

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060912

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20061010

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20061122

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20070130

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20070212

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20100302

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20110302

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20110302

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20120302

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20130302

Year of fee payment: 6