JPH0293730A - Information processor - Google Patents
Information processorInfo
- Publication number
- JPH0293730A JPH0293730A JP24534088A JP24534088A JPH0293730A JP H0293730 A JPH0293730 A JP H0293730A JP 24534088 A JP24534088 A JP 24534088A JP 24534088 A JP24534088 A JP 24534088A JP H0293730 A JPH0293730 A JP H0293730A
- Authority
- JP
- Japan
- Prior art keywords
- area
- stack
- program
- stack area
- overflow
- 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.)
- Pending
Links
- 230000010365 information processing Effects 0.000 claims description 13
- 238000001514 detection method Methods 0.000 claims description 7
- 238000005111 flow chemistry technique Methods 0.000 abstract 1
- 230000006870 function Effects 0.000 description 11
- 238000010586 diagram Methods 0.000 description 4
- 238000000034 method Methods 0.000 description 4
- 230000000694 effects Effects 0.000 description 2
- 208000003028 Stuttering Diseases 0.000 description 1
Landscapes
- Executing Machine-Instructions (AREA)
Abstract
Description
【発明の詳細な説明】
〔産業上の利用分野〕
本発明は所定のプログラムを実行する情報処理装置に関
する。DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to an information processing device that executes a predetermined program.
従来の情報処理装置では、周知のように、所定のプログ
ラムの実行中、1つの手続き(または関数)の呼び出し
毎に、該手続き(または関数)に関係するデータ、例え
ば、演算結果を示すデータ等を格納しておくスタック領
域を、予め設定しておくのが一般的である。As is well known, in conventional information processing devices, during execution of a predetermined program, each time a procedure (or function) is called, data related to the procedure (or function), such as data indicating a calculation result, etc. It is common to set a stack area in advance to store the .
ところで、上記従来の情報処理装置では、プログラムの
実行中に、予め設定されたスタック領域がオーバフロー
した場合は、プログラムの実行の継続は不可能であり、
当該プログラムの実行は中断されてしまう。By the way, in the conventional information processing device described above, if the preset stack area overflows during program execution, it is impossible to continue the program execution.
Execution of the program will be interrupted.
特に、大規模なプログラムの実行においては、スタック
領域が、オーバフローとなる確率が高いため、当該プロ
グラムの実行が中断され易くなってしまうという欠点が
あった。In particular, when executing a large-scale program, there is a high probability that the stack area will overflow, so there is a drawback that the execution of the program is likely to be interrupted.
本発明は上記欠点を解消し、確実に所定のプログラムの
実行を最後まで行うことのできる情報処理装置を提供す
ることを目的とする。SUMMARY OF THE INVENTION An object of the present invention is to provide an information processing apparatus that can eliminate the above-mentioned drawbacks and reliably execute a predetermined program to the end.
本発明では、所定のスタック領域を含む記憶領域にデー
タを記憶する記憶手段と、前記所定のスタック領域にオ
ーバフローが発生するか否かを検出する検出手段と、前
記オーバフローが発生するときは、前記記憶手段におけ
る空きの記憶領域に前記所定のスタック領域に関連する
新たなスタック領域を割当する割当手段とを具えている
。In the present invention, a storage means for storing data in a storage area including a predetermined stack area, a detection means for detecting whether an overflow occurs in the predetermined stack area, and a detecting means for detecting whether or not an overflow occurs in the predetermined stack area; and allocation means for allocating a new stack area related to the predetermined stack area to an empty storage area in the storage means.
本発明の情報処理装置は、プログラムの実行中に予め設
定された所定のスタック領域がオーバフローした場合は
、記憶手段における空きの記憶領域、例えば、前記所定
のスタック領域に連続する空きの記憶領域があれば、当
該空きの記憶領域に新たなスタック領域を割当しくつま
り、所定のスタック領域の拡張)、反対に、連続する空
きの記憶領域がなければ、記憶手段における他の空きの
記憶領域に新たなスタック領域を割当する。そして所定
のスタック領域がオーバフローした以降のデータは、割
当された新たなスタック領域に格納される。In the information processing apparatus of the present invention, when a predetermined stack area set in advance overflows during execution of a program, an empty storage area in the storage means, for example, an empty storage area contiguous to the predetermined stack area, is used. If there is, a new stack area is allocated to the free storage area (in other words, the specified stack area is expanded), and conversely, if there is no continuous free storage area, a new stack area is allocated to the other free storage area in the storage means. allocate stack space. Data after the predetermined stack area overflows is stored in a new allocated stack area.
以下、本発明に係る情報処理装置の実施例を添付図面を
参照して説明する。Embodiments of an information processing apparatus according to the present invention will be described below with reference to the accompanying drawings.
第1図は本発明に係る情報処理装置の一実施例を示すブ
ロック図である。同図において、情報処理装置は、メモ
リ部1と、主メモリ2と、プログラム実行制御部3と、
スタックオーバフロー検知部4とを有している。メモリ
部1は、RAMからなる実メモリと、ディスク装置とを
有しており、このディスク装置は、所定のプログラム1
1、スタックオーバフロー処理ルーチン12および後述
するスタックオーバフロー処理の動作を示すフローチャ
ー1・に基づくプログラム等を格納しており、一方、実
メモリは、ディスク装置から読み出された所定のプログ
ラム11等の一部を記憶する主メモリ2は、所定のスタ
ック領域21と、プログラム11の実行の途中経過を保
持するプログラム実行途中経過保持領域(以下、途中経
過保持領域という)22と、当該主メモリ2における空
きの記憶W4域の一部の記憶領域を示す利用可能領域2
3とを有している。プログラム実行制御部3は、所定の
プログラム11の実行を制御するものであり、スタック
オーバフロー検知部4はスタック領域21にオーバフロ
ーが発生するか否かを検知するものである。FIG. 1 is a block diagram showing an embodiment of an information processing apparatus according to the present invention. In the figure, the information processing device includes a memory section 1, a main memory 2, a program execution control section 3,
It has a stack overflow detection section 4. The memory unit 1 has a real memory consisting of RAM and a disk device, and this disk device stores a predetermined program 1.
1. Stack overflow processing routine 12 and programs based on flowchart 1 showing the operation of stack overflow processing described later are stored, while the real memory stores predetermined programs 11 etc. read from the disk device. The main memory 2 that partially stores a predetermined stack area 21, a program execution progress holding area (hereinafter referred to as an interim progress holding area) 22 that holds the progress of the execution of the program 11, and a Available area 2 indicating a part of the storage area of the free storage W4 area
3. The program execution control section 3 controls the execution of a predetermined program 11, and the stack overflow detection section 4 detects whether an overflow occurs in the stack area 21.
第2図は本発明に係るスタックの構造を示したものであ
り、同図において、スタックは、プログラムの構成単位
である関数が呼び出されることにより、スタックに積ま
れ、フレームと呼ばれる形式のデータである制御情報が
格納されている制御フレーム30と、該制御フレーム3
0に引き続いてスタックに積まれる計算の中間結果31
と、現在の制御フレームを示すポインタを保持するレジ
スタ32と、現在の制御フレームに対応する関数のオブ
ジェクトコード33と、該オブジェクトコード33の中
で現在実行中のオブジェクトコードの位置を示すプログ
ラムカウンタと呼ばれる、オブジェクトコード33の先
頭からのオフセットを保持するレジスタ34とから構成
されている。Figure 2 shows the structure of the stack according to the present invention. In the figure, the stack is data in a format called a frame that is piled up on the stack when a function, which is a structural unit of a program, is called. A control frame 30 in which certain control information is stored, and the control frame 3
Intermediate result of calculation 31 placed on the stack following 0
, a register 32 that holds a pointer indicating the current control frame, an object code 33 of a function corresponding to the current control frame, and a program counter that indicates the position of the object code currently being executed within the object code 33. It is composed of a register 34 that holds an offset from the beginning of the object code 33, called the object code 33.
制御フレーム30は、1つ前に実行されていた関数に対
応する制御フレーム30aへのポインタ35、およびオ
ブジェクトコード33へのポインタ36を格納している
。The control frame 30 stores a pointer 35 to the control frame 30a corresponding to the function that was executed immediately before, and a pointer 36 to the object code 33.
次に、上記情報処理装置のスタックオーバフロー処理の
動作を第3図のフローチャートに基づき説明する。Next, the stack overflow processing operation of the information processing apparatus will be explained based on the flowchart of FIG. 3.
最初に、プログラムの処理単位である関数が1つ呼びだ
される毎に、その関数に関する制御情報を格納した制御
フレーム30がスタック領域21の中に構成され、また
前記制御フレーム30に引き続き、前記関数の実行にお
ける中間結果31がスタック領域21に積まれる。First, each time a function, which is a processing unit of a program, is called, a control frame 30 storing control information regarding that function is configured in the stack area 21, and following the control frame 30, the control frame 30 stores control information regarding that function. Intermediate results 31 in the execution of the function are stacked on the stack area 21 .
ここで、スタックオーバフロー検知部4は、スタック領
域21に上記中間結果31を積む前に、当該中間結果3
1のデータ量を計算しくステップ100) 、該データ
量とスタック領域21の空き領域とを比較し、前記中間
結果31のデータをスタック領域21の空き領域に積む
ことにより、当該スタック領域21がオーバフローする
か否かを検知する(ステップioi>、オーバフローす
る場合、スタックオーバフロー検知部4は、途中経過保
持領域22に現在の制御フレームを示すポインタの値を
格納するとともに(ステップ102)、前記途中経過保
持領域22に現在実行中のオブジェクトコードの位置を
示すプログラムカウンタの値を格納しくステップ103
)、さらに制御をスタックオーバフロー処理ルーチン1
2に渡す。Here, before stacking the intermediate result 31 in the stack area 21, the stack overflow detection unit 4
Step 100) calculates the data amount of 1, compares the data amount with the free space of the stack area 21, and stacks the data of the intermediate result 31 in the free space of the stack area 21, thereby preventing the stack area 21 from overflowing. (Step ioi>) If there is an overflow, the stack overflow detection unit 4 stores the value of the pointer indicating the current control frame in the intermediate progress holding area 22 (Step 102), and Step 103: Store the value of the program counter indicating the position of the object code currently being executed in the holding area 22.
), further controls the stack overflow handling routine 1
Pass it to 2.
スタックオーバフロー処理ルーチン12は、主メモリ2
におけるスタック領域21に連続する空きの記憶領域が
あるか否か、つまりスタック領域21の拡張領域がある
か否かを判断しくステップ104)、空きの記憶領域が
ある場合には、当該空きの記憶領域に1ペ一ジ分の新た
なスタック領域を割当て、当該スタック領域21を1ペ
一ジ分拡張する(ステップ105)。The stack overflow processing routine 12 is executed in the main memory 2.
In step 104), it is determined whether there is a continuous empty storage area in the stack area 21, that is, whether there is an expansion area of the stack area 21. If there is an empty storage area, the empty storage area is A new stack area corresponding to one page is allocated to the area, and the stack area 21 is expanded by one page (step 105).
一方、連続する空きの記憶領域が無い場合、スタッタオ
ーバフロー処理ルーチン12は、主メモリ2における使
用可能領域23に1ペ一ジ分の新たなスタック領域を割
当て、新たなスタック領域を1ペ一ジ分確保するととも
に(ステップ106) 、途中経過保持領域22に格納
されている制御フレーム30へのポインタの値に基づい
て、当該制御フレーム30の内容、およびスタック領域
21がオーバフローすることにより、当該スタック領域
21に格納されない中間結果31を、使用可能領域23
に割当られた新たなスタック領域に移動させる(ステッ
プ107)。On the other hand, if there is no continuous free storage area, the stutter overflow processing routine 12 allocates a new stack area for one page in the available area 23 in the main memory 2, and Based on the value of the pointer to the control frame 30 stored in the intermediate progress holding area 22, the content of the control frame 30 and the stack area 21 are overflowed. Intermediate results 31 that are not stored in the stack area 21 are stored in the available area 23.
(step 107).
ここで、使用可能領域23に割当られた新たなスタック
領域に移動される制御フレーム30の内容には、スタッ
ク領域21に格納されない中間結果31に対応する関数
の1つ前に実行された関数に対応する制御フレーム30
aへのポインタ35と、オブジェクトコード33へのポ
インタ36とが含まれている。Here, the contents of the control frame 30 that are moved to the new stack area allocated to the available area 23 include the function executed immediately before the function corresponding to the intermediate result 31 that is not stored in the stack area 21. Corresponding control frame 30
A pointer 35 to a and a pointer 36 to the object code 33 are included.
なお、スタック領域21に連続する空きの記憶領域に、
1ペ一ジ分の新たなスタック領域が割当された場合は、
制御フレーム30の内容の移動は行われず、スタック領
域21に格納されない中間結果31のみ、当該新たなス
タック領域に格納されることになる。Note that in the free storage area contiguous to the stack area 21,
If a new stack area for one page is allocated,
The contents of the control frame 30 are not moved, and only the intermediate results 31 that are not stored in the stack area 21 are stored in the new stack area.
ところで、上記入テップ105を終了したスタックオー
バフロー処理ルーチン12は、途中経過保持領域22に
格納されている制御フレーム30へのポインタの値を、
現在の制御フレームを示すポインタを保持するレジスタ
32へ復帰させる(ステップ108)、一方、上記ステ
ップ107を終了したスタックオーバフロー処理ルーチ
ン12は、新たなスタック領域に移動された制御フレー
ム30へのポインタの値を、現在の制御フレームを示す
ポインタを保持するレジスタ32へ格納する(ステップ
108)。By the way, the stack overflow processing routine 12 that has completed the above input step 105 stores the value of the pointer to the control frame 30 stored in the intermediate progress storage area 22 as
The stack overflow processing routine 12 that has completed step 107 returns the pointer to the control frame 30 that has been moved to the new stack area (step 108). The value is stored in a register 32 that holds a pointer to the current control frame (step 108).
レジスタ32に制御フレーム30へのポインタの値が格
納されてから、スタックオーバフロー処理ルーチン12
は、途中経過保持領域22に格納されているプログラム
カウンタの値をレジスタ34へ復帰させる(ステップ1
09)。After the value of the pointer to the control frame 30 is stored in the register 32, the stack overflow handling routine 12
returns the value of the program counter stored in the intermediate progress holding area 22 to the register 34 (step 1
09).
そして、レジスタ32およびレジスタ34に保持されて
いるそれぞれのポインタの値に対応する制御フレームお
よびオブジェクトコードを実行することにより、プログ
ラムの実行を継続することができる。Then, by executing the control frame and object code corresponding to the values of the pointers held in the registers 32 and 34, execution of the program can be continued.
なお、上記ステップ101においてオーバフローしない
場合は、スタック領域21内にまだ空きの記憶領域があ
ることになり、当該スタック領域21に格納された制御
フレーム30に引き続き中間結果31が8!止れること
になる。Note that if there is no overflow in step 101, there is still a free storage area in the stack area 21, and the intermediate result 31 is 8! following the control frame 30 stored in the stack area 21. It will stop.
また上記ステップ101においてオーバフローしない場
合、上記ステップ108を終了した場合には、スタック
オーバフロー処理の処理動作は終了する。Furthermore, if there is no overflow in step 101, or if step 108 is completed, the stack overflow process ends.
なお上記実施例では、スタック領域がオーバフローした
場合、1ページの新たなスタック領域を割当するように
したが、本発明はこれに限定されることなく、新たなス
タック領域を割当するようにしたものであれば、どのよ
うな記憶領域単位であっても良い。In the above embodiment, when the stack area overflows, a new stack area of one page is allocated, but the present invention is not limited to this, and a new stack area is allocated. Any storage area unit may be used.
上記実施例によれば、プログラムの実行中にスタックが
オーバフローした場合でも、当該プログラムの実行を中
断することなく、処理を継続させることが可能となり、
大規模なプログラムの実行を最後まで行うことが可能と
なる。According to the above embodiment, even if the stack overflows during execution of a program, it is possible to continue processing without interrupting the execution of the program,
It becomes possible to execute a large-scale program to the end.
以上説明したように本発明によれば、プログラムの実行
中に所定のスタック領域がオーバフローした場合は、記
憶手段における空きの記憶領域に新たなスタック領域を
割当し、当該新たなスタック領域に、オーバフローした
以降のデータを格納するようにしたため、所定のスタッ
ク領域のオーバフローによるプログラムの実行の中断が
極めて少なくなり、特に、大規模なプログラムの実行に
おいては、確実にプログラムの実行処理を行うことがで
きるという利点がある。As explained above, according to the present invention, when a predetermined stack area overflows during program execution, a new stack area is allocated to an empty storage area in the storage means, and the overflow is stored in the new stack area. Since the data after the execution is stored, the interruption of program execution due to overflow of the predetermined stack area is extremely rare, and the program execution process can be performed reliably, especially when executing a large-scale program. There is an advantage.
第1図は本発明に係る情報処理装置の一実施例を示すブ
ロック図、第2図は本発明に係るスタックの構造の一例
を示す構成図、第3図は情報処理装置のスタックオーバ
フロー処理の動作を示すフローチャートである。
1・・・メモリ部、2・・・主メモリ、3・・・プログ
ラム実行制御部、4・・・スタックオーバフロー検知部
、11・・・プログラム、12・・・スタックオーバフ
ロー処理ルーチン、21・・・スタック領域、22・・
・プログラム実行途中経過保存領域、23・・・利用可
能領域、30・・・制御フレーム、31・・・計算中間
結果、32.34・・・レジスタ、33・・・オブジェ
クトコード、35.36・・・ポインタ。FIG. 1 is a block diagram showing an embodiment of an information processing device according to the present invention, FIG. 2 is a block diagram showing an example of the structure of a stack according to the present invention, and FIG. 3 is a block diagram showing an example of the stack structure of the information processing device. It is a flowchart showing the operation. DESCRIPTION OF SYMBOLS 1...Memory unit, 2...Main memory, 3...Program execution control unit, 4...Stack overflow detection unit, 11...Program, 12...Stack overflow processing routine, 21...・Stack area, 22...
・Program execution progress storage area, 23... Available area, 30... Control frame, 31... Intermediate calculation result, 32. 34... Register, 33... Object code, 35. 36. ...pointer.
Claims (1)
記憶手段を有する情報処理装置において、前記所定のス
タック領域にオーバフローが発生するか否かを検出する
検出手段と、 前記オーバフローが発生するときは、前記記憶手段にお
ける空きの記憶領域に前記所定のスタック領域に関連す
る新たなスタック領域を割当する割当手段と を具えたことを特徴とする情報処理装置。[Scope of Claims] An information processing apparatus having a storage means for storing data in a storage area including a predetermined stack area, further comprising: a detection means for detecting whether an overflow occurs in the predetermined stack area; and the overflow. 2. An information processing apparatus comprising: allocation means for allocating a new stack area related to the predetermined stack area to an empty storage area in the storage means when this occurs.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP24534088A JPH0293730A (en) | 1988-09-29 | 1988-09-29 | Information processor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP24534088A JPH0293730A (en) | 1988-09-29 | 1988-09-29 | Information processor |
Publications (1)
Publication Number | Publication Date |
---|---|
JPH0293730A true JPH0293730A (en) | 1990-04-04 |
Family
ID=17132213
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP24534088A Pending JPH0293730A (en) | 1988-09-29 | 1988-09-29 | Information processor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPH0293730A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2000155677A (en) * | 1998-11-19 | 2000-06-06 | Nec Corp | Method for preventing runaway of program and computer system for the method and recording medium for recording program for preventing runaway |
JP2006202268A (en) * | 2004-12-24 | 2006-08-03 | Kawasaki Microelectronics Kk | Cpu |
WO2008013010A1 (en) | 2006-07-26 | 2008-01-31 | Nishikawa Rubber Co., Ltd. | Method for amplification of nucleotide sequence |
-
1988
- 1988-09-29 JP JP24534088A patent/JPH0293730A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2000155677A (en) * | 1998-11-19 | 2000-06-06 | Nec Corp | Method for preventing runaway of program and computer system for the method and recording medium for recording program for preventing runaway |
JP2006202268A (en) * | 2004-12-24 | 2006-08-03 | Kawasaki Microelectronics Kk | Cpu |
WO2008013010A1 (en) | 2006-07-26 | 2008-01-31 | Nishikawa Rubber Co., Ltd. | Method for amplification of nucleotide sequence |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6006247A (en) | Method and system for scheduling threads and handling exceptions within a multiprocessor data processing system | |
US5842016A (en) | Thread synchronization in a garbage-collected system using execution barriers | |
US3924245A (en) | Stack mechanism for a data processor | |
JPH0293730A (en) | Information processor | |
US4942524A (en) | Software trap system which saves previous content of software trap handling pointer in a stack upon execution of a trap | |
EP0206335A2 (en) | Interruption Method for a Data Processing System | |
KR840007192A (en) | Data processing system | |
US11681527B2 (en) | Electronic device and multiplexing method of spatial | |
JPH07152574A (en) | Program loading system | |
JPS6353650A (en) | Computer | |
JPS6375948A (en) | Garbage collection control system | |
JPH02304624A (en) | Information processor | |
JPH0580691B2 (en) | ||
JPH04342037A (en) | Operand checking system for program | |
JPS6126095B2 (en) | ||
KR960011685A (en) | Data processing device and method for handling interrupt request | |
JP2584528Y2 (en) | Information processing device | |
JPH07210421A (en) | Debugging method in thread environment | |
JPH0667942A (en) | Log extraction system | |
JPH02252032A (en) | Computer | |
JPH01116851A (en) | Program load control system | |
JPH04358236A (en) | Data processor | |
JPH04322333A (en) | Dispatch system | |
JPS599936B2 (en) | data monitoring device | |
JPH01211048A (en) | Measuring system for executing instruction number of program |