JPH05289867A - Multibranch branching control system - Google Patents

Multibranch branching control system

Info

Publication number
JPH05289867A
JPH05289867A JP11981792A JP11981792A JPH05289867A JP H05289867 A JPH05289867 A JP H05289867A JP 11981792 A JP11981792 A JP 11981792A JP 11981792 A JP11981792 A JP 11981792A JP H05289867 A JPH05289867 A JP H05289867A
Authority
JP
Japan
Prior art keywords
value
key
branch
entry
variable
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
JP11981792A
Other languages
Japanese (ja)
Inventor
Keiichi Yamazaki
啓一 山崎
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
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 filed Critical NEC Corp
Priority to JP11981792A priority Critical patent/JPH05289867A/en
Publication of JPH05289867A publication Critical patent/JPH05289867A/en
Pending legal-status Critical Current

Links

Landscapes

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

Abstract

PURPOSE:To set a processing time for selecting a branch destination to the same as the case when the number of branch destinations is small even in the case its number is large, in the multibranch branching control system of an information processor. CONSTITUTION:In a main storage device 2, a hash table 31 containing a key part 32 and an address part 33 is stored. In the key part 32, a value of a variable is stored in an entry shown by a hash function value corresponding to its value. In each entry of the address part 33, an address of a branch destination shown by the value of the variable stored in each entry of the corresponding key part 32 is stored. When the value of the variable for showing the branch destination at the time of execution is given, a calculating means 11 calculates the hash function value corresponding to the value of its variable, and a searching means 12 searches the hash table 31 based on a result of calculation, and derives an address of the branch destination. Accordingly, even in the case there are many branch destinations, the branch destination can be selected at a high speed.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は情報処理装置に於いて、
与えられた変数の値に基づいて分岐先を選択する多枝分
岐制御方式に関する。
The present invention relates to an information processing device,
The present invention relates to a multi-branch control method for selecting a branch destination based on the value of a given variable.

【0002】[0002]

【従来の技術】従来の情報処理装置に於ける多枝分岐制
御方式は、分岐先を選択するためのキーとなるデータが
与えられると、例えば、図7のフローチャートに示すよ
うに、与えられたデータと分岐先No.1〜No.nの
データとを逐次比較し (ステップS71−1〜S71−
n)、データが一致した分岐先No.i対応のアドレス
に分岐するようにしている (ステップS72−1〜S7
2−n)。
2. Description of the Related Art A conventional multi-branch branch control system in an information processing apparatus is provided with data as a key for selecting a branch destination, for example, as shown in the flowchart of FIG. Data and branch destination No. 1-No. n data is sequentially compared (steps S71-1 to S71-
n), the branch destination No. where the data match. i is branched to an address corresponding to i (steps S72-1 to S7)
2-n).

【0003】また、従来の情報処理装置に於ける多枝分
岐制御方式としては、この他にもコンパイル時に図8に
示すキー部81,アドレス部82から構成される表を作
成しておき、実行時に分岐先を選択するためのキーとな
るデータが与えられることにより、図9のフローチャー
トに示す処理を行なうというものもある。
In addition, as a multi-branch branch control method in a conventional information processing apparatus, in addition to this, a table including a key section 81 and an address section 82 shown in FIG. In some cases, the processing shown in the flowchart of FIG. 9 is performed by giving data as a key for selecting a branch destination.

【0004】即ち、コンパイル時に図8に示すように、
分岐先のデータkey1〜keynを内容とするキー部
81と、分岐先のデータkey1〜keynに対応した
分岐先アドレスA1〜Anを内容とするアドレス部82
とから構成される表を作成しておく。
That is, when compiling, as shown in FIG.
A key portion 81 having branch destination data key1 to keyn, and an address portion 82 having branch destination addresses A1 to An corresponding to the branch destination data keys1 to keyn.
Create a table consisting of and.

【0005】そして、実行時に分岐先を選択するための
キーとなるデータkeyが与えられると、図9のフロー
チャートに示すように、表のキー部81の先頭に格納さ
れているデータkey1と与えられたデータkeyとが
一致しているか否かを判断する (ステップS91,S9
2)。
When the data key serving as a key for selecting the branch destination at the time of execution is given, the data key1 stored at the head of the key portion 81 of the table is given as shown in the flowchart of FIG. It is determined whether or not the received data key matches (steps S91 and S9).
2).

【0006】そして、一致していると判断した場合は表
のアドレス部82の対応するエントリに格納されている
アドレスA1を分岐先アドレスとする (ステップS9
3)。
When it is determined that they match, the address A1 stored in the corresponding entry of the address section 82 of the table is set as the branch destination address (step S9).
3).

【0007】また、一致していないと判断した場合はキ
ー部81の全てのエントリの探索が終了したか否かを判
断する (ステップS94)。
If it is determined that they do not match, it is determined whether or not the search for all entries in the key portion 81 has been completed (step S94).

【0008】そして、全てのエントリの探索が終了した
と判断した場合はその処理を終了し、終了していないと
判断した場合は表の処理対象エントリを次のエントリに
した後 (ステップS95)、再び前述したと同様の処理
を行なう。
If it is determined that the search for all the entries has been completed, the processing is terminated, and if it is determined that the search has not been completed, the entry to be processed in the table is set to the next entry (step S95), The same processing as described above is performed again.

【0009】[0009]

【発明が解決しようとする課題】上述したように、従来
の多枝分岐制御方式は、キーとなるデータと分岐先のデ
ータとを逐次比較することにより、或いは表を順次探索
することにより、分岐先を選択するようにしているた
め、分岐先の数に比例して分岐先を選択するために必要
となる時間が増加するという問題があった。
As described above, according to the conventional multi-branch branching control system, the branching is performed by sequentially comparing the key data and the branch destination data, or by sequentially searching the table. Since the destination is selected, there is a problem that the time required to select the destination increases in proportion to the number of destinations.

【0010】本発明の目的は、分岐先の数が増加しても
分岐先を選択するための処理時間が増加することのない
多枝分岐制御方式を提供することにある。
It is an object of the present invention to provide a multi-branch branch control system in which the processing time for selecting branch destinations does not increase even if the number of branch destinations increases.

【0011】[0011]

【課題を解決するための手段】本発明は上記目的を達成
するため、与えられた変数の値に応じて分岐先を選択す
る情報処理装置の多枝分岐制御方式に於いて、コンパイ
ル時、ハッシュ関数を用いて変数の値及びその変数の値
に対応した分岐先がハッシュ関数値によって示されるエ
ントリに格納されたハッシュ表を作成し、実行時、前記
ハッシュ関数を用いて与えられた変数の値に対応するハ
ッシュ関数値を計算し、計算結果に基づいて前記ハッシ
ュ表から分岐先を得るようにしたものである。
In order to achieve the above object, the present invention provides a multi-branch control method of an information processing apparatus which selects a branch destination according to a value of a given variable, and a hash at compile time. The value of the variable and the branch destination corresponding to the value of the variable are created using the function to create a hash table stored in the entry indicated by the hash function value, and at the time of execution, the value of the variable given using the hash function. Is calculated, and the branch destination is obtained from the hash table based on the calculation result.

【0012】[0012]

【作用】コンパイル時にハッシュ関数を用いて変数の値
及びその変数の値に対応した分岐先がハッシュ関数値に
よって示されるエントリに格納されたハッシュ表を作成
しておく。
The hash table in which the value of the variable and the branch destination corresponding to the value of the variable are stored in the entry indicated by the hash function value is created at the time of compilation by using the hash function.

【0013】そして、実行時に変数の値が与えられる
と、ハッシュ関数値を計算し、その計算結果に基づいて
ハッシュ表から分岐先を得る。
When the value of the variable is given at the time of execution, the hash function value is calculated, and the branch destination is obtained from the hash table based on the calculation result.

【0014】[0014]

【実施例】次に本発明の実施例について図面を参照して
詳細に説明する。
Embodiments of the present invention will now be described in detail with reference to the drawings.

【0015】図1は本発明の実施例のブロック図であ
り、中央処理装置1と主記憶装置2とを含んでいる。
FIG. 1 is a block diagram of an embodiment of the present invention, which includes a central processing unit 1 and a main memory 2.

【0016】中央処理装置1は計算手段11と、探索手
段12と、分岐手段13とを含んでいる。尚、計算手段
11,探索手段12はマイクロプログラムによるファー
ムウェアによって実現される。このようにすることによ
り、機械語プログラムによって実行する場合に比較して
処理時間を短縮させることが可能になる。
The central processing unit 1 includes a calculating means 11, a searching means 12 and a branching means 13. The calculating means 11 and the searching means 12 are realized by firmware of a micro program. By doing so, the processing time can be shortened as compared with the case of executing by a machine language program.

【0017】図2は多枝分岐制御構造のソースプログラ
ムの一例を示した図であり、変数keyに与えられた値
に応じて異なる処理に分岐することを示している。即
ち、図2は変数keyに与えられた値が0,1,5,1
0,100,200,1000の場合はkey=0,k
ey=1,key=5,key=10,key=10
0,key=200,key=1000の処理に分岐
し、上記以外の値である場合は“それ以外”の処理に分
岐することを示している。
FIG. 2 is a diagram showing an example of a source program having a multi-branch branching control structure, and shows branching to different processing according to the value given to the variable key. That is, in FIG. 2, the values given to the variable key are 0, 1, 5, 1
In the case of 0, 100, 200, 1000, key = 0, k
ey = 1, key = 5, key = 10, key = 10
It indicates that the process branches to 0, key = 200, and key = 1000, and that if the value is other than the above, the process branches to “other”.

【0018】次に、本実施例の動作を説明する。Next, the operation of this embodiment will be described.

【0019】図2に示したソースプログラムのコンパイ
ル時、適当なハッシュ関数hash(x)を用いて図3
に示すようなハッシュ表31を作成する。
At the time of compiling the source program shown in FIG. 2, an appropriate hash function hash (x) is used to generate the program shown in FIG.
The hash table 31 as shown in FIG.

【0020】図3のハッシュ表31はハッシュ関数ha
sh(x)≡x mod 6(modは剰余演算を表
す)とすることにより作成したものであり、キー部32
とアドレス部33とから構成されている。
The hash table 31 of FIG. 3 is a hash function ha.
sh (x) ≡x mod 6 (mod represents a remainder operation), and the key unit 32
And an address section 33.

【0021】この場合、hash(x)=x mod
6であり、hash(0)=0,hash(1)=1,
hash(200)=2,hash(5)=5となるの
で、キー部32のindex=0のエントリには0が、
index=1のエントリには1が、index=2の
エントリには200が、index=5のエントリには
5が格納される。
In this case, hash (x) = x mod
6 and hash (0) = 0, hash (1) = 1,
Since hash (200) = 2 and hash (5) = 5, 0 is entered in the entry of index = 0 in the key part 32,
1 is stored in the entry of index = 1, 200 is stored in the entry of index = 2, and 5 is stored in the entry of index = 5.

【0022】また、hash(10)=hash(10
0)=hash(1000)=4であり、変数keyの
値が10,100,1000の時は衝突を起こすので、
キー部32のindex=4のエントリには10のみが
格納され、100はindex=4のエントリとポイン
タによってつながっているindex=6のエントリ
に、1000はindex=6のエントリとポインタに
よってつながっているindex=7のエントリに格納
される。
Also, hash (10) = hash (10
0) = hash (1000) = 4, and when the value of the variable key is 10, 100, 1000, a collision occurs, so
Only 10 is stored in the entry of index = 4 in the key part 32, 100 is connected to the entry of index = 6 by the pointer to the entry of index = 4, and 1000 is connected to the entry of the index = 6 by the pointer. It is stored in the entry of index = 7.

【0023】また、アドレス部33のindex=0の
エントリにはkey=0の処理に対応する分岐先のアド
レスが、index=1のエントリにはkey=1の処
理に対応する分岐先のアドレスが、index=2のエ
ントリにはkey=200の処理に対応する分岐先のア
ドレスが、index=4のエントリにはkey=10
の処理に対応する分岐先のアドレスが、index=5
のエントリにはkey=5の処理に対応する分岐先のア
ドレスが、index=6のエントリにはkey=10
0の処理に対応する分岐先のアドレスが、index=
7のエントリにはkey1000の処理に対応する分岐
先のアドレスが格納されている。
In the address section 33, the index = 0 entry has the branch destination address corresponding to the key = 0 processing, and the index = 1 entry has the branch destination address corresponding to the key = 1 processing. , Index = 2, the branch destination address corresponding to the key = 200 process, and index = 4 entry, the key = 10.
The address of the branch destination corresponding to the processing of is index = 5
Entry has a branch destination address corresponding to the processing of key = 5, and an entry having index = 6 has key = 10.
The branch destination address corresponding to the processing of 0 is index =
The entry of 7 stores the address of the branch destination corresponding to the processing of key 1000.

【0024】コンパイル時に作成された図3に示すハッ
シュ表31は実行時には図1に示すように、主記憶装置
2に格納され、中央処理装置1は実行時に変数keyの
値が与えられると、図4のフローチャートに示す処理を
行なう。
The hash table 31 shown in FIG. 3 created at the time of compilation is stored in the main memory 2 at the time of execution as shown in FIG. 1, and the central processing unit 1 is given the value of the variable key at the time of execution. The process shown in the flowchart of FIG.

【0025】先ず、中央処理装置1は計算手段11によ
りindex=hash(key)=key mod
6なる計算を行なう (ステップS41)。
First, in the central processing unit 1, the calculation means 11 causes index = hash (key) = key mod.
Calculation 6 is performed (step S41).

【0026】次いで、探索手段12により上記計算結果
に対応したハッシュ表31のキー部32のエントリを参
照し、そのエントリに格納されている値と与えられた変
数keyの値とが一致するか否かを判断する (ステップ
S42)。
Then, the search means 12 refers to the entry of the key part 32 of the hash table 31 corresponding to the above calculation result, and determines whether the value stored in the entry matches the value of the given variable key. It is determined whether or not (step S42).

【0027】そして、一致すると判断した場合は、探索
手段12は上記キー部32のエントリに対応するアドレ
ス部33のエントリに格納されているアドレスを分岐手
段13に渡し、そのアドレスに分岐させる (ステップS
43)。
When it is determined that they match, the searching means 12 passes the address stored in the entry of the address portion 33 corresponding to the entry of the key portion 32 to the branching means 13 and branches to that address (step S
43).

【0028】また、ステップS42で一致しないと判断
した場合は、探索手段12はステップS42で参照した
エントリとポインタによりつながっているキー部32の
エントリを探索し、与えられた変数keyの値が格納さ
れているエントリを探す (ステップS44)。
If it is determined in step S42 that they do not match, the searching means 12 searches the entry of the key portion 32 connected by the pointer to the entry referred to in step S42, and the value of the given variable key is stored. Search for the entry that has been made (step S44).

【0029】そして、与えられた変数keyの値と一致
する値が格納されているエントリがキー部32に存在す
る場合(ステップS45がYESの場合)は、探索手段
12は上記キー部32のエントリに対応するアドレス部
33のエントリに格納されているアドレスを分岐手段1
3に渡し、そのアドレスに分岐させる (ステップS4
6)。
If there is an entry in the key section 32 that stores a value that matches the value of the given variable key (YES in step S45), the searching means 12 causes the entry of the key section 32 to be performed. The address stored in the entry of the address part 33 corresponding to
3 and branches to that address (step S4
6).

【0030】また、存在しないと判断した場合はその旨
を分岐手段13に通知し、“それ以外”の処理のアドレ
スに分岐させる (ステップS47)。
When it is determined that the data does not exist, the branching means 13 is notified of that fact, and the address is branched to the address of "other" processing (step S47).

【0031】従って、与えられた変数keyの値が例え
ば200である場合は、ステップS41の計算結果は2
となり、ステップS42に於いてキー部32のinde
x=2のエントリが参照され、更にそのエントリに格納
されている値と与えられた変数keyの値2とが一致す
るか否かが判断される。本実施例の場合、キー部32の
index=2のエントリには200が格納されてお
り、ステップS42の判断結果がYESとなるので、ス
テップS43の処理が行なわれ、アドレス部33のin
dex=2のエントリに格納されているkey=200
の処理対応のアドレスへの分岐が行なわれる。
Therefore, when the value of the given variable key is, for example, 200, the calculation result of step S41 is 2
Then, in step S42, the inde of the key part 32
The entry of x = 2 is referred to, and it is further determined whether or not the value stored in the entry and the value 2 of the given variable key match. In the case of the present embodiment, 200 is stored in the entry of index = 2 of the key part 32, and the determination result of step S42 is YES. Therefore, the process of step S43 is performed, and the in
key = 200 stored in the entry of dex = 2
A branch is made to an address corresponding to the processing.

【0032】与えられた変数keyの値が0,1,1
0,5の場合も同様の処理が行なわれ、key=0,k
ey=1,key=10,key=5の処理対応のアド
レスへの分岐が行なわれる。
The value of the given variable key is 0, 1, 1
In the case of 0 and 5, the same processing is performed and key = 0, k
A branch is made to an address corresponding to the processing of ey = 1, key = 10, and key = 5.

【0033】また、与えられた変数keyの値が100
或いは1000の場合、即ちハッシュ関数値が4とな
り、変数keyの値が10の時のハッシュ関数値と衝突
を起こす場合は以下の処理が行なわれる。
The value of the given variable key is 100.
Alternatively, in the case of 1000, that is, when the hash function value becomes 4 and the value of the variable key collides with the hash function value of 10, the following processing is performed.

【0034】与えられた変数keyの値が例えば100
0の場合は、ステップS41の計算結果は4となり、ス
テップS42に於いてキー部32のindex=4のエ
ントリが参照され、更にそのエントリに格納されている
値と与えられた変数keyの値1000とが一致するか
否かが判断される。本実施例の場合、キー部32のin
dex=4のエントリには10が格納されており、ステ
ップS42の判断結果はNOとなるので、ステップS4
4に於いてポインタをたどって値1000が格納されて
いるキー部32のエントリを探索するという処理が行な
われ、index=7のエントリが探し出される。その
後、ステップS46の処理が行なわれ、アドレス部33
のindex=7のエントリに格納されているkey=
1000の処理対応のアドレスへの分岐が行なわれる。
The value of the given variable key is, for example, 100.
In the case of 0, the calculation result of step S41 is 4, the entry of index = 4 of the key part 32 is referred to in step S42, and the value stored in the entry and the value of the given variable key are 1000. It is determined whether and match. In the case of the present embodiment, in of the key unit 32
Since 10 is stored in the entry of dex = 4, and the determination result of step S42 is NO, step S4
In step 4, the pointer is traced to search the entry of the key part 32 in which the value 1000 is stored, and the entry of index = 7 is found. Thereafter, the process of step S46 is performed, and the address section 33
Key = stored in the index = 7 entry of
A branch is made to an address corresponding to 1000 processes.

【0035】与えられた変数keyの値が100の場合
も同様の処理が行なわれ、key=100の処理対応の
アドレスへの分岐が行なわれる。
When the value of the given variable key is 100, similar processing is performed, and branching is performed to the address corresponding to the processing of key = 100.

【0036】また、与えられた変数keyの値がハッシ
ュ表31のキー部32に格納されていない値の場合はス
テップS42,S45の判断結果が共にNOとなり、ス
テップS47の処理が行なわれる。
If the value of the given variable key is not stored in the key portion 32 of the hash table 31, the determination results of steps S42 and S45 are both NO, and the process of step S47 is performed.

【0037】ところで、上述した実施例ではハッシュ関
数が完全ハッシュ関数ではなかったが、プログラムに於
ける多枝分岐制御構造は図2に示すように、分岐先の数
と各分岐先対応の変数keyの値とが既知である場合が
多く、このような場合はハッシュ関数に完全ハッシュ関
数を選ぶことができる。
By the way, although the hash function is not a perfect hash function in the above-described embodiment, the multi-branch branch control structure in the program is, as shown in FIG. 2, the number of branch destinations and the variable key corresponding to each branch destination. In many cases, the value of and is known, and in such a case, a perfect hash function can be selected as the hash function.

【0038】図5は図2に示したソースプログラムのコ
ンパイル時に完全ハッシュ関数hash(x)≡x m
od 7を用いて作成したハッシュ表51を示してい
る。
FIG. 5 shows a complete hash function hash (x) ≡x m when the source program shown in FIG. 2 is compiled.
The hash table 51 created using od 7 is shown.

【0039】同図に示すように、ハッシュ表51はキー
部52とアドレス部53とから構成されている。
As shown in the figure, the hash table 51 is composed of a key portion 52 and an address portion 53.

【0040】この場合、hash(x)=x mod
7であり、hash(0)=0,hash(1)=1,
hash(100)=2,hash(10)=3,ha
sh(200)=4,hash(5)=5,hash
(1000)=6となるので、ハッシュ表51のキー部
52のindex=0〜index=6のエントリには
それぞれ0,1,100,10,200,5,1000
が格納される。
In this case, hash (x) = x mod
7 and hash (0) = 0, hash (1) = 1,
hash (100) = 2, hash (10) = 3, ha
sh (200) = 4, hash (5) = 5, hash
Since (1000) = 6, the entries of index = 0 to index = 6 of the key part 52 of the hash table 51 are 0, 1, 100, 10, 200, 5, 1000, respectively.
Is stored.

【0041】また、アドレス部53のindex0〜i
ndex6のエントリにはそれぞれ変数key=0の処
理に対応する分岐先のアドレス,変数key=1,変数
key=100,変数key=10,変数key=20
0,変数key=5,変数key=1000の処理に対
応する分岐先のアドレスが格納されている。
Further, the indexes 0 to i of the address section 53
In the entry of ndex6, the branch destination address corresponding to the processing of the variable key = 0, the variable key = 1, the variable key = 100, the variable key = 10, the variable key = 20.
The address of the branch destination corresponding to the processing of 0, variable key = 5, variable key = 1000 is stored.

【0042】コンパイル時に作成されたハッシュ表51
は実行時には主記憶装置2に格納され、中央処理装置1
は実行時に変数keyの値が与えられると、図6のフロ
ーチャートに示す処理を行なう。
Hash table 51 created at compile time
Are stored in the main memory 2 at the time of execution, and the central processing unit 1
When the value of the variable key is given at the time of execution, performs the processing shown in the flowchart of FIG.

【0043】変数keyの値が与えられると、中央処理
装置1は計算手段11により完全ハッシュ関数hash
(x)=x mod 7を用いてindex=hash
(key)なる計算を行なう (ステップS61)。
When the value of the variable key is given, the central processing unit 1 causes the calculation means 11 to calculate the complete hash function hash.
Using (x) = x mod 7, index = hash
The calculation of (key) is performed (step S61).

【0044】次に、中央処理装置1は探索手段12を用
いて上記計算結果に対応したハッシュ表51のキー部5
2のエントリを参照し、そのエントリに格納されている
値と与えられた変数keyの値とが一致するか否かを判
断する (ステップS62)。本実施例の場合、完全ハッ
シュ関数を用いてハッシュ表51を作成しているので、
与えられた変数keyの値が図2のソースプログラムに
記述されている変数keyの値である場合にはステップ
S62の判断結果は必ずYESとなる。
Next, the central processing unit 1 uses the search means 12 to search the key portion 5 of the hash table 51 corresponding to the above calculation result.
The second entry is referred to, and it is determined whether the value stored in the entry and the value of the given variable key match (step S62). In the case of this embodiment, since the hash table 51 is created using the complete hash function,
When the value of the given variable key is the value of the variable key described in the source program of FIG. 2, the determination result of step S62 is always YES.

【0045】そして、ステップS62の判断結果がYE
Sの場合、即ち与えられた変数keyの値が図2のソー
スプログラム中に記述されている変数keyの値である
場合は、検索手段12は上記キー部52のエントリに対
応するアドレス部53のエントリに格納されているアド
レスを分岐手段13に渡し、そのアドレスに分岐させる
(ステップS63)。
Then, the determination result of step S62 is YE.
In the case of S, that is, when the value of the supplied variable key is the value of the variable key described in the source program of FIG. 2, the search means 12 causes the address section 53 corresponding to the entry of the key section 52. The address stored in the entry is passed to the branching unit 13 and branched to that address.
(Step S63).

【0046】また、ステップS62の判断結果がNOの
場合は、探索手段12はその旨を分岐手段13に通知
し、“それ以外”の処理に分岐させる (ステップS6
4)。
If the decision result in the step S62 is NO, the searching means 12 notifies the branching means 13 to that effect and branches it to the "other" processing (step S6).
4).

【0047】従って、変数keyの値として図2のソー
スプログラムに記述されている値0,1,100,1
0,200,5,1000が与えられた場合は、ステッ
プS61の計算結果はそれぞれ0,1,2,3,4,
5,6となり、ステップS62に於いてキー部52のi
ndex=0,1,2,3,4,5,6のエントリに格
納されている値と与えられた変数keyの値とが一致す
ると判断され、ステップS63に於いてアドレス部53
のindex=0,1,2,3,4,5,6のエントリ
に格納されているアドレスへの分岐が行なわれる。この
ように、完全ハッシュ関数を使用することにより、ハッ
シュ関数値の衝突がなくなるので、分岐の際の選択処理
を単純化し、処理時間を短縮させることができる。
Therefore, as the value of the variable key, the values 0, 1, 100, 1 described in the source program of FIG.
When 0,200,5,1000 is given, the calculation results of step S61 are 0, 1, 2, 3, 4, respectively.
5 and 6, and in step S62, i of the key portion 52
It is determined that the values stored in the entries of ndex = 0, 1, 2, 3, 4, 5, 6 and the value of the given variable key match, and in step S63, the address part 53
Branch to the address stored in the entry of index = 0,1,2,3,4,5,6. As described above, by using the perfect hash function, the collision of the hash function values is eliminated, so that the selection processing at the time of branching can be simplified and the processing time can be shortened.

【0048】また、変数keyの値として、図2のソー
スプログラムに記述されていない値が与えられた場合
は、ステップS62の判断結果がNOとなり、ステップ
S64の処理が行なわれる。
If a value not described in the source program of FIG. 2 is given as the value of the variable key, the result of the determination in step S62 is NO, and the process of step S64 is performed.

【0049】また、図2のソースプログラムにdefa
ultの処理が記述されていない場合は、図6の破線で
囲んだ部分のステップS62,S64を省略することが
できる。
In addition, the source program of FIG.
If the ult processing is not described, steps S62 and S64 in the part surrounded by the broken line in FIG. 6 can be omitted.

【0050】[0050]

【発明の効果】以上説明したように、本発明は、情報処
理装置の多枝分岐制御方式にハッシング手法を用いたも
のであるので、分岐先を選択するための処理時間を分岐
先の数が多い場合でも分岐先が少ない場合と同じにする
ことができる。従って、本発明によれば分岐先が多い場
合でも、分岐先を高速に選択できる効果がある。
As described above, since the present invention uses the hashing method for the multi-branch branch control method of the information processing apparatus, the processing time for selecting the branch destinations depends on the number of branch destinations. Even if there are many branches, it can be the same as when there are few branches. Therefore, according to the present invention, even if there are many branch destinations, there is an effect that the branch destinations can be selected at high speed.

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

【図1】本発明の実施例のブロック図である。FIG. 1 is a block diagram of an embodiment of the present invention.

【図2】実施例に於いて実行するソースプログラムの一
部を示した図である。
FIG. 2 is a diagram showing a part of a source program executed in the embodiment.

【図3】ハッシュ関数を用いて作成したハッシュ表を示
す図である。
FIG. 3 is a diagram showing a hash table created using a hash function.

【図4】図3のハッシュ表を用いて分岐先を選択する際
の処理例を示すフローチャートである。
4 is a flowchart showing a processing example when selecting a branch destination using the hash table of FIG.

【図5】完全ハッシュ関数を用いて作成したハッシュ表
を示す図である。
FIG. 5 is a diagram showing a hash table created by using a perfect hash function.

【図6】図5のハッシュ表を用いて分岐先を選択する際
の処理例を示すフローチャートである。
6 is a flowchart showing a processing example when selecting a branch destination using the hash table of FIG.

【図7】従来の技術を説明するためのフローチャートで
ある。
FIG. 7 is a flowchart for explaining a conventional technique.

【図8】他の従来の技術を説明するための表である。FIG. 8 is a table for explaining another conventional technique.

【図9】図8の表を用いて分岐先を選択する際の処理例
を示すフローチャートである。
9 is a flowchart showing a processing example when selecting a branch destination using the table of FIG.

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

1…中央処理装置 2…主記憶装置 11…計算手段 12…探索手段 13…分岐手段 31,51…ハッシュ表 32,52,81…キー部 33,53,82…アドレス部 DESCRIPTION OF SYMBOLS 1 ... Central processing unit 2 ... Main memory device 11 ... Calculation means 12 ... Search means 13 ... Branching means 31, 51 ... Hash table 32, 52, 81 ... Key part 33, 53, 82 ... Address part

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 与えられた変数の値に応じて分岐先を選
択する情報処理装置の多枝分岐制御方式に於いて、 コンパイル時、ハッシュ関数を用いて変数の値及びその
変数の値に対応した分岐先がハッシュ関数値によって示
されるエントリに格納されたハッシュ表を作成し、 実行時、前記ハッシュ関数を用いて与えられた変数の値
に対応するハッシュ関数値を計算し、計算結果に基づい
て前記ハッシュ表から分岐先を得ることを特徴とする多
枝分岐制御方式。
1. In a multi-branch branch control method of an information processing apparatus for selecting a branch destination according to a value of a given variable, at the time of compilation, a hash function is used to correspond to the value of the variable and the value of the variable. Creates a hash table whose branch destination is stored in the entry indicated by the hash function value, calculates the hash function value corresponding to the value of the given variable using the hash function at runtime, and based on the calculation result A multi-branch branch control method, wherein a branch destination is obtained from the hash table.
【請求項2】 前記ハッシュ関数は剰余関数であること
を特徴とする請求項1記載の多枝分岐制御方式。
2. The multi-branch control method according to claim 1, wherein the hash function is a residue function.
【請求項3】 前記ハッシュ関数は完全ハッシュ関数で
あることを特徴とする請求項1または2記載の多枝分岐
制御方式。
3. The multi-branch control method according to claim 1, wherein the hash function is a perfect hash function.
JP11981792A 1992-04-13 1992-04-13 Multibranch branching control system Pending JPH05289867A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP11981792A JPH05289867A (en) 1992-04-13 1992-04-13 Multibranch branching control system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP11981792A JPH05289867A (en) 1992-04-13 1992-04-13 Multibranch branching control system

Publications (1)

Publication Number Publication Date
JPH05289867A true JPH05289867A (en) 1993-11-05

Family

ID=14770983

Family Applications (1)

Application Number Title Priority Date Filing Date
JP11981792A Pending JPH05289867A (en) 1992-04-13 1992-04-13 Multibranch branching control system

Country Status (1)

Country Link
JP (1) JPH05289867A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007280214A (en) * 2006-04-10 2007-10-25 Mitsubishi Electric Corp Programmable controller

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007280214A (en) * 2006-04-10 2007-10-25 Mitsubishi Electric Corp Programmable controller
JP4516046B2 (en) * 2006-04-10 2010-08-04 三菱電機株式会社 Programmable controller

Similar Documents

Publication Publication Date Title
JP2001147819A (en) Optimizing device and recording medium
US5721924A (en) Method and device for obtaining a value of a referred to variable defined in a source program having a specific variable name
JPH11250112A (en) Method and device for synthesizing hardware and recording medium recorded with hardware synthesizing program
JPH05289867A (en) Multibranch branching control system
JPH086797A (en) Constant reference optimizing processor
JP2585793B2 (en) Compiler system
JPH0522272B2 (en)
JP2904112B2 (en) Automatic program synthesizer
JPH1063675A (en) Data retrieving method and data retrieving device applying the method
JP3021697B2 (en) Exception handling in programming languages
JP2650803B2 (en) Full screen editor control processor
JPH0675757A (en) Link system for virtual space resident program
JPH0981381A (en) Object program comparison system
JP2000242531A (en) System and method for inputting and outputting directed graph
JPH06208470A (en) Objective code optimizing device
JPH0792757B2 (en) Optimal data allocation method
JPH08212083A (en) Interruption processor
JPH05189209A (en) Initial program loading system
JPH08272411A (en) Ladder instruction processor
JPH08249192A (en) Compiler, linker and debugger
JPH0325529A (en) Job control language generator
JPH11238012A (en) Memory access batching method and storage medium
JPH05204699A (en) Identifier searching system at debugging
JPS6057437A (en) Compiler device
JPH05204636A (en) Method for setting load address