JP3520966B2 - Information processing equipment - Google Patents

Information processing equipment

Info

Publication number
JP3520966B2
JP3520966B2 JP26444098A JP26444098A JP3520966B2 JP 3520966 B2 JP3520966 B2 JP 3520966B2 JP 26444098 A JP26444098 A JP 26444098A JP 26444098 A JP26444098 A JP 26444098A JP 3520966 B2 JP3520966 B2 JP 3520966B2
Authority
JP
Japan
Prior art keywords
function
instance
address
register
start address
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
JP26444098A
Other languages
Japanese (ja)
Other versions
JP2000099331A (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.)
Fuji Electric FA Components and Systems Co Ltd
Original Assignee
Fuji Electric FA Components and Systems Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fuji Electric FA Components and Systems Co Ltd filed Critical Fuji Electric FA Components and Systems Co Ltd
Priority to JP26444098A priority Critical patent/JP3520966B2/en
Publication of JP2000099331A publication Critical patent/JP2000099331A/en
Application granted granted Critical
Publication of JP3520966B2 publication Critical patent/JP3520966B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は情報処理装置に関
し、特に、インスタンスを持つ関数の呼び出し方式に適
用して好適なものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an information processing apparatus, and is particularly suitable for application to a function calling system having an instance.

【0002】[0002]

【従来の技術】従来のシーケンサやマイクロコンピュー
タなどの演算制御装置には、インスタンスを持った関数
の処理が可能な言語体系で記述されたプログラムで動作
するものがある。このような言語体系として、例えば、
「IEC1131−3」で規定されているコントローラ
用の言語があり、この中のファンクションブロック(F
B)がインスタンスメモリを持った関数に相当する。
2. Description of the Related Art Some conventional operation control devices such as sequencers and microcomputers operate with a program written in a language system capable of processing a function having an instance. As such a language system, for example,
There is a controller language defined in "IEC1131-3", and the function block (F
B) corresponds to a function having an instance memory.

【0003】図5は、従来の関数呼び出し方法を示すマ
シン語展開例である。ここで、関数funcA及び関数
funcBは、それぞれ独自のインスタンスを持ってい
るものとする。インスタンスとは、関数が実行する時に
固定で持つメモリ領域であり、前回の処理値などが格納
される。なお、同じ関数であっても、その関数をコール
する位置が異なれば、インスタンスの格納位置も異な
る。
FIG. 5 is an example of machine language expansion showing a conventional function calling method. Here, it is assumed that the function funcA and the function funcB each have their own instance. An instance is a memory area that is fixed when the function executes, and stores the previous processing value. It should be noted that even if the same function is used, if the position where the function is called is different, the storage position of the instance also differs.

【0004】図5において、メイン関数MAINは、関
数funcAを呼び出す場合、関数funcAのインス
タンス先頭アドレスをプロセッサ内のアドレスレジスタ
にセットし、関数funcAを呼び出す。次に、関数f
uncAが関数funcBを呼び出す場合、関数fun
cAのインスタンス先頭アドレスがプロセッサ内のアド
レスレジスタにセットされているため、関数funcA
のインスタンス先頭アドレスをスタックに退避させてか
ら()、関数funcBのインスタンス先頭アドレス
をプロセッサ内のアドレスレジスタにセットし()、
関数funcBを呼び出す。次に、関数funcBの処
理が終了し、関数funcAの処理に戻る場合、関数f
uncAのインスタンス先頭アドレスがプロセッサ内の
アドレスレジスタにセットされている必要がある。この
ため、スタックに退避させていた関数funcAのイン
スタンス先頭アドレスをプロセッサ内のアドレスレジス
タにセットし()、関数funcAの処理に戻る。
In FIG. 5, when calling the function funcA, the main function MAIN sets the instance start address of the function funcA in an address register in the processor and calls the function funcA. Then the function f
If uncA calls the function funcB, the function fun
Since the instance start address of cA is set in the address register in the processor, the function funcA
After saving the instance start address of () to the stack (), set the instance start address of the function funcB to the address register in the processor (),
Call the function funcB. Next, when the processing of the function funcB ends and the processing of the function funcA returns, the function f
The instance start address of uncA must be set in the address register in the processor. Therefore, the instance start address of the function funcA saved in the stack is set in the address register in the processor (), and the process returns to the function funcA.

【0005】図6は、同一の関数を複数箇所で呼び出す
場合の従来の関数呼び出し方法を示すマシン語展開例で
ある。図6の例では、メイン関数MAINは関数fun
cAを2箇所で呼び出しており、関数funcAのメイ
ン関数MAINで呼ばれる位置が異なると、関数fun
cAのインスタンスの格納位置も異なる。このため、関
数funcA1及び関数funcA2の2つのオブジェ
クトが生成されている。
FIG. 6 is an example of machine language expansion showing a conventional function calling method when the same function is called at a plurality of points. In the example of FIG. 6, the main function MAIN is the function fun.
If cA is called at two places and the position called by the main function MAIN of the function funcA is different, the function fun
The storage location of the cA instance is also different. Therefore, two objects of the function funcA1 and the function funcA2 are generated.

【0006】図6において、メイン関数MAINは、L
1の位置で関数funcAを呼び出す場合、関数fun
cA1のインスタンス先頭アドレスをプロセッサ内のア
ドレスレジスタにセットし、関数funcA1を呼び出
す。次に、関数funcA1が関数funcBを呼び出
す場合、関数funcA1のインスタンス先頭アドレス
がプロセッサ内のアドレスレジスタにセットされている
ため、関数funcA1のインスタンス先頭アドレスを
スタックに退避させてから、関数funcB1のインス
タンス先頭アドレスをプロセッサ内のアドレスレジスタ
にセットし、関数funcBを呼び出す。次に、関数f
uncBの処理が終了し、関数funcA1の処理に戻
る場合、関数funcA1のインスタンス先頭アドレス
がプロセッサ内のアドレスレジスタにセットされている
必要がある。このため、スタックに退避させていた関数
funcA1のインスタンス先頭アドレスをプロセッサ
内のアドレスレジスタにセットし、関数funcAの処
理に戻る。
In FIG. 6, the main function MAIN is L
When calling the function funcA at the position of 1, the function func
The instance start address of cA1 is set in the address register in the processor, and the function funcA1 is called. Next, when the function funcA1 calls the function funcB, the instance start address of the function funcA1 is saved in the stack because the instance start address of the function funcA1 is set in the address register in the processor, and then the instance start address of the function funcB1 is saved. The address is set in the address register in the processor and the function funcB is called. Then the function f
When the processing of uncB is completed and the processing returns to the processing of the function funcA1, the instance start address of the function funcA1 needs to be set in the address register in the processor. Therefore, the instance start address of the function funcA1 saved on the stack is set in the address register in the processor, and the process returns to the function funcA.

【0007】次に、メイン関数MAINは、L2の位置
で関数funcAを呼び出す場合、関数funcA2の
インスタンス先頭アドレスをプロセッサ内のアドレスレ
ジスタにセットし、関数funcA2を呼び出す。次
に、関数funcA2が関数funcBを呼び出す場
合、関数funcA2のインスタンス先頭アドレスがプ
ロセッサ内のアドレスレジスタにセットされているた
め、関数funcA2のインスタンス先頭アドレスをス
タックに退避させてから、関数funcB2のインスタ
ンス先頭アドレスをプロセッサ内のアドレスレジスタに
セットし、関数funcBを呼び出す。次に、関数fu
ncBの処理が終了し、関数funcA2の処理に戻る
場合、関数funcA2のインスタンス先頭アドレスが
プロセッサ内のアドレスレジスタにセットされている必
要がある。このため、スタックに退避させていた関数f
uncA2のインスタンス先頭アドレスをプロセッサ内
のアドレスレジスタにセットし、関数funcAの処理
に戻る。
Next, when calling the function funcA at the position of L2, the main function MAIN sets the instance start address of the function funcA2 in the address register in the processor and calls the function funcA2. Next, when the function funcA2 calls the function funcB, the instance start address of the function funcA2 is saved in the stack because the instance start address of the function funcA2 is set in the address register in the processor, and then the instance start address of the function funcB2 is saved. The address is set in the address register in the processor and the function funcB is called. Then the function fu
When the process of ncB ends and the process returns to the process of the function funcA2, the instance start address of the function funcA2 needs to be set in the address register in the processor. Therefore, the function f saved in the stack
The instance start address of uncA2 is set in the address register in the processor, and the process returns to the function funcA.

【0008】[0008]

【発明が解決しようとする課題】しかしながら、図5の
関数呼び出し方法では、インスタンスを持つ関数fun
cAからインスタンスを持つ関数funcBを呼び出す
場合、関数funcAのインスタンス先頭アドレスをア
ドレスレジスタのスタックに退避させ、関数funcB
のインスタンス先頭アドレスをアドレスレジスタにセッ
トさせる必要があるとともに、関数funcAの処理に
戻る場合には、関数funcAのインスタンス先頭アド
レスをアドレスレジスタに再びセットさせる必要があ
り、これらの処理を実行するプログラムが複雑になると
いう問題があった。
However, in the function calling method shown in FIG. 5, the function fun having an instance is used.
When calling the function funcB having an instance from cA, the instance start address of the function funcA is saved in the stack of the address register, and the function funcB is saved.
The instance start address of the function funcA needs to be set in the address register, and when returning to the process of the function funcA, the instance start address of the function funcA needs to be set again in the address register, and the program that executes these processes is There was a problem that it became complicated.

【0009】また、図6の関数呼び出し方法では、関数
funcAが複数箇所で使用されている場合、関数fu
ncAは各呼び出し位置ごとに別々のインスタンスを持
ち、関数funcAから呼び出される関数funcBも
各関数funcAごとに独自のインスタンスを持つ。こ
のため、同一の関数funcAを呼び出す場合において
も、関数funcAの呼ばれている個数分のオブジェク
トを生成し、それぞれの関数funcAが呼び出す関数
funcBのインスタンス先頭アドレスをアドレスレジ
スタにセットするマシン語を生成する必要があるという
問題があった。
Further, in the function calling method of FIG. 6, when the function funcA is used at a plurality of places, the function fu
ncA has a separate instance for each call position, and the function funcB called from the function funcA also has its own instance for each function funcA. Therefore, even if the same function funcA is called, a machine word is generated that sets the number of objects of the function funcA called and sets the instance start address of the function funcB called by each function funcA in the address register. There was a problem that I had to do.

【0010】そこで、本発明の目的は、インスタンスを
持つ関数の呼び出しプログラムを簡略化することが可能
な情報処理装置を提供することである。
Therefore, an object of the present invention is to provide an information processing apparatus capable of simplifying a program for calling a function having an instance.

【0011】[0011]

【課題を解決するための手段】上述した課題を解決する
ために、本発明によれば、 インスタンスを持つ関数の
処理を行う情報処理装置において、スタックを有するア
ドレスレジスタと、第1の1マシン語命令で、第1の関
数の呼び出し位置によるインスタンスの先頭アドレスを
前記スタックに退避させ、第2の関数の呼び出し位置に
よるインスタンスの先頭アドレスを前記アドレスレジス
タに設定する手段と、第2の1マシン語命令で、前記第
1の関数の呼び出し位置によるインスタンスの先頭アド
レスを前記スタックから取り出し、前記アドレスレジス
タに設定する手段と、前記第1の関数の中で、前記第1
の1マシン語命令で前記アドレスレジスタに設定した前
記第2の関数の呼び出し位置によるインスタンスの先頭
アドレスと呼び出し命令で、前記第2の関数と前記第2
の関数の呼び出し位置によるインスタンスを呼び出す手
段を備えている。
In order to solve the above-mentioned problems, according to the present invention, in an information processing apparatus for processing a function having an instance, an information processing apparatus having a stack is provided.
The first register with the dress register and the first one machine language instruction.
The start address of the instance depending on the call position of the number
Saved on the stack and set it to the calling position of the second function.
The start address of the instance according to the address register
And a second one machine language instruction,
First add of instance depending on the call position of function 1
Of the address register from the stack
In the first function among the means for setting
Before setting in the address register with one machine language instruction
The beginning of the instance depending on the call position of the second function
The second function and the second
Of calling an instance depending on the call position of the function
Equipped with steps.

【0012】このことにより、インスタンスを持つ関数
の呼び出しプログラムを簡略化することが可能となると
ともに、これらの命令をハードウェアで直接実行するこ
とにより、インスタンスを持つ関数の呼び出し処理を高
速に実行することが可能となる。
As a result, it becomes possible to simplify the program for calling the function having the instance, and by executing these instructions directly in the hardware, the calling process of the function having the instance is executed at high speed. It becomes possible.

【0013】また、本発明の一態様によれば、前記第2
の関数の呼び出し位置によるインスタンスの先頭アドレ
スを前記第1の関数の呼び出し位置によるインスタンス
に設定する手段を備えることを特徴とする。これらの
とにより、同一の関数を複数の箇所で使用する場合にお
いても、その関数のオブジェクトを各箇所ごとに個別に
生成する必要がなくなり、インスタンスを持つ関数の呼
び出し処理を効率的に行うことが可能となる。
According to one aspect of the present invention, the second
Address of the instance depending on the call position of the function
Instance according to the call position of the first function
It is characterized by comprising means for setting to. With these features, even if the same function is used at multiple points, it is not necessary to individually generate the object of the function at each point, which makes it efficient to call a function that has an instance. It becomes possible to do it.

【0014】[0014]

【発明の実施の形態】以下、本発明の一実施例に係わる
情報処理装置について図面を参照しながら説明する。図
1は、本発明の一実施例に係わる情報処理装置の構成を
示すブロック図である。図1において、CPU1には、
フェッチ制御部5、データメモリアクセス制御部6及び
演算実行部8が設けられ、データメモリアクセス制御部
6には、スタック構造を持つアドレスレジスタ部7が設
けられている。
DETAILED DESCRIPTION OF THE INVENTION An information processing apparatus according to an embodiment of the present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing the configuration of an information processing apparatus according to an embodiment of the present invention. In FIG. 1, the CPU 1 has
A fetch control unit 5, a data memory access control unit 6, and an operation execution unit 8 are provided, and the data memory access control unit 6 is provided with an address register unit 7 having a stack structure.

【0015】データメモリ3にはインスタンスメモリ4
が設けられ、関数のインスタンスは、インスタンスメモ
リ4にマッピングされる。なお、同じ関数であっても、
その関数のコールする位置が異なれば、インスタンスの
格納位置も異なる。
The data memory 3 includes an instance memory 4
Is provided, and the instance of the function is mapped in the instance memory 4. In addition, even if it is the same function,
If the call position of the function is different, the storage position of the instance is also different.

【0016】フェッチ制御部5は、プログラムメモリ2
から命令を取り出し、演算実行部8に供給する。データ
メモリアクセス制御部6は、データメモリ3からデータ
を取り出し、演算実行部8に供給する。
The fetch control unit 5 includes a program memory 2
The instruction is fetched from and is supplied to the operation execution unit 8. The data memory access control unit 6 takes out the data from the data memory 3 and supplies it to the operation executing unit 8.

【0017】演算実行部8は、フェッチ制御部5から送
られた命令に従って、データメモリアクセス制御部6か
ら送られたデータを処理する。関数をコールする場合、
その関数のインスタンスメモリ4の先頭アドレスをアド
レスレジスタ部7にセットし、その関数内でインスタン
スメモリ4にアクセスする時は、アドレスレジスタ部7
をベースレジスタとしてインスタンスメモリ4にアクセ
スする。
The operation execution unit 8 processes the data sent from the data memory access control unit 6 according to the instruction sent from the fetch control unit 5. When calling a function,
The start address of the instance memory 4 of the function is set in the address register unit 7, and when accessing the instance memory 4 in the function, the address register unit 7
Is used as a base register to access the instance memory 4.

【0018】また、関数Aから関数Bが呼ばれる場合、
関数Aのインスタンス4aの先頭アドレスをアドレスレ
ジスタ部7のスタックに退避させ、関数Bのインスタン
ス4bの先頭アドレスをアドレスレジスタ部7に設定す
る。そして、関数Bから関数Aに復帰する時に、関数A
のインスタンス4aの先頭アドレスをアドレスレジスタ
部7のスタックから取り出し、関数Aのインスタンス4
aの先頭アドレスをアドレスレジスタ部7に書き戻す。
When function B is called from function A,
The start address of the instance 4a of the function A is saved in the stack of the address register unit 7, and the start address of the instance 4b of the function B is set in the address register unit 7. When the function B returns to the function A, the function A
The instance 4a of the function A is fetched from the stack of the address register unit 7
The head address of a is written back to the address register unit 7.

【0019】また、プログラムの起動時の前処理とし
て、関数Aから呼ばれる関数Bのインスタンス4bの領
域の先頭アドレスを、関数Aのインスタンス4aの領域
に予めセットしておく。
Further, as a pre-process at the time of starting the program, the start address of the area of the instance 4b of the function B called from the function A is set in advance in the area of the instance 4a of the function A.

【0020】図2は、本発明の一実施例に係わる関数呼
び出し方法を示すプログラム例及びインスタンスメモリ
の内容を示す図である。図2において、メイン関数ma
inのの位置で関数funcAを呼び出すために、P
USH_IS100命令が使用されている。また、メイ
ン関数mainのの位置で関数funcAを呼び出す
ために、PUSH_IS140命令が使用されている。
関数funcAでは、関数funcAから関数func
Bを呼び出すために、PUSH_IS(IS+0)命令
が使用されている。関数funcBでは、関数func
Bから関数funcAに復帰するために、POP_IS
命令が使用されている。
FIG. 2 is a diagram showing an example of a program showing a function calling method according to an embodiment of the present invention and contents of an instance memory. In FIG. 2, the main function ma
In order to call the function funcA at the position of in, P
The USH_IS100 instruction is used. Further, the PUSH_IS140 instruction is used to call the function funcA at the position of the main function main.
In the function funcA, the functions funcA to func
A PUSH_IS (IS + 0) instruction is used to call B. In the function funcB, the function func
In order to return from B to the function funcA, POP_IS
The instruction is being used.

【0021】また、の位置で呼ばれる関数funcA
のインスタンスメモリ4の領域として、データメモリ3
の100〜119番地が割り当てられ、の位置の関数
funcAから呼ばれる関数funcBのインスタンス
メモリ4の領域として、データメモリ3の120〜13
9番地が割り当てられ、の位置で呼ばれる関数fun
cAのインスタンスメモリ4の領域として、データメモ
リ3の140〜159番地が割り当てられ、の位置の
関数funcAから呼ばれる関数funcBのインスタ
ンスメモリ4の領域として、データメモリ3の160〜
179番地が割り当てられている。
The function funcA called at the position of
Data memory 3 as an area of the instance memory 4 of
Nos. 100 to 119 are allocated, and 120 to 13 of the data memory 3 are set as the area of the instance memory 4 of the function funcB called from the function funcA at the position of
Function fun is assigned at address 9 and is called at position
The addresses 140 to 159 of the data memory 3 are allocated as the area of the instance memory 4 of cA, and the area of the instance memory 4 of the function funcB called from the function funcA at the position of 160 to 159 of the data memory 3 is allocated.
Address 179 is assigned.

【0022】ここで、の位置で呼ばれる関数func
Aのインスタンスメモリ4の領域(100番地)には、
の位置の関数funcAから呼ばれる関数funcB
のインスタンスメモリ4の領域の先頭アドレス(120
番地)を格納し、の位置で呼ばれる関数funcAの
インスタンスメモリ4の領域(140番地)には、の
位置の関数funcAから呼ばれる関数funcBのイ
ンスタンスメモリ4の領域の先頭アドレス(160番
地)を格納しておく。
Here, the function func called at the position of
In the area (100 address) of the instance memory 4 of A,
Function funcB called from function funcA at position
Start address of the area of instance memory 4 (120
Address), and the area of the instance memory 4 of the function funcA called at position (address 140) stores the top address (address 160) of the area of the instance memory 4 of function funcB called from the function funcA at position of Keep it.

【0023】メイン関数mainで使われているPUS
H_IS命令は、現在処理している関数のインスタンス
の先頭アドレスをアドレスレジスタ部7のスタックに退
避させ、これから呼び出す関数のインスタンスの先頭ア
ドレスをアドレスレジスタ部7にセットする。
PUS used in main function main
The H_IS instruction saves the start address of the instance of the function currently being processed in the stack of the address register unit 7, and sets the start address of the instance of the function to be called in the address register unit 7.

【0024】例えば、PUSH_IS100命令は、現
在処理している関数のインスタンスの先頭アドレスをア
ドレスレジスタ部7のスタックに退避させ、の位置で
呼び出す関数funcAのインスタンスメモリの先頭ア
ドレス(100番地)をアドレスレジスタ部7にセット
する。また、PUSH_IS140命令は、現在処理し
ている関数のインスタンスの先頭アドレスをアドレスレ
ジスタ部7のスタックに退避させ、の位置で呼び出す
関数funcAのインスタンスメモリの先頭アドレス
(140番地)をアドレスレジスタ部7にセットする。
For example, in the PUSH_IS100 instruction, the start address of the instance of the function currently being processed is saved in the stack of the address register unit 7, and the start address (address 100) of the instance memory of the function funcA called at the position Set in part 7. Also, the PUSH_IS140 instruction saves the start address of the instance of the function currently being processed in the stack of the address register unit 7, and sets the start address (address 140) of the instance memory of the function funcA to be called at the position to the address register unit 7. set.

【0025】関数funcAで使われているPUSH_
IS(IS+0)命令は、現在処理している関数のイン
スタンスの先頭アドレスをアドレスレジスタ部7のスタ
ックに退避させ、インスタンスメモリ4の(IS+0)
番地に格納されているデータをアドレスレジスタ部7に
セットする。ここで、ISは、現在処理している関数の
インスタンスの先頭アドレスである。
PUSH_ used in the function funcA
The IS (IS + 0) instruction saves the start address of the instance of the function currently being processed in the stack of the address register unit 7, and (IS + 0) in the instance memory 4
The data stored in the address is set in the address register unit 7. Here, IS is the start address of the instance of the function currently being processed.

【0026】例えば、メイン関数mainのPUSH_
IS100命令が実行され、の位置で関数funcA
が呼ばれた後、関数funcAのPUSH_IS(IS
+0)命令が実行されると、アドレスレジスタ部7にセ
ットされている関数funcAのインスタンスメモリ
の先頭アドレス(100番地)を、アドレスレジスタ部
7のスタックに退避させる。そして、インスタンスメモ
リの100番地に格納されているデータ(120番地)
をアドレスレジスタ部7にセットし、関数funcBを
呼び出す。
For example, PUSH_ of the main function main
The IS100 instruction is executed, and the function funcA is executed at the position of
Is called, then PUSH_IS (IS
When the +0) instruction is executed, the start address (address 100) of the instance memory of the function funcA set in the address register unit 7 is saved in the stack of the address register unit 7. And the data stored at address 100 in instance memory (address 120)
Is set in the address register unit 7 and the function funcB is called.

【0027】また、メイン関数mainのPUSH_I
S140命令が実行され、の位置で関数funcAが
呼ばれた後、関数funcAのPUSH_IS(IS+
0)命令が実行されると、アドレスレジスタ部7にセッ
トされている関数funcAのインスタンスメモリの
先頭アドレス(140番地)を、アドレスレジスタ部7
のスタックに退避させる。そして、インスタンスメモリ
の140番地に格納されているデータ(160番地)を
アドレスレジスタ部7にセットし、関数funcBを呼
び出す。
Also, PUSH_I of the main function main
After the S140 instruction is executed and the function funcA is called at the position of, the PUSH_IS (IS +
0) When the instruction is executed, the start address (140th address) of the instance memory of the function funcA set in the address register unit 7 is set to the address register unit 7
To the stack. Then, the data (address 160) stored at address 140 of the instance memory is set in the address register unit 7, and the function funcB is called.

【0028】この結果、の位置の関数funcAから
関数funcBを呼び出した時には、先頭アドレスが1
20番地の関数funcBのインスタンスを用いて処理
を行うことが可能となるとともに、の位置の関数fu
ncAから関数funcBを呼び出した時には、先頭ア
ドレスが160番地の関数funcBのインスタンスを
用いて処理を行うことが可能となり、同一の関数fun
cAから関数funcBを異なる位置で呼び出した場合
においても、関数funcAの呼び出し位置に応じて、
関数funcBのインスタンスを使い分けることが可能
となる。
As a result, when the function funcA at the position of is called from the function funcB, the start address is 1
It becomes possible to perform processing using the instance of the function funcB at address 20, and the function fu at the position of
When the function funcB is called from ncA, it becomes possible to perform processing using the instance of the function funcB whose start address is 160, and the same function func
Even when the function funcB is called from cA at a different position, depending on the calling position of the function funcA,
It becomes possible to properly use the instance of the function funcB.

【0029】関数funcBで使われているPOP_I
S命令は、関数funcBを呼び出した関数funcA
のインスタンスの先頭アドレスをアドレスレジスタ部7
のスタックから取り出し、アドレスレジスタ部7に設定
するこのように、PUSH_IS命令及びPOP_IS
命令を用いて、インスタンスを持つ関数の呼び出し処理
を実行することにより、プログラムを簡潔に動作させる
ことができる。
POP_I used in function funcB
The S instruction is the function funcA that calls the function funcB.
The start address of the instance of
Of the PUSH_IS instruction and the POP_IS instruction.
The program can be operated simply by executing the calling process of the function having the instance using the instruction.

【0030】また、関数funcAから呼ばれる関数f
uncBのインスタンスメモリ4の領域の先頭アドレス
を、関数funcAのインスタンスメモリ4の領域に格
納しておき、PUSH_IS(IS+0)命令を用い
て、関数funcBのインスタンスメモリ4の先頭アド
レスを指定することにより、関数funcBのインスタ
ンスメモリ4の先頭アドレスを関数funcAの中で直
接指定する必要がなくなる。このため、及びのそれ
ぞれの位置に対応して別個に生成された関数funcB
のインスタンスに対し、関数funcAのオブジェクト
をそれぞれ別個に生成する必要がなくなり、インスタン
スを持つ関数の呼び出し処理を効率的に行うことが可能
となる。
The function f called from the function funcA
By storing the starting address of the area of the instance memory 4 of uncB in the area of the instance memory 4 of the function funcA, and specifying the starting address of the instance memory 4 of the function funcB using the PUSH_IS (IS + 0) instruction, It is not necessary to directly specify the start address of the instance memory 4 of the function funcB in the function funcA. For this reason, the function funcB generated separately corresponding to the respective positions of and
It is not necessary to separately generate the object of the function funcA for each instance of, and it is possible to efficiently perform the calling process of the function having the instance.

【0031】図3は、図2の処理を実現するハード構成
例を示すブロック図である。図3において、プロセッサ
11には、フェッチ制御部14、フェッチデータ格納レ
ジスタ15、マイクロプログラム制御部16、データア
クセス制御部17、ISレジスタ18、ISレジスタス
タックポインタ19及び加減算器20が設けられ、フェ
ッチ制御部14はプログラムメモリ12から命令を取り
出して、フェッチデータ格納レジスタ15に格納する。
FIG. 3 is a block diagram showing a hardware configuration example for realizing the processing of FIG. In FIG. 3, the processor 11 is provided with a fetch controller 14, a fetch data storage register 15, a microprogram controller 16, a data access controller 17, an IS register 18, an IS register stack pointer 19 and an adder / subtractor 20. The control unit 14 fetches the instruction from the program memory 12 and stores it in the fetch data storage register 15.

【0032】データメモリ13には、例えば、図2のイ
ンスタンスメモリ領域が各関数funcA、funcB
の呼び出し位置、ごとに設けられている。また、呼
び出し元の関数funcAのインスタンスメモリの領域
には、呼び出し先の関数funcBのインスタンスメモ
リの先頭アドレスが格納されている。
In the data memory 13, for example, the instance memory area of FIG. 2 has the functions funcA and funcB.
It is provided for each calling position. Further, the start address of the instance memory of the called function funcB is stored in the area of the instance memory of the calling function funcA.

【0033】データアクセス制御部17は、データメモ
リ13のデータの読み出しや書き込みを行い、ISレジ
スタ18は、現在処理している関数のインスタンスの先
頭アドレスを格納する。
The data access control unit 17 reads and writes data in the data memory 13, and the IS register 18 stores the start address of the instance of the function currently being processed.

【0034】マイクロプログラム制御部16は、PUS
H_IS命令を実行する場合、ISレジスタ18の内容
をISレジスタスタックポインタ19に退避させ、加減
算器20にISレジスタスタックポインタ19を1だけ
インクリメントさせた後、これから呼び出す関数のイン
スタンスの先頭アドレスをISレジスタ18にセットす
る。
The microprogram control unit 16 uses the PUS
When executing the H_IS instruction, the contents of the IS register 18 are saved in the IS register stack pointer 19 and the adder / subtractor 20 increments the IS register stack pointer 19 by one, and then the start address of the instance of the function to be called is set in the IS register. Set to 18.

【0035】また、マイクロプログラム制御部16は、
POP_IS命令を実行する場合、呼び出し元の関数の
インスタンスの先頭アドレスをISレジスタスタックポ
インタ19から取り出してISレジスタ18にセット
し、加減算器20にISレジスタスタックポインタ19
を1だけデクリメントさせる。
Further, the micro program control section 16 is
When executing the POP_IS instruction, the start address of the caller function instance is fetched from the IS register stack pointer 19 and set in the IS register 18, and the IS register stack pointer 19 is added to the adder / subtractor 20.
Decrement by 1.

【0036】また、マイクロプログラム制御部16は、
PUSH_IS(IS+0)命令を実行する場合、IS
レジスタ18の内容をISレジスタスタックポインタ1
9に退避させ、加減算器20にISレジスタスタックポ
インタ19を1だけインクリメントさせる。そして、デ
ータメモリ13の(IS+0)番地に格納されているデ
ータを読み出すように、データアクセス制御部17に指
示する。なお、ISは、呼び出し元の関数のインスタン
スの先頭アドレスを示し、データメモリ13の(IS+
0)番地には、呼び出し先の関数のインスタンスの先頭
アドレスが格納されている。データアクセス制御部17
は、データメモリ13の(IS+0)番地に格納されて
いるデータを読み出すと、そのデータをISレジスタ1
8にセットする。
Further, the micro program control section 16 is
When executing the PUSH_IS (IS + 0) instruction, IS
The contents of register 18 are set to IS register stack pointer 1
The IS register stack pointer 19 is incremented by 1 by the adder / subtractor 20. Then, the data access control unit 17 is instructed to read the data stored in the (IS + 0) address of the data memory 13. Note that IS indicates the start address of the instance of the caller function, and (IS + (IS +
The address 0) stores the start address of the instance of the called function. Data access control unit 17
Reads out the data stored in the address (IS + 0) of the data memory 13, the data is stored in the IS register 1
Set to 8.

【0037】図4は、本発明の一実施例に係わる関数呼
び出し方法を示すフローチャートである。なお、これら
の処理は、マイクロプログラムで実行することができ
る。図4において、PUSH_IS100命令が実行さ
れると、ISレジスタ18の内容をISレジスタスタッ
クポインタ19に格納し(ステップS1)、ISレジス
タスタックポインタ19の内容を1だけインクリメント
し(ステップS2)、ISレジスタ18に100をセッ
トする(ステップS3)。
FIG. 4 is a flowchart showing a function calling method according to an embodiment of the present invention. Note that these processes can be executed by a microprogram. In FIG. 4, when the PUSH_IS100 instruction is executed, the contents of the IS register 18 are stored in the IS register stack pointer 19 (step S1), the contents of the IS register stack pointer 19 are incremented by 1 (step S2), and the IS register 100 is set to 18 (step S3).

【0038】POP_IS命令が実行されると、ISレ
ジスタスタックポインタ19の内容をISレジスタ18
に格納し(ステップS11)、ISレジスタスタックポ
インタ19の内容を1だけデクリメントする(ステップ
S12)。
When the POP_IS instruction is executed, the contents of the IS register stack pointer 19 are changed to the IS register 18
(Step S11), the contents of the IS register stack pointer 19 are decremented by 1 (step S11).
S12 ).

【0039】PUSH_IS(IS+0)命令が実行さ
れると、ISレジスタ18の内容をISレジスタスタッ
クポインタ19に格納し(ステップS21)、ISレジ
スタスタックポインタ19の内容を1だけインクリメン
トし(ステップS22)、ISレジスタ18に(IS+
0)番地のデータをセットする(ステップS23)。平
成15年11月6日付けで出願人名義変更届提出済み
When the PUSH_IS (IS + 0) instruction is executed, the contents of the IS register 18 are stored in the IS register stack pointer 19 (step S21), the contents of the IS register stack pointer 19 are incremented by 1 (step S22 ), In IS register 18 (IS +
Data of address 0) is set (step S23). Applicant's name change notification has been submitted as of November 6, 2003

【0040】[0040]

【発明の効果】以上説明したように、本発明によれば、
第1のインスタンスの先頭アドレスをスタックに退避さ
せ、第2のインスタンスの先頭アドレスをアドレスレジ
スタに設定する命令と、前記第1のインスタンスの先頭
アドレスを前記スタックから取り出し、前記アドレスレ
ジスタに設定する命令を用いることにより、インスタン
スを持つ関数の呼び出しプログラムを簡略化することが
可能となるとともに、これらの命令をハードウェアで直
接実行することにより、インスタンスを持つ関数の呼び
出し処理を高速に実行することが可能となる。
As described above, according to the present invention,
An instruction that saves the start address of the first instance in the stack and sets the start address of the second instance in the address register, and an instruction that extracts the start address of the first instance from the stack and sets it in the address register By using, it is possible to simplify the calling program of the function that has an instance, and by executing these instructions directly in the hardware, the calling process of the function that has an instance can be executed at high speed. It will be possible.

【0041】また、本発明の一態様によれば、呼び出し
先の関数のインスタンスの先頭アドレスを、呼び出し元
の関数のインスタンスに設定することにより、同一の関
数を複数の箇所で使用する場合においても、その関数の
オブジェクトを各箇所ごとに個別に生成する必要がなく
なり、インスタンスを持つ関数の呼び出し処理を効率的
に行うことが可能となる。
Further, according to one aspect of the present invention, even when the same function is used in a plurality of places by setting the start address of the instance of the function of the call destination to the instance of the function of the call source , It is not necessary to individually generate the object of the function for each location, and it becomes possible to efficiently perform the calling process of the function having the instance.

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

【図1】本発明の一実施例に係わる情報処理装置の構成
を示すブロック図である。
FIG. 1 is a block diagram showing a configuration of an information processing apparatus according to an embodiment of the present invention.

【図2】本発明の一実施例に係わる関数呼び出し方法を
示すプログラム例及びインスタンスメモリの内容を示す
図である。
FIG. 2 is a diagram showing an example of a program showing a function calling method and contents of an instance memory according to an embodiment of the present invention.

【図3】図1の情報処理装置の具体的な構成例を示すブ
ロック図である。
3 is a block diagram showing a specific configuration example of the information processing apparatus of FIG.

【図4】本発明の一実施例に係わる関数呼び出し方法を
示すフローチャートである。
FIG. 4 is a flowchart showing a function calling method according to an embodiment of the present invention.

【図5】従来の関数呼び出し方法を示すプログラム例で
ある。
FIG. 5 is a program example showing a conventional function calling method.

【図6】同一の関数を複数箇所で呼び出す場合の従来の
関数呼び出し方法を示すプログラム例である。
FIG. 6 is a program example showing a conventional function calling method in the case of calling the same function at a plurality of points.

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

1 CPU 2、12 プログラムメモリ 3、13 データメモリ 4 インスタンスメモリ 5、14 フェッチ制御部 6 データメモリアクセス制御部 7 アドレスレジスタ部 8 演算実行部 11 プロセッサ 15 フェッチデータ格納レジスタ 16 マイクロプログラム制御部 17 データアクセス制御部 18 ISレジスタ 19 ISレジスタスタックポインタ 20 加減算器 1 CPU 2,12 Program memory 3, 13 data memory 4 instance memory 5, 14 Fetch controller 6 Data memory access controller 7 Address register section 8 Operation execution unit 11 processors 15 Fetch data storage register 16 Micro program controller 17 Data access control unit 18 IS register 19 IS register stack pointer 20 adder / subtractor

───────────────────────────────────────────────────── フロントページの続き (56)参考文献 特開 平10−91443(JP,A) 特開 昭59−135551(JP,A) (58)調査した分野(Int.Cl.7,DB名) G06F 9/40 - 9/42 ─────────────────────────────────────────────────── ─── Continuation of the front page (56) References JP-A-10-91443 (JP, A) JP-A-59-135551 (JP, A) (58) Fields investigated (Int.Cl. 7 , DB name) G06F 9/40-9/42

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 インスタンスを持つ関数の処理を行う情
報処理装置において、 スタックを有するアドレスレジスタと、第1の 1マシン語命令で、第1の関数の呼び出し位置に
よるインスタンスの先頭アドレスを前記スタックに退避
させ、第2の関数の呼び出し位置によるインスタンスの
先頭アドレスを前記アドレスレジスタに設定する手段
と、第2の 1マシン語命令で、前記第1の関数の呼び出し位
置によるインスタンスの先頭アドレスを前記スタックか
ら取り出し、前記アドレスレジスタに設定する手段と、 前記第1の関数の中で、前記第1の1マシン語命令で前
記アドレスレジスタに設定した前記第2の関数の呼び出
し位置によるインスタンスの先頭アドレスと呼び出し命
令で、前記第2の関数と前記第2の関数の呼び出し位置
によるインスタンスを呼び出す手段 を備えることを特徴
とする情報処理装置。
1. An information processing device for processing a function having an instance, wherein an address register having a stack and a first one machine language instruction are used to call a first function.
According to the head address of the instance is saved to the stack, and means for setting a start address of an instance by calling the position of the second function to the address register, the second one machine language instruction, the call to the first function Rank
Means for fetching the start address of the instance from the stack from the stack and setting it in the address register; and in the first function, the first one machine language instruction
Calling the second function set in the address register
Start address of the instance and call order depending on the position
The second function and the call position of the second function
An information processing device, comprising means for calling an instance according to .
【請求項2】記第2の関数の呼び出し位置による
ンスタンスの先頭アドレスを前記第1の関数の呼び出し
位置によるインスタンスに設定する手段を備えることを
特徴とする請求項1に記載の情報処理装置。
2. A previous SL call to the first function start address Lee <br/> instance by calling the position of the second function
The information processing apparatus according to claim 1, further comprising means for setting an instance according to a position .
JP26444098A 1998-09-18 1998-09-18 Information processing equipment Expired - Lifetime JP3520966B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP26444098A JP3520966B2 (en) 1998-09-18 1998-09-18 Information processing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP26444098A JP3520966B2 (en) 1998-09-18 1998-09-18 Information processing equipment

Publications (2)

Publication Number Publication Date
JP2000099331A JP2000099331A (en) 2000-04-07
JP3520966B2 true JP3520966B2 (en) 2004-04-19

Family

ID=17403232

Family Applications (1)

Application Number Title Priority Date Filing Date
JP26444098A Expired - Lifetime JP3520966B2 (en) 1998-09-18 1998-09-18 Information processing equipment

Country Status (1)

Country Link
JP (1) JP3520966B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111209042B (en) * 2020-01-06 2022-08-26 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for establishing function stack

Also Published As

Publication number Publication date
JP2000099331A (en) 2000-04-07

Similar Documents

Publication Publication Date Title
JP3253303B2 (en) Context switching apparatus and method
EP0330226B1 (en) Apparatus of and method for executing subprogram in bank switching data processing system
JPS6259812B2 (en)
US6564283B1 (en) Data processing system for expanded addresses
JP2003515805A (en) Processor system
JP3520966B2 (en) Information processing equipment
JP3088303B2 (en) Cache memory bank controller
JPS61296407A (en) Multiprocessor type numerical controller
JPS62151940A (en) Register saving/return system
JP2927102B2 (en) Instruction string switching method and arithmetic processor using the same
JP3074809B2 (en) Programmable controller
JP3379744B2 (en) Program control unit
JP2972557B2 (en) Data transfer control device and control method
JP3022848B2 (en) Multitask task switching method and real-time operating system
JP3345050B2 (en) Two-dimensional array type memory system
JP3095483B2 (en) Register save instruction processing method
JPH0442328A (en) Interruption control system for information processor
JP2000194554A (en) Arithmetic processor
JP2002544619A (en) Object-oriented processing using dedicated pointer memory
JPH11249959A (en) Method and device for cache memory control
JPH0231265A (en) Dma controller
JPH0661039B2 (en) Memory access control circuit
JPH0512107A (en) Program execution system
JPH0682321B2 (en) Micro controller
JPH0812637B2 (en) Address translation method

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20031208

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20031208

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20040120

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040128

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20040218

A072 Dismissal of procedure [no reply to invitation to correct request for examination]

Free format text: JAPANESE INTERMEDIATE CODE: A072

Effective date: 20040525

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

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

Free format text: PAYMENT UNTIL: 20080213

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20090213

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20090213

Year of fee payment: 5

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

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

Free format text: PAYMENT UNTIL: 20090213

Year of fee payment: 5

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

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

Free format text: PAYMENT UNTIL: 20100213

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110213

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20110213

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20120213

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20120213

Year of fee payment: 8

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

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

Free format text: PAYMENT UNTIL: 20120213

Year of fee payment: 8

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

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

Free format text: PAYMENT UNTIL: 20130213

Year of fee payment: 9

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

EXPY Cancellation because of completion of term