JP2004126739A - Name resolution method - Google Patents
Name resolution method Download PDFInfo
- Publication number
- JP2004126739A JP2004126739A JP2002286752A JP2002286752A JP2004126739A JP 2004126739 A JP2004126739 A JP 2004126739A JP 2002286752 A JP2002286752 A JP 2002286752A JP 2002286752 A JP2002286752 A JP 2002286752A JP 2004126739 A JP2004126739 A JP 2004126739A
- Authority
- JP
- Japan
- Prior art keywords
- class
- instruction
- name
- information
- storage unit
- 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
Images
Landscapes
- Stored Programmes (AREA)
Abstract
Description
【0001】
【発明の属する技術分野】
本発明は、動的リンクを行うオブジェクト指向プログラムの実行方法であって、特に、実行するメソッドを決定する名前解決方法に関するものである。
【0002】
【従来の技術】
近年、情報処理機器や、情報通信機器や、情報家電機器において、ソフトウェアの開発量と必要なシステム資源が増大し、これに対して、効率的な開発手法・システム構成が求められている。これに対し、オブジェクト指向を用いたプログラム実行システムの開発や、動的リンクを行うシステム構成が利用されている。
動的リンクを行うオブジェクト指向プログラム実行システムにおいて、クラス継承を行ったメンバの名前解決処理は、実行命令にて指定されたクラスのメンバ解決処理と、その後、クラスのメンバ情報に基づき実行対象命令が処理対象とする実行対象インスタンスに対するメンバ解決処理を行う必要性がある。このような名前解決処理における実行効率を上げるために、実行命令にて指定されたクラスのメンバ解決情報をキャッシュすることにより、実行命令にて指定されたクラスのメンバ解決処理をスキップする技術が処理の実行効率を上げる技術が知られている(例えば、非特許文献1参照)。
【0003】
【非特許文献1】
Sun Microsystems社「The JavaTM Virtual Machine Specification (first
edition)」
【0004】
【発明が解決しようとする課題】
しかしながら、前記従来の技術では、メンバの継承関係が多階層になった場合、インスタンスに対するメンバ解決のための計算量が多くなり、本来の処理の実行効率を低下させるという問題が発生する。
【0005】
これは、データ参照の局所性により、同一の命令箇所では、同一インスタンスに対する同一メンバ解決が多く、名前解決を必要とする命令が実行される度に、インスタンスに対するメンバ解決を毎回行うと全処理量に占めるメンバ解決の処理量が膨大となり、本来実行したい処理の実行効率が低下するためである。
【0006】
また、前記従来の技術では、ROM上の実行命令に対しても書換処理を実行するため、キャッシュメモリと実メモリ間で不整合が発生し、書換処理が行われた実行命令部が、期待とは異なる不正な動作をする場合が存在した。
【0007】
本発明は、上記問題点を解決するためになされたものであり、メンバの継承関係が多階層になっても処理の実行効率が低下することがなく、メンバ解決にかかる処理量を少なくする名前解決方法を提供すること目的とする。
【0008】
【課題を解決するための手段】
この課題を解決するために本発明は、動的リンクを行うオブジェクト指向プログラムを所定のコンパイラによりコンパイルすることにより得られたクラスファイルを実行する方法であって、前記クラスファイルに記述された実行対象の命令が、名前解決を要する名前解決命令であって、前記実行対象の命令で指定されているクラスメンバの名前を解決するステップと、前記名前を解決したクラスメンバの情報に基づき、実行対象となっているインスタンスに対するメンバの名前を解決するステップと、前記解決したインスタンスに対するメンバと、前記メンバを継承する実行対象インスタンスのクラスの情報とをメンバ情報としてキャッシュするステップと、前記実行対象の命令である名前解決を要する名前解決命令を、解決した名前をキャッシュしていることを示す別の名前解決済み名前解決命令に置換えるステップと、前記名前解決を要する名前解決命令が再度実行された場合に、実行対象のインスタンスクラスが、キャッシュしているメンバの実体を持つクラスと同一、または、キャッシュしている実行対象インスタンスクラスと同一である際に、キャッシュに保存している前記メンバ情報を利用して名前解決を行うステップとを備えることを特徴とし、2回目以降はキャッシュされているメンバ情報を用いて処理を行う。
【0009】
また、本発明は、前記クラスファイルは、読込み専用記憶部、または読書き可能記憶部に配置してあり、前記キャッシュするステップは、実行対象命令が読書き可能記憶部に配置してある場合のみ、解決したメンバ情報をキャッシュするステップであることを特徴とし、読書き可能記憶部に配置してあり、かつ2回目以降はキャッシュされているメンバ情報を用いて処理を行う。
【0010】
また、本発明は、前記クラスファイルは、読込み専用記憶部、または読書き可能記憶部にクラス単位で配置してあり、各クラスの情報として、前記クラスが、読込み専用記憶部に配置されているのか、読書き可能記憶部に配置されているのかを識別可能な情報である、書込み可能フラグを持ち、前記キャッシュするステップは、前記書込み可能フラグに基づいて、クラスファイルが前記読書き可能記憶部に配置してある判断した場合のみ、解決した面罵情報をキャッシュするステップであることを特徴とする。
【0011】
【発明の実施の形態】
以下、本発明の実施の形態について、図面を用いて説明する。
【0012】
図1は、本発明の実施の形態における名前解決方法を実施するプログラム実行装置の構成の一例を示す機能ブロック図である。
【0013】
図1において、プログラム実行装置は、プログラム実行部4000と、読込み専用記憶部2000と、読書き可能記憶部3000とを備えている。ここで、プログラム実行部4000への入力は、オブジェクト指向言語にて記述したプログラムを、所定のコンパイラによりコンパイルすることによって得られたクラスファイル(以下、クラスファイル1000とする)であるものとする。なお、Java(R)やC++などが、代表的なオブジェクト指向言語である。
【0014】
読込み専用記憶部2000は、ライブラリとなるクラス群を格納している。なお、ライブラリとなるクラス群は、読書き可能記憶部3000に格納することも可能である。その場合、プログラム実行部4000と、読書き可能記憶部3000を備えていればよい。
【0015】
読書き可能記憶部3000は、クラス1000の実行時の格納先であり、また、プログラム実行部4000が実行する過程で必要となる情報の記憶領域である。
【0016】
クラス読み込み部4100は、実行命令判定部4200からの指示に従い、読込み指定されたクラス1000を読込んで、読書き可能記憶部3000に配置し、かつ読み書き可能記憶部3000に存在するそのクラスの書込み可能フラグに、書込み可能を示す値を設定する。なお、書込み可能とは、読書き可能なRAM領域に配置されていることを意味する。
【0017】
実行命令判定部4200は、実行開始が指示されると、読書き可能記憶部3000から実行対象の命令を取得し、取得した実行対象の命令を判定する。実行対象の命令種別に基づき、名前解決を要さない命令であると判定した場合は、実効対象の命令を命令実行部4700に通知し、名前解決情報が既にキャッシュされている名前解決済み名前解決命令であると判定した場合は、解決メンバ情報比較部4800に処理を移し、そうでない場合(名前未解決の名前解決命令)は、クラス読込み部4100に実行対象のクラスの読込みを指示し、実行指定クラスメンバ解決部4300に実行命令に付随しているクラスメンバ情報を通知する。
【0018】
実行指定クラスメンバ解決部4300は、実行命令判定部4200から通知された実行命令に付随しているクラスメンバ情報を解決し、インスタンスメンバ解決部4400に解決したクラスメンバ情報を通知する。
【0019】
インスタンスメンバ解決部4400は、通知されたクラスメンバ情報をもとに、実行対象命令が処理対象として実行対象となっているインスタンスに対して、メンバの名前の解決を行い、実行命令存在箇所判定部4500に処理を指示する。
【0020】
実行命令存在箇所判定部4500は、実行対象の命令を持つメソッドの実体を持つクラスの書込み可能フラグを確認し、書込み可能フラグの値が書込み可能を示している場合、解決メンバ情報保存・命令書換部4600に処理を移し、そうでない場合は、処理を命令実行部4700に処理を移す。
【0021】
解決メンバ情報保存・命令書換部4600は、解決したメンバ情報と現在実行対象命令が処理対象として実行対象となっているインスタンスクラスの情報を名前解決済み情報として読書き可能記憶部3000に格納し、実行対象の名前解決命令を、名前解決済み情報を参照可能な情報を付加した、名前解決済み名前解決命令に書換え、命令実行部4700に名前解決済み名前解決命令を通知する。
【0022】
命令実行部4700は、通知された実行対象の命令の実行を行い、実行した結果を読書き可能記憶部2000に格納する。
【0023】
解決メンバ情報比較部4800は、読書き可能記憶部3000に格納されている名前解決済み情報を取得し、実行対象命令が処理対象として実行対象となっているインスタンスのクラスと、名前解決済み情報のメンバ情報が示すメンバの実体を保持するクラスと一致するか、または実行対象命令が処理対象として実行対象となっているインスタンスのクラスと、名前解決済み情報の実行対象インスタンスクラス情報が示すクラスが一致するかの判定を行う。何れかと一致した場合は、名前解決済み情報のメンバ情報を、実行対象命令が処理対象として実行対象となっているインスタンスのメンバの解決情報として命令実行部4700に通知する。何れも一致しない場合は、名前解決済み情報のメンバ情報を、実行対象命令に指定されている解決したクラスメンバの解決情報としてインスタンスメンバ解決部4400に通知する。
【0024】
図2は、本発明の実施の形態における名前解決方法の処理の流れを示す。プログラム実行装置が実行開始の指示を受け、実行対象の命令を取得し、命令を実行する動作手順を示す。まず、実行命令判定部4200は、実行開始の指示を受けると、指示に基づき、読込み専用記憶部2000、または読書き可能記憶部3000から、実行対象命令を取得し、処理を開始する。
【0025】
実行命令判定部4200は、取得した実行対象命令の命令種別に基づき、実行対象命令が名前解決済み名前解決命令であるか、そうでないか判定する(S4201)。
【0026】
実行対象命令が、名前解決済み名前解決命令である場合(S4201がYES)、解決メンバ情報比較部4800に処理を移し、S4801に遷移する。
【0027】
実行対象命令が、名前解決済み名前解決命令でない場合(S4201がNO)、名前解決命令(名前未解決の名前解決命令)であるか、そうでない(名前解決を要さない命令)か判定する(S4202)。
【0028】
実行対象命令が、名前解決を要さない命令である場合(S4202がNO)、命令実行部4700は、実効対象の命令に対して規定された処理を実行し、結果を読書き可能記憶部3000に格納して処理を終了する(S4701)。
【0029】
実行対象命令が、名前未解決の名前解決命令である場合(S4202がYES)、クラス読込み部4100に実行対象のクラスの読込みを指示し、実行指定クラスメンバ解決部4300に実行命令に付随しているクラスメンバ情報を通知する(S4100)。なお、クラス読み込み部4100での処理については、図3に後述する。
【0030】
実行指定クラスメンバ解決部4300は、通知されたクラスメンバ情報を解決し、インスタンスメンバ解決部に解決したクラスメンバ情報を通知する(S4301)。
【0031】
インスタンスメンバ解決部4400は、通知されたクラスメンバの情報をもとに、実行対象命令が処理対象として実行対象となっているインスタンスに対する、メンバの名前を解決し、実行命令存在箇所判定部4500に処理を移す(S4401)。
【0032】
実行命令存在箇所判定部4500は、実行対象命令が存在するメソッドを保持するクラスの、書換え可能フラグを確認する(S4501)。書換え可能フラグの値が、書換え可能を示さない場合(S4501がNO)、命令実行部4700は、実効対象の命令に対して規定された処理を実行し、結果を読書き可能記憶部3000に格納して処理を終了する(S4701)。書換え可能フラグの値が、書換え可能を示す場合(S4501がYES)、解決メンバ情報保存・命令書換部4600が、名前解決済み情報を読書き可能記憶部3000に格納し(S4601)、更に、実行対象の名前解決命令を、書換え可能情報を持つ、名前解決済み名前解決命令に書換え、命令実行部4700に名前解決済み名前解決命令を通知する(S4602)。
【0033】
命令実行部4700は、実効対象の命令に対して規定された処理を実行し、結果を読書き可能記憶部3000に格納して処理を終了する(S4701)。
【0034】
解決メンバ情報比較部4800は、読書き可能記憶部3000から、名前解決済み情報を取得する(S4801)。
【0035】
解決メンバ情報比較部4800は、実行対象命令が処理対象として実行対象となっているインスタンスのクラスと、名前解決済み情報のメンバ情報が示すメンバの実体を保持するクラスと一致するか、または実行対象命令が処理対象として実行対象となっているインスタンスのクラスと、名前解決済み情報の実行対象インスタンスクラス情報が示すクラスが一致するかを判定する(S4802)。
【0036】
何れかと一致した場合(S4802がYES)、名前解決済み情報のメンバ情報を、実行対象命令が処理対象として実行対象となっているインスタンスのメンバの解決情報として設定し(S4803)、命令実行部4700は、実効対象の命令に対して規定された処理を実行し、結果を読書き可能記憶部3000に格納して処理を終了する(S4701)。
【0037】
何れも一致しない場合(S4802がNO)、名前解決済み情報のメンバ情報を、実行対象命令にて指定されているクラスメンバの解決情報とて設定し、インスタンスメンバ解決部4400に処理を移し、S4401に遷移する。
【0038】
図3は、本発明の実施の形態における名前解決方法の処理の流れの一部であり、クラス読込み部4100の動作手順を示す。これは、図2のS4100を詳細に示したものである。
【0039】
クラス読込み部4100は、実行命令判定部4200からの指示に従い、読込み指定されたクラス1000を読込み、読書き可能記憶部3000に、実行可能な状態に配置する(S4101)。
【0040】
次に、クラス読込み部4100は、読書き可能記憶部3000に配置した、実行可能な状態のクラスが持つ書込み可能フラグに、書き込み可能を示す値を設定し、処理を終了する(S4102)。
【0041】
図4は、本発明の実施の形態における名前解決方法が使用する情報の構成の一例を示す図である。
【0042】
処理に使用する情報として、クラス9100と、メンバテーブル9200と、フィールドテーブル9300と、メソッドテーブル9400と、メソッド9500と、名前解決済み情報9600と、メソッド実行コード9700とを備えている。メソッド実行コードは、1つ以上の実行命令からなるメソッドのプログラムである。
【0043】
クラス9100は、実行可能な状態に配置された各クラスの情報である、スーパクラスである別のクラス9100、メンバテーブル9200、書込み可能フラグの情報を持つ。スーパクラスとは、継承関係にある親クラス(基底クラス)である。
【0044】
書込み可能フラグとは、前記クラスが、読込み専用記憶部に配置されているのか、読書き可能記憶部に配置されているのかを識別可能な情報の記憶部である。
【0045】
メンバテーブル9200は、各クラス保持するフィールドテーブル9300、メソッドテーブル9400の情報を持つ。
【0046】
フィールドテーブル9300は、各クラスおよび格クラスのインスタンスが実体として持つ、フィールドの情報を持つ。
【0047】
メソッドテーブル9400は、各クラスおよび各クラスのインスタンスが実体として持つ、メソッドの情報を持つ。
【0048】
メソッド9500は、各メソッドのメソッド属性およびメソッドの実行コード9700の情報を持つ。メソッド属性は、所属クラス、メソッドのアクセス制限、引数、返値、実行コードへのポインタ、実行コード長、実行に必要なスタック量、実行に必要なローカル変数領域サイズ、例外発生時のジャンプ先情報から構成される。
【0049】
名前解決済み情報9600は、名前解決したメンバの情報として、メソッド9500あるいは、フィールドテーブル9300中の何れかのフィールドの情報を持ち、そのメンバ9500を継承するクラス9100の情報を持つ。
【0050】
メソッド実行コード9700はメソッド9500の実際に実行されるプログラムのコードを持ち、このコード中にて書換られた名前解決済み名前解決命令は、名前解決済み情報9600の情報を持つ。
【0051】
以上により、名前解決済み名前解決命令が再度実行された場合、前回実行対象であったオブジェクト(インスタンスまたはクラス)と同一のオブジェクトが実行対象となっていた場合、既に名前解決されて保持されている情報を用いることにより、少ない計算量にて名前解決処理を終了することが可能である。
【0052】
【発明の効果】
以上のように本発明によれば、名前解決命令に対して、その実行対象クラスメンバと実行対象インスタンスクラスとをキャッシュしておくことにより、実行対象インスタンスクラスが実行対象クラスメンバの実体を保持していない場合においても、データ参照の局所性を利用して、2回目以降にメンバ解決にかかる計算負荷を軽減させることができる。
【0053】
また、実行すべき名前解決命令が読込み専用記憶部と読書き可能記憶部の双方にあり、クラス単位で、読込み専用記憶部と読書き可能記憶部何れかに配置されているシステムにおいて、 クラスを実行可能状態で読込み専用記憶部と読書き可能記憶部何れかに配置する時点で、何れの記憶部に配置されているかを判定する書込み可能フラグを設定しておき、実行対象となっている名前解決命令を持つメンバの実体を保持するクラスの書込み可能フラグを参照し、読書き可能記憶部に存在する場合、その実行対象クラスメンバをキャッシュしておくことにより、実行対象命令の書換可否を判断する計算処理を軽減させ、かつデータ参照の局所性を利用して、2回目以降に名前解決にかかる計算負荷を軽減させ、かつキャッシュメモリと実メモリ間の不整合が発生しない。
【図面の簡単な説明】
【図1】本発明の実施の形態に係る名前解決方法を実施するプログラム実行装置の構成の一例を示す機能ブロック図
【図2】本発明の実施の形態に係る名前解決方法の処理の流れの一例を示すフローチャート
【図3】本発明の実施の形態に係るクラス読込み部における処理の流れの一例を示すフローチャート
【図4】本発明の実施の形態に係る名前解決方法が使用する情報の構成の一例を示す図
【符号の説明】
1000 クラス
2000 読込み専用記憶部
3000 読書き可能記憶部
4000 プログラム実行部
4100 クラス読込み部
4200 実行命令判定部
4300 実行指定クラスメンバ解決部
4400 インスタンスメンバ解決部
4500 実行命令存在箇所判定部
4600 解決メンバ情報保存・命令書換部
4700 命令実行部
4800 解決メンバ情報比較部
9100 クラス
9200 メンバテーブル
9300 フィールドテーブル
9400 メソッドテーブル
9500 メソッド
9600 名前解決済み情報
9700 メソッド実行コード[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a method for executing an object-oriented program that performs dynamic linking, and more particularly to a name resolution method for determining a method to be executed.
[0002]
[Prior art]
In recent years, in information processing equipment, information communication equipment, and information home appliances, the amount of software development and required system resources have increased, and accordingly, efficient development methods and system configurations have been demanded. On the other hand, a system configuration for developing a program execution system using object orientation and performing dynamic linking is used.
In an object-oriented program execution system that performs dynamic linking, the name resolution process of a member that has performed class inheritance includes a member resolution process of a class specified by an execution instruction, and thereafter, an execution target instruction is executed based on class member information. There is a need to perform member resolution processing for the execution target instance to be processed. In order to increase the execution efficiency in such name resolution processing, a technique for skipping the member resolution processing of the class specified by the execution instruction by caching the member resolution information of the class specified by the execution instruction has been developed. There is known a technique for improving the execution efficiency of a program (for example, see Non-Patent Document 1).
[0003]
[Non-patent document 1]
Sun Microsystems, Inc. "The JavaTM Virtual Machine Specification (first
edition) "
[0004]
[Problems to be solved by the invention]
However, in the above-described conventional technology, when the inheritance relationship of members is multi-layered, the amount of calculation for solving a member for an instance increases, which causes a problem that the execution efficiency of the original processing is reduced.
[0005]
This is because, due to the locality of data reference, in the same instruction location, the same member is often resolved in the same instance, and every time an instruction that requires name resolution is executed, the member processing for the instance is performed every time. This is because the processing amount of the member solution occupying becomes enormous, and the execution efficiency of the processing originally desired to be executed is reduced.
[0006]
Further, in the above-described conventional technology, the rewriting process is also performed for the execution instruction on the ROM. Therefore, inconsistency occurs between the cache memory and the real memory, and the execution instruction portion on which the rewriting process has been performed is not expected. May behave differently incorrectly.
[0007]
SUMMARY OF THE INVENTION The present invention has been made to solve the above problems, and a name for reducing the processing amount required for member resolution without lowering the execution efficiency of processing even if the inheritance relationship of members is multi-layered. The purpose is to provide a solution.
[0008]
[Means for Solving the Problems]
In order to solve this problem, the present invention provides a method for executing a class file obtained by compiling an object-oriented program that performs dynamic linking with a predetermined compiler, and includes an execution target described in the class file. Is a name resolution instruction that requires name resolution, the step of resolving the name of the class member specified in the instruction of the execution target, based on the information of the class member that resolved the name, Resolving the name of the member for the instance that has become, caching, as member information, the member for the resolved instance and the class of the execution target instance that inherits the member as member information, A name resolution instruction that requires a name resolution is Replacing with another name-resolved name-resolved instruction indicating that the cached member is being executed, and when the name-resolved instruction requiring the name resolution is executed again, The same as the class having the entity, or when it is the same as the cached execution target instance class, performing a name resolution using the member information stored in the cache, From the second time onward, processing is performed using the cached member information.
[0009]
Also, in the present invention, the class file is arranged in a read-only storage unit or a readable / writable storage unit, and the caching step is performed only when the execution target instruction is arranged in the readable / writable storage unit. The step of caching the resolved member information is characterized in that the member information is arranged in the readable / writable storage unit, and the process is performed from the second time onward using the cached member information.
[0010]
In the present invention, the class file is arranged in a read-only storage unit or a readable / writable storage unit for each class, and the class is arranged in the read-only storage unit as information of each class. Or a writable flag, which is information for identifying whether the class file is located in the readable / writable storage unit, and the step of caching comprises: storing the class file in the readable / writable storage unit based on the writable flag. The step is a step of caching the resolved face information only when it is determined that the information is arranged.
[0011]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[0012]
FIG. 1 is a functional block diagram illustrating an example of a configuration of a program execution device that performs a name resolution method according to an embodiment of the present invention.
[0013]
In FIG. 1, the program execution device includes a program execution unit 4000, a read-
[0014]
The read-
[0015]
The readable /
[0016]
The
[0017]
When the execution start is instructed, the execution
[0018]
The execution designation class
[0019]
The instance member resolving unit 4400 resolves the member name of the instance in which the execution target instruction is to be processed and executed based on the notified class member information, and executes the execution instruction existence location determination unit. 4500 is instructed.
[0020]
The execution instruction existence
[0021]
The resolved member information storage /
[0022]
The
[0023]
The resolution member
[0024]
FIG. 2 shows a processing flow of the name resolution method according to the embodiment of the present invention. An operation procedure in which a program execution device receives an instruction to start execution, acquires an instruction to be executed, and executes the instruction. First, upon receiving an instruction to start execution, the execution
[0025]
The execution
[0026]
If the instruction to be executed is a name-resolved name resolution instruction (YES in S4201), the process proceeds to the resolution member
[0027]
If the instruction to be executed is not a name-resolved name resolution instruction (NO in S4201), it is determined whether the instruction is a name resolution instruction (an unresolved name resolution instruction) or not (an instruction that does not require name resolution) ( S4202).
[0028]
If the instruction to be executed is an instruction that does not require name resolution (S4202: NO), the
[0029]
If the execution target instruction is an unresolved name resolution instruction (S4202: YES), it instructs the
[0030]
The execution-designated class
[0031]
The instance member resolving unit 4400 resolves the member name of the instance for which the execution target instruction is to be processed based on the notified class member information, and sends the execution instruction existence
[0032]
The execution instruction existence
[0033]
The
[0034]
The resolution member
[0035]
The resolution member
[0036]
If any of them matches (YES in S4802), the member information of the name resolved information is set as the resolution information of the member of the instance which is the execution target instruction as the processing target (S4803), and the
[0037]
If none of them match (NO in S4802), the member information of the name resolved information is set as the resolution information of the class member specified by the execution target instruction, and the process is moved to the instance member resolution unit 4400, and S4401 is executed. Transitions to.
[0038]
FIG. 3 shows a part of the flow of processing of the name resolution method according to the embodiment of the present invention, and shows an operation procedure of the
[0039]
The
[0040]
Next, the
[0041]
FIG. 4 is a diagram illustrating an example of a configuration of information used by the name resolution method according to the embodiment of the present invention.
[0042]
The information used for processing includes a class 9100, a member table 9200, a field table 9300, a method table 9400, a method 9500, name resolved information 9600, and a
[0043]
The class 9100 has information of another class 9100 which is a super class, a member table 9200, and information of a writable flag, which are information of each class arranged in an executable state. A super class is a parent class (base class) that has an inheritance relationship.
[0044]
The writable flag is a storage unit of information that can identify whether the class is arranged in the read-only storage unit or the read-write storage unit.
[0045]
The member table 9200 has information of a field table 9300 and a method table 9400 held by each class.
[0046]
The field table 9300 has field information that each class and case class instance has as an entity.
[0047]
The method table 9400 has information on methods that each class and an instance of each class have as an entity.
[0048]
The method 9500 has information on a method attribute of each method and an
[0049]
The name resolved information 9600 has information of a method 9500 or any field in the field table 9300 as information of a member whose name has been resolved, and has information of a class 9100 that inherits the member 9500.
[0050]
The
[0051]
As described above, when the name-resolved name resolution instruction is executed again, and when the same object as the object (instance or class) previously executed is the object to be executed, the name is already resolved and held. By using the information, the name resolution process can be completed with a small amount of calculation.
[0052]
【The invention's effect】
As described above, according to the present invention, the execution target class member holds the substance of the execution target class member by caching the execution target class member and the execution target instance class for the name resolution instruction. Even if not, it is possible to use the locality of data reference to reduce the calculation load required for member resolution for the second and subsequent times.
[0053]
Further, in a system in which the name resolution instruction to be executed is in both the read-only storage unit and the readable / writable storage unit, and the class is arranged in either the read-only storage unit or the readable / writable storage unit, At the time of placement in either the read-only storage unit or the readable / writable storage unit in the executable state, a writable flag that determines which storage unit is located is set, and the name to be executed is set. Refers to the writable flag of the class that holds the entity of the member having the resolution instruction, and if it exists in the readable / writable storage unit, caches the execution target class member to determine whether the execution target instruction can be rewritten. To reduce the computational load required for name resolution in the second and subsequent times by utilizing the locality of data reference, and to reduce the load between the cache memory and the real memory. Does not occur.
[Brief description of the drawings]
FIG. 1 is a functional block diagram illustrating an example of a configuration of a program execution device that implements a name resolution method according to an embodiment of the present invention. FIG. 2 is a flowchart of a processing flow of the name resolution method according to an embodiment of the present invention. FIG. 3 is a flowchart illustrating an example of the process. FIG. 4 is a flowchart illustrating an example of a process flow in a class reading unit according to the embodiment of the present invention. Diagram showing an example [Description of reference numerals]
1000
Claims (3)
前記実行対象の命令で指定されているクラスメンバの名前を解決するステップと、
前記名前を解決したクラスメンバの情報に基づき、実行対象となっているインスタンスに対するメンバの名前を解決するステップと、
前記解決したインスタンスに対するメンバと、前記メンバを継承する実行対象インスタンスのクラスの情報とをメンバ情報としてキャッシュするステップと、前記実行対象の命令である名前解決を要する名前解決命令を、解決した名前をキャッシュしていることを示す別の名前解決済み名前解決命令に置換えるステップと、
前記名前解決を要する名前解決命令が再度実行された場合に、実行対象のインスタンスクラスが、キャッシュしているメンバの実体を持つクラスと同一、または、キャッシュしている実行対象インスタンスクラスと同一である際に、キャッシュに保存している前記メンバ情報を利用して名前解決を行うステップとを備えることを特徴とする名前解決方法。A method for executing a class (or a class file that is a file in class units) obtained by compiling an object-oriented program that performs dynamic linking with a predetermined compiler, wherein an execution instruction stored in the class is a name A name resolution instruction that requires resolution,
Resolving the name of a class member specified in the instruction to be executed;
Resolving the name of the member for the instance being executed based on the information of the class member that has resolved the name;
Caching, as member information, a member for the resolved instance and information on a class of an execution target instance that inherits the member, and resolving a name obtained by resolving the name resolution instruction that requires name resolution as the execution target instruction. Replacing it with another name-resolved name-resolved instruction that indicates that it is cached;
When the name resolution instruction requiring name resolution is executed again, the execution target instance class is the same as the class having the cached member entity or the same as the cached execution target instance class. Performing a name resolution using the member information stored in the cache.
前記キャッシュするステップは、実行対象命令が読書き可能記憶部に配置してある場合のみ、解決したメンバ情報をキャッシュするステップであることを特徴とする請求項1記載の名前解決方法。The class is arranged in a read-only storage unit or a readable / writable storage unit,
2. The method according to claim 1, wherein the caching step is a step of caching the resolved member information only when the execution target instruction is arranged in the readable / writable storage unit.
各クラスの情報として、前記クラスが、読込み専用記憶部に配置されているのか、読書き可能記憶部に配置されているのかを識別可能な情報記憶部として、書込み可能フラグを持ち、
前記キャッシュするステップは、前記書込み可能フラグに基づいて、クラスが前記読書き可能記憶部に配置してある判断した場合のみ、解決した面罵情報をキャッシュするステップであることを特徴とする請求項2記載の名前解決方法。The class is arranged in a read-only storage unit or a readable / writable storage unit in class units,
As information of each class, the class has a writable flag as an information storage unit capable of identifying whether the class is arranged in a read-only storage unit or a readable / writable storage unit,
3. The method according to claim 2, wherein the caching step is a step of caching the resolved face information only when it is determined based on the writable flag that a class is arranged in the readable / writable storage unit. Name resolution method described.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2002286752A JP2004126739A (en) | 2002-09-30 | 2002-09-30 | Name resolution method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2002286752A JP2004126739A (en) | 2002-09-30 | 2002-09-30 | Name resolution method |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JP2004126739A true JP2004126739A (en) | 2004-04-22 |
Family
ID=32279736
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2002286752A Pending JP2004126739A (en) | 2002-09-30 | 2002-09-30 | Name resolution method |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2004126739A (en) |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8006190B2 (en) * | 2006-10-31 | 2011-08-23 | Yahoo! Inc. | Social namespace addressing for non-unique identifiers |
| US8370349B2 (en) | 2007-02-28 | 2013-02-05 | Yahoo! Inc. | Instant contact searching and presentation by category |
| US8599801B2 (en) | 2007-02-01 | 2013-12-03 | Yahoo! Inc. | Collecting implicit information for determining context of event actions |
-
2002
- 2002-09-30 JP JP2002286752A patent/JP2004126739A/en active Pending
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8006190B2 (en) * | 2006-10-31 | 2011-08-23 | Yahoo! Inc. | Social namespace addressing for non-unique identifiers |
| US9495712B2 (en) | 2006-10-31 | 2016-11-15 | Yahoo! Inc. | Social namespace addressing for non-unique identifiers |
| US8599801B2 (en) | 2007-02-01 | 2013-12-03 | Yahoo! Inc. | Collecting implicit information for determining context of event actions |
| US8370349B2 (en) | 2007-02-28 | 2013-02-05 | Yahoo! Inc. | Instant contact searching and presentation by category |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN109614165B (en) | Multi-version parallel operation method and device for COM (component object model) component | |
| US6334213B1 (en) | Merging of separate executable computer programs to form a single executable computer program | |
| US6760905B1 (en) | Lazy compilation of template-generated classes in dynamic compilation execution environments | |
| US6112025A (en) | System and method for dynamic program linking | |
| JP3470948B2 (en) | Dynamic compilation timing determination method, bytecode execution mode selection method, and computer | |
| US6243668B1 (en) | Instruction set interpreter which uses a register stack to efficiently map an application register state | |
| JPH10198570A (en) | Method and system for loading class in read only memory | |
| JPH07160483A (en) | Method for dynamic linkage of designated program image and related library program to executable application program image | |
| US6633892B1 (en) | Archiving tool | |
| JP2000035893A (en) | Method for statically initializing arrangement of data processing system, data processing method, data processing system and computer readable storage medium storing program making computer execute its control procedure | |
| JP2002517033A (en) | Dynamic switching without recompilation from statically bound function calls to dynamically bound function calls | |
| JP2002508544A (en) | Java runtime system with change constant pool | |
| US7197600B2 (en) | Transferring data along with code for program overlays | |
| US7406687B1 (en) | Sharing runtime representation of software component methods across component loaders | |
| US6094664A (en) | Method and apparatus for optimizing the null pointer exception in an object-oriented programming environment with statically typed variables | |
| US20080301653A1 (en) | Method and apparatus for increasing task-execution speed | |
| US8099724B2 (en) | Fast patch-based method calls | |
| US20040015855A1 (en) | Frameworks for accessing Java class files | |
| CN114253523A (en) | Method, apparatus, computer device and medium for reading raw device | |
| JP2005507103A (en) | Framework to realize Java heap | |
| JP2004126739A (en) | Name resolution method | |
| US6275985B1 (en) | Method and apparatus for developing an application that implements garbage collection efficiently by combining proxy objects with compiler support | |
| JP4864287B2 (en) | Identification method, recording medium, and computer system | |
| US7496923B2 (en) | Method and device to process multidimensional array objects | |
| KR100478463B1 (en) | Dynamic Linking Method for Application Program |