JP2005346406A - Method for solving reference of other program in language translation program - Google Patents
Method for solving reference of other program in language translation program Download PDFInfo
- Publication number
- JP2005346406A JP2005346406A JP2004165245A JP2004165245A JP2005346406A JP 2005346406 A JP2005346406 A JP 2005346406A JP 2004165245 A JP2004165245 A JP 2004165245A JP 2004165245 A JP2004165245 A JP 2004165245A JP 2005346406 A JP2005346406 A JP 2005346406A
- Authority
- JP
- Japan
- Prior art keywords
- program
- class
- interface information
- referenced
- dll
- 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
- Devices For Executing Special Programs (AREA)
Abstract
Description
本発明は、コンピュータのソフトウェアプログラムにおいて、他プログラムを参照する際の参照方法に関する。 The present invention relates to a reference method for referring to another program in a software program of a computer.
近年のソフトウェアとして、オペレーティングシステムの違いを意識せずに共通のソフトウェア環境を作り出し、さらに共通言語仕様(Common Language Specification)のもとにどの言語でも同じ実行環境で動作する共通言語ランタイム(Common Language Runtime)という技術が導入されている。共通言語ランタイムでは、言語を意識しないソフトウェアを構築することができる。例えば、オブジェクト指向プログラミングにおいて、C#言語で生成したクラスのインスタンスオブジェクトを、COBOL言語で生成したクラスのインスタンスオブジェクトが継承したり、COBOL言語のプログラムから、C#言語のクラスのメソッドを呼び出すことが可能である。 As a recent software, create a common software environment without being aware of the difference of operating systems, and also run in any language in the same execution environment under the Common Language Specification (Common Language Runtime) ) Technology has been introduced. With the common language runtime, it is possible to build software that is not language-aware. For example, in object-oriented programming, an instance object of a class generated in the COBOL language is inherited by an instance object of a class generated in the C # language, or a method of a C # language class is called from a COBOL language program. Is possible.
原始プログラムが共通言語ランタイム上で動作するためのアプリケーションである実行可能プログラムに翻訳されるとき、その原始プログラムの中で他の実行可能プログラム内のクラスを参照している場合、各言語翻訳プログラムは、他の実行可能プログラム内のクラスの情報を取得しなければならない。 When a source program is translated into an executable program that is an application for running on the common language runtime, each language translator is referenced if the source program references a class in another executable program. You must get information about classes in other executable programs.
例えば.NET Frameworkでは、他のアセンブリ(Windows(登録商標)システムにおけるDLLファイルやEXEファイルに含まれる実行可能プログラムの単位)内のクラスの情報を取得するには、アセンブリのバイナリフォーマットの中から、外部参照するクラスの情報として、クラスに含まれるメソッドの名前や引数などのインタフェース情報が含まれるメタデータ情報を、アセンブリのアクセス関数を使用して取得する(例えば特許文献1等参照)。 For example, in the .NET Framework, in order to obtain class information in another assembly (unit of an executable program included in a DLL file or EXE file in a Windows (registered trademark) system), from the binary format of the assembly, As information on a class to be externally referenced, metadata information including interface information such as a method name and an argument included in the class is acquired using an access function of the assembly (see, for example, Patent Document 1).
上記の従来技術において、原始プログラム上で他のアセンブリであるDLL内に含まれるクラスを参照する場合に、参照されるクラスが原始プログラム上の参照元クラスの中に指定される。言語コンパイラは、その指定されたクラスを、コマンドライン上に指定された複数の参照されるDLLのファイル名の中から探さなければならない。コマンドラインに指定された全ての参照されるDLLをローディングし、その中からアセンブリの一種であるDLL内に含まれるマニフェスト及びメタデータを参照するためのアクセス関数を使用して、情報を取得する手順に則ってクラスを一個ずつ検索して見つけ出す。 In the above prior art, when referring to a class included in a DLL that is another assembly on the source program, the class to be referred to is specified in the reference source class on the source program. The language compiler must find the specified class from the file names of multiple referenced DLLs specified on the command line. Procedure for loading all referenced DLLs specified on the command line and obtaining information using access functions for referring to manifests and metadata included in the DLL which is a kind of assembly from among them Search for each class one by one and find out.
上記の場合、原始プログラムをコンパイル中に、他のアセンブリであるDLLを参照している場合の問題として、その参照されているDLLを全てローディングしてメモリを圧迫することと、DLLを一個ずつ検索して参照されるクラスを探し出すための検索時間を要することがある。本発明の目的は、一度参照されたクラスを、2回目以降の参照時に、より少ないメモリで、より少ない検索時間で探し出すことで、プログラム開発時のコンパイル時間を短縮し、プログラム開発の効率を向上させることにある。 In the above case, while compiling the source program, as a problem when referring to a DLL that is another assembly, loading all the referenced DLLs and compressing the memory, and searching the DLL one by one It may take a search time to find a class to be referenced. The object of the present invention is to search for a class that has been referenced once in the second and subsequent searches with less memory and less search time, thereby shortening the compilation time during program development and improving the efficiency of program development. There is to make it.
上記目的を達成するために、局所的に管理するローカルな外部記憶ファイルとしてローカルリポジトリを導入する。ここで、リポジトリとは、クラスのインタフェース情報を格納しておき、他のアセンブリからクラスの情報が参照された場合に、そのクラスのインタフェース情報を提供するためのものである。ローカルリポジトリには、一度参照されたクラスの定義情報を格納しておき、2回目以降の参照時にそのローカルリポジトリを利用して名前の参照解決をするものである。 In order to achieve the above object, a local repository is introduced as a local external storage file managed locally. Here, the repository stores the interface information of a class, and provides the interface information of the class when the class information is referenced from another assembly. The local repository stores definition information of a class that has been referenced once, and performs name reference resolution using the local repository at the second and subsequent references.
以上により、ローカルリポジトリを使用して原始プログラムから参照されるクラスのインタフェース情報を取得することにより、参照されるクラスが含まれると考えられるDLLをすべて検索して参照されるクラスを見つけ出し、言語翻訳プログラムがそのクラスのインタフェース情報を使用できるようにメモリ上に展開する処理の時間を短縮することが可能となる。特に、原始プログラムから参照されるクラスを含んでいるアセンブリ(DLL)が多ければ多いほど、また、参照されるアセンブリがすでに変更されることはなく、開発中の原始プログラムを何度も翻訳すればするほど有効となる。言語翻訳性能を向上させ、プログラム開発の効率向上に貢献する。 As described above, the interface information of the class referenced from the source program is acquired using the local repository, and all the DLLs that are considered to contain the referenced class are searched to find the referenced class, and the language translation. It is possible to reduce the processing time for developing the program on the memory so that the program can use the interface information of the class. In particular, the more assemblies (DLLs) that contain classes that are referenced from the source program, the referenced assemblies will not be changed, and the source program under development will be translated many times. The more effective it is. Improve language translation performance and improve program development efficiency.
また、参照されるクラスのインタフェース情報を他のアセンブリ(DLL)から直接取得する方法では、参照されるクラスが含まれると考えられるアセンブリを全てメモリ中にローディングする必要があり、多くのメモリを消費することから、ローカルリポジトリを使用することでコンピュータ資源の削減という観点からも効果的である。 In addition, in the method of directly obtaining the interface information of the referenced class from another assembly (DLL), it is necessary to load all the assemblies considered to contain the referenced class into the memory, which consumes a lot of memory. Therefore, using a local repository is also effective from the viewpoint of reducing computer resources.
本発明の一実施例を、図にしたがって説明する。 An embodiment of the present invention will be described with reference to the drawings.
図1に本発明の基本構成を示す。コンピュータ101の構成要素として、CPU102、ディスプレイ103、キーボード104、2次記憶装置105、主記憶装置106から成り、バス110によって各構成要素が接続されている。2次記憶装置105は、利用者が作成する原始プログラム111を含む。主記憶装置106は、コンピュータを動作させるための基本プログラムであるオペレーティングシステム107、利用者が動作させるアプリケーションプログラム109、原始プログラム111を翻訳して、オペレーティングシステム107上で動作させるための実行可能プログラム(アプリケーションプログラム109に相当する)を作成する言語翻訳プログラム108から構成される。ここでオペレーティングシステム107は、例えば.NET Frameworkのような、各種言語翻訳プログラムから作成したアプリケーションプログラムが動作するための共通言語基盤のプログラムも含む。
FIG. 1 shows the basic configuration of the present invention. The computer 101 includes a
図2に、外部記憶としてローカルリポジトリを使用した言語翻訳プログラム108の構成を示す。言語翻訳プログラム108は、利用者が作成した原始プログラム111を入力とし、オペレーティングシステム107で動作するようなアセンブリ109を出力する。アセンブリ109は、共通言語基盤上で動作する実行単位で、Windows(登録商標)システムにおけるDLLファイルやEXEファイルに含まれる実行可能プログラムを指す。
FIG. 2 shows the configuration of the
言語翻訳プログラム108は、原始プログラム111を入力すると、字句解析部201で字句に分解する。分解した字句を、構文解析部202で構文にしたがって内部的に表現した中間語203に変換する。意味解析部204では中間語203をさらに詳細に表現し、コード生成部205で実行可能プログラムであるアセンブリ109に変換する。
When the source program 111 is input, the
原始プログラム111が例えばオペレーティングシステム107のクラスライブラリを呼び出すなど他のアセンブリ(DLLファイル)207を参照している場合、言語翻訳プログラム108は、呼び出したクラスなどのインタフェース情報を取得して、クラスの参照関係を解決する必要がある。そのため、構文解析部202において、原始プログラム111が他のアセンブリ207を参照していたら、リポジトリ解析部206が参照している他のクラスのインタフェース情報を取得して解析し、構文解析部202に渡してクラスの参照関係を解決する。ここで、.NET Frameworkのような共通言語基盤システムでは、アセンブリをそのままリポジトリとして使用している。
When the source program 111 refers to another assembly (DLL file) 207 such as calling a class library of the
本発明では、参照されるアセンブリ207に含まれているクラスが参照される場合に、1回目は参照されるアセンブリ207からそのままクラスのインタフェース情報を取得する。そのときに、リポジトリ解析部206がそのインタフェース情報をローカルリポジトリ208に格納しておく。そして、同じクラスを原始プログラムの別の個所で参照していたり、再度原始プログラムを翻訳する場合には、クラスのインタフェース情報を、参照されるアセンブリ207から取得せずに、格納しておいたローカルリポジトリ208から取得する。
In the present invention, when a class included in the referenced
図3に、ローカルリポジトリ208の構成図を示す。ローカルリポジトリ208は、ローカルリポジトリのヘッダ部301とローカルリポジトリの本体部302から構成される。ローカルリポジトリのヘッダ部301は、原始プログラム111から参照されるクラス単位に、参照されるクラス名303、参照されるクラスを含んでいるDLL名304、DLLの更新日時305、ローカルリポジトリの本体部302に格納されているインタフェース情報へのインデックス306で構成されている。ローカルリポジトリの本体部302は、参照されるクラス単位に、クラスのインタフェース情報307から構成されている。クラスのインタフェース情報307には、クラスに含まれるメソッドのメソッド名やそのメソッドの引数の情報が含まれている。また、クラスのインタフェース情報307は、ローカルリポジトリのヘッダ部301に含まれるインタフェース情報へのインデックス306と関連付けられている。
FIG. 3 shows a configuration diagram of the
原始プログラムから他のアセンブリに含まれるクラスを参照する場合に、ローカルリポジトリに格納する情報の例を図4に示す。図4において、原始プログラムA(401)、原始プログラムB(402)、および原始プログラムC(403)の3個の原始プログラムから1個のアセンブリ109が生成されるとする。原始プログラムA(401)内のクラスA1において、アセンブリX.dll(404)に含まれるクラスX1とクラスX2を参照している。原始プログラムB(402)内のクラスB1において、アセンブリX.dll(404)に含まれるクラスX1とアセンブリY.dll(405)に含まれるクラスY1を参照している。原始プログラムC(403)内のクラスC1において、アセンブリX.dll(404)に含まれるクラスX3を参照している。その場合、ローカルリポジトリ208には、クラスX1、クラスX2、クラスX3、およびクラスY1のインタフェース情報が格納される。ローカルリポジトリのヘッダ部301におけるクラスX1の情報として、クラス名「クラスX1」、クラスX1が含まれるDLL名「X.dll」、DLL「X.dll」の更新日時である「20040110 08:04:15」、インタフェース情報がローカルリポジトリの本体部302の先頭に格納されるためにインタフェース情報へのインデックス「0」が格納される。同様に、クラスX2、クラスX3、およびクラスY1の情報がローカルリポジトリのヘッダ部301に格納される。一方、ローカルリポジトリの本体部302におけるクラスX1の情報として、クラスX1のインタフェース情報が先頭(すなわちインデックス0)に格納される。同様に、クラスX2、クラスX3、およびクラスY1のインタフェース情報が順に格納される。
FIG. 4 shows an example of information stored in the local repository when referring to a class included in another assembly from the source program. In FIG. 4, it is assumed that one
図5において、リポジトリ解析部206が、ローカルリポジトリ208を使用して、他のアセンブリ207に含まれるクラスを参照する処理の流れを説明する。まず、リポジトリ解析部206は、他のアセンブリ(DLL)のクラスが参照されているかを判定する(501)。参照されていない場合は、何もせずに終了する。参照されている場合、参照されるクラスがローカルリポジトリにあるかを判定する(502)。ローカルリポジトリにある場合、ローカルリポジトリのヘッダ部301に格納されている、参照されるクラスの更新日時305が、そのクラスを含んでいるDLLの現在の更新日時より新しいかを判定する(503)。ここで、更新日時は、現在のDLLに含まれるインタフェース情報と整合性をとるためのもので、バージョン情報等でもよい。503の判定で新しい場合、ローカルリポジトリのヘッダ部301に格納されているインタフェース情報へのインデックス306より、参照されるクラスのインタフェース情報307を取得し(504)、その情報を構文解析部202に渡して終了する。参照されるクラスがローカルリポジトリにあるかの判定(502)で存在しない場合、参照されるアセンブリ(DLL)を1個ずつ検索して(505)、参照するクラスを見つける。また、参照されるクラスの更新日時305が、そのクラスを含んでいるDLLの現在の更新日時より新しいかの判定(503)で、古い場合、ローカルリポジトリのヘッダ部301に格納されているDLL名304を検索する(506)。505および506において、参照されるクラスを含んでいるアセンブリ(DLL)が見つかったかを判定する(507)。見つかった場合、ローカルリポジトリに参照されるクラスの情報を登録し(508)、参照されるクラスのインタフェース情報307を取得する処理(504)に移る。参照されるクラスを含んでいるアセンブリ(DLL)が見つかったかの判定(507)において見つからなかった場合、検索エラーを出力し(509)、終了する。
In FIG. 5, a processing flow in which the
101…コンピュータ、102…CPU、103…ディスプレイ、104…キーボード、105…2次記憶装置、106…主記憶装置、107…オペレーティングシステム、108…言語翻訳プログラム、109…アプリケーションプログラム(アセンブリ(実行可能プログラム))、110…バス、111…原始プログラム、203…アセンブリ(実行可能プログラム)、201…字句解析部、202…構文解析部、203…中間語、204…意味解析部、205…コード生成部、206…リポジトリ解析部、207…参照されるアセンブリ(DLL)、208…ローカルリポジトリ、301…ローカルリポジトリのヘッダ部、302…ローカルリポジトリの本体部、303…参照されるクラス名、304…DLL名、305…DLLの更新日時、306…インタフェース情報へのインデックス、307…クラスのインタフェース情報(メソッド名、メソッド引数の情報等)、401…原始プログラムA、402…原始プログラムB、403…原始プログラムC、404…アセンブリX.dll、405…アセンブリY.dll、501…他のアセンブリ(DLL)のクラスが参照されているかという判定処理、502…参照されるクラスがローカルリポジトリにあるかの判定処理、503…参照されるクラスの更新日時が、そのクラスを含んでいるDLLの現在の更新日時より新しいかという判定処理、504…参照されるクラスのインタフェース情報を取得する処理、505…参照されるアセンブリ(DLL)を1個ずつ検索する処理、506…ローカルリポジトリのヘッダ部に格納されているDLL名を検索する処理、507…参照されるクラスを含んでいるアセンブリ(DLL)が見つかったかを判定する処理、508…ローカルリポジトリに参照されるクラスの情報を登録する処理、509…検索エラーを出力する処理。 DESCRIPTION OF SYMBOLS 101 ... Computer, 102 ... CPU, 103 ... Display, 104 ... Keyboard, 105 ... Secondary storage device, 106 ... Main storage device, 107 ... Operating system, 108 ... Language translation program, 109 ... Application program (Assembly (executable program) )), 110 ... bus, 111 ... primitive program, 203 ... assembly (executable program), 201 ... lexical analysis unit, 202 ... syntax analysis unit, 203 ... intermediate language, 204 ... semantic analysis unit, 205 ... code generation unit, 206 ... Repository analysis unit, 207 ... Referenced assembly (DLL), 208 ... Local repository, 301 ... Local repository header, 302 ... Local repository body, 303 ... Referenced class name, 304 ... DLL name, 305 ... Update DLL Date, 306 ... index to interface information, 307 ... interface information classes (method name, method arguments information), 401 ... source program A, 402 ... source program B, 403 ... source program C, 404 ... assembly X. dll, 405, assembly Y. dll, 501... Judgment process of whether a class of another assembly (DLL) is referenced, 502... Judgment process of whether or not the referenced class exists in the local repository, 503. 504... Processing for acquiring interface information of a referenced class, 505... Searching for each referenced assembly (DLL), 506... Processing for searching for the DLL name stored in the header part of the local repository, 507... Processing for determining whether an assembly (DLL) including the referenced class is found, 508... Information on the class referenced by the local repository 509, processing for outputting a search error.
Claims (3)
A recording medium device storing a program for realizing the functions according to claim 1, claim 2 and claim 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004165245A JP2005346406A (en) | 2004-06-03 | 2004-06-03 | Method for solving reference of other program in language translation program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004165245A JP2005346406A (en) | 2004-06-03 | 2004-06-03 | Method for solving reference of other program in language translation program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2005346406A true JP2005346406A (en) | 2005-12-15 |
Family
ID=35498721
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2004165245A Pending JP2005346406A (en) | 2004-06-03 | 2004-06-03 | Method for solving reference of other program in language translation program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2005346406A (en) |
-
2004
- 2004-06-03 JP JP2004165245A patent/JP2005346406A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4183399B2 (en) | Multiple language compilation method and system | |
US8370822B2 (en) | Compiling techniques for providing limited accuracy and enhanced performance granularity | |
US7877741B2 (en) | Method and corresponding apparatus for compiling high-level languages into specific processor architectures | |
US8850414B2 (en) | Direct access of language metadata | |
US8549495B2 (en) | Using appropriate level of code to be executed in runtime environment using metadata describing versions of resources being used by code | |
US7793275B2 (en) | Methods and apparatus to tune intermediate representations in a managed runtime environment | |
JPH08339304A (en) | Method and apparatus for generation of platform standard object file containing machine independence code | |
US20090328016A1 (en) | Generalized expression trees | |
JP2004310776A (en) | Extension runtime hosting | |
US20070050707A1 (en) | Enablement of multiple schema management and versioning for application-specific xml parsers | |
US20160357529A1 (en) | Parallel computing apparatus and parallel processing method | |
JP2006092544A (en) | Dynamic link of module in pre-operating system environment | |
US20120159463A1 (en) | Method and system for creating, applying, and removing a software fix | |
Ramsey et al. | Hoopl: a modular, reusable library for dataflow analysis and transformation | |
JP2005141410A (en) | Compiler apparatus and compile method | |
US20100218174A1 (en) | Dynamic compiling and loading at runtime | |
JPH0769832B2 (en) | Method and apparatus for expressing effects and dependencies of programming operations | |
US10013244B2 (en) | Apparatus and method to compile a variadic template function | |
US20050055682A1 (en) | Authoring and using generic classes in JAVA language code | |
US11163545B2 (en) | Type inference optimization | |
US20100010801A1 (en) | Conflict resolution and error recovery strategies | |
JP2011141676A (en) | Apparatus and method for processing language, and computer program product | |
US7080370B1 (en) | Method and apparatus for compiling source programs using one or more libraries | |
JP2006163686A (en) | Compiling method, compiling program, compiling device and recording medium for compile | |
US9229698B2 (en) | Method and apparatus for compiler processing for a function marked with multiple execution spaces |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD04 | Notification of resignation of power of attorney |
Effective date: 20060424 Free format text: JAPANESE INTERMEDIATE CODE: A7424 |