JPH0619710A - Call processing method for routine in other translation unit - Google Patents

Call processing method for routine in other translation unit

Info

Publication number
JPH0619710A
JPH0619710A JP4176719A JP17671992A JPH0619710A JP H0619710 A JPH0619710 A JP H0619710A JP 4176719 A JP4176719 A JP 4176719A JP 17671992 A JP17671992 A JP 17671992A JP H0619710 A JPH0619710 A JP H0619710A
Authority
JP
Japan
Prior art keywords
address
routine
translation unit
callee
called
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.)
Withdrawn
Application number
JP4176719A
Other languages
Japanese (ja)
Inventor
Hiroko Matsui
弘子 松井
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 JP4176719A priority Critical patent/JPH0619710A/en
Publication of JPH0619710A publication Critical patent/JPH0619710A/en
Withdrawn legal-status Critical Current

Links

Landscapes

  • Executing Machine-Instructions (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

(57)【要約】 【目的】コンパイラ12が出力するオブジェクトにおける
他翻訳単位内ルーチンの呼び出し処理方法に関し,結合
編集時の処理時間を短縮するとともに,他翻訳単位内ル
ーチンの名前に対する制約を解消することを目的とす
る。 【構成】呼び出し先オブジェクト14に関する翻訳時に,
その翻訳単位内で他から呼び出されるルーチンのアドレ
スを格納するアドレスリスト15を,その翻訳単位内の領
域に作成する。呼び出し元オブジェクト13では,呼び出
し先オブジェクト14のルーチンを呼び出すときに,その
ルーチンのアドレスがアドレスリスト15中のどの位置に
あるかを分岐先指示領域16に設定した後,呼び出し先オ
ブジェクト14の先頭に分岐し,呼び出し先オブジェクト
14では,分岐先指示領域16から呼び出すルーチンのアド
レスが格納されているアドレスリスト15中の位置を得
て,そこから取り出したアドレスに分岐する。
(57) [Summary] [Objective] Regarding the processing method for calling a routine in another translation unit in the object output by the compiler 12, while shortening the processing time at the time of binding and editing, eliminating the restriction on the name of the routine in another translation unit. The purpose is to [Structure] When translating the callee object 14,
An address list 15 for storing addresses of routines called by others in the translation unit is created in an area in the translation unit. When the routine of the callee object 14 is called in the caller object 13, after setting the position of the address of the routine in the address list 15 in the branch destination indication area 16, the callee object 14 is set to the beginning of the callee object 14. Branch and call destination object
At 14, the address in the address list 15 in which the address of the routine to be called is stored is obtained from the branch destination instruction area 16, and the branch is made to the address fetched from there.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は,コンパイラが出力する
オブジェクトにおける他翻訳単位内ルーチンの呼び出し
処理方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method of calling a routine in another translation unit in an object output by a compiler.

【0002】翻訳単位が異なるプログラム中のルーチン
を外部名参照により呼び出す場合,翻訳単位の結合編集
に処理時間がかかる。このような処理時間を短縮する技
術が必要とされる。
When a routine in a program having different translation units is called by referring to an external name, it takes processing time to combine and edit the translation units. A technique for shortening such processing time is required.

【0003】[0003]

【従来の技術】図6は,従来技術の説明図である。例え
ば,図6の(イ)に示すように,呼び出し元ソースプロ
グラム10から,翻訳単位が異なる呼び出し先ソースプ
ログラム11内のルーチンを呼び出す場合,従来,図6
の(ロ)に示すような処理により,他翻訳単位内ルーチ
ンの呼び出しを可能としていた。
2. Description of the Related Art FIG. 6 is an explanatory diagram of a conventional technique. For example, as shown in FIG. 6A, when a routine in a call source program 11 having a different translation unit is called from the call source program 10, the conventional method shown in FIG.
By the process shown in (b) of, it was possible to call a routine in another translation unit.

【0004】呼び出し元ソースプログラム10に呼び出
し先ソースプログラム11のルーチンRの呼び出し文が
あると(図示(a) ),コンパイラの翻訳時に,「Rの呼
び出し文」を,「Rのアドレスへの分岐命令」に変換す
る。すなわち,オブジェクト中に,「Rのアドレスへの
分岐命令」を出力する(図示(b),(c) )。ここで,Rの
アドレスは,いわゆるV型アドレス定数で表現する。
When the calling source program 10 has a calling statement of the routine R of the called source program 11 ((a) in the figure), when the compiler is translated, the "calling statement of R" is "branched to the address of R". Convert to "instruction". That is, the "branch instruction to the address of R" is output to the object ((b) and (c) in the figure). Here, the R address is represented by a so-called V-type address constant.

【0005】これらの翻訳結果について結合編集すると
きには,(d) に示すように,(c) に示すオブジェクトの
Rのアドレスが未確定であることから,「R」のアドレ
スを他の翻訳単位(呼び出し先ソースプログラム11の
翻訳結果)から検索し,確定した時点でRのアドレスを
(c) に示すオブジェクトのV型アドレス定数領域に設定
する。これにより,(e) に示すロードモジュール中のR
のアドレスへの分岐命令における実際の分岐先アドレス
が確定する。
When these translation results are combined and edited, as shown in (d), since the R address of the object shown in (c) is undetermined, the "R" address is changed to another translation unit ( The translation result of the call source program 11) is searched and the address of R is determined when it is confirmed.
Set in the V-type address constant area of the object shown in (c). As a result, R in the load module shown in (e) is
The actual branch destination address in the branch instruction to the address is determined.

【0006】[0006]

【発明が解決しようとする課題】以上のように,自翻訳
単位から他翻訳単位内ルーチンを呼び出す場合,従来,
他翻訳単位内ルーチンの先頭アドレスをV型アドレス定
数を使用して表し,そのアドレスに分岐するような命令
にオブジェクト展開していた。
As described above, when calling a routine in another translation unit from the own translation unit, conventionally,
A V-type address constant is used to represent the start address of a routine in another translation unit, and the object is expanded into an instruction that branches to that address.

【0007】この方法によると,他翻訳単位内ルーチン
のアドレスは,自翻訳単位でなく,他の翻訳単位を検索
しないと確定しないため,結合編集時にアドレスを確定
するための処理時間が長くかかるという問題があった。
また,他翻訳単位内ルーチンの名前を外部名として扱う
必要があるため,他翻訳単位内ルーチンの名前が他と重
複しないようにしなければならず,名前の付け方に制約
が生じるという問題があった。
According to this method, the address of the routine in the other translation unit is not the self translation unit and cannot be determined unless the other translation unit is searched. Therefore, it takes a long processing time to determine the address at the time of combined editing. There was a problem.
Also, since the name of the routine in another translation unit must be treated as an external name, the name of the routine in another translation unit must be unique and there is a problem in how to name it. .

【0008】本発明は上記問題点の解決を図り,結合編
集時における処理を高速化し,かつ他翻訳単位内ルーチ
ンの名前の付け方の制約を解消することを目的としてい
る。
An object of the present invention is to solve the above problems, to speed up the processing at the time of combining and editing, and to eliminate the restriction on how to name routines in other translation units.

【0009】[0009]

【課題を解決するための手段】図1は本発明の原理説明
図である。図中,10は呼び出し元ソースプログラムで
あって,呼び出し元のルーチンが存在する翻訳単位,1
1は呼び出し先ソースプログラムであって,呼び出し先
のルーチンが存在する翻訳単位,12はソースプログラ
ムをオブジェクトプログラムに翻訳するコンパイラ,1
3は呼び出し元ソースプログラム10を翻訳した呼び出
し元オブジェクト,14は呼び出し先ソースプログラム
11を翻訳した呼び出し先オブジェクト,15は呼び出
し先ルーチンのアドレスが格納されたアドレスリスト,
16は分岐先指示領域を表す。
FIG. 1 is a diagram for explaining the principle of the present invention. In the figure, 10 is a caller source program, and a translation unit in which the caller's routine exists, 1
Reference numeral 1 is a callee source program, a translation unit in which a callee routine exists, 12 is a compiler that translates the source program into an object program, 1
Reference numeral 3 is a caller object that is a translation of the caller source program 10, 14 is a callee object that is a translation of the callee source program 11, 15 is an address list in which the addresses of the callee routines are stored,
Reference numeral 16 represents a branch destination instruction area.

【0010】本発明では,結合編集時において,呼び出
し先である他翻訳単位内ルーチンの名前を検索してアド
レスを確定する処理時間を短縮するため,呼び出し元ソ
ースプログラム10,呼び出し先ソースプログラム11
を次のように翻訳する。
According to the present invention, in order to shorten the processing time for retrieving the name of the routine in the other translation unit which is the callee and fixing the address at the time of linking and editing, the caller source program 10, the callee source program 11
Is translated as follows.

【0011】呼び出し先ソースプログラム11の翻訳時
に,その翻訳単位内で他から呼び出されるルーチンR
1,R2,…のアドレスを格納するアドレスリスト15
を,その翻訳単位内の領域に作成する。
When the source program 11 to be called is translated, a routine R that is called from another in the translation unit
Address list 15 for storing addresses of 1, R2, ...
In the area within the translation unit.

【0012】そして,呼び出し元ソースプログラム10
を翻訳した呼び出し元オブジェクト13には,呼び出し
先オブジェクト14のルーチンを呼び出すときに,その
ルーチンのアドレスがアドレスリスト15中のどの位置
にあるかを,所定の分岐先指示領域16に設定する命令
と,呼び出し先オブジェクト14の先頭番地または先頭
からの所定番地に分岐する命令を組み込む。
The calling source program 10
In the caller object 13 that has translated the above, when calling the routine of the callee object 14, an instruction for setting the position of the address of the routine in the address list 15 in a predetermined branch destination instruction area 16 , An instruction for branching to the head address of the callee object 14 or a predetermined address from the head is incorporated.

【0013】呼び出し先オブジェクト14には,先頭番
地または先頭からの所定番地に,分岐先指示領域16か
らアドレスリスト15中の位置を取り出す命令と,その
アドレスリスト15中の位置から分岐先アドレスを取り
出して,呼び出し先ルーチンへ分岐する命令を組み込
む。
In the callee object 14, an instruction for fetching a position in the address list 15 from the branch designation area 16 at a head address or a predetermined address from the head and a branch destination address from the position in the address list 15 are fetched. And incorporate an instruction to branch to the called routine.

【0014】呼び出し時の処理は,例えば次のようにな
る。 呼び出し元オブジェクト13では,呼び出し先ルー
チンのアドレスが,アドレスリスト15中のどこにある
かを,分岐先指示領域16に設定する。なお,複数の呼
び出し先ルーチンのアドレスをアドレスリスト15内に
どのような順序で配置するかは,あらかじめ設計時に決
めておく。分岐先指示領域16として,所定のレジスタ
やスタック領域等を用いることができる。
The processing at the time of calling is as follows, for example. In the call-source object 13, the address of the call-destination routine is set in the branch-destination designation area 16 in the address list 15. The order in which the addresses of a plurality of callee routines are arranged in the address list 15 is determined in advance at the time of design. A predetermined register, a stack area, or the like can be used as the branch destination instruction area 16.

【0015】 次に,呼び出し先オブジェクト14の
先頭(または先頭からの所定番地)に分岐する。すなわ
ち,ルーチンR1を呼び出す場合でも,ルーチンR2を
呼び出す場合でも,共通に呼び出し先オブジェクト14
の先頭に分岐する。
Next, the callee object 14 branches to the head (or a predetermined address from the head). That is, whether the routine R1 or the routine R2 is called, the callee object 14 is commonly used.
Branch to the beginning of.

【0016】 呼び出し先オブジェクト14の先頭で
は,分岐先指示領域16を参照して,呼び出し先ルーチ
ンのアドレスが格納されているアドレスリスト15中の
位置を得る。
At the head of the callee object 14, the branch destination instruction area 16 is referenced to obtain the position in the address list 15 in which the address of the callee routine is stored.

【0017】 処理で得た情報をもとに,呼び出し
先ルーチンのアドレスを,アドレスリスト15から取り
出す。 処理で取り出したアドレスに分岐する。
The address of the called routine is fetched from the address list 15 based on the information obtained by the processing. Branch to the address fetched in the process.

【0018】[0018]

【作用】以上のような呼び出し処理方法を用いることに
より,他翻訳単位内(呼び出し先オブジェクト14内)
のルーチンを呼び出す場合,V型アドレス定数を使って
分岐する必要がなくなる。この結果,アドレスを解決す
るために他の翻訳単位を検索する必要がなくなり,ま
た,各ルーチンの名前を外部名として扱う必要もなくな
る。
[Operation] By using the above call processing method, in another translation unit (in the callee object 14)
When calling this routine, it is not necessary to branch using the V-type address constant. As a result, it is no longer necessary to look up other translation units to resolve the address, nor is it necessary to treat the name of each routine as an external name.

【0019】[0019]

【実施例】図2は本発明の実施例を説明するためのソー
スプログラムの例,図3は呼び出し先オブジェクトの構
造の例,図4は本発明の実施例による呼び出し処理説明
図,図5は本発明の実施例の動作説明図を示す。
FIG. 2 is an example of a source program for explaining the embodiment of the present invention, FIG. 3 is an example of the structure of a callee object, FIG. The operation | movement explanatory drawing of the Example of this invention is shown.

【0020】図2の(イ)に示す翻訳単位UNIT1
は,(a) の呼び出し元プログラムと,(b) の他翻訳単位
(UNIT2)の情報からなる。図2の(ロ)に示す翻
訳単位UNIT2は,呼び出し先ソースプログラム11
であって,呼び出される各ルーチンR1,R2,…の集
まりである。
The translation unit UNIT1 shown in FIG.
Consists of the calling program of (a) and the information of the other translation unit (UNIT2) of (b). The translation unit UNIT2 shown in (B) of FIG.
And is a collection of called routines R1, R2, ....

【0021】翻訳単位UNIT2中にR1,R2,R3
の三つのルーチンがあるとすると,それを翻訳した結果
は,図3に示すような構造になる。呼び出し先オブジェ
クト14の先頭部分に,実際に呼び出すルーチンへの分
岐命令等が用意される。また,各ルーチンR1,R2,
R3のアドレスが格納されたアドレスリスト15が設け
られる。
R1, R2, R3 in the translation unit UNIT2
If there are three routines, the result of translating them will be the structure shown in FIG. At the beginning of the callee object 14, a branch instruction to a routine to be called is prepared. In addition, each routine R1, R2
An address list 15 in which the address of R3 is stored is provided.

【0022】翻訳単位UNIT1から,他の翻訳単位U
NIT2中にあるルーチンR2を呼び出す場合を例にと
って説明する。翻訳単位UNIT1および翻訳単位UN
IT2における処理および動作は,図4および図5に示
す〜のようになる。
From the translation unit UNIT1, another translation unit U
The case of calling the routine R2 in NIT2 will be described as an example. Translation unit UNIT1 and translation unit UN
The processing and operation in IT2 are as shown in FIGS. 4 and 5.

【0023】 ルーチンR2のアドレスが格納されて
いるアドレスリスト15の先頭からの変位「4」を,分
岐先指示領域16(以下,領域Xという)に設定する。
領域Xは,UNIT1からもUNIT2からも参照でき
る領域である。
The displacement “4” from the beginning of the address list 15 in which the address of the routine R2 is stored is set in the branch destination designation area 16 (hereinafter referred to as area X).
The area X is an area that can be referred to from both UNIT1 and UNIT2.

【0024】 UNIT2の先頭へ分岐する。 UNIT2の先頭部分で,まず領域Xを参照して,
ルーチンR2のアドレスが格納してあるアドレスリスト
15内変位「4」を得る。そして,アドレスリスト15
の(先頭+4バイト)目に格納されている値「R2のア
ドレス」を取り出す。
Branch to the beginning of UNIT2. At the beginning of UNIT2, first refer to area X,
The displacement "4" in the address list 15 in which the address of the routine R2 is stored is obtained. And address list 15
The value "address of R2" stored in the (first + 4 bytes) of is extracted.

【0025】 処理で取り出したR2のアドレスへ
分岐する。同様に,上記処理で領域Xに設定する値が
「0」であれば,ルーチンR1が呼び出され,「8」で
あれば,ルーチンR3が呼び出されることになる。
It branches to the address of R2 taken out in the process. Similarly, if the value set in the area X in the above processing is "0", the routine R1 is called, and if it is "8", the routine R3 is called.

【0026】[0026]

【発明の効果】以上説明したように,本発明によれば,
結合編集時に他の翻訳単位を検索してアドレス解決をす
る必要がなくなるため,処理時間が短縮され,かつ外部
から呼び出されるルーチンの名前に対する制約もなくな
る。
As described above, according to the present invention,
Since it is not necessary to search for another translation unit to perform address resolution at the time of binding and editing, processing time is shortened, and there is no restriction on the name of a routine called from outside.

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

【図1】本発明の原理説明図である。FIG. 1 is a diagram illustrating the principle of the present invention.

【図2】本発明の実施例を説明するためのソースプログ
ラムの例を示す図である。
FIG. 2 is a diagram showing an example of a source program for explaining an embodiment of the present invention.

【図3】本発明の実施例に係る呼び出し先オブジェクト
の構造の例を示す図である。
FIG. 3 is a diagram showing an example of a structure of a callee object according to the embodiment of the present invention.

【図4】本発明の実施例による呼び出し処理説明図であ
る。
FIG. 4 is an explanatory diagram of a calling process according to the embodiment of the present invention.

【図5】本発明の実施例の動作説明図である。FIG. 5 is an operation explanatory diagram of the embodiment of the present invention.

【図6】従来技術の説明図である。FIG. 6 is an explanatory diagram of a conventional technique.

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

10 呼び出し元ソースプログラム 11 呼び出し先ソースプログラム 12 コンパイラ 13 呼び出し元オブジェクト 14 呼び出し先オブジェクト 15 アドレスリスト 16 分岐先指示領域 10 Caller Source Program 11 Callee Source Program 12 Compiler 13 Caller Object 14 Callee Object 15 Address List 16 Branch Destination Instruction Area

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 コンパイラ(12)が出力するオブジェクト
における他翻訳単位内ルーチンの呼び出し処理方法にお
いて,呼び出し先翻訳単位(14)の翻訳時に,その翻訳単
位内で他から呼び出されるルーチンのアドレスを格納す
るアドレスリスト(15)を,その翻訳単位内の領域に作成
し,呼び出し元翻訳単位(13)では,呼び出し先翻訳単位
(14)のルーチンを呼び出すときに,そのルーチンのアド
レスが前記アドレスリスト(15)中のどの位置にあるかを
所定の領域(16)に設定した後,呼び出し先翻訳単位(14)
の先頭番地または先頭からの所定番地に分岐し,呼び出
し先翻訳単位(14)では,前記所定の領域(16)から呼び出
すルーチンのアドレスが格納されているアドレスリスト
(15)中の位置を得て,そこから取り出したアドレスに分
岐することを特徴とする他翻訳単位内ルーチンの呼び出
し処理方法。
1. A method for processing a call of a routine in another translation unit in an object output by a compiler (12), storing an address of a routine called from another in the translation unit at the time of translation of a callee translation unit (14). The address list (15) to be created is created in the area within the translation unit, and the caller translation unit (13) is called in the callee translation unit.
When calling the routine of (14), after setting the position of the address of the routine in the address list (15) in a predetermined area (16), the called translation unit (14)
Address list that stores the address of the routine called from the predetermined area (16) in the callee translation unit (14) by branching to the first address or a predetermined address from the beginning
(15) A method of calling a routine in another translation unit, characterized in that the position in (15) is obtained and the address is branched to the address fetched from it.
JP4176719A 1992-07-03 1992-07-03 Call processing method for routine in other translation unit Withdrawn JPH0619710A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4176719A JPH0619710A (en) 1992-07-03 1992-07-03 Call processing method for routine in other translation unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4176719A JPH0619710A (en) 1992-07-03 1992-07-03 Call processing method for routine in other translation unit

Publications (1)

Publication Number Publication Date
JPH0619710A true JPH0619710A (en) 1994-01-28

Family

ID=16018581

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4176719A Withdrawn JPH0619710A (en) 1992-07-03 1992-07-03 Call processing method for routine in other translation unit

Country Status (1)

Country Link
JP (1) JPH0619710A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6177100B1 (en) 1988-12-02 2001-01-23 L'oreal Cosmetic or pharmaceutical composition for the treatment of the hair and scalp

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6177100B1 (en) 1988-12-02 2001-01-23 L'oreal Cosmetic or pharmaceutical composition for the treatment of the hair and scalp

Similar Documents

Publication Publication Date Title
JPH06149589A (en) Reference target variable determination processing method and translation processing system
JPH086797A (en) Constant reference optimization processor
JPH11327887A (en) Compiler system with automatic parts converting function and recording medium
JP2670276B2 (en) Character reader
JP2577626B2 (en) Program conversion device
JP2692141B2 (en) Sequence controller
JP2001125793A (en) Compiler system, compile method and recording medium
JPH08329095A (en) Data retrieval system for relational data base
JPH01231137A (en) Trace information output system
JPH01258029A (en) Data processor
JPH04116756A (en) Dynamic link system for user definition command in application
JPH05324715A (en) Machine translation processor
JPH05250210A (en) Program trace system
JPH1124939A (en) Program conversion method
JPH01231136A (en) Trace information output system
JPH01166134A (en) Cross reference list output system
JPH0359726A (en) Program unit batch translation system
JPS62196706A (en) Method for searching sequence number at high speed
JPH08234995A (en) Program converter
JPH06332683A (en) Table link device
JPS63280328A (en) Control method for data with multiple names
JPH01293438A (en) Overlay segment information output system
JPH05313967A (en) Record editing method
JPH0675757A (en) Virtual space resident program link method
JPH06274351A (en) Optimizing system for compiler

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 19991005