JPH06266562A - Object code size optimizing system in object-oriented language processing system - Google Patents

Object code size optimizing system in object-oriented language processing system

Info

Publication number
JPH06266562A
JPH06266562A JP8016493A JP8016493A JPH06266562A JP H06266562 A JPH06266562 A JP H06266562A JP 8016493 A JP8016493 A JP 8016493A JP 8016493 A JP8016493 A JP 8016493A JP H06266562 A JPH06266562 A JP H06266562A
Authority
JP
Japan
Prior art keywords
input file
class
declaration
name
code
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
JP8016493A
Other languages
Japanese (ja)
Inventor
Takashi Miyamoto
敬士 宮本
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 JP8016493A priority Critical patent/JPH06266562A/en
Publication of JPH06266562A publication Critical patent/JPH06266562A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To reduce the size of an object code by generating only one real body of a method address storage table inside the object code. CONSTITUTION:In an object-oriented language processing system for generating output codes for the respective input files of an input file group 11 and realizing the execution time decision of the method of an object-oriented language by using the method address storage table statically generated inside the object code 17, a syntax semantic analysis part 13 compares an input file name with the name of a class to which the method belongs at the time of the semantic analysis processing of a class declaration, generates the real body and the declaration of the method address storage table inside the output code 15 in the case of coincidence and generates only the declaration of the method address storage table inside the output code 15 in the case of noncoincidence. A linker 16 solves reference relation among the plural output codes 15 and generates one object code 17.

Description

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

【0001】[0001]

【産業上の利用分野】本発明はオブジェクト指向言語
(例えば、プログラミング言語C++,LOOPS,T
AO等)を用いた情報処理システムに関し、特に複数の
入力ファイルに対して各々に対応する出力コードを生成
した後に複数の出力コード間の参照関係を解決して1つ
の目的コードを生成し、かつオブジェクト指向言語のメ
ソッドの実行時決定を目的コード内に静的に生成される
メソッドアドレス格納テーブルを使用することによって
実現するオブジェクト指向言語処理システムにおける目
的コードサイズ最適化方式に関する。
BACKGROUND OF THE INVENTION The present invention is an object-oriented language (eg, programming languages C ++, LOOPS, T).
AO, etc.), particularly, an output code corresponding to each of a plurality of input files is generated, and then a reference relationship between the plurality of output codes is resolved to generate one object code, and The present invention relates to a method of optimizing a target code size in an object-oriented language processing system, which realizes a runtime decision of a method of an object-oriented language by using a method address storage table statically generated in the target code.

【0002】[0002]

【従来の技術】オブジェクト指向言語にはメソッドの実
行時決定という機能がある。これは異なるクラスに属す
るオブジェクトを統括して扱うために、オブジェクトに
与えられたメッセージに対して起動されるメソッドをオ
ブジェクトの所属するクラスに基づいて実行時に決定す
る機能である。
2. Description of the Related Art Object-oriented languages have a function called method runtime decision. This is a function for collectively handling objects belonging to different classes, and at the time of execution, determines a method activated for a message given to the object based on the class to which the object belongs.

【0003】ある種のオブジェクト指向言語処理システ
ムでは、この機能を目的コード内に静的に生成されるメ
ソッドアドレス格納テーブルを使用することによって実
現している。実際に実行されるメソッドはオブジェクト
の所属するクラスに基づいて決定されるから、メソッド
アドレス格納テーブルの内容はクラスごとに(正確には
クラスとクラスの継承関係ごとに)異なるものである。
In some object-oriented language processing systems, this function is realized by using a method address storage table statically generated in the object code. Since the method to be actually executed is determined based on the class to which the object belongs, the contents of the method address storage table are different for each class (more precisely, for each class and each class inheritance relationship).

【0004】従来は、実行時に決定されるメソッドの属
するクラスの宣言が入力ソースプログラムファイル(以
下、単に入力ファイルという)に含まれていると、オブ
ジェクト指向言語処理システムのユーザが特に指定しな
い場合は出力コード内にメソッドアドレス格納テーブル
の実体が必ず生成されていた。
Conventionally, if a declaration of a class to which a method determined at execution time belongs is included in an input source program file (hereinafter, simply referred to as an input file), unless a user of the object-oriented language processing system specifies otherwise. The substance of the method address storage table was always generated in the output code.

【0005】以下、オブジェクト指向言語の1つである
C++の場合について従来技術を説明する。C++に
は、仮想関数というメソッドの実行時決定のための機構
がある。仮想関数であることを指定するためには、vi
rtualというキーワードを用いる。
The prior art will be described below in the case of C ++, which is one of the object-oriented languages. C ++ has a mechanism for runtime decision of methods called virtual functions. To specify that it is a virtual function, vi
The keyword rtual is used.

【0006】仮想関数を実現するためには、与えられた
メッセージ呼出しに対して、実行時(プログラム動作
時)に呼び出されるメソッドを決定する必要がある。仮
想関数の呼出しが正しく行われるためには、実行される
メソッドが各オブジェクトのもつ情報をもとにプログラ
ム動作時に決定されなければならない。
In order to realize a virtual function, it is necessary to determine a method to be called at the time of execution (at the time of program operation) for a given message call. In order for the virtual function to be called correctly, the method to be executed must be determined at the time of program operation based on the information held by each object.

【0007】これを実現する方法として自然に考えられ
る方法は、C++処理系がクラスの属性を表す情報を出
力コード中に埋め込み、各オブジェクトはその情報への
ポインタを保持するという方法である。当然のことなが
ら、クラスの属性を表す情報には実行されるメソッドの
情報も含まれている。プログラム動作時には、オブジェ
クトからポインタをたどってこの情報をアクセスし、実
行されるべきメソッドを決定することになる。
A naturally conceivable method for realizing this is a method in which the C ++ processing system embeds information representing class attributes in the output code and each object holds a pointer to that information. As a matter of course, the information indicating the attribute of the class includes the information of the method to be executed. During program operation, a pointer is traced from the object to access this information to determine the method to be executed.

【0008】仮想関数テーブルは、C++処理系が仮想
関数機能を実現するために出力コード中に埋め込むメソ
ッドアドレス格納テーブルである。仮想関数テーブル
は、「クラスの属性を表す情報」を簡略化したものと考
えてよい。すなわち、クラスに関する全ての情報をもつ
のではなく、実行されるべきメソッドの決定を行うため
に必要最低限の情報をもっているテーブルである。ここ
では、仮想関数テーブルは、実行されるべきメソッドの
アドレス(位置)を情報としてもっていると考えてよ
い。
The virtual function table is a method address storage table which the C ++ processing system embeds in the output code to realize the virtual function function. The virtual function table may be considered to be a simplification of “information indicating the class attribute”. That is, it is not a table that has all the information about the class, but a table that has the minimum information necessary to determine the method to be executed. Here, it may be considered that the virtual function table has the address (position) of the method to be executed as information.

【0009】仮想関数テーブルが必要なのは、仮想関数
(virtual付きの関数)がクラス宣言中に用いら
れた場合である。仮想関数が書き換えられるごとに、言
い換えれば仮想関数が書き換えられるようなクラスが宣
言されるごとに仮想関数テーブルを生成しなければなら
ない。
The virtual function table is necessary when a virtual function (function with virtual) is used in a class declaration. The virtual function table must be generated each time the virtual function is rewritten, in other words, each class in which the virtual function is rewritten is declared.

【0010】また、入力ファイル中でオブジェクトを使
用するには、そのオブジェクトが所属するクラスの宣言
が入力ファイル中に含まれていなければならない。ある
クラスのオブジェクトを複数の入力ファイルで使用する
場合、複数の入力ファイルにクラスの宣言が含まれてい
なければならない。このために、通常、クラスの宣言を
ヘッダファイル(ファイル名末尾を.hとすることが多
い)に入れ、オブジェクトを使用する入力ファイルでヘ
ッダファイルをインクルードする(C++の言語仕様
で、#includeを用いて指定する)ことが多い。
ヘッダファイルのインクルードを指定すると、C++処
理系は、#includeが指定された部分をインクル
ードされるヘッダファイルの内容で置き換える。
In order to use an object in the input file, the declaration of the class to which the object belongs must be included in the input file. If you want to use an object of a class in multiple input files, the input files must contain declarations for the class. For this reason, the class declaration is usually put in a header file (the file name often ends in .h), and the header file is included in the input file that uses the object (#include is specified in the C ++ language specification). Often specified).
When the header file include is specified, the C ++ processing system replaces the part in which #include is specified with the contents of the included header file.

【0011】C++処理系が出力コード中に仮想関数テ
ーブルを埋め込むとき、仮想関数テーブルは、ソースプ
ログラム中の外部変数と同じ形態で埋め込まれるが、外
部変数と同じ形態で埋め込まれるためには、外部変数と
同様に、仮想関数テーブルに名前(変数名と同様)が与
えられる必要がある。このように名前が与えられるか
ら、オブジェクトが仮想関数テーブルへのポインタを保
持することが可能なのである(名前を使って参照するこ
とができる)。逆にいうと、仮想関数テーブルの名前さ
えわかっていれば、仮想関数テーブルの実体(先に述べ
た外部変数と同様な形態で出力コード中に確保される領
域)は必要でない。
When the C ++ processing system embeds the virtual function table in the output code, the virtual function table is embedded in the same form as the external variable in the source program. Like variables, virtual function tables need to be given names (similar to variable names). Given the name this way, it is possible for an object to hold a pointer to a virtual function table (which can be referenced by name). Conversely, as long as the name of the virtual function table is known, the substance of the virtual function table (the area secured in the output code in the same form as the external variable described above) is not necessary.

【0012】ただし、重要なことは、単一または複数の
入力ファイルで構成される全体のプログラムに対して生
成される目的コード中に最低1個の仮想関数テーブルの
実体が必要なことである。そうしないと、プログラムの
実行中に、オブジェクトは実際に仮想関数テーブルが作
成されていない位置のアドレスを保持することになって
しまう。
However, what is important is that at least one virtual function table entity is required in the object code generated for the entire program composed of a single or a plurality of input files. Otherwise, during program execution, the object will hold the address of the location where the virtual function table was not actually created.

【0013】そこで、C++処理系が全てのプログラム
を同時に調べて目的コード中に仮想関数テーブルの実体
を1個だけ生成するという処理を行えればよいが、しか
し全てのプログラムを同時に調べるということは処理時
間,消費メモリ量等の問題から現実的ではない。このた
め、多くのC++処理系では、入力ファイルごとに出力
コードを生成し、後で名前の結合(ある出力コードでは
変数の名前だけを用いて参照し、別の出力コード中にそ
の変数の領域があるという場合に、参照された部分の名
前を実際の領域のアドレスに書き換える処理)を行うと
いう方法をとっている。
Therefore, it suffices for the C ++ processing system to perform a process of examining all programs at the same time and generating only one entity of the virtual function table in the target code, but to examine all the programs at the same time. It is not realistic because of problems such as processing time and memory consumption. For this reason, in many C ++ processing systems, an output code is generated for each input file, and names are combined later (in one output code, only the variable name is used for reference, and in another output code, the variable area is referred to). If there is, the process of rewriting the name of the referenced part to the address of the actual area) is performed.

【0014】したがって、通常のC++処理系では、各
出力コードにおいてすべて仮想関数テーブルの実体を生
成せざるを得ない。なぜならば、単一の入力ファイルを
対象としている限り、他の入力ファイルに対する出力コ
ードで仮想関数テーブルの実体が生成されているかどう
かはわからないからである。
Therefore, in a normal C ++ processing system, the virtual function table is inevitably generated in each output code. This is because, as long as the target is a single input file, it is not known whether the virtual function table entity is generated by the output code for another input file.

【0015】[0015]

【発明が解決しようとする課題】上述した従来のオブジ
ェクト指向言語処理システムでは、メソッドアドレス格
納テーブルに関しては、実行時に決定されるメソッドの
属するクラスの宣言が入力ファイルに含まれていると、
オブジェクト指向言語処理システムのユーザが特に指定
しない場合は出力コード内にメソッドアドレス格納テー
ブルの実体が必ず生成されていたので、本来、目的コー
ド内に実体がクラス毎に1つ生成されれば十分であるメ
ソッドアドレス格納テーブルがクラスの宣言が取り込ま
れた入力ファイルの数だけ生成され、目的コードのサイ
ズが不必要に大きくなるという問題点があった。
In the above-mentioned conventional object-oriented language processing system, regarding the method address storage table, if the declaration of the class to which the method determined at execution time belongs is included in the input file,
Unless otherwise specified by the user of the object-oriented language processing system, the entity of the method address storage table was always generated in the output code, so it is essentially sufficient to generate one entity for each class in the target code. There is a problem that a certain method address storage table is generated by the number of input files in which the class declaration is included, and the size of the target code becomes unnecessarily large.

【0016】この問題点に対処するために、オブジェク
ト指向言語処理システムのユーザが、入力ファイルごと
に出力コード内にメソッドアドレス格納テーブルの実体
および宣言を生成するか、あるいはメソッドアドレス格
納テーブルの宣言のみを生成するかを指定し、複数の出
力コード間の参照関係が解決されることにより目的コー
ド内に生成されるメソッドアドレス格納テーブルの実体
の数を減少させるという方法も存在する(AT&T,
“AT&T C++ LANGUAGE SYSTEM
RELEASE 2.1 Release Note
s”,pp.4−16〜4−18)。しかし、クラスの
宣言が入力ファイルに含まれているかどうかを、オブジ
ェクト指向言語処理システムのユーザが判定するのは困
難であるという問題点があった。
To solve this problem, the user of the object-oriented language processing system generates the substance and declaration of the method address storage table in the output code for each input file, or only the declaration of the method address storage table. There is also a method in which the number of entities of the method address storage table generated in the target code is reduced by specifying whether or not to generate and the reference relationship between a plurality of output codes is reduced (AT & T,
"AT & T C ++ LANGUAGE SYSTEM
RELEASE 2.1 Release Note
s ", pp. 4-16 to 4-18). However, there is a problem that it is difficult for the user of the object-oriented language processing system to judge whether the declaration of the class is included in the input file. It was

【0017】目的コードのサイズを不必要に大きくしな
いためには、メソッドの実行時決定に用いられるメソッ
ドアドレス格納テーブルの数を入力コードの意味が変わ
らない限り少なくすべきである。また、メソッドアドレ
ス格納テーブルの数を減少させる処理は、オブジェクト
指向言語処理システムのユーザの判断によることなく自
動的に行うべきである。
In order not to unnecessarily increase the size of the object code, the number of method address storage tables used in the method runtime determination should be reduced unless the meaning of the input code changes. Also, the process of reducing the number of method address storage tables should be automatically performed without the judgment of the user of the object-oriented language processing system.

【0018】本発明の目的は、上述の点に鑑み、オブジ
ェクト指向言語処理システムが出力コードへのメソッド
アドレス格納テーブルの実体および/または宣言の生成
を制御することにより、目的コード内にメソッドアドレ
ス格納テーブルの実体を1つのみ生成し、目的コードの
大きさを削減するようにしたオブジェクト指向言語処理
システムにおける目的コードサイズ最適化方式を提供す
ることにある。
In view of the above points, an object of the present invention is to store the method address in the object code by controlling the generation of the substance and / or declaration of the method address storage table in the output code by the object-oriented language processing system. An object of the present invention is to provide a target code size optimization method in an object-oriented language processing system in which only one table entity is generated and the size of the target code is reduced.

【0019】[0019]

【課題を解決するための手段】本発明のオブジェクト指
向言語処理システムにおける目的コードサイズ最適化方
式は、複数の入力ファイルに対して各々に対応する出力
コードを生成した後に複数の出力コード間の参照関係を
解決して1つの目的コードを生成し、かつオブジェクト
指向言語のメソッドの実行時決定を目的コード内に静的
に生成されるメソッドアドレス格納テーブルを使用する
ことによって実現するオブジェクト指向言語処理システ
ムにおいて、クラス宣言の意味解析処理時にメソッドの
所属するクラス名と入力ファイル名とを比較し、一致す
ればメソッドアドレス格納テーブルの実体および宣言を
出力コード内に生成し、一致しなければメソッドアドレ
ス格納テーブルの宣言のみを出力コード内に生成する構
文意味解析部を設けたことを特徴とする。
The object code size optimizing method in the object-oriented language processing system of the present invention is such that the output code corresponding to each of a plurality of input files is generated and then a reference is made between the plurality of output codes. An object-oriented language processing system that resolves relationships to generate a single object code, and implements the runtime decision of a method in an object-oriented language by using a method address storage table that is statically created in the object code In, in the semantic analysis process of the class declaration, the class name to which the method belongs and the input file name are compared, and if they match, the method address storage table entity and declaration are generated in the output code, and if they do not match, the method address storage Set up a syntactic and semantic analysis part that generates only the table declaration in the output code. Characterized in that was.

【0020】[0020]

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

【0021】本発明の一実施例として、オブジェクト指
向言語で記述されたソースプログラムを入力とし、構文
意味解析部においてこれを中間言語形式に変換し、さら
にコード生成部でこれを出力コードに変換してファイル
に出力する、コンパイル方式のオブジェクト指向言語処
理システムの例を挙げる。
As an embodiment of the present invention, a source program described in an object-oriented language is input, the syntactic and semantic analysis section converts it into an intermediate language format, and the code generation section converts it into an output code. The following is an example of a compiled object-oriented language processing system that outputs a file to a file.

【0022】図1は、本発明の一実施例に係るオブジェ
クト指向言語処理システムにおける目的コードサイズ最
適化方式の構成を示すブロック図である。本実施例のオ
ブジェクト指向言語処理システムにおける目的コードサ
イズ最適化方式は、入力ファイル群11と、構文意味解
析部13およびコード生成部14を含むコンパイラ12
と、出力コード15と、リンカ16と、目的コード17
とから構成されている。
FIG. 1 is a block diagram showing the configuration of an object code size optimizing system in an object-oriented language processing system according to an embodiment of the present invention. The object code size optimizing method in the object-oriented language processing system of this embodiment is as follows.
, Output code 15, linker 16, purpose code 17
It consists of and.

【0023】図2を参照すると、構文意味解析部13の
目的コードサイズ最適化処理は、クラス宣言意味解析処
理ステップS1と、メソッドアドレス格納テーブル要否
判定ステップS2と、入力ファイル名/クラス名比較ス
テップS3と、メソッドアドレス格納テーブル実体およ
び宣言生成ステップS4と、メソッドアドレス格納テー
ブル宣言生成ステップS5と、同名入力ファイル存在判
定ステップS6と、クラス宣言存在判定ステップS7
と、クラス宣言包含ステップS8と、コンパイル済判定
ステップS9と、コンパイル未処理設定ステップS10
と、同名入力ファイル作成ステップS11と、クラス宣
言包含ステップS12と、コンパイル未処理設定ステッ
プS13とからなる。
Referring to FIG. 2, the object code size optimizing process of the syntactic and semantic analyzing unit 13 includes a class declaration and semantic analyzing process step S1, a method address storage table necessity judgment step S2, and an input file name / class name comparison. Step S3, method address storage table entity and declaration generation step S4, method address storage table declaration generation step S5, same name input file existence determination step S6, class declaration existence determination step S7
, Class declaration inclusion step S8, compiled judgment step S9, uncompiled setting step S10
, A same-name input file creation step S11, a class declaration inclusion step S12, and a compilation unprocessed setting step S13.

【0024】次に、このように構成された本実施例のオ
ブジェクト指向言語処理システムにおける目的コードサ
イズ最適化方式の動作について説明する。
Next, the operation of the object code size optimizing method in the object-oriented language processing system of the present embodiment thus constructed will be described.

【0025】コンパイラ12は、入力ファイル群11と
して複数の入力ファイルを受け付ける。コンパイラ12
は、入力ファイル群11を構成するすべての入力ファイ
ルについて、1つずつコンパイル処理を行うために構文
意味解析部13およびコード生成部14を起動する。
The compiler 12 receives a plurality of input files as the input file group 11. Compiler 12
Activates the syntactic and semantic analysis unit 13 and the code generation unit 14 in order to compile one by one for all the input files constituting the input file group 11.

【0026】コンパイラ12において、目的コードサイ
ズ最適化処理は、構文意味解析部13によって行われ
る。
In the compiler 12, the object code size optimizing process is performed by the syntactic and semantic analysis unit 13.

【0027】最初に、構文意味解析部13は、入力ファ
イル内のクラス宣言の意味解析処理を行う(ステップS
1)。詳しくは、クラス宣言のメンバのシンボルテーブ
ルへの登録等を行う。
First, the syntactic and semantic analysis unit 13 performs a semantic analysis process for class declarations in the input file (step S).
1). For details, register the members of the class declaration in the symbol table.

【0028】次に、構文意味解析部13は、入力ファイ
ル内のクラス宣言がメソッドアドレス格納テーブルを必
要とするかどうかを調べる(ステップS2)。これは、
入力ファイルに記述されているプログラミング言語の仕
様に基づき、現在処理対象としているクラスがメソッド
の実行時決定を必要とするかどうかにより決定される。
C++処理系の場合、virtualの宣言があるか
(#includeされる場合を含める)どうかに基づ
いて決定する。メソッドアドレス格納テーブルを必要と
しないならば、このクラスに対してこれ以上の処理は行
わない。
Next, the syntactic and semantic analysis unit 13 checks whether or not the class declaration in the input file requires the method address storage table (step S2). this is,
Based on the specifications of the programming language described in the input file, it is determined by whether the class currently being processed requires the runtime decision of the method.
In the case of the C ++ processing system, it is determined based on whether or not there is a virtual declaration (including the case where #include is included). If no method address storage table is needed, no further processing is done for this class.

【0029】現在処理対象としているクラスがメソッド
アドレス格納テーブルを必要とする場合、構文意味解析
部13は、クラス名と入力ファイル名とが等しいかどう
かを調べる(ステップS3)。ただし、入力ファイル名
にオブジェクト指向言語処理システム自体またはオブジ
ェクト指向言語処理システムがその上で動作する情報処
理システムが定めた付加部分(拡張子)が含まれている
場合は、その付加部分を除いた部分をクラス名と比較す
る。以後、クラス名と入力ファイル名とを比較するとき
はこの処理を行うものとする。
When the class currently being processed requires the method address storage table, the syntactic and semantic analysis unit 13 checks whether or not the class name and the input file name are equal (step S3). However, if the input file name includes an additional part (extension) defined by the object-oriented language processing system itself or the information processing system on which the object-oriented language processing system operates, the additional part is excluded. Compare the part with the class name. After that, this process is performed when comparing the class name with the input file name.

【0030】クラス名と入力ファイル名とが等しいなら
ば、構文意味解析部13は、出力コード内にメソッドア
ドレス格納テーブルの実体および宣言を生成して(ステ
ップS4)、このクラスに対してこれ以上の処理は行わ
ない。この結果、メソッドアドレス格納テーブルの実体
および宣言は、クラス名と入力ファイル名とが一致する
場合のみ出力コード内に生成されることになる。C++
処理系の場合、出力コード15中のデータセクションに
仮想関数テーブルを生成するとともに、シンボルテーブ
ルにクラスの仮想関数テーブルの属性を生成する(図3
参照)。
If the class name and the input file name are the same, the syntactic and semantic analysis unit 13 generates the substance and declaration of the method address storage table in the output code (step S4), and no more for this class. Is not processed. As a result, the substance and declaration of the method address storage table will be generated in the output code only when the class name and the input file name match. C ++
In the case of the processing system, the virtual function table is generated in the data section in the output code 15, and the attribute of the virtual function table of the class is generated in the symbol table (see FIG. 3).
reference).

【0031】クラス名と入力ファイル名とが等しくない
場合、構文意味解析部13は、出力コード内にメソッド
アドレス格納テーブルの宣言のみを生成して(ステップ
S5)、クラス名と同名の入力ファイルがコンパイラ1
2に与えられた入力ファイル群11中に存在するかどう
かを調べる(ステップS6)。
When the class name and the input file name are not equal, the syntactic and semantic analysis section 13 generates only the declaration of the method address storage table in the output code (step S5), and the input file having the same name as the class name is created. Compiler 1
It is checked whether the file exists in the input file group 11 given to No. 2 (step S6).

【0032】入力ファイル群11中にクラス名と同名の
入力ファイルが存在する場合は、構文意味解析部13
は、クラス名と同名の入力ファイルの内容を調べ、現在
対象としているクラスの宣言が含まれていれるかどうか
を調べる(ステップS7)。クラスの宣言が含まれてい
れば、このクラスに対してこれ以上の処理を行わない。
When an input file having the same name as the class name exists in the input file group 11, the syntactic and semantic analysis unit 13
Checks the contents of the input file having the same name as the class name to see if the declaration of the currently targeted class is included (step S7). If the class declaration is included then no further processing is done for this class.

【0033】クラスの宣言が含まれていなければ、構文
意味解析部13は、クラス名と同名の入力ファイルの内
容を変更して現在対象としているクラスの宣言を含める
(ステップS8)。C++処理系の場合、シンボルテー
ブルにクラスの仮想関数テーブルの属性を生成する(図
3参照)。さらに、すでにコンパイル処理が終了してい
る場合には(ステップS9でイエス)、コンパイラ12
が記録しているコンパイル未処理の入力ファイル群11
に含める(ステップS10)。
If the class declaration is not included, the syntactic and semantic analysis unit 13 changes the contents of the input file having the same name as the class name to include the declaration of the currently targeted class (step S8). In the case of the C ++ processing system, the attributes of the virtual function table of the class are generated in the symbol table (see FIG. 3). Furthermore, if the compilation process has already been completed (YES in step S9), the compiler 12
Uncompiled input file group 11 recorded by
(Step S10).

【0034】ステップS6で、クラス名と同名の入力フ
ァイルがコンパイラ12に与えられた入力ファイル群1
1の中に存在しない場合は、構文意味解析部13は、新
たにクラス名と同名の入力ファイルを作成して(ステッ
プS11)、オブジェクト指向言語処理システムで動作
している情報処理システムの適当な位置に置き、この入
力ファイル内にクラスの宣言を含め(ステップS1
2)、さらにこの入力ファイルをコンパイラ12が記録
しているコンパイル未処理の入力ファイル群11に含め
る(ステップS13)。この場合、新たに作成した入力
ファイルについてコンパイル処理が施される時点で、出
力コード15中にメソッドアドレス格納テーブルの実体
および宣言が生成される。
In step S6, the input file group 1 in which the input file having the same name as the class name is given to the compiler 12
If it does not exist in 1, the syntactic and semantic analysis unit 13 newly creates an input file having the same name as the class name (step S11), and selects a suitable one of the information processing system operating in the object-oriented language processing system. Place it in the position and include the class declaration in this input file (step S1
2) Further, the input file is included in the uncompiled input file group 11 recorded by the compiler 12 (step S13). In this case, the substance and declaration of the method address storage table are generated in the output code 15 when the newly created input file is compiled.

【0035】コンパイラ12により複数の出力コード1
5が出力された後、リンカ16は、複数の出力コード1
5間の参照関係を解決して1つの目的コード17を生成
する。
Multiple output codes 1 by the compiler 12
5 is output, the linker 16 outputs a plurality of output codes 1
One reference code 17 is generated by solving the reference relationship between the five.

【0036】図3は、入力ファイルX.h,X.Cおよ
びa.Cと出力コードX.oおよびa.oの一例を示す
図である。入力ファイルX.Cおよびa.Cにおいてヘ
ッダファイルX.hがインクルードされている。クラス
名Xと入力ファイル名X.Cの付加部分を除いたものと
が一致するので、出力コードX.oにはクラスXの仮想
関数テーブルの実体および宣言が生成されている。ま
た、クラス名Xと入力ファイル名a.Cの付加部分を除
いたものとが一致しないので、出力コードa.oにはク
ラスXの仮想関数テーブルの宣言のみが生成されてい
る。
FIG. 3 shows the input file X. h, X. C and a. C and output code X. o and a. It is a figure which shows an example of o. Input file X. C and a. Header file X.C. h is included. Class name X and input file name X. The output code X. In o, the substance and declaration of the virtual function table of class X are generated. Also, the class name X and the input file name a. The output code a. Only the declaration of the virtual function table of class X is generated in o.

【0037】[0037]

【発明の効果】以上説明したように本発明は、オブジェ
クト指向言語処理システムの構文意味解析部に出力コー
ド内へのメソッドアドレス格納テーブルの実体および/
または宣言の生成の選択をオブジェクト指向言語処理シ
ステム自体が行う機能を設け、目的コード内にメソッド
アドレス格納テーブルの実体を1つのみ生成するように
したことにより、オブジェクト指向言語処理システムの
ユーザが困難な解析を行うことなく、目的コードのサイ
ズを削減することができるという効果がある。
As described above, according to the present invention, the substance of the method address storage table in the output code and //
Alternatively, the object-oriented language processing system has a function of allowing the object-oriented language processing system itself to select whether to generate a declaration and only one entity of the method address storage table is generated in the target code, which makes it difficult for the user of the object-oriented language processing system. The effect is that the size of the target code can be reduced without performing detailed analysis.

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

【図1】本発明の一実施例に係るオブジェクト指向言語
処理システムにおける目的コードサイズ最適化方式の構
成を示すブロック図である。
FIG. 1 is a block diagram showing a configuration of an object code size optimizing method in an object-oriented language processing system according to an embodiment of the present invention.

【図2】図1中の構文意味解析部における目的コードサ
イズ最適化処理を示す流れ図である。
FIG. 2 is a flowchart showing a target code size optimizing process in a syntactic and semantic analysis section in FIG.

【図3】図1中の入力ファイルおよび出力コードの一例
を示す図である。
FIG. 3 is a diagram showing an example of an input file and an output code in FIG.

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

11 入力ファイル群 12 コンパイラ 13 構文意味解析部 14 コード生成部 15 出力コード 16 リンカ 17 目的コード 11 Input File Group 12 Compiler 13 Syntax Semantic Analysis Section 14 Code Generation Section 15 Output Code 16 Linker 17 Purpose Code

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 複数の入力ファイルに対して各々に対応
する出力コードを生成した後に複数の出力コード間の参
照関係を解決して1つの目的コードを生成し、かつオブ
ジェクト指向言語のメソッドの実行時決定を目的コード
内に静的に生成されるメソッドアドレス格納テーブルを
使用することによって実現するオブジェクト指向言語処
理システムにおいて、 クラス宣言の意味解析処理時にメソッドの所属するクラ
ス名と入力ファイル名とを比較し、一致すればメソッド
アドレス格納テーブルの実体および宣言を出力コード内
に生成し、一致しなければメソッドアドレス格納テーブ
ルの宣言のみを出力コード内に生成する構文意味解析部
を設けたことを特徴とするオブジェクト指向言語処理シ
ステムにおける目的コードサイズ最適化方式。
1. An output code corresponding to each of a plurality of input files is generated, and then a reference relation between the plurality of output codes is resolved to generate one object code, and an object-oriented language method is executed. In an object-oriented language processing system that realizes time determination by using a method address storage table that is statically generated in the target code, the class name to which the method belongs and the input file name are processed during the semantic analysis processing of the class declaration. A syntactic and semantic analysis unit is provided to compare and generate a method address storage table entity and declaration in the output code if they match, and generate only the method address storage table declaration in the output code if they do not match. Objective Code Size Optimization Method for Object-Oriented Language Processing Systems.
【請求項2】 前記クラス名と入力ファイル名とが一致
しない場合は、オブジェクト指向言語処理システムが処
理対象としているすべての入力ファイル名を調べ、入力
ファイル名がクラス名と一致する入力ファイルがあれば
その入力ファイルの内容を走査し、現在対象としている
クラスの宣言が含まれていなければその入力ファイル内
にクラスの宣言を含め、入力ファイル名がクラス名と一
致する入力ファイルがなければクラス名と同名の入力フ
ァイルを作成し、この入力ファイルにクラスの宣言を含
めるとともにこの入力ファイルを入力ファイル群に含め
る請求項1記載の目的コードサイズ最適化方式。
2. If the class name and the input file name do not match, all the input file names processed by the object-oriented language processing system are checked, and if there is an input file whose input file name matches the class name. For example, scan the contents of the input file and include the declaration of the class in the input file if it does not contain the declaration of the current target class. If there is no input file whose input file name matches the class name, class name 2. The object code size optimizing method according to claim 1, wherein an input file having the same name as is created, a class declaration is included in the input file, and the input file is included in the input file group.
【請求項3】 前記オブジェクト指向言語がC++でな
り、前記メソッドアドレス格納テーブルが仮想関数テー
ブルでなる請求項1または2記載のオブジェクト指向言
語処理システムにおける目的コードサイズ最適化方式。
3. The object code size optimizing method in an object oriented language processing system according to claim 1, wherein the object oriented language is C ++ and the method address storage table is a virtual function table.
JP8016493A 1993-03-15 1993-03-15 Object code size optimizing system in object-oriented language processing system Pending JPH06266562A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP8016493A JPH06266562A (en) 1993-03-15 1993-03-15 Object code size optimizing system in object-oriented language processing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP8016493A JPH06266562A (en) 1993-03-15 1993-03-15 Object code size optimizing system in object-oriented language processing system

Publications (1)

Publication Number Publication Date
JPH06266562A true JPH06266562A (en) 1994-09-22

Family

ID=13710685

Family Applications (1)

Application Number Title Priority Date Filing Date
JP8016493A Pending JPH06266562A (en) 1993-03-15 1993-03-15 Object code size optimizing system in object-oriented language processing system

Country Status (1)

Country Link
JP (1) JPH06266562A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6851106B1 (en) 1998-02-20 2005-02-01 Hitachi, Ltd. Object oriented optimizing code generator with user selection of use or do not use for dynamic generation of functions
JP2006163686A (en) * 2004-12-06 2006-06-22 Matsushita Electric Ind Co Ltd Compiling method, compiling program, compiling device and recording medium for compile

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6851106B1 (en) 1998-02-20 2005-02-01 Hitachi, Ltd. Object oriented optimizing code generator with user selection of use or do not use for dynamic generation of functions
JP2006163686A (en) * 2004-12-06 2006-06-22 Matsushita Electric Ind Co Ltd Compiling method, compiling program, compiling device and recording medium for compile
US7624390B2 (en) 2004-12-06 2009-11-24 Panasonic Corporation Optimizing compiling of object oriented source code

Similar Documents

Publication Publication Date Title
US7120898B2 (en) Intermediate representation for multiple exception handling models
US6662354B1 (en) Determining destinations of a dynamic branch
US5832273A (en) System for deleting redundant instructions from high level language source code containing in-line assembly instructions
US6901579B1 (en) Generation of source code from classes and maintaining the comment that indicates the role of the class in the generated source code
US5361357A (en) Method and apparatus for optimizing computer file compilation
US7028291B2 (en) Debugging method and debugging device
US20080184197A1 (en) Macro to instantiate a variable used with a first macro requiring use of a second macro suitable for said variable
US7386843B2 (en) Method and system for register allocation
JP2007531946A (en) Data integrity in data processing equipment
JP4026940B2 (en) Program converter
JPH06266562A (en) Object code size optimizing system in object-oriented language processing system
JP3266097B2 (en) Automatic reentrant method and system for non-reentrant program
JPH09218789A (en) Division compiling system
CN114489683B (en) JVM-based functional programming grammar implementation method for java-like language
JPH0695890A (en) Name replacement system in compiler
JP3018783B2 (en) Compilation method
JP2000112770A (en) Program translating device
JP2002055852A (en) Object generation/extinction information management system
JPH03186933A (en) Symbol processing system for language processing system
JP2001290674A (en) Device and method for setting program breakpoint
Klinger et al. Günther Haslinger
JPH11232120A (en) Program matching method
JPH0566949A (en) Calling system for function definition compiled code
JPH08339309A (en) Data breakdown check method, data processor and data base preparing device
JP2005242879A (en) Performance information acquiring device and method, and control program