JPS59158459A - Structure memory recovery system - Google Patents

Structure memory recovery system

Info

Publication number
JPS59158459A
JPS59158459A JP3306583A JP3306583A JPS59158459A JP S59158459 A JPS59158459 A JP S59158459A JP 3306583 A JP3306583 A JP 3306583A JP 3306583 A JP3306583 A JP 3306583A JP S59158459 A JPS59158459 A JP S59158459A
Authority
JP
Japan
Prior art keywords
memory
header
area
heap
data
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
Application number
JP3306583A
Other languages
Japanese (ja)
Inventor
Akihiko Konagaya
明彦 小長谷
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.)
NEC Corp
Original Assignee
NEC Corp
Nippon Electric 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 NEC Corp, Nippon Electric Co Ltd filed Critical NEC Corp
Priority to JP3306583A priority Critical patent/JPS59158459A/en
Publication of JPS59158459A publication Critical patent/JPS59158459A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units

Abstract

PURPOSE:To realize a structure again in high speed by moving a data section corresponding to a header section in use at present to a continuous area of another heap memory and using the other heap memory as a data accumulating area of the structure so as to recover the memory used already. CONSTITUTION:A header memory 110 accumulates the header section of the structure and heap memories 120, 121 accumulate a data section of the structure to a continuous area. Suppose that the continuous area accumnlating the data section of a new structure is not ensured when one of the two memories 120 and 121 is used as the data section accumulating area of the structure. In this case, a strcture memory managing unit 130 moves a data section corresponding to the header section in use at present in the header section of the structure accumulated in the memory 110 to the continuous area of the other heap memory and then, the other heap memory is used as the data section accumulating area of the structure.

Description

【発明の詳細な説明】 本発明はプロログの構造体の実現ならびにメモリセルの
回収方式に関する。
DETAILED DESCRIPTION OF THE INVENTION The present invention relates to the implementation of a prolog structure and a memory cell recovery method.

近年、知的システムへの関心の高まりとともに述語論理
型言語プロログが注目されている。その理由の1つとし
て、可変個の要素から構成される構造体が枡えることが
あげられる。
In recent years, as interest in intelligent systems has increased, predicate logic language prologs have been attracting attention. One of the reasons for this is that a structure composed of a variable number of elements can be scaled.

例えば、プロログでは、かごの中に′りんご′、lなし
′、′みかん′が入っている状態を′かご1要素数3の
構造体を使って次のように表現できる。
For example, in the prolog, the state in which the basket contains ``apples'', ``no l'', and ``oranges'' can be expressed as follows using a structure with 3 elements per basket.

かご(りんご、なし、みかん) さらに、太部がこのかごを持っているという事実は、構
造体比 ′持つ′ 、要素数2の構造体を用いて次のよ
うに記述できる。
Basket (apples, pears, oranges) Furthermore, the fact that Abe has this basket can be described as follows using a structure with a structure ratio of 'has' and two elements.

持つ(太部、かご(りんご、なし、みかん))。Hold (fat, basket (apples, pears, oranges)).

プロログではこのように可変個の要素を持つ構造体を用
いることによりデータを容易に記述することができる。
In prolog, data can be easily described by using a structure with a variable number of elements.

一方、プロログを実行すると多数の構造体が動的に生成
、消滅するため、構造体の領域として多量のメモリセル
が必要である。そこで、メモリセルの使用効率を高めろ
ために、一度、使用済となったメモリセルを回収し、再
度、構造体を実現するのに使用するいわゆるガーベージ
フレクション(月下GCと略す)が行われる。しかしな
がら、ガーページコレクションにかかる処理コストは大
きく、全体の帆埋コストの30係から50係以上かかる
場合がある、 本発明は、このようなGCを高速に処理できるような構
造体の実現と構造体メモリの回収方式を提供するもので
ある。
On the other hand, when a prolog is executed, a large number of structures are dynamically created and destroyed, so a large amount of memory cells are required as an area for the structures. Therefore, in order to increase the usage efficiency of memory cells, we carry out so-called garbage reflection (abbreviated as GC), which collects used memory cells and uses them again to realize the structure. be exposed. However, the processing cost required for garpage collection is large, and may take 30 to 50 parts or more of the total burial cost.The present invention aims to realize and structure a structure that can process such GC at high speed. This provides a method for recovering body memory.

本発明の実施例について述べる前に、構造体を実現する
従来方式とその問題点について触れておく。
Before describing embodiments of the present invention, a conventional method for realizing a structure and its problems will be discussed.

構造体を実現するための良く知られた実現方式の1つは
、固定長の領域をポインタで捨数個つなぐ方式である。
One of the well-known implementation methods for realizing a structure is a method of connecting a decimal number of fixed-length areas with pointers.

第1図に2進木リストセル10を用いて構造体 持つ(太部、かご(りんご、なし、みかん))を表現し
たときの概念図を示す。この方式の最大の特徴は、メモ
リセルを確保する単位が固定長となっているため、未使
用領域が連続頼切になくても良い点にある。すなわち、
ガーベージコレクシ冒ンにより使用済メモリセルを回収
する作業は不要な固定領鯖(2進木リストでは2連続の
メモリセル)をポインタで結ぶだけでよい。
FIG. 1 shows a conceptual diagram when expressing a structure (fat section, basket (apple, pear, orange)) using a binary tree list cell 10. The greatest feature of this method is that the unit for securing memory cells is a fixed length, so there is no need for continuous unused areas. That is,
It is only necessary to connect fixed areas (two consecutive memory cells in a binary tree list) with a pointer, which does not require the work of collecting used memory cells by garbage collection.

しかしながら、固定長領域をポインタで接続する方式は
構造体の要素をアクセスする際のオーバーヘッドが大き
いという問題を持つ。例えば、構造体のn番目の要素を
アクセスするためにはポインタをn回辿らねばならず、
メモリアクセスネックの要因となる。
However, the method of connecting fixed-length areas with pointers has the problem of large overhead when accessing the elements of the structure. For example, to access the nth element of a structure, the pointer must be traced n times,
This causes memory access bottlenecks.

前記方式の欠点を解決する別の方式としては、構造体の
要素を連続領域に並ぺ、各要素へのアクセスをヘッダ部
からのオフセットで行う方式が知られている。第2図は
この方式による構造体持つ(太部、かご(りんご、なし
、みかん))を表現する紘念図である。第2図において
、20は′!44造体名領域、2工は要素数領斌、22
は構造体ヘッダ領域、23はデータ領域を表わす。
As another method for solving the drawbacks of the above method, a method is known in which the elements of the structure are arranged in a continuous area and each element is accessed by offset from the header section. Figure 2 is a diagram representing the structure of this method (fat section, basket (apple, pear, tangerine)). In Figure 2, 20 is '! 44 structure name area, 2nd element number area, 22
23 represents a structure header area, and 23 represents a data area.

この方式では、構造体は構造件名と要素数から構成され
る横遺体ヘッダ領域22と構造体の各要素を格納するデ
ータ領域23が連続領域に割り当てられている。したが
って、構造体を要素として含むときは構造体ヘッダ領域
22へのポインタをを素とすればよい。また、要素への
アクセスは構造体ヘッダ領域22からのオフセットを用
いて高速に行うことができる。
In this method, the structure has a horizontal body header area 22 consisting of a structure subject and the number of elements, and a data area 23 for storing each element of the structure, which are allocated as continuous areas. Therefore, when including a structure as an element, the pointer to the structure header area 22 may be used as the element. Furthermore, elements can be accessed at high speed by using offsets from the structure header area 22.

しかしながら、この方式はガーベージフレクシ冒ンのオ
ーバーヘッドが太きいという問題点を持つ。すなわち、
この方式では構造体は可変長の連続領域に格納される必
要がある。
However, this method has a problem in that the overhead of garbage flexing is large. That is,
This method requires structures to be stored in continuous areas of variable length.

また、構造体の性資上1つの構造体を複数個の構造体が
共有する可能性がありうる。
Further, due to the property of the structure, there is a possibility that one structure may be shared by a plurality of structures.

第3図(1)、(2)は構造体Aと構造体Cが構造体B
を共有しているときのガーベージコレクシロンによるヒ
ープ領域の遷移を示す概念図である。第3図において、
30はヒープメモリ、31は使用中の構造体の領域、3
2は使用済の構造体の領域を示す。また、第3図(1)
はガーベージコレクシ、ンを行う前のヒープメモリの状
態、第3図(2)はガーベージコレクシ璽ンを行った後
のヒープメモリの状態を表わす。この方式圧よるガーベ
ージコレクシ四ンは次のようKして実現される。始めに
、現在イカ用中の構造体に印をつける。これは次のアル
ゴリズムにより、川、在使用中のスタックから直接およ
び間接に参照される構造体に印をつけることにより実籾
される。
In Figure 3 (1) and (2), structure A and structure C are connected to structure B.
FIG. 3 is a conceptual diagram showing the transition of a heap area due to garbage collection when sharing a heap area. In Figure 3,
30 is heap memory, 31 is the area of the structure in use, 3
2 indicates the area of the used structure. Also, Figure 3 (1)
represents the state of the heap memory before performing garbage collection, and FIG. 3(2) represents the state of heap memory after performing garbage collection. Garbage collection according to this method is realized as follows. First, mark the structure currently being used for squid. This is accomplished by marking structures that are directly and indirectly referenced from the stack in use by the following algorithm.

(1)スタックより指されろ全ての構造体について(2
)の処理を行う。
(1) For all structures pointed to from the stack (2
).

(2)s遺体に使用中の印がすでに付いていれば何もせ
ず、ついていなければ、前記構造体に使用中の印を付け
、前記構造体が要素としてさらに構造体を含むときはy
素となっている全ての構造体について(2)の処理を繰
り返す。
(2) If the body is already marked as in use, do nothing; if not, mark the structure as in use, and if the structure contains further structures as elements, y
Repeat the process (2) for all elementary structures.

上記のアルゴリズムで使用中の印が付けられなかった構
造体は使用済の領域として回収できる。
Structures that are not marked as in use by the above algorithm can be reclaimed as used space.

しかしながら、前記固定領域を用いた構造体実現方式の
ように単に使用済の領域をポインタで結ぶだけでは、次
に新しい構造体の領域として連続領域を確保することが
できない。したがって、未使用領域を連続領域上に確保
するためには、第3図(1)、(2)に図示しであるよ
うに、使用中の構造体領域31をすpケートして使用済
領域32を集めなければならない。
However, simply connecting used areas with a pointer as in the structure implementation method using fixed areas does not ensure a continuous area as the area for the next new structure. Therefore, in order to secure an unused area on a continuous area, as shown in FIGS. I have to collect 32.

本方式の問題点は構造体をリロケートする際にリロケー
トした構造体を指すポインタを全て書き換えねばならな
い点にある。
The problem with this method is that when relocating a structure, all pointers pointing to the relocated structure must be rewritten.

本発明の目的は、上記従来方式の問題点を解決し、要素
へのアクセスが高速で、かつ、ゴーベージフレクシロン
時の構造体のり1ケーシヲンのオーバーヘッドが最小と
なるような構造体の実現を可能にする構造体メモリ回収
方式を提供するととKある。
The purpose of the present invention is to solve the problems of the conventional method described above, and to realize a structure in which access to elements is fast and the overhead of one casion of the structure at the time of gouvage flexion is minimized. K provides a structure memory recovery method that makes it possible.

以上の目的は、構造体のエン)IJとなる固定長のヘッ
ダ部と構造体の各要素を蓄積する可変長のデータ部から
構成される構造体に対し、前記構造体のヘッダ部を蓄積
するヘッダメモリと、前記構造体のデータ部を連続領域
に@積する2つのヒープメモリと、前記2つのヒープメ
モリのうちいずれか一方のヒープメモリを構造体のデー
タ部蓄積領域として使用しているときに、新たな構造体
のデータ部を蓄積する連続領域が確保できなくなると、
前記ヘッダメモリに蓄積されている構造体のヘッダ部の
うち現在使用中のヘッダ部に対応するデータ部を他方の
ヒープメモリの連続領域に移し、以降、他方のヒープメ
モリを構造体のデータ部蓄積領域として使用する動作を
行う構造体メモリ管理ユニ、・トを備えている構造体メ
モリ回収方式により達成される。
The above purpose is to store the header part of the structure in a structure consisting of a fixed length header part which becomes the IJ of the structure and a variable length data part which stores each element of the structure. When using a header memory, two heap memories that multiply the data part of the structure into a continuous area, and one of the two heap memories as the storage area for the data part of the structure. When it becomes impossible to secure a continuous area to store the data part of a new structure,
Among the header parts of the structure stored in the header memory, the data part corresponding to the header part currently in use is moved to a continuous area of the other heap memory, and from then on, the data part of the structure is stored in the other heap memory. This is achieved by a structure memory recovery method that includes a structure memory management unit that performs the operation of using the memory as an area.

次に本発明の具体的実施例について述べる。Next, specific examples of the present invention will be described.

第4図は本発明の実施例の1つである構造体メモリ回収
装置のブロック図である。図において、110はへラダ
メモ!+、111はマークピット領域、112は構造体
温領域、113は要素数領域、114は要素を格納する
データ領域へのポインタ領域である。また、120,1
21は同−論理アドレス空間を持つヒープメモリであり
、122は使用中の構造体のデータ領域、123は使用
済の構造体のデータ領域、124は未使用領域で、これ
ら122〜124はヒープメモリ120および121の
うち現在使用中のいずれか一方のメモリ上に許かわる。
FIG. 4 is a block diagram of a structure memory recovery device which is one of the embodiments of the present invention. In the diagram, 110 is a memo! +, 111 is a mark pit area, 112 is a structural body temperature area, 113 is an element number area, and 114 is a pointer area to a data area in which elements are stored. Also, 120,1
21 is a heap memory having the same logical address space, 122 is a data area for structures in use, 123 is a data area for used structures, and 124 is an unused area; these 122 to 124 are heap memories. The memory of either memory 120 or 121 that is currently in use will be replaced.

さらに、130は構造体メモリ管理ユニットであり、1
31は現在使用中のヒープメモリを指すヒープメモリス
イッチ、132は未使用領域124の先頭のアドレスを
示す先頭アドレスレジスタ、133は未使用領域124
の終嬬アドレスレジスタである。150はプローグを実
行するのに使用さ第1る情報を蓄積するスタックメモリ
である。そして、構造体メモリ管理ユニット130け前
記ヘッダメモリ110.前記ヒープメモリ120゜12
1を管理し、かつ、前記スタックメモリ150に格納さ
れている構造体ヘッダへのポインタから現在使用中の構
造体のマーキングを指示する■り能を有するユニットを
表わし、140は前f構造体メモリ管理ユニット130
.前記スタックメモリ150および図示されていない外
部の処理ユニットを結合する内部バスを表わす。
Furthermore, 130 is a structure memory management unit;
31 is a heap memory switch that indicates the heap memory currently in use; 132 is a start address register that indicates the start address of the unused area 124; and 133 is the unused area 124.
is the final address register of . 150 is a stack memory that stores primary information used to execute the prologue. The structure memory management unit 130 includes the header memory 110 . Said heap memory 120°12
1 and has the ability to instruct the marking of the structure currently in use from the pointer to the structure header stored in the stack memory 150, and 140 represents the previous f structure memory. Management unit 130
.. It represents an internal bus that couples the stack memory 150 and an external processing unit (not shown).

本実於例ではマークピット領域111に1ビツト、構造
体温領域112に11ビツト、要素数領域113に8ビ
ツト、ポインタ領域114に16ビツト用意(9) している。また、ヘッダメモリ110ば9KB、ヒープ
メモリ120,121はそれぞれ4ビツト中のタグビッ
トを含む20ビツト中128KBを用意している。
In this example, 1 bit is prepared in the mark pit area 111, 11 bits in the structural body temperature area 112, 8 bits in the number of elements area 113, and 16 bits in the pointer area 114 (9). Further, the header memory 110 has 9 KB, and the heap memories 120 and 121 each have 128 KB out of 20 bits including the tag bit out of 4 bits.

したがって、本実施例では得大256個の要素を持つ構
造体を2000個取り扱うことができる。
Therefore, in this embodiment, 2000 structures each having a maximum of 256 elements can be handled.

また、構造体メモリ管理ユニット130は例えば市販の
16ビツトマイクロプロセツサと4KBの高速メモリI
Cから構成されろ。さらに、前記構造体メモリ管理ユニ
ット130は内部にヒープメモリスイッチ131として
1ビツトのフリップフロップ、および、光端アドレスレ
ジスタ132.終端アドレスレジスタ133として16
ビツト巾の2つのレジスタを備えている。スタックメモ
リ150は16ビツト巾の32KBのメモリで構成“さ
れる。
In addition, the structure memory management unit 130 may include, for example, a commercially available 16-bit microprocessor and a 4KB high-speed memory I
It is composed of C. Further, the structure memory management unit 130 includes a 1-bit flip-flop as a heap memory switch 131, and an optical end address register 132. 16 as the terminal address register 133
It has two bit-width registers. The stack memory 150 is composed of 32 KB of 16 bit wide memory.

本発明によれば、全てのa遺体は構造体ヘッダを介して
アクセスされるため、構造体のデータ領域を指すポイン
タは高々1つである。したがってデータ部をリロケート
してもポインタの書き換えは構造体ヘッダのポインタ部
のみを変更すれば良(10) く、すpケート0オーバヘッドを大巾に減少させること
かできる、また、構造体ヘッダ部は固定畏さらに、デー
タ領域のりpケートは2つのヒープ細繊を使って高速に
処理することが可能であり、かつ2つのヒープ1i’i
Vは同一のアドレス空間上に置かれているので、構造体
ヘッダのポインタ部のビット巾は片方のヒープ細繊を指
せるだけあればよい。
According to the present invention, all a bodies are accessed via the structure header, so there is at most one pointer pointing to the data area of the structure. Therefore, even if the data part is relocated, rewriting the pointer only needs to change the pointer part of the structure header (10), which can greatly reduce the overhead of the structure header. In addition, data area partitions can be processed at high speed using two heaps, and two heaps 1i'i
Since V are placed in the same address space, the bit width of the pointer part of the structure header only needs to be enough to point to one heap file.

次に本実施例での構造体メモリ回収方式を図を参照しつ
つ説明する。
Next, the structure memory recovery method in this embodiment will be explained with reference to the drawings.

第5図は本実施例における構造体メモリ回収方式を説明
する概念図である。ただし、本実施例ではマークビット
順接111が′1′のヘッダは使用中であることを表わ
し、ヒープメモリスイッチ131が/ O/のときはヒ
ープメモリ120が使用中であることを ヒープメモリ
スイッチ131が′1′のときはヒープメモリ121が
使用中であることを示す。
FIG. 5 is a conceptual diagram illustrating the structure memory recovery method in this embodiment. However, in this embodiment, a header in which the mark bit order 111 is '1' indicates that the header is in use, and when the heap memory switch 131 is /O/, the heap memory switch 131 indicates that the heap memory 120 is in use. When 131 is '1', it indicates that heap memory 121 is in use.

構造体が全く定義されていない状態では全ての(11) 構造体ヘッダのマークピット領域111の値は70′で
あり、ヒープメモリスイッチ131は′0′を先端アド
レスレジスタ132はヒープメモリ120の先端アドレ
スを、終端アドレスレジスタ133はヒープメモリ12
0の終端のアドレスを指している。
When no structure is defined at all, the value of the mark pit area 111 of all (11) structure headers is 70', and the heap memory switch 131 is set to '0', and the tip address register 132 is set to the tip of the heap memory 120. The end address register 133 is the heap memory 12
It points to the end address of 0.

図示されていない外部の処理ユニット(例えばプロログ
プロセッサ)から構造体メモリ管理ユニッ)130に新
しく構造体を作成するように要求されると構造体メモリ
管理ユニッ) 130は次のように動作する。
When the structure memory management unit 130 is requested to create a new structure from an external processing unit (for example, a prolog processor, not shown), the structure memory management unit 130 operates as follows.

例えば、構造体かと(りんご、なし、みかん)をヒープ
上に置(場合を考える。はじめに、先端アドレスレジス
タ132の値に要素数3を加え、終端アドレスレジスタ
133の値を越えたか否かを判定する。もし、越えてい
なければ、ヘッダメモリ110からマークビット111
が′0′のヘッダ領域を1つ選び、前記ヘッダ領域の構
造体ヘッダ112に構造体毛Iかご′を表わす値を代入
し、要素数領域113に要素数3を代入し、ポインタ領
域114に現在先端アドレスレジスタ132が指してい
るアト02) レスを代入し、先端アドレスレジスタ132のアドレス
を1ずつ増やしながら、前記$造林の要素′りんご′、
′なし′、′みかん′を表わす値をヒープメモリ120
に格納し、前記ヘッダ領域のアドレスを構造体のアドレ
スとして外部の処理ユニットに返す。
For example, consider the case where structures (apples, pears, oranges) are placed on the heap. First, add the number of elements 3 to the value of the end address register 132, and determine whether the value exceeds the value of the end address register 133. If it does not exceed the mark bit 111 from the header memory 110.
Select one header area where is '0', assign a value representing the structure I basket to the structure header 112 of the header area, assign the number of elements 3 to the element number area 113, and set the current value to the pointer area 114. Assigning address 02) pointed to by the tip address register 132 and incrementing the address of the tip address register 132 by 1, the $ afforestation element 'apple',
The values representing 'None' and 'Orange' are stored in the heap memory 120.
and returns the address of the header area to the external processing unit as the address of the structure.

構造体の値としては、構造体ヘッダの値がアドレスとし
て返されるので、構造体6持つ(太部、かご(りんご、
なし、みかん))′のように構造体を要素として含む構
造体は、第5図に図示されるように、構造体ヘッダへの
ポインタをデータ領竣に格納することになる。
As the value of the structure, the value of the structure header is returned as the address, so it has 6 structures (fat, basket, apple,
A structure that includes a structure as an element, such as None, Orange))', stores a pointer to the structure header in the data area, as shown in FIG.

第5図ばさらに構造体 持つ(花子、かご(りんご、なし1.I/かん))が構
造体 かご(りんご、なし、みかん) を共有し、かつ、スタックメモリ150からは構造体 持つ(太部、かご(りんご、なし、みかん))と構造体 (13) 持つ(花子、かご(りんご、なし、みかん))のみが指
されている状態を表わす。
In Figure 5, the structure basket (Hanako, basket (apple, pear 1.I/can)) shares the structure basket (apple, pear, orange), and the stack memory 150 has a structure (thickness). Part, basket (apple, pear, orange)) and structure (13) Represents a state in which only the holding (hanako, basket (apple, pear, orange)) is pointed.

このような状態で、さらに、構造体 人間(太部、花子) を追加する。In this state, furthermore, the structure Human (Abe, Hanako) Add.

構造体メモリ管理ユニット130は同様にして、先端ア
ドレスレジスタ132の値に要素数2を足した値と終端
アドレスレジスタ133の値を比較するが、もし、終端
アドレスレジスタ133の値の方が小さげれば、次に述
べるガーベージコレクシロンのプロセスを$+!III
J する。ガーベージフレクシヲンが起動されると、ば
じめにマークビット111の値を全て/Q/にセットす
る。次にスタックメモリ150に置かれている各構造体
ヘッダに対して次のアルゴリズムに従って使用中構造体
ヘッダのマーキングを行う。
Similarly, the structure memory management unit 130 compares the value of the end address register 132 plus the number of elements 2 and the value of the end address register 133, but if the value of the end address register 133 is smaller. If so, the garbage collection process described below will be $+! III
J. When the garbage flexion is activated, all the values of mark bits 111 are first set to /Q/. Next, each structure header placed in the stack memory 150 is marked as an in-use structure header according to the following algorithm.

(1)マークビット111を/1′にセットした後、ポ
インタ114が指すアドレスから要素数だけサーチし、
構造体ヘッダを値とする要素に対して(2)の操作を行
う。
(1) After setting the mark bit 111 to /1', search for the number of elements from the address pointed to by the pointer 114,
Perform the operation (2) on the element whose value is the structure header.

(14) (2)対応する構造体ヘッダのマークビット111の値
が′1′なら/1町もせず、′0′ならば、その構造体
ヘッダに対して(1)の処理を繰り返す。
(14) (2) If the value of the mark bit 111 of the corresponding structure header is '1', the process of (1) is repeated for the structure header.If it is '0', the process (1) is repeated for that structure header.

この結果ヘッダメモリIIOにおいて、現在使用中の構
造体ヘッダのマークピット領域111のみが勺′にセッ
トされる。
As a result, in the header memory IIO, only the mark pit area 111 of the structure header currently in use is set to ''.

次に、先端アドレスレジスタ132の値をヒープメモリ
121の先頭アドレスにセットし、次のアルコリズムに
従って使用中のデータ領域122のリロケーシ四ンを行
う。
Next, the value of the leading address register 132 is set to the leading address of the heap memory 121, and the data area 122 in use is relocated according to the following algorithm.

(1)ヘッダメモリ110の各構造体ヘッダに対し、マ
ークピット領域の値が′1′ならば(2)の処理を行う
。全ての構造体ヘッダについて処理したら(3)の処理
を行う。
(1) For each structure header in the header memory 110, if the value of the mark pit area is '1', process (2). Once all structure headers have been processed, process (3) is performed.

(2)構造体ヘッダのポインタ領域114の指すアドレ
スから前記アドレスに要素数値域110の値を加えたア
ドレスまでのヒープ領域120の内容を先端アドレスレ
ジスタ132の指すアドレスからヒープ領域121の連
続領域にフビーし、前記先端アドレスレジスタ132の
値に前記要素数領岐110の飴を(15) 加える。
(2) The contents of the heap area 120 from the address pointed to by the pointer area 114 of the structure header to the address plus the value of the element value area 110 are transferred from the address pointed to by the tip address register 132 to a continuous area of the heap area 121. Then, the candy of the number of elements branch 110 is added to the value of the tip address register 132 (15).

(3)  ヒープメモリスイッチ131の値ヲ′1′ニ
セットし、構造体のデータ格納領域としてヒープメモリ
121を使用していることを指示するようにする。
(3) Set the value of the heap memory switch 131 to '1' to indicate that the heap memory 121 is being used as a data storage area for the structure.

第6図は前記アルゴリズムによりリロケーシ冒ンを行っ
た後の状態を示す概念図である。リロケーシヲンにより
未使用状態にあったデータ領域が圧縮されるので未使用
領域124が連続領域として得られろ。また、ヘッダメ
モリ110においても使用済の構造体ヘッダのマークピ
ット領域の値は′O′に戻されるので前記ヘッダの領域
を再使用することが可能となる。
FIG. 6 is a conceptual diagram showing the state after relocation is performed using the algorithm. Since the unused data area is compressed by relocation, the unused area 124 can be obtained as a continuous area. Also, in the header memory 110, the value of the mark pit area of the used structure header is returned to 'O', so that the header area can be reused.

後は通常の場合と同様にして、構造体の追加を行えば良
い。ただし、ガーベージコレクシヮンを行った後でも必
要なデータ領域およびヘッダ領域が確保できないときは
エラーメツセージを出力して処理を中断する。
After that, just add the structure as you normally would. However, if the necessary data area and header area cannot be secured even after garbage collection, an error message is output and processing is interrupted.

さらに、ヒープメモリ121の領域が足りなくなったと
きは、同様にしてヒープメモリ121上の使用中のデー
タ領域をヒープメモリ120にリロケー(16) トし、ヒープメモリスイッチ131を′0′に切り換え
れげpい。
Furthermore, when the heap memory 121 runs out of space, the data area in use on the heap memory 121 is similarly relocated to the heap memory 120 (16), and the heap memory switch 131 is set to '0'. Burp.

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

第1図は構造体を固定@斌を使って実現したときの一例
を示す概念図、第2図は構造体を可り長の連続領域を使
って実現したときの一例を示す概念図、第3図は構造体
を可変長の連続領−を使って実現したときのガーベージ
コレクシ四ンの一例を示す概念図、第4図は本発明の一
実施例であり構造体メモリ回収装置のブpツク図である
。また第5図、第6図は本発明のガーページコレクシ冒
ン方式を説明する概念図である。 図において、20は構造体者q!L埴、21は要素数値
域、22は構造体のヘッダ領域、23は構造体のデータ
領域、30はヒープメモリ、31は使用中の構造体の領
域、32は使用済の構造体の領域を表わす、1 また、110は本発明の一実施例である構造体処理装置
のヘッダメモリ、111はマークビット411、(17
) 112は構造体水領域、113は′g素数領域、114
データ領竣へのポインタ領域、120は第1のヒープメ
モリ、121は第2のヒープメモリ、122は使用中の
データ領域、123は使用済のデータ領域、124は未
使用細波、130は構造体メモリ管理ユニット、131
はヒープメモリスイッチ、132は先端アドレスレジス
タ、133は終端アドレスレジスタ、140は内部デー
タバス、150はスタックメモリな表わ(18) 手続補正書(自発) 特許庁長官 殿 1、事件の表示   昭和58年 特許 願第0330
65号2、発明の名称  構造体メモリ回収方式3、補
正をする者 事件との関係       出 願 人東京都)巷区芝
五丁目33番1号 (423)   日本電気株式会社 代表者 関本忠弘 4、代理人 〒108  東京都港区芝五丁目37番8号 住友三田
ビル(連絡先 日本電気株式会社特許部) 5、補正の対象 明細書の特許請求の範囲の欄 6、補正の内容 特許請求の範囲を別紙のとおり補正する〇(別紙) 特許請求の範囲 構造体のエン) IJとなる固定長のヘッダ部と構造体
の各要素を蓄積する可変長のデータ部から構成される構
造体に対し、前記構造体のヘッダ部を蓄積するヘッダメ
モリと、前記構造体のデータ部を連続領域に蓄積する2
つのヒープメモリと、前記2つのヒープメモリのうちい
ずれか一方のヒープメモリを構造体のデータ部蓄積領域
として使用しているときに、新たな構造体のデータ部を
蓄積する連続領域が確保できなくなると、前記ヘッダメ
モリに蓄積されている構造体のヘッダ部のうち現在使用
中のヘッダ部に対応するデータ部を他方のヒープメモリ
の連続領域に移し、以降、他方のヒープメモリを構造体
のデータ部蓄積領域として使用する動作を行う構造体メ
モリ管理ユニットを備えていることを特徴とする構造体
メモリ回収方式。 −・了1.パ 315−
Figure 1 is a conceptual diagram showing an example of realizing a structure using a fixed @bin, Figure 2 is a conceptual diagram showing an example of realizing a structure using a continuous region of considerable length, Figure 3 is a conceptual diagram showing an example of garbage collection when a structure is realized using a continuous area of variable length, and Figure 4 is an example of the structure memory collection device according to the present invention. This is a diagram. Further, FIGS. 5 and 6 are conceptual diagrams explaining the Garpage correction method of the present invention. In the figure, 20 is a structure person q! 21 is the element value area, 22 is the header area of the structure, 23 is the data area of the structure, 30 is the heap memory, 31 is the area of the structure in use, and 32 is the area of the used structure. In addition, 110 is a header memory of a structure processing device which is an embodiment of the present invention, 111 is a mark bit 411, (17
) 112 is the structure water region, 113 is the 'g prime number region, 114
Pointer area to the data area, 120 is the first heap memory, 121 is the second heap memory, 122 is the data area in use, 123 is the used data area, 124 is the unused wavelet, 130 is the structure memory management unit, 131
represents the heap memory switch, 132 is the tip address register, 133 is the end address register, 140 is the internal data bus, and 150 is the stack memory. Year Patent Application No. 0330
No. 65 No. 2, Name of the invention Structure memory recovery method 3, Relationship with the amended person's case Applicant 5-33-1 Shiba, Iwa-ku, Tokyo (423) NEC Corporation Representative Tadahiro Sekimoto 4; Agent address: Sumitomo Sanda Building, 37-8 Shiba 5-chome, Minato-ku, Tokyo 108 (Contact address: NEC Corporation Patent Department) 5. Scope of claims of the specification to be amended, column 6, Contents of the amendment Correct the range as shown in the attached sheet 〇 (Attachment) Claims Structure En) For a structure consisting of a fixed-length header section that becomes IJ and a variable-length data section that stores each element of the structure. , a header memory that stores the header part of the structure, and 2 that stores the data part of the structure in a continuous area.
When one heap memory and one of the two heap memories are used as the storage area for the data part of a structure, it becomes impossible to secure a continuous area to store the data part of a new structure. Then, among the header parts of the structure stored in the header memory, the data part corresponding to the header part currently in use is moved to a contiguous area of the other heap memory, and from then on, the data of the structure is transferred to the other heap memory. A structure memory recovery method characterized by comprising a structure memory management unit that operates to use the structure memory as a partial storage area. -・Complete 1. Pa315-

Claims (1)

【特許請求の範囲】[Claims] 構造体のエントリとなる固定長のヘッダ部と構造体の各
要素を蓄積する可変長のデータ部から構成される構造体
に対し、前記構造体のヘッダ部を蓄積するヘッダメモリ
と、前記構造体のデータ部を連続領域に蓄積する2つの
ヒープメモリと、前記2つのヒープメそりのうちいずれ
か一方のヒープメモリを構造体のデータ部蓄積領域とし
て使用しているときK、新たな構造体のデータ部を蓄積
する連続領域が確保できなると、前記ヘッダメモリに蓄
積されている構造体のヘッダ部のうち現在使用中のヘッ
ダ部に対応するデータ部を他方のヒープメモリの連続領
域に移し、以降、他方のヒープメモリを構造体のデータ
部蓄積領域として使用する動作を行う構造体メモリ管理
ユニットを備えていることを特徴とする構造体メモリ回
収方式。
For a structure consisting of a fixed-length header part that is an entry of the structure and a variable-length data part that stores each element of the structure, a header memory that stores the header part of the structure, and a header memory that stores the header part of the structure, and a When two heap memories are used to store the data part of a structure in a continuous area, and one of the two heap memories is used as the storage area for the data part of a structure, the data of the new structure is When a contiguous area for storing the data is secured, the data part corresponding to the header part currently in use among the header parts of the structure stored in the header memory is moved to a contiguous area in the other heap memory, and from then on, A structure memory recovery method characterized by comprising a structure memory management unit that operates to use the other heap memory as a data storage area of a structure.
JP3306583A 1983-03-01 1983-03-01 Structure memory recovery system Pending JPS59158459A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3306583A JPS59158459A (en) 1983-03-01 1983-03-01 Structure memory recovery system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3306583A JPS59158459A (en) 1983-03-01 1983-03-01 Structure memory recovery system

Publications (1)

Publication Number Publication Date
JPS59158459A true JPS59158459A (en) 1984-09-07

Family

ID=12376329

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3306583A Pending JPS59158459A (en) 1983-03-01 1983-03-01 Structure memory recovery system

Country Status (1)

Country Link
JP (1) JPS59158459A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8352700B2 (en) 2009-11-04 2013-01-08 Fujitsu Limited Memory management program and apparatus

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8352700B2 (en) 2009-11-04 2013-01-08 Fujitsu Limited Memory management program and apparatus

Similar Documents

Publication Publication Date Title
EP0127753B1 (en) Method for executing a distribution sort
Schorr et al. An efficient machine-independent procedure for garbage collection in various list structures
CN109104876A (en) A kind of arithmetic unit and Related product
US7249235B2 (en) Architecture for a scalable and user-extensible heap dump analysis tool
JP2002506550A (en) Bounded pause garbage collection systems and methods including write barriers for source and destination instances of partially relocated objects
JP2003044335A (en) Digital tree data structure
JPS6234257A (en) Computer system
Haddon et al. A compaction procedure for variable-length storage elements
US6874070B2 (en) System and method for memory interleaving using cell map with entry grouping for higher-way interleaving
JPS59158459A (en) Structure memory recovery system
WO1990007151A1 (en) Data management system
US20050268053A1 (en) Architecture for a scalable heap analysis tool
Fujimoto et al. The roll back chip: Hardware support for distributed simulation using Time Warp
JPS59158460A (en) Structure memory recovery system
CN111552651A (en) Hybrid memory management method for lightweight operation system of Internet of things terminal
TWI284806B (en) Method for managing external memory of a processor and chip for managing external memory
Harland et al. OBJEKT—a persistent object store with an integrated garbage collector
JPS6027962A (en) Structure memory control system
Srisa-An et al. Scalable hardware-algorithm for mark-sweep garbage collection
JP2001022640A (en) Memory managing method
US20020078078A1 (en) Method for recovering a database provided with disk back-up
Ribeiro et al. Distributed parallel generation of pat arrays
RU2060537C1 (en) Device for calculation of disjunctive logical determinant
Lindstrom Algorithms for list structure condensation
JPH0363094B2 (en)