JP2000112770A - Program translating device - Google Patents

Program translating device

Info

Publication number
JP2000112770A
JP2000112770A JP27878198A JP27878198A JP2000112770A JP 2000112770 A JP2000112770 A JP 2000112770A JP 27878198 A JP27878198 A JP 27878198A JP 27878198 A JP27878198 A JP 27878198A JP 2000112770 A JP2000112770 A JP 2000112770A
Authority
JP
Japan
Prior art keywords
type information
tag
runtime type
section
program
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
JP27878198A
Other languages
Japanese (ja)
Inventor
Tsutomu Yoshida
力 吉田
Toshiyuki Sakata
俊幸 坂田
Seiichi Urushibara
誠一 漆原
Naosuke Haruna
修介 春名
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP27878198A priority Critical patent/JP2000112770A/en
Publication of JP2000112770A publication Critical patent/JP2000112770A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PROBLEM TO BE SOLVED: To avoid incorporating unnecessary information of an executing time type in an execution form program. SOLUTION: In compiling, an executing time type information preparing part 805 generates the section of a specific name storing executing time type information and an executing time type information use discriminating part 804 discriminates whether a reserved word for referring to execution time type information is included in a source program and in the case of being included, a tag generation part 806 generates a tag showing that it is included and incorporate it in an object module. When linked, a tag recognizing part 811 discriminates whether a tag is respectively included in all the object modules being the object of linking and in the case of discriminating that any object module does not include the tag, an execution time type information section erasing part 812 removes the section of the specific name included in them.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、ソースプログラム
をコンパイル・リンクするプログラム翻訳装置に関し、
特に、実行時型情報の参照が可能なオブジェクト指向プ
ログラミング用の翻訳装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a program translator for compiling and linking a source program.
In particular, the present invention relates to a translation device for object-oriented programming that can refer to runtime type information.

【0002】[0002]

【従来の技術】C++言語に代表されるオブジェクト指
向プログラミングにおいては、実行時型情報(RTTI:Run
-Time Type Information)を参照することによって多様
な機能を持つプログラムを作成するが可能となる。ここ
で、実行時型情報とは、実行時に決定されるオブジェク
トの型情報をいい、具体的には、参照されているオブジ
ェクトがどのクラスに属するかを示す情報である。以
下、図12〜図18を用いて、実行時型情報が用いられ
る例を示す。
2. Description of the Related Art In object-oriented programming represented by the C ++ language, runtime type information (RTTI: Run
-Time Type Information) makes it possible to create programs with various functions. Here, the runtime type information refers to type information of an object determined at the time of execution, and specifically, information indicating to which class the referenced object belongs. Hereinafter, an example in which the runtime type information is used will be described with reference to FIGS.

【0003】図12は3つのクラスを定義するプログラ
ムリストであり、図13はそれらクラスの継承関係を示
すツリー図である。基本クラスAと、その基本クラスA
を継承する派生クラスB、Cが示されている。基本クラ
スAでは、1つのメンバ変数aと3つの仮想関数(オー
バーライドメソッド)f、g、hが定義され、派生クラ
スBではさらに、1つのメンバ変数bと仮想関数gが定
義され、派生クラスCではさらに、1つのメンバ変数c
と仮想関数gが定義されている。
FIG. 12 is a program list defining three classes, and FIG. 13 is a tree diagram showing the inheritance relationship of the classes. Base class A and its base class A
Are derived classes B and C that inherit from. In the base class A, one member variable a and three virtual functions (override methods) f, g, and h are defined. In the derived class B, one member variable b and a virtual function g are further defined, and the derived class C is defined. Then, one more member variable c
And a virtual function g are defined.

【0004】図14は、図12で定義されたクラスを利
用するプログラム例であり、仮想関数の典型的な利用例
を示すプログラムのリストである。関数xは、クラスA
のオブジェクトへのポインタobjを引数とし、その引数o
bjが指すオブジェクトのメンバ関数(メソッド)gを呼
び出している。ここで、引数objは、クラスAだけでな
く、その派生クラスであるクラスBやクラスCのオブジ
ェクトへのポインタにもなり得ること、及び、関数gが
仮想関数として定義されていることから、この関数x
は、実行時における引数objの値に依存して、クラス
A、B及びCのいずれかの関数gを呼び出す内容とな
る。
FIG. 14 shows an example of a program using the classes defined in FIG. 12, and is a list of programs showing typical examples of using virtual functions. The function x is a class A
With a pointer obj to the object of
The member function (method) g of the object pointed to by bj is called. Here, since the argument obj can be not only a class A but also a pointer to an object of a class B or class C that is a derived class thereof, and the function g is defined as a virtual function, Function x
Is the content for calling the function g of any of the classes A, B and C depending on the value of the argument obj at the time of execution.

【0005】図15は、図12で定義されたクラスを利
用するプログラム例であり、実行時型情報を参照するプ
ログラムのリストである。関数yは、クラスA(及びそ
の派生クラス)のオブジェクトへのポインタobjを引数
とし、その引数objが指すオブジェクトのメンバ変数a
に1を代入した後に、引数objがクラスBへのポインタ
であるか否か判断し、そうである場合に引数objが指す
オブジェクトのメンバ変数bに2を代入している。ここ
で、演算子typeid(ptr)は、実行時型情報を参照する予
約語の一つであり、ポインタptrが指すオブジェクトが
属するクラスを特定する情報、即ち、ポインタptrが指
すオブジェクトの実行時型情報を格納したconst typein
fo型のオブジェクトを返す関数である。
FIG. 15 shows an example of a program that uses the classes defined in FIG. 12, and is a list of programs that refer to runtime type information. The function y takes a pointer obj to an object of the class A (and its derived class) as an argument, and a member variable a of the object indicated by the argument obj.
After assigning 1 to, it is determined whether or not the argument obj is a pointer to the class B. If so, 2 is assigned to the member variable b of the object indicated by the argument obj. Here, the operator typeid (ptr) is one of the reserved words referring to the runtime type information, and information for specifying the class to which the object pointed to by the pointer ptr belongs, that is, the runtime type of the object pointed to by the pointer ptr. Const typein that stores information
This function returns an fo type object.

【0006】図15に示される関数zは、クラスA(及
びその派生クラス)のオブジェクトへのポインタobjを
引数とし、その引数objをクラスCのオブジェクトを指
すポインタに型変換(キャスト)し、その変換に成功し
た場合にのみ、変換後のポインタcpを実引数として関数
wを呼び出している。このような判断が必要とされるの
は、関数wはクラスC(及びその派生クラス)のオブジ
ェクトへのポインタobjを引数としているので、クラス
AやクラスBのオブジェクトへのポインタを実引数とし
て受け取ることができず、事前の判断が必要とされるか
らである。
A function z shown in FIG. 15 takes a pointer obj to an object of class A (and its derived class) as an argument, converts the argument obj to a pointer to an object of class C (cast), and Only when the conversion is successful, the function w is called using the converted pointer cp as an actual argument. Such a judgment is required because the function w receives the pointers to the class A and class B objects as the actual arguments because the function w uses the pointer obj to the object of the class C (and its derivative class) as an argument. This is because it is not possible to do so and prior judgment is required.

【0007】ここで、演算子dynamic_cast<T>(ptr)は、
実行時型情報を参照する予約語の一つであり、ポインタ
ptrをTの型にキャスト、即ち、ポインタptrをクラスT
のオブジェクトへのポインタに変換し、成功すればその
ポインタを返し、そうでなければヌルポインタ(ゼロ)
を返す。なお、ポインタptrが示すオブジェクトが属す
るクラスがクラスT又はその派生クラスであるときに成
功となる。また、この演算子dynamic_cast<T>(ptr)は、
それ自体、上述の演算子typeid()を用いて作られた関数
であり、実行時型情報を参照する予約語の一つと言え
る。
Here, the operator dynamic_cast <T> (ptr) is
One of the reserved words that refer to runtime type information, and a pointer
Cast ptr to type T, ie, convert pointer ptr to class T
Converts to a pointer to an object, returns the pointer if successful, otherwise a null pointer (zero)
return it. Note that the process is successful when the class to which the object indicated by the pointer ptr belongs is the class T or a derivative class thereof. Also, this operator dynamic_cast <T> (ptr)
The function itself is a function created using the above-mentioned operator typeid (), and can be said to be one of the reserved words for referring to the runtime type information.

【0008】このような実行時型情報の参照を可能とす
るために、C++言語に代表される従来のプログラム翻
訳装置は、コンパイルやリンクの処理によってオブジェ
クトモジュールや実行形式プログラムを生成する際に、
仮想関数表等と関連させて実行時型情報をも生成するこ
ととしている。ここで、仮想関数表とは、クラス毎に作
成される表であって、C++言語では、そのクラスで定
義されている仮想関数へのポインタと併せて実行時型情
報へのポインタも格納している。
In order to make it possible to refer to such runtime type information, a conventional program translator represented by the C ++ language generates an object module or an executable program by compiling or linking.
Runtime type information is also generated in association with a virtual function table and the like. Here, the virtual function table is a table created for each class. In the C ++ language, a pointer to runtime type information is stored together with a pointer to a virtual function defined in the class. I have.

【0009】図16は、実行時においてメモリ上に形成
されるオブジェクト、仮想関数表及び実行時型情報の関
連を示す図である。オブジェクトの先頭には仮想関数表
へのポインタvptrが格納され、仮想関数表の先頭には実
行時型情報へのポインタrptrが格納されている。図17
は、図12に示されるクラスAについての仮想関数表
と、その仮想関数表に関連づけて生成された実行時型情
報の例を示す図である。ここでは、クラスAについての
仮想関数表には、シンボル_virtual_Aで始まる4要素の
データの並び、即ち、クラスAの実行時型情報、関数
f、関数g、関数hそれぞれへのポインタが格納されて
いる。また、実行時型情報は、シンボル_typeID_Aで始
まる17要素のデータの並びである。
FIG. 16 is a diagram showing the relationship between an object formed on a memory at the time of execution, a virtual function table, and runtime type information. A pointer vptr to a virtual function table is stored at the head of the object, and a pointer rptr to runtime type information is stored at the head of the virtual function table. FIG.
FIG. 13 is a diagram showing an example of a virtual function table for class A shown in FIG. 12 and runtime type information generated in association with the virtual function table. Here, in the virtual function table for the class A, an array of four-element data starting with the symbol _virtual_A, that is, the runtime type information of the class A, and pointers to the functions f, g, and h are stored. ing. The runtime type information is a sequence of 17 elements of data starting with the symbol _typeID_A.

【0010】このように、プログラムの実行時において
は、オブジェクトへのポインタを出発点として仮想関数
表を経て実行時型情報に辿ることによって、そのオブジ
ェクトに関する実行時型情報を参照することが可能とな
る。
As described above, when a program is executed, it is possible to refer to the runtime type information on the object by tracing the runtime type information via the virtual function table with the pointer to the object as a starting point. Become.

【0011】[0011]

【発明が解決しようとする課題】しかしながら、従来の
翻訳装置によれば、ソースプログラム中で実行時型情報
が参照されるか否かに拘わらず図17に示されるような
実行時型情報を含むオブジェクトモジュールが生成さ
れ、リンクされるために、最終的に得られる実行形式プ
ログラム中には必ず実行時型情報が含まれることとな
り、そのサイズが肥大化するという問題がある。つま
り、リンクによって生成された最終的な実行形式プログ
ラム全体において実行時型情報が全く用いられない場合
であっても、その中には常に実行時型情報が含まれてし
まうという問題がある。このようなプログラムサイズの
肥大化は、特に、家電機器のようなメモリ容量の制約が
厳しい電子機器に用いられる組込み用途のマイクロプロ
セッサを対象とする翻訳装置にとって致命的な問題とな
る。
However, according to the conventional translator, regardless of whether or not the runtime type information is referred to in the source program, it includes the runtime type information as shown in FIG. Since the object module is generated and linked, the finally obtained executable program always includes the runtime type information, and there is a problem that its size is enlarged. That is, there is a problem that even when the runtime type information is not used at all in the final executable program generated by the link, the runtime type information is always included therein. Such an increase in program size is a fatal problem, especially for a translation device for a microprocessor for embedded use used in an electronic device having a strict memory capacity such as a home appliance.

【0012】なお、従来の翻訳装置がコンパイル時にお
いてソースプログラム中での実行時型情報の使用の有無
に拘わらず常に実行時型情報を生成するのは、そのオブ
ジェクトモジュールとリンクされる他のオブジェクトモ
ジュールからその実行時型情報が参照される可能性があ
るからである。そのような無駄な実行時型情報の生成を
回避する方法の一つとして、ソースプログラム中におい
てクラス毎に実行時型情報の使用を許可するか否か(実
行時型情報を生成させるか否か)を明示しておく方法が
考えられる。つまり、図18に示されるクラスAのよう
に、予約語__rttiを伴って宣言されたクラスについては
実行時型情報を生成し、そうでない場合には生成しない
とする方法である。しかし、そのような方法では、ソー
スプログラムの作成時点において、プログラマはリンク
の対象となり得る他のオブジェクトモジュール全てがそ
のクラスの実行時型情報を参照しないことを確定的に知
っている必要があり、汎用的なオブジェクトモジュール
(どのようなオブジェクトモジュールとリンクされて用
いられるかが不明なオブジェクトモジュール)の作成が
困難になる等、柔軟なプログラム開発が妨げられる。
The reason why the conventional translator always generates the runtime type information at the time of compiling irrespective of whether or not the runtime type information is used in the source program is that other object linked with the object module is used. This is because the runtime type information may be referred to from a module. One method of avoiding such useless generation of runtime type information is whether to permit use of runtime type information for each class in the source program (whether to generate runtime type information or not). ) Is conceivable. That is, as in the class A shown in FIG. 18, the method is such that the runtime type information is generated for a class declared with the reserved word __rtti, and is not generated otherwise. However, such a method requires that at the time of writing the source program, the programmer definitely know that all other object modules that can be linked do not refer to the runtime type information of the class, Flexible program development is hindered, for example, it is difficult to create a general-purpose object module (an object module for which it is unknown which object module is linked to be used).

【0013】そこで、本発明はかかる問題点に鑑みてな
されたものであり、実行時型情報の生成が必要であるか
否かをソースプログラム中に明示することなく、実行形
式プログラムに無駄な実行時型情報が含まれることを回
避したプログラム翻訳装置、即ち、プログラムサイズの
無駄な肥大化を回避したプログラム翻訳装置を提供する
ことを目的とする。
Accordingly, the present invention has been made in view of such a problem, and there is no need to explicitly indicate in a source program whether or not generation of run-time type information is necessary, so that an unnecessary execution is executed in an executable format program. It is an object of the present invention to provide a program translator that avoids the inclusion of time type information, that is, a program translator that avoids an unnecessary increase in program size.

【0014】[0014]

【課題を解決するための手段】上記目的を達成するため
に、本発明に係る翻訳装置は、オブジェクト指向言語で
記述されたソースプログラムをコンパイルしてオブジェ
クトモジュールを生成するコンパイラ手段と、オブジェ
クトモジュールをリンクして実行形式プログラムを生成
するリンカ手段とを備える翻訳装置であって、前記コン
パイラ手段は、特定の名前で識別可能なセクションであ
って実行時型情報を収めたものを生成し前記オブジェク
トモジュールに含ませる実行時型情報生成部と、前記ソ
ースプログラムにおいて実行時型情報が使用されている
か否かを判別する使用判別部と、使用されていると判別
された場合にその旨を示すタグを生成し前記オブジェク
トモジュールに含ませるタグ生成部とを有し、前記リン
カ手段は、リンクの対象となる全てのオブジェクトモジ
ュールそれぞれに前記タグが含まれているか否かを判別
するタグ判別部と、前記全てのオブジェクトモジュール
のいずれにも前記タグが含まれていないと判別された場
合にそれらオブジェクトモジュールに含まれている前記
セクションをリンクの対象から除外する実行時型情報削
除部とを有することを特徴とする。
In order to achieve the above object, a translation apparatus according to the present invention comprises: a compiler for compiling a source program described in an object-oriented language to generate an object module; A translation unit for generating an executable program by linking, wherein the compiler unit generates a section that can be identified by a specific name and contains runtime type information, and A runtime type information generating unit to be included in the source program, a use determining unit for determining whether or not runtime type information is used in the source program, and a tag indicating that it is determined that the runtime type information is used. A tag generation unit for generating and including the generated object module in the object module; A tag determining unit that determines whether or not each of the target object modules includes the tag, and a tag determining unit that determines that none of the object modules includes the tag. A runtime type information deletion unit that excludes the section included in the module from a link target.

【0015】つまり、コンパイル時において、ソースプ
ログラムで定義されたクラスごとの実行時型情報を収め
た特定の名前のセクションを生成すると共に、そのソー
スプログラムが実行時型情報を参照する内容であるか否
かを判別し、参照する内容である場合にはその旨を示す
タグを生成し、それらをオブジェクトモジュールに含ま
せる。そして、リンク時において、リンクの対象となる
全てのオブジェクトモジュールそれぞれにタグが含まれ
ているか判別し、いずれのオブジェクトモジュールにも
タグが含まれていない、つまり、いずれのオブジェクト
モジュールも実行時型情報を参照していないと判別した
場合には、それらオブジェクトモジュールに含まれてい
た上記特定名のセクションをリンクの対象から除外す
る。
That is, at compile time, a section having a specific name containing runtime type information for each class defined in the source program is generated, and whether the source program refers to the runtime type information or not. It is determined whether or not the content is to be referred to, and a tag indicating that fact is generated, and these are included in the object module. Then, at the time of linking, it is determined whether a tag is included in each of all the object modules to be linked, and no tag is included in any of the object modules. , The section with the specific name included in the object module is excluded from the link targets.

【0016】[0016]

【発明の実施の形態】以下、本発明の実施の形態につい
て図面を用いて詳細に説明する。図1は、本発明に係る
プログラム翻訳装置の構成を示す機能ブロック図であ
る。本装置は、C++言語等の一般的なオブジェクト指
向言語で記述されたソースプログラム801,802、
即ち、実行時型情報の生成を明示することなく作成した
ソースプログラムをコンパイルしリンクすることによっ
て、無駄な実行時型情報を含まない特定のマイクロプロ
セッサ向けの実行形式ファイル814を生成する装置で
あり、大きく分けて2つの構成要素、即ち、コンパイラ
部803とリンカ部810とから構成される。本装置
は、C++言語等の従来のの翻訳装置の機能に本発明に
特有の機能を付加したものに相当し、汎用のコンピュー
タ上で実行されるプログラムとして実現される。
Embodiments of the present invention will be described below in detail with reference to the drawings. FIG. 1 is a functional block diagram showing a configuration of a program translation device according to the present invention. The present apparatus includes source programs 801 and 802 described in a general object-oriented language such as the C ++ language,
In other words, this is an apparatus that generates an executable file 814 for a specific microprocessor that does not include useless runtime type information by compiling and linking a source program created without specifying generation of runtime type information. It is roughly composed of two components, that is, a compiler unit 803 and a linker unit 810. The present device corresponds to a function of a conventional translator such as a C ++ language added with a function unique to the present invention, and is realized as a program executed on a general-purpose computer.

【0017】コンパイラ部803は、各ソースプログラ
ム801(802)ごとに、高級言語で記述された命令
列を上記プロセッサ向けの械語命令列及びデータに変換
することによりオブジェクトモジュール808(80
9)を生成する翻訳部であり、さらに、実行時型情報使
用判別部804、実行時型情報作成部805、タグ生成
部806及び命令翻訳部807から構成される。
The compiler unit 803 converts, for each source program 801 (802), an instruction sequence described in a high-level language into a machine instruction sequence and data for the processor, thereby obtaining an object module 808 (80).
9), and further includes a runtime type information use determining unit 804, a runtime type information creation unit 805, a tag generation unit 806, and an instruction translation unit 807.

【0018】実行時型情報作成部805は、入力された
ソースプログラム801(802)中で定義されている
全てのクラスについて、クラスごとの実行時型情報が含
まれた特定の名前のセクションを生成し、命令翻訳部8
07に渡す。ここで、セクションとは、オブジェクトモ
ジュールを構成する機械語命令列やデータの論理的なま
とまり(単位)をいい、それら論理的なまとまりをリン
カに伝えるために用いられる。また、特定の名前とは、
プログラムの処理本体に相当する機械語命令列やデータ
を示すセクション名とは区別される独自のセクション名
をいい、ここでは、文字列「_RTTI_」と当該クラス名と
を結合した文字列が用いられる。この実行時型情報作成
部805は、ソースプログラムで定義されている全ての
クラスについて実行時型情報を生成する点で従来の翻訳
装置と同じであるが、上述のルールに従った特定の名前
のセクション中に生成する点で、機械語命令列と同じセ
クション中に生成する従来の翻訳装置と異なる。
The runtime type information creating unit 805 generates a section having a specific name including runtime type information for each class for all classes defined in the input source program 801 (802). And the instruction translator 8
Hand over to 07. Here, the section refers to a logical unit (unit) of a machine language instruction sequence and data constituting the object module, and is used for transmitting the logical unit to the linker. Also, a specific name is
This is a unique section name that is distinguished from the machine language instruction string or section name that indicates data that corresponds to the program processing body. Here, a character string that combines the character string "_RTTI_" and the class name is used. . The runtime type information creation unit 805 is the same as the conventional translation apparatus in that runtime type information is generated for all classes defined in the source program, but has a specific name according to the above-described rules. This is different from the conventional translator that generates the instruction in the same section as the machine language instruction sequence in that it is generated in the section.

【0019】実行時型情報使用判別部804は、入力さ
れたソースプログラム801(802)中で実行時型情
報が使用されているか否か、具体的には、ソースプログ
ラム中に予約語typeid又はdynamic_castが含まれている
か否かを判別し、その結果をタグ生成部806に伝え
る。タグ生成部806は、ソースプログラム801(8
02)中に上記予約語が含まれている旨の通知を実行時
型情報使用判別部804から受けた場合にのみ、その旨
をリンカ部810に伝えるためのタグ(ここでは、疑似
命令「.usertti」)を生成し、命令翻訳部807に渡
す。
The run-time type information use determining unit 804 determines whether or not the run-time type information is used in the input source program 801 (802), specifically, the reserved word typeid or dynamic_cast in the source program. Is determined, and the result is transmitted to the tag generation unit 806. The tag generation unit 806 outputs the source program 801 (8
02), the tag (here, the pseudo-instruction ".0") for notifying the linker unit 810 that the reserved word is included from the runtime type information use determination unit 804 only when the notification is received. usertti ”) and passes it to the instruction translating unit 807.

【0020】命令翻訳部807は、本装置に入力された
ソースプログラム801(802)を上述のプロセッサ
向けの機械語命令列及びデータに変換した後に、それら
機械語命令列及びデータと、実行時型情報作成部805
で生成されたセクションと、タグ生成部806で生成さ
れた(生成されない場合もある)タグ(疑似命令「.use
rtti」)とを結合することによってオブジェクトモジュ
ール808(809)を完成させ、外部に出力する。な
お、ここでの変換は、ソースプログラムの構文解析、中
間言語への変換、資源割り付け及び機械語コードへの変
換等であり、従来の翻訳装置が備えるコンパイラ部と同
様の機能である。
The instruction translator 807 converts the source program 801 (802) input to the present apparatus into the above-described machine language instruction sequence and data for the processor, Information creation unit 805
And the tag (may not be generated) generated by the tag generation unit 806 (the pseudo instruction “.use
rtti ") to complete the object module 808 (809) and output it to the outside. The conversion here is a syntax analysis of a source program, a conversion to an intermediate language, a resource allocation, a conversion to a machine language code, and the like, and has the same function as a compiler unit provided in a conventional translation apparatus.

【0021】このようにしてコンパイラ部803により
生成されたオブジェクトモジュール808、809それ
ぞれには、そのプログラムで定義されている各クラスに
対応する実行時型情報が含まれると共に、そのプログラ
ムで実行時型情報を参照する命令が用いられている場合
におけるその旨を示すタグが含まれていることになる。
Each of the object modules 808 and 809 generated by the compiler unit 803 in this way includes runtime type information corresponding to each class defined in the program, and executes the runtime type information in the program. When an instruction to refer to information is used, a tag indicating that fact is included.

【0022】リンカ部810は、上記コンパイラ部80
3によって生成されたオブジェクトモジュール808、
809を入力とし、それらモジュール間での参照関係
(アドレス)を解決し連結することで上述のプロセッサ
が直接実行できる1個の実行形式ファイル814を生成
する連結編集部であり、さらに、タグ識別部811、実
行時型情報セクション削除部812及びファイル連結部
813から構成される。
The linker unit 810 is provided with the compiler unit 80
3, the object module 808 generated by
809, a link editing unit that generates one executable file 814 that can be directly executed by the processor by resolving and linking reference relationships (addresses) between the modules, and a tag identification unit. 811, a runtime type information section deletion unit 812 and a file connection unit 813.

【0023】タグ識別部811は、このリンカ部810
に入力されたオブジェクトモジュール808、809そ
れぞれに上述のタグ(疑似命令「.usertti」)が含まれ
ているか否かを判断し、その結果を実行時型情報セクシ
ョン削除部812に通知する。その通知に基づいて、実
行時型情報セクション削除部812は、リンクの対象と
なる全てのオブジェクトモジュール中にタグが含まれな
いことを確認できた場合、即ち、いずれのオブジェクト
モジュールも実行時型情報を参照していないことを確認
できた場合には、それらオブジェクトモジュール80
8、809それぞれに含まれていた全ての実行時型情報
を削除し、削除後のオブジェクトモジュール808、8
09をファイル連結部813に渡す。そうでない場合に
は、このリンカ部810に入力されたオブジェクトモジ
ュール808、809をそのままファイル連結部813
に渡す。
The tag identification section 811 is provided by the linker section 810.
It is determined whether or not each of the object modules 808 and 809 input in the above includes the tag (pseudo-instruction “.usertti”), and the result is notified to the runtime type information section deletion unit 812. Based on the notification, the runtime type information section deletion unit 812 confirms that no tag is included in all the object modules to be linked, that is, the runtime type information Are not referred to, the object module 80
8, 809, deletes all the runtime type information included in each of the object modules 808, 8
09 to the file connection unit 813. If not, the object modules 808 and 809 input to the linker unit 810 are directly copied to the file connection unit 813.
Pass to.

【0024】なお、実行時型情報セクション削除部81
2は、各オブジェクトモジュールを構成するセクション
のうち上述の特定の名前を持つセクション、即ち、文字
列「_RTTI_」とクラス名とが結合された名前を持つセク
ションを特定し、そのセクションに置かれたデータ(実
行時型情報)を消去する(空にする)ことにより、実行
時型情報の削除を行う。
The run-time type information section deletion unit 81
2 specifies a section having the above-mentioned specific name among sections constituting each object module, that is, a section having a name obtained by combining a character string "_RTTI_" and a class name, and placed in the section. By deleting (emptying) the data (run-time type information), the run-time type information is deleted.

【0025】ファイル連結部813は、実行時型情報セ
クション削除部812から渡された全てのオブジェクト
モジュールを対象としてモジュール間の参照関係等を解
決しながら機械語命令列及びデータを連結することによ
って、最終的な1個の実行形式ファイル814を完成さ
せる。なお、ここでの連結処理は、従来の翻訳装置が備
えるリンカ部が有する機能と同様である。
The file linking unit 813 links all the object modules passed from the runtime type information section deleting unit 812 and resolves the reference relation between the modules while linking the machine language instruction sequence and data. One final executable file 814 is completed. The linking process here is the same as the function of the linker provided in the conventional translation device.

【0026】以上のように、本装置によれば、コンパイ
ル時において、ソースプログラムごとに実行時型情報を
参照する内容であるか否かが判断され、その判断結果が
タグの添付の有無となってオブジェクトモジュールに反
映され、リンク時において、そのタグの存在を検証する
ことによって、リンクの対象となった全てのオブジェク
トモジュールにおいて実行時型情報の参照が行われてい
ないと判断された場合には、そのような無駄な実行時型
情報が実行形式ファイルに残されることが回避される。
これによって、実行時型情報の参照の有無に関してソー
スプログラム中に明示しておくことなく、実行形式ファ
イルのサイズの無駄な肥大化が防止される。
As described above, according to the present apparatus, at the time of compiling, it is determined whether or not the contents refer to the runtime type information for each source program, and the result of the determination is whether or not a tag is attached. If it is determined that reference to the runtime type information has not been made in all the linked object modules by verifying the existence of the tag at the time of linking, This prevents such useless runtime type information from being left in the executable file.
As a result, it is possible to prevent the size of the executable file from being unnecessarily enlarged without explicitly indicating in the source program whether or not the runtime type information is referenced.

【0027】次に、以上のように構成された本装置の時
系列的な動作について、具体的なサンプルプログラムを
用いて説明する。まず、ソースプログラム中において実
行時型情報が参照されている第1のケースを例にとって
説明する。図2及び図3は、それぞれ、本装置に入力さ
れる一つのソースプログラム801及びその場合に本装
置のコンパイラ部803によって生成されるオブジェク
トモジュール808のリストである。同様に、図4及び
図5は、それぞれ、本装置に入力されるもう一つのソー
スプログラム802及びその場合に本装置のコンパイラ
部803によって生成されるオブジェクトモジュール8
09のリストである。さらに、図6は、オブジェクトモ
ジュール808及び809が入力された場合にリンカ部
810によって生成される最終的な実行形式ファイル8
14のリストである。
Next, the time-series operation of the present apparatus configured as described above will be described using a specific sample program. First, the first case in which the runtime type information is referred to in the source program will be described as an example. FIGS. 2 and 3 are lists of one source program 801 to be input to the apparatus and object modules 808 generated by the compiler unit 803 of the apparatus in that case. Similarly, FIGS. 4 and 5 show another source program 802 to be input to the apparatus and an object module 8 generated by the compiler unit 803 of the apparatus in that case.
09 is a list. FIG. 6 shows a final executable file 8 generated by the linker unit 810 when the object modules 808 and 809 are input.
14 is a list.

【0028】図2に示されるように、ソースプログラム
801では、変数aと仮想関数fとをメンバに持つ基本
クラスX、変数bと仮想関数fとをメンバに持つその派
生クラスY、クラスXの仮想関数f、及び、クラスYの
仮想関数fが定義されている。一方、図4に示されるよ
うに、ソースプログラム802では、ソースプログラム
801と同様のクラスX及びY、クラスXのオブジェク
トへのポインタobjを引数とし、その引数が指すオブジ
ェクトが属するクラスを判断して表示する関数printCla
ssName、並びに、そのような関数printClassNameを呼び
出すメイン関数mainが定義されている。このソースプロ
グラム802には、予約語typeidが含まれていることか
ら分かるように、実行時型情報を参照する処理が含まれ
ている。
As shown in FIG. 2, in a source program 801, a base class X having a variable a and a virtual function f as members, a derived class Y having a variable b and a virtual function f as members, and a class A virtual function f and a virtual function f of class Y are defined. On the other hand, as shown in FIG. 4, the source program 802 uses the same classes X and Y as the source program 801 and the pointer obj to the object of the class X as arguments and determines the class to which the object indicated by the argument belongs. Function to display printCla
An ssName is defined, as well as a main function main that calls such a function printClassName. As can be seen from the fact that the reserved word typeid is included, the source program 802 includes a process of referring to the runtime type information.

【0029】なお、上記オブジェクトモジュール80
8、809や実行形式ファイル814のリストにおける
主な表記の意味は以下の通りである。sction _TEXT_vir
tual_X commom : この宣言以後に置かれた機械語命
令列がセクション_TEXT_virtual_Xに格納されること、
及び、セクション_TEXT_virtual_Xの属性がcommomであ
ることを示す擬似命令である。属性がcommomであると
は、複数のオブジェクトファイルに同名のcommom属性の
セクションが含まれている場合においてそれらオブジェ
クトモジュールをリンクしたときには、最初に読み込ま
れたオブジェクトモジュールのセクションに含まれる内
容のみがリンクされ、以後のオブジェクトモジュールに
存在する同名のセクションはリンクの対象から外される
ことを意味する。
The object module 80
The meanings of main notations in the list of 8, 809 and the execution format file 814 are as follows. sction _TEXT_vir
tual_X commom: A machine instruction sequence placed after this declaration is stored in section _TEXT_virtual_X.
And a pseudo-instruction indicating that the attribute of section_TEXT_virtual_X is commom. When the attribute is commom, when multiple object files contain a commom attribute section with the same name, when those object modules are linked, only the contents contained in the section of the first loaded object module are linked. This means that sections of the same name existing in the subsequent object modules are excluded from the link target.

【0030】_virtual_X : クラスX仮想関数表の先
頭を示すラベルである。 dd value : valueで示されたデータ(領域)を定義
する擬似命令である。 _virtual_X : クラスX仮想関数表の先頭を示すラベ
ルである。 sction _TEXT_virtual_Y commom 及び _virtual_Y
: クラスYについての上記と同様の意味である。
_Virtual_X: Label indicating the top of the class X virtual function table. dd value: A pseudo-instruction that defines the data (area) indicated by value. _virtual_X: Label indicating the top of the class X virtual function table. sction _TEXT_virtual_Y commom and _virtual_Y
: Has the same meaning as above for class Y.

【0031】section _TEXT : この宣言以後に置か
れた機械語命令列がセクション_TEXTに格納されること
を示す擬似命令である。 _X_f$qv : クラスXの仮想関数void f(void)のアドレ
スを表すラベルである。 mov A0 , Label : Labelで表わされるアドレスをレ
ジスタA0にロードする転送命令である。
Section_TEXT: A pseudo-instruction indicating that a machine instruction sequence placed after this declaration is stored in section_TEXT. _X_f $ qv: Label indicating the address of virtual function void f (void) of class X. mov A0, Label: A transfer instruction for loading the address represented by Label into register A0.

【0032】call Label : Labelで表わされるアド
レスに分岐するサブルーチンコール命令である。 ret : 関数からの復帰命令である。 _Y_f$qv : クラスYの仮想関数void f(void)のアドレ
スを表すラベルである。
Call Label: A subroutine call instruction that branches to the address represented by Label. ret: Return instruction from a function. _Y_f $ qv: Label indicating the address of the virtual function void f (void) of class Y.

【0033】ds string : stringで表わされた文字
列データを定義する疑似命令である。 db 0 : 文字列の終端を定義する疑似命令である。 section _RTTI_X commom : この宣言以後に置かれ
た機械語命令列がセクション_RTTI_Xに格納されるこ
と、及び、セクション_RTTI_Xの属性がcommomであるこ
とを示す擬似命令である。
Ds string: A pseudo-instruction that defines character string data represented by string. db 0: Pseudo-instruction that defines the end of a character string. section_RTTI_X commom: A pseudo-instruction indicating that the machine instruction sequence placed after this declaration is stored in section_RTTI_X, and that the attribute of section_RTTI_X is commom.

【0034】_typeID_X : クラスXの実行時型情報を
収めている領域の先頭アドレスを表すラベルである。 section _RTTI_Y commom 及び _typeID_Y : ク
ラスYについての上記と同様の意味である。 .usertti : このオブジェクトモジュール内のプログ
ラムが実行時型情報を使用していることを表す疑似命令
である。
_TypeID_X: A label indicating the start address of the area containing the runtime type information of class X. section _RTTI_Y commom and _typeID_Y: Same meaning as above for class Y. .usertti: A pseudo-instruction indicating that the program in this object module uses runtime type information.

【0035】_obj : 静的オブジェクトobjの格納さ
れるアドレスを示すラベルである。 _printClassName$qp1X : 関数printClassName(X *)
の先頭アドレスを示すラベルである。 mov A0 , A1 : レジスタA0の内容をレジスタA1
にロードする転送命令である。
_Obj: label indicating the address where the static object obj is stored. _printClassName $ qp1X: Function printClassName (X *)
This is a label indicating the start address of. mov A0, A1: The contents of register A0 are stored in register A1
Transfer instruction to be loaded into

【0036】mov (A1) , A1 : レジスタA1の内容
をアドレスとするメモリの内容をレジスタA1にロード
する転送命令である。 mov Label , A1 : ラベルLabelに置かれた値をレジ
スタA1にロードする転送命令である。 call _typeinfo_$beq1$xqrx8typeinfo : typeinfo型
の構造体の比較を行う関数に分岐するサブルーチンコー
ル命令である。
Mov (A1), A1: A transfer instruction for loading the contents of the memory whose address is the contents of the register A1 into the register A1. mov Label, A1: A transfer instruction for loading the value placed on the label Label into the register A1. call _typeinfo_ $ beq1 $ xqrx8typeinfo: This is a subroutine call instruction that branches to a function that compares typeinfo type structures.

【0037】beq Label : 直前の演算結果が0(比
較が一致)であればLabelに分岐する条件分岐命令であ
る。 main : 関数main()の先頭アドレスを示すラベルであ
る。 mov (A1,4) , A0 : レジスタA1に4を加えた値を
アドレスとするメモリの内容をレジスタA0にロードす
る転送命令である。
Beq Label: A conditional branch instruction that branches to the Label if the immediately preceding operation result is 0 (comparison is found). main: A label indicating the start address of the function main (). mov (A1,4), A0: A transfer instruction for loading the contents of the memory having the address obtained by adding 4 to the register A1 into the register A0.

【0038】call (A0) : レジスタA0の内容で示
されるアドレスから始まる関数に分岐するサブルーチン
コール命令である。 まず、コンパイラ部803の動作を説明する。図7は、
本装置のコンパイラ部803の動作手順を示すフローチ
ャートである。いま、図2に示されたソースプログラム
801(802)が本装置に入力されたとすると(ステ
ップS1401)、まず、実行時型情報作成部805
は、そのソースプログラム801(802)中で定義さ
れている全てのクラス(クラスX、Y)を検出し、それ
らについて順次にクラス情報を取得することで、実行時
型情報を収めた特定名のセクションを生成する(ステッ
プS1402〜S1404)。
Call (A0): A subroutine call instruction that branches to a function starting from the address indicated by the contents of the register A0. First, the operation of the compiler unit 803 will be described. FIG.
5 is a flowchart illustrating an operation procedure of a compiler unit 803 of the present device. Now, assuming that the source program 801 (802) shown in FIG. 2 is input to this apparatus (step S1401), first, the runtime type information creating unit 805
Detects all classes (classes X and Y) defined in the source program 801 (802) and sequentially obtains class information on the classes, thereby obtaining a specific name containing runtime type information. A section is generated (steps S1402 to S1404).

【0039】具体的には、文字列「_RTTI_」及び文字列
「_typeID_」それぞれとクラス名(例えば、X)とを結
合することでセクション指定疑似命令「section _RTTI_
X common」及びラベル「 _typeID_X」を生成し、さら
に、クラス定義の内容から一義的に定まる実行時型情報
を生成した後に、それらをデータとして宣言する疑似命
令「dd」を生成する。このように生成されたセクション
は、図3に示されるオブジェクトモジュール808の最
後部に配置されたセクション_RTTI_X及び_RTTI_Yの通り
である。
More specifically, by combining each of the character strings "_RTTI_" and "_typeID_" with the class name (for example, X), the section designation pseudo instruction "section_RTTI_"
After generating "X common" and a label "_typeID_X", and further generating runtime type information uniquely determined from the contents of the class definition, a pseudo instruction "dd" for declaring them as data is generated. The sections generated in this way are as shown in sections _RTTI_X and _RTTI_Y arranged at the end of the object module 808 shown in FIG.

【0040】続いて、コンパイラ部803の実行時型情
報使用判別部804は、入力されたソースプログラム8
01中に予約語typeid及びdynamic_castのいずれかが一
度でも使用されているか否かを判別し(ステップS14
05)、使用されている場合には、タグ生成部806
は、その旨を示す疑似命令「.usertti」を生成する(ス
テップS1406)。このソースプログラム801中に
は上記予約語が用いられていないので疑似命令「.usert
ti」は生成されない。
Subsequently, the runtime type information use judging section 804 of the compiler section 803 outputs the input source program 8
01, it is determined whether any of the reserved words typeid and dynamic_cast have been used at least once (step S14).
05), if used, tag generator 806
Generates a pseudo instruction ".usertti" indicating that (step S1406). Since the above reserved word is not used in this source program 801, the pseudo instruction ".usert
ti "is not generated.

【0041】最後に、命令翻訳部807は、ソースプロ
グラム801を機械語命令列及びデータに変換すること
によって3つのセクション_TEXT_virtual_X、_TEXT_vir
tual_Y、_TEXTを生成した後に(ステップS140
7)、それらと実行時型情報作成部805で生成された
2つのセクション_RTTI_X、_RTTI_Yとを結合すること
で、図3に示されようなオブジェクトモジュール808
を完成し出力する(ステップS1408)。このように
して生成された図3のオブジェクトモジュール808が
従来の翻訳装置により生成されたものと異なる点は、実
行時型情報が、プログラムの処理本体をなす機械語命令
列等と同一のセクション(_TEXT)に格納されるのでは
なく、特定の名前のセクション(_RTTI_X等)に格納さ
れていることである。
Finally, the instruction translator 807 converts the source program 801 into a machine language instruction sequence and data, thereby forming three sections _TEXT_virtual_X and _TEXT_vir
After generating tual_Y and _TEXT (step S140
7), by combining them with the two sections _RTTI_X and _RTTI_Y generated by the runtime type information creating unit 805, an object module 808 as shown in FIG.
Is completed and output (step S1408). The object module 808 of FIG. 3 generated in this way is different from that generated by the conventional translation device in that the runtime type information is the same as the section (such as the machine language instruction sequence forming the processing body of the program). _TEXT) instead of being stored in a section with a specific name (such as _RTTI_X).

【0042】以上のソースプログラム801のコンパイ
ルに続いて、今度は、図2に示されるソースプログラム
802が本装置に入力される(ステップS1401)。
基本的な動作はソースプログラム801が入力された場
合と同じであるが、実行時型情報使用判別部804及び
タグ生成部806での処理(ステップS1405、S1
406)が異なる。つまり、コンパイラ部803の実行
時型情報使用判別部804は、入力されたソースプログ
ラム802中に予約語typeid及びdynamic_castのいずれ
かが少なくとも1回は使用されていると判別するので
(ステップS1405)、タグ生成部806は、その旨
を示す疑似命令「.usertti」を生成する(ステップS1
406)。このことは、図5に示されるオブジェクトモ
ジュール809の先頭位置に疑似命令「.usertti」が配
置されていることに対応する。
Following the compilation of the source program 801 described above, this time, the source program 802 shown in FIG. 2 is input to the apparatus (step S1401).
The basic operation is the same as when the source program 801 is input, but the processing in the runtime type information use determination unit 804 and the tag generation unit 806 (steps S1405, S1
406) are different. That is, the runtime type information use determining unit 804 of the compiler unit 803 determines that either the reserved word typeid or dynamic_cast is used at least once in the input source program 802 (step S1405). The tag generation unit 806 generates a pseudo instruction ".usertti" indicating that (step S1).
406). This corresponds to the pseudo-instruction “.usertti” being placed at the head position of the object module 809 shown in FIG.

【0043】この図5に示されるオブジェクトモジュー
ル809が従来の翻訳装置により生成されたものと異な
る点は、(i)実行時型情報が、プログラム本体をなす機
械語命令列等と同一のセクション(_TEXT)に格納され
るのではなく、特定の名前のセクション(_RTTI_X等)
に格納されていること、及び、(ii)このオブジェクトモ
ジュール809に実行時型情報を参照する命令が存在す
ることを示すタグ、即ち、疑似命令「.usertti」が付加
されていることである。
The difference between the object module 809 shown in FIG. 5 and the object module 809 generated by the conventional translator is that (i) the runtime type information is the same as the section (such as the machine language instruction sequence forming the program body) _TEXT), rather than a section with a specific name (such as _RTTI_X)
And (ii) a tag indicating that the object module 809 has an instruction that refers to the runtime type information, that is, a pseudo instruction “.usertti” is added.

【0044】次に、リンカ部810の動作を説明する。
図8は、本装置のリンカ部810の動作手順を示すフロ
ーチャートである。いま、図3に示されたオブジェクト
モジュール808及び図5に示されたオブジェクトモジ
ュール809がリンカ部810に入力されたとする(ス
テップS1501)。
Next, the operation of the linker 810 will be described.
FIG. 8 is a flowchart showing an operation procedure of the linker unit 810 of the present apparatus. Now, it is assumed that the object module 808 shown in FIG. 3 and the object module 809 shown in FIG. 5 have been input to the linker unit 810 (step S1501).

【0045】すると、タグ識別部811は、それらオブ
ジェクトモジュール808、809ごとに上記タグ(疑
似命令「.usertti」)が付されているか否かを判別し実
行時型情報セクション削除部812に通知する(ステッ
プS1502)。その結果、実行時型情報セクション削
除部812は、タグ付きのオブジェクトモジュールが存
在しないことを確認できた場合には、即ち、いずれのオ
ブジェクトモジュールも実行時型情報を参照していない
ことを確認できた場合には(ステップS1502)、そ
れらオブジェクトモジュール808、809中に含まれ
る上記特定名のセクション(_RTTI_で始まる名前のセク
ション)全ての内容を空にする(ステップS1503、
S1504)。
Then, the tag identifying section 811 determines whether or not the tag (pseudo-instruction “.usertti”) is attached to each of the object modules 808 and 809, and notifies the execution-time type information section deleting section 812. (Step S1502). As a result, when the runtime type information section deletion unit 812 can confirm that there is no tagged object module, that is, it can confirm that no object module refers to the runtime type information. In this case (step S1502), the contents of all the sections with the specific names (sections starting with _RTTI_) included in the object modules 808 and 809 are emptied (step S1503,
S1504).

【0046】ここでは、図5に示されるように、オブジ
ェクトモジュール809の先頭位置には疑似命令「.use
rtti」が置かれているので、これがタグ識別部811に
よって検出される(ステップS1502)。その結果、
実行時型情報セクション削除部812は、タグ付きのオ
ブジェクトモジュールが存在すると認識するので、何ら
の処理も行わずにオブジェクトモジュール808、80
9をそのままファイル連結部813に渡す。従って、フ
ァイル連結部813は、結局、このリンカ部810に入
力されたときのオブジェクトモジュール808、809
に対してリンク処理を行い(ステップS1505)、最
終的に、図6に示される実行形式ファイル814を生成
し出力する(ステップS1506)。
Here, as shown in FIG. 5, the pseudo instruction “.use
Since “rtti” is placed, this is detected by the tag identifying unit 811 (step S1502). as a result,
Since the runtime type information section deletion unit 812 recognizes that an object module with a tag exists, the execution type information section deletion unit 812 does not perform any processing, and the object module
9 is passed to the file connection unit 813 as it is. Therefore, the file linking unit 813 ends up with the object modules 808, 809 when input to the linker unit 810.
Is linked (step S1505), and finally, an executable file 814 shown in FIG. 6 is generated and output (step S1506).

【0047】このようにして生成された実行形式ファイ
ル814は、結果的には実行時型情報が残されている点
において従来の翻訳装置により生成されたものと異なら
ない。この例では、リンクの対象となったオブジェクト
モジュールの少なくとも一つにおいて実行時型情報を参
照する処理が含まれているので、最終的な実行形式ファ
イル814中に実行時型情報を残しておく必要があるか
らである。
The executable file 814 generated in this way is not different from the file generated by the conventional translator in that the runtime type information is eventually left. In this example, at least one of the object modules to be linked includes a process of referring to the runtime type information. Therefore, it is necessary to leave the runtime type information in the final executable file 814. Because there is.

【0048】次に、いずれのソースプログラム中におい
ても実行時型情報が参照されていない第2のケースを例
にとって本装置の動作を説明する。このケースでは、一
つのソースプログラム801は上述のもの(図2に示さ
れるもの)と同一であるが、もう一つのソースプログラ
ム802は、上述と異なり、実行時型情報を参照しない
内容(図9)である。以下、第1のケースと異なる点を
中心に説明する。
Next, the operation of the present apparatus will be described with reference to the second case in which the runtime type information is not referred to in any of the source programs. In this case, one source program 801 is the same as the one described above (shown in FIG. 2), but the other source program 802 is different from the above and does not refer to the runtime type information (FIG. 9). ). Hereinafter, the points different from the first case will be mainly described.

【0049】図9及び図10は、それぞれ、ソースプロ
グラム802及びその場合に本装置のコンパイラ部80
3によって生成されるオブジェクトモジュール808の
リストである。さらに、図11は、それらオブジェクト
モジュール808及び809が入力された場合にリンカ
部810によって最終的に生成される実行形式ファイル
814のリストである。
FIGS. 9 and 10 show a source program 802 and a compiler 80 of the present apparatus, respectively.
3 is a list of object modules 808 generated by the third module. FIG. 11 is a list of executable files 814 that are finally generated by the linker unit 810 when the object modules 808 and 809 are input.

【0050】図9から分かるように、このソースプログ
ラム802では、ソースプログラム801と同様のクラ
スX及びY、クラスXのオブジェクトへのポインタobj
を引数とし、その引数が指すオブジェクトの関数fを呼
び出す関数printClassName、並びに、そのような関数pr
intClassNameを呼び出すメイン関数mainが定義されてい
るが、実行時型情報を参照する処理は含まれていない。
As can be seen from FIG. 9, this source program 802 has the same classes X and Y as the source program 801 and pointers obj to objects of class X.
, The function printClassName that calls the function f of the object pointed to by the argument, and the function pr
The main function main that calls intClassName is defined, but does not include processing that refers to runtime type information.

【0051】このようなソースプログラム802が本装
置に入力された場合のコンパイラ部803の動作は、上
記ケース1におけるソースプログラム801の場合と同
じである。つまり、ソースプログラム802では実行時
型情報が参照されていないので、図10に示されるよう
に、上記タグ(疑似命令「.usertti」)を含まないオブ
ジェクトモジュール809が生成される。
The operation of the compiler unit 803 when such a source program 802 is input to the present apparatus is the same as the case of the source program 801 in Case 1 described above. That is, since the runtime type information is not referred to in the source program 802, an object module 809 not including the tag (pseudo-instruction “.usertti”) is generated as shown in FIG.

【0052】ところが、オブジェクトモジュール808
及び809が入力された場合のリンカ部810の動作が
第1のケースと異なる。つまり、このケースでは、それ
らオブジェクトモジュール808及び809のいずれに
も上記タグ(疑似命令「.usertti」)が含まれていない
ので、タグ識別部811によってはタグが検出されない
(ステップS1502)。
However, the object module 808
And 809 are different from the first case in the operation of the linker unit 810. That is, in this case, since the tag (pseudo-instruction “.usertti”) is not included in any of the object modules 808 and 809, no tag is detected by the tag identifying unit 811 (step S1502).

【0053】その結果、実行時型情報セクション削除部
812はリンク対象のオブジェクトモジュールにはタグ
付きのものは存在しないと認識し(ステップS150
2)、それらオブジェクトモジュール808、809中
に含まれる全ての特定名のセクション(_RTTI_で始まる
名前のセクション)の内容を空にしてファイル連結部8
13に渡す(ステップS1503、S1504)。従っ
て、ファイル連結部813は、実行時型情報を持たない
2つのオブジェクトモジュールをリンクし、図11に示
されるような実行形式ファイル814を出力する(ステ
ップS1505、S1506)。
As a result, the runtime type information section deletion unit 812 recognizes that there is no tag-attached object module to be linked (step S150).
2) Emptying the contents of all sections with specific names (sections starting with _RTTI_) included in the object modules 808 and 809 to make the file connection unit 8
13 (steps S1503, S1504). Therefore, the file linking unit 813 links the two object modules having no runtime type information, and outputs an executable file 814 as shown in FIG. 11 (steps S1505 and S1506).

【0054】このようにして生成された実行形式ファイ
ル814は、図11に示されるように、その最後部には
特定名(_RTTI_X、_RTTI_Y)のセクションを宣言する疑
似命令だけが置かれ、その内容は空となっている。つま
り、この第2のケースでは、従来の翻訳装置の場合と相
違し、無駄な実行時型情報が実行形式ファイルに残され
てしまうことが防止される。
As shown in FIG. 11, the executable file 814 generated in this manner has, at the end thereof, only a pseudo-instruction for declaring a section having a specific name (_RTTI_X, _RTTI_Y). Is empty. That is, in the second case, unlike the case of the conventional translator, useless runtime type information is prevented from being left in the executable file.

【0055】以上のように、本装置によれば、いずれの
オブジェクトモジュールにおいても実行時型情報を参照
する命令が存在しない場合には、リンク過程において、
そのような使用もされない無駄なデータ(実行時型情
報)は、排除され、最終的な実行形式ファイルに残され
ることが回避される。これによって、実行時型情報の参
照の有無に関してプログラマが明示することなく、実行
形式プログラムのサイズの肥大化が防止される。なお、
実行時型情報はプログラム中に定義されているクラスご
とに生成されるので、多くの種類のクラスが定義されて
いるプログラムに適用された場合に、本装置により発揮
される効果(プログラムサイズの削減)がより顕著とな
る。
As described above, according to the present apparatus, if there is no instruction that refers to the runtime type information in any object module, the link process will
Such useless data (execution-time type information) that is not used is excluded, and is prevented from being left in the final executable file. As a result, the size of the executable program is prevented from increasing without the programmer explicitly indicating whether or not the runtime type information is referenced. In addition,
Since the runtime type information is generated for each class defined in the program, when many types of classes are applied to the defined program, the effect (reduction of the program size) exerted by this device is achieved. ) Becomes more pronounced.

【0056】また、本装置のコンパイラ部803によっ
て生成されるオブジェクトモジュールは、従来の翻訳装
置によって生成されるオブジェクトモジュールの内容に
加えて、そのモジュール内に実行時型情報を参照する命
令が存在するか否かを示すタグが添付され、外部からの
参照が可能となるので、汎用性の高いモジュールと言え
る。つまり、本実施の形態のリンカ部810だけでな
く、このようなタグを参照してプログラムを最適化する
ような様々な処理に役立つモジュールと言える。
In the object module generated by the compiler unit 803 of the present apparatus, in addition to the contents of the object module generated by the conventional translator, an instruction for referring to the runtime type information exists in the module. A tag indicating whether or not the module is attached can be referred to from the outside, so it can be said that the module is highly versatile. That is, it can be said that the module is useful not only for the linker unit 810 of the present embodiment but also for various processes such as optimizing a program with reference to such tags.

【0057】以上、本発明に係る翻訳装置について実施
の形態に基づいて説明したが、本発明はこの実施の形態
に限られないことは勿論である。例えば、本実施の形態
では、ソースプログラム中で実行時型情報の参照が行わ
れている場合にのみオブジェクトモジュールにタグを付
したが、その逆の処理、即ち、ソースプログラム中で実
行時型情報の参照が行われていない場合にのみタグ(例
えば、疑似命令「.no_usertti」)を付けることにして
もよい。その場合には、リンク時において、全てのオブ
ジェクトモジュール中にそのようなタグが含まれている
ことが判明したときにのみ、実行時型情報を削除すれば
よい。同様に、全てのオブジェクトモジュールに、2種
類の疑似命令(「.usertti」、「.no_usertti」)のい
ずれかを付することとしてもよい。
Although the translation apparatus according to the present invention has been described based on the embodiments, it goes without saying that the present invention is not limited to this embodiment. For example, in the present embodiment, the tag is attached to the object module only when the runtime type information is referred to in the source program. (For example, a pseudo-instruction “.no_usertti”) may be added only when reference is not made. In such a case, the runtime type information may be deleted only when it is determined that such a tag is included in all the object modules at the time of linking. Similarly, any of two types of pseudo-instructions (“.usertti” and “.no_usertti”) may be attached to all object modules.

【0058】また、本実施の形態では、ソースプログラ
ム内に2種類の演算子(「typeid」、「dynamic_cas
t」)のいずれかが用いられているときに実行時型情報
の参照が行われていると判断したが、コンパイル過程で
生成される中間言語や機械語命令列中に実行時型情報を
参照する処理が含まれているときに実行時型情報の参照
が行われていると判断してもよい。
In this embodiment, two types of operators (“typeid” and “dynamic_cas”) are included in the source program.
t)), the runtime type information was determined to have been referenced, but the runtime type information was referenced in the intermediate language or machine instruction sequence generated during the compilation process. It may be determined that the run-time type information is being referred to when the process to be performed is included.

【0059】例えば、機械語命令列中に、図5のリスト
におけるラベル_printClassName$qp1Xの先頭箇所の如
く、(i)オブジェクトへのポインタ(引数)が指す内容
をメモリから読み出し(mov (A1),A1)、(ii)読み出し
た内容をアドレスとして再びメモリから読み出す(mov
(A1),A0)ような機械語命令が連続している場合に実行
時型情報の参照が行われていると判断してもよい。これ
は、図16から分かるように、上記ステップ(i)が仮想
関数表へのポインタvptrの読み出しを意味し、上記ステ
ップ(ii)が実行時型情報へのポインタの読み出しを意味
するので、これら2つのステップ(i)(ii)の存在によっ
て、続く処理において実行時型情報へのアクセスが行わ
れることが十分に推測される、ことを根拠とするもので
ある。このように、機械語コードを対象として実行時型
情報の参照の有無を判断することによって、従来の翻訳
装置における字句解析部分を変更することなく、コード
生成部分のみを変更することで本発明の翻訳装置を実現
することが可能となる。
For example, in the machine language instruction sequence, (i) the content pointed to by the pointer (argument) to the object, such as the head of the label _printClassName $ qp1X in the list of FIG. 5, is read from the memory (mov (A1) , A1), and (ii) read the content again from memory as the read content (mov
When machine instructions such as (A1) and A0) are consecutive, it may be determined that the runtime type information is being referred to. This means that, as can be seen from FIG. 16, step (i) means reading the pointer vptr to the virtual function table, and step (ii) means reading the pointer to the runtime type information. It is based on the fact that the presence of the two steps (i) and (ii) sufficiently supposes that the runtime type information will be accessed in the subsequent processing. As described above, by determining whether or not to refer to the runtime type information for the machine language code, it is possible to change only the code generation portion without changing the lexical analysis portion in the conventional translator, and thereby achieve the present invention. A translation device can be realized.

【0060】また、本実施の形態では、コンパイルの過
程において実行時型情報そのもの(実行時型情報という
データ)を生成し、リンクの過程において実行時型情報
そのものを削除したが、これら実行時型情報そのものに
代えて、実行時型情報をメンバデータとするクラスイン
スタンスを生成する関数とすることもできる。つまり、
コンパイル時においては、実行時型情報の生成に代えて
実行時型情報を生成する関数を生成し、リンク過程にお
いては、実行時型情報の削除に代えて実行時型情報を生
成する関数を削除する方式であってもよい。これによっ
て、実行時型情報を生成するための関数を予め提供して
いる従来の翻訳装置の資産を有効活用して、本発明の翻
訳装置を実現することが可能となる。
In this embodiment, the runtime type information itself (data called runtime type information) is generated in the compilation process, and the runtime type information itself is deleted in the linking process. Instead of the information itself, a function that generates a class instance using runtime type information as member data may be used. That is,
Generates a function that generates run-time type information instead of generating run-time type information at compile time, and deletes a function that generates run-time type information instead of deleting run-time type information during the linking process May be used. As a result, the translation device of the present invention can be realized by effectively utilizing the resources of the conventional translation device that previously provides a function for generating runtime type information.

【0061】また、本発明の翻訳装置は、上述したよう
に、汎用のコンピュータ上で実行されるプログラムとし
て実現することが可能である。従って、本発明に係るプ
ログラムを、CD-ROM等のコンピュータ読み取り可能な記
録媒体やネットワーク等の伝送媒体を介して流通させる
ことが可能であるのは言うまでもない。
As described above, the translation device of the present invention can be realized as a program executed on a general-purpose computer. Therefore, it goes without saying that the program according to the present invention can be distributed via a computer-readable recording medium such as a CD-ROM or a transmission medium such as a network.

【0062】[0062]

【発明の効果】以上の説明から明らかなように、本発明
に係る翻訳装置は、オブジェクト指向言語で記述された
ソースプログラムをコンパイルしてオブジェクトモジュ
ールを生成するコンパイラ手段と、オブジェクトモジュ
ールをリンクして実行形式プログラムを生成するリンカ
手段とを備える翻訳装置であって、前記コンパイラ手段
は、特定の名前で識別可能なセクションであって実行時
型情報を収めたものを生成し前記オブジェクトモジュー
ルに含ませる実行時型情報生成部と、前記ソースプログ
ラムにおいて実行時型情報が使用されているか否かを判
別する使用判別部と、使用されていると判別された場合
にその旨を示すタグを生成し前記オブジェクトモジュー
ルに含ませるタグ生成部とを有し、前記リンカ手段は、
リンクの対象となる全てのオブジェクトモジュールそれ
ぞれに前記タグが含まれているか否かを判別するタグ判
別部と、前記全てのオブジェクトモジュールのいずれに
も前記タグが含まれていないと判別された場合にそれら
オブジェクトモジュールに含まれている前記セクション
をリンクの対象から除外する実行時型情報削除部とを有
することを特徴とする。
As is apparent from the above description, the translation apparatus according to the present invention links the object module with compiler means for compiling a source program described in an object-oriented language to generate an object module. A linker for generating an executable program, wherein the compiler generates a section identifiable by a specific name and containing runtime type information, and includes the section in the object module. A runtime type information generating unit, a use determining unit for determining whether or not runtime type information is used in the source program, and generating a tag indicating that when it is determined to be used, A tag generation unit to be included in the object module, wherein the linker means
A tag determination unit that determines whether or not the tag is included in each of all the object modules to be linked; and when it is determined that none of the object modules includes the tag. A runtime type information deletion unit that excludes the sections included in the object modules from linking targets.

【0063】ここで、上記タグの意味付けを逆にするこ
ともできる。つまり、タグ生成部は、実行時型情報が使
用されていないと判別された場合にその旨を示すタグを
生成し、実行時型情報削除部は、前記全てのオブジェク
トモジュールのいずれにも前記タグが含まれていると判
別された場合にそれらオブジェクトモジュールに含まれ
ている前記セクションをリンクの対象から除外してもよ
い。
Here, the meaning of the tags can be reversed. That is, when it is determined that the runtime type information is not used, the tag generation unit generates a tag indicating that fact, and the runtime type information deletion unit transmits the tag to any of the object modules. May be excluded from the links when the object module is determined to be included.

【0064】これによって、リンクの対象となる全ての
オブジェクトモジュールにおいて実行時型情報が参照さ
れていない場合には、使用もされない無駄な実行時型情
報が最終的な実行形式ファイルに残されてしまうことが
回避され、プログラムサイズの肥大化が防止される。ま
た、前記実行時型情報生成部は、前記実行時型情報を収
めたセクションに代えて前記実行時型情報を有するクラ
スインスタンスを生成する関数を収めたセクション生成
し前記オブジェクトモジュールに含ませ、前記実行時型
情報削除部は、前記関数が収められたセクションをリン
クの対象から除外してもよい。これによって、実行時型
情報を生成するための関数を提供しているような従来の
翻訳装置に近い形式のオブジェクトモジュールや実行形
式プログラムを生成する翻訳装置が実現される。
As a result, when the runtime type information is not referenced in all the object modules to be linked, useless runtime type information that is not used is left in the final executable format file. Is avoided, and enlargement of the program size is prevented. Further, the runtime type information generating unit generates a section containing a function for generating a class instance having the runtime type information instead of the section containing the runtime type information, and causes the section to be included in the object module. The runtime type information deletion unit may exclude the section containing the function from the link target. As a result, a translation device that generates an object module or an executable program similar to a conventional translation device that provides a function for generating runtime type information is realized.

【0065】また、前記使用判別部は、前記ソースプロ
グラム中に実行時型情報を使用する予約語が含まれてい
るか否かによって前記判別を行ってもよい。これによっ
て、ソースプログラムにおける文字列のマッチングとい
う簡単な処理によって、実行時型情報の使用の有無を判
別することができる。また、前記使用判別部は、前記オ
ブジェクトモジュール中に前記実行時型情報生成部が生
成したセクションを参照する機械語命令が含まれている
か否かによって前記判別を行ってもよい。これによっ
て、従来の翻訳装置が持つ字句解析部分を変更すること
なく、コード生成部分のみを変更することで本発明の翻
訳装置を実現することが可能となる。
Further, the use determining unit may perform the determination based on whether or not a reserved word using runtime type information is included in the source program. This makes it possible to determine whether or not the runtime type information is used by a simple process of character string matching in the source program. The use determining unit may perform the determination based on whether the object module includes a machine language instruction that refers to a section generated by the runtime type information generating unit. This makes it possible to realize the translation device of the present invention by changing only the code generation portion without changing the lexical analysis portion of the conventional translation device.

【0066】このように、本発明によってプログラムサ
イズの無駄な肥大化が防止され、特に、家電機器のよう
なメモリ容量の制約が厳しい電子機器に用いられる組込
み用途のマイクロプロセッサを対象とする翻訳装置とし
て、その実用的効果は極めて大きい。
As described above, the present invention prevents a program size from becoming uselessly enlarged, and in particular, a translation apparatus for embedded microprocessors used in electronic devices such as home appliances which have severe memory capacity restrictions. The practical effect is extremely large.

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

【図1】本発明に係るプログラム翻訳装置の構成を示す
機能ブロック図である。
FIG. 1 is a functional block diagram showing a configuration of a program translation device according to the present invention.

【図2】同装置に入力されるソースプログラム801の
リストである。
FIG. 2 is a list of source programs 801 input to the apparatus.

【図3】図2に示されたソースプログラム801に対応
するオブジェクトモジュール808のリストである。
FIG. 3 is a list of object modules 808 corresponding to the source program 801 shown in FIG.

【図4】同装置に入力されるソースプログラム802の
リストである。
FIG. 4 is a list of source programs 802 input to the apparatus.

【図5】図4に示されたソースプログラム802に対応
するオブジェクトモジュール809のリストである。
FIG. 5 is a list of object modules 809 corresponding to the source program 802 shown in FIG.

【図6】図3に示されたオブジェクトモジュール808
と図5に示されたオブジェクトモジュール809がリン
クされて生成される実行形式ファイル814のリストで
ある。
FIG. 6 shows an object module 808 shown in FIG.
6 is a list of executable files 814 generated by linking the object module 809 shown in FIG.

【図7】同装置のコンパイラ部803の動作手順を示す
フローチャートである。
FIG. 7 is a flowchart showing an operation procedure of a compiler unit 803 of the apparatus.

【図8】同装置のリンカ部810の動作手順を示すフロ
ーチャートである。
FIG. 8 is a flowchart showing an operation procedure of a linker unit 810 of the apparatus.

【図9】同装置に入力される別のソースプログラム80
2のリストである。
FIG. 9 shows another source program 80 input to the apparatus.
2 is a list.

【図10】図9に示されたソースプログラム802に対
応するオブジェクトモジュール809のリストである。
FIG. 10 is a list of object modules 809 corresponding to the source program 802 shown in FIG.

【図11】図3に示されたオブジェクトモジュール80
8と図10に示されたオブジェクトモジュール809が
リンクされて生成される実行形式ファイル814のリス
トである。
11 is an object module 80 shown in FIG.
8 is a list of executable files 814 generated by linking the object module 809 shown in FIG.

【図12】3つのクラスを定義するプログラムリストで
ある。
FIG. 12 is a program list that defines three classes.

【図13】図12で定義されたクラスの継承関係を示す
ツリー図である。
FIG. 13 is a tree diagram showing inheritance relationships of classes defined in FIG.

【図14】仮想関数の典型的な利用例を示すプログラム
のリストである。
FIG. 14 is a list of programs showing typical usage examples of virtual functions.

【図15】実行時型情報を参照するプログラムのリスト
である。
FIG. 15 is a list of programs that refer to runtime type information.

【図16】実行時においてメモリ上に形成されるオブジ
ェクト、仮想関数表及び実行時型情報の関連を示す図で
ある。
FIG. 16 is a diagram illustrating the relationship between an object formed on a memory at the time of execution, a virtual function table, and runtime type information;

【図17】図12に示されるクラスAについての仮想関
数表と、その仮想関数表に関連づけて生成された実行時
型情報の例を示す図である。
17 is a diagram showing an example of a virtual function table for class A shown in FIG. 12 and runtime type information generated in association with the virtual function table.

【図18】クラス毎に実行時型情報の使用を許可するか
否かを明示したプログラムのリストである。
FIG. 18 is a list of programs that clearly indicates whether use of runtime type information is permitted for each class.

【符号の説明】 801、802 ソースプログラム 803 コンパイラ部 804 実行時型情報使用判別部 805 実行時型情報作成部 806 タグ生成部 807 命令翻訳部 808、809 オブジェクトモジュール 810 リンカ部 811 タグ識別部 812 実行時型情報セクション削除部 813 ファイル連結部 814 実行形式ファイル[Description of Signs] 801, 802 Source program 803 Compiler section 804 Runtime type information use determination section 805 Runtime type information creation section 806 Tag generation section 807 Instruction translation section 808, 809 Object module 810 Linker section 811 Tag identification section 812 Execution Time type information section deletion unit 813 File connection unit 814 Executable file

───────────────────────────────────────────────────── フロントページの続き (72)発明者 漆原 誠一 大阪府門真市大字門真1006番地 松下電器 産業株式会社内 (72)発明者 春名 修介 大阪府門真市大字門真1006番地 松下電器 産業株式会社内 Fターム(参考) 5B081 AA09 CC51  ──────────────────────────────────────────────────続 き Continuing on the front page (72) Inventor Seiichi Urushibara 1006 Kazuma Kadoma, Osaka Pref. Matsushita Electric Industrial Co., Ltd. Term (reference) 5B081 AA09 CC51

Claims (7)

【特許請求の範囲】[Claims] 【請求項1】 オブジェクト指向言語で記述されたソー
スプログラムをコンパイルしてオブジェクトモジュール
を生成するコンパイラ手段と、オブジェクトモジュール
をリンクして実行形式プログラムを生成するリンカ手段
とを備える翻訳装置であって、 前記コンパイラ手段は、 特定の名前で識別可能なセクションであって実行時型情
報を収めたものを生成し前記オブジェクトモジュールに
含ませる実行時型情報生成部と、 前記ソースプログラムにおいて実行時型情報が使用され
ているか否かを判別する使用判別部と、 使用されていると判別された場合にその旨を示すタグを
生成し前記オブジェクトモジュールに含ませるタグ生成
部とを有し、 前記リンカ手段は、 リンクの対象となる全てのオブジェクトモジュールそれ
ぞれに前記タグが含まれているか否かを判別するタグ判
別部と、 前記全てのオブジェクトモジュールのいずれにも前記タ
グが含まれていないと判別された場合にそれらオブジェ
クトモジュールに含まれている前記セクションをリンク
の対象から除外する実行時型情報削除部とを有すること
を特徴とするプログラム翻訳装置。
1. A translation apparatus comprising: a compiler for compiling a source program described in an object-oriented language to generate an object module; and a linker for linking the object modules to generate an executable program. The compiler means includes a runtime type information generation unit that generates a section that can be identified by a specific name and stores runtime type information and includes the section in the object module. A use determining unit that determines whether or not the tag is used; and a tag generating unit that generates a tag indicating that the tag is determined to be used and includes the tag in the object module. The tag is included in each object module to be linked. A tag determining unit that determines whether or not the tag is included in any of the object modules; and when it is determined that the tag is not included in any of the object modules, the section included in the object module is linked from the link target. A program translation device, comprising: a runtime type information deletion unit to be excluded.
【請求項2】 オブジェクト指向言語で記述されたソー
スプログラムをコンパイルしてオブジェクトモジュール
を生成するコンパイラ手段と、オブジェクトモジュール
をリンクして実行形式プログラムを生成するリンカ手段
とを備える翻訳装置であって、 前記コンパイラ手段は、 特定の名前で識別可能なセクションであって実行時型情
報を収めたものを生成し前記オブジェクトモジュールに
含ませる実行時型情報生成部と、 前記ソースプログラムにおいて実行時型情報が使用され
ているか否かを判別する使用判別部と、 使用されていないと判別された場合にその旨を示すタグ
を生成し前記オブジェクトモジュールに含ませるタグ生
成部とを有し、 前記リンカ手段は、 リンクの対象となる全てのオブジェクトモジュールそれ
ぞれに前記タグが含まれているか否かを判別するタグ判
別部と、 前記全てのオブジェクトモジュールのいずれにも前記タ
グが含まれていると判別された場合にそれらオブジェク
トモジュールに含まれている前記セクションをリンクの
対象から除外する実行時型情報削除部とを有することを
特徴とするプログラム翻訳装置。
2. A translation apparatus comprising: a compiler for compiling a source program described in an object-oriented language to generate an object module; and a linker for linking the object modules to generate an executable program. The compiler means includes a runtime type information generation unit that generates a section that can be identified by a specific name and stores runtime type information and includes the section in the object module. A use determining unit that determines whether or not the tag is used; and a tag generating unit that generates a tag indicating that the tag is not used and includes the tag in the object module. The tag is attached to each object module to be linked. A tag determining unit that determines whether or not the tag is included; and when it is determined that the tag is included in any of the object modules, the section included in the object module is a link target. And a runtime type information deleting unit for excluding from the program.
【請求項3】 前記実行時型情報生成部は、前記実行時
型情報を収めたセクションに代えて前記実行時型情報を
有するクラスインスタンスを生成する関数を収めたセク
ション生成し前記オブジェクトモジュールに含ませ、 前記実行時型情報削除部は、前記関数が収められたセク
ションをリンクの対象から除外することを特徴とする請
求項1又は2記載のプログラム翻訳装置。
3. The runtime type information generating section generates a section containing a function for generating a class instance having the runtime type information in place of the section containing the runtime type information, and includes the section in the object module. The program translation device according to claim 1, wherein the runtime type information deletion unit excludes a section containing the function from link targets.
【請求項4】 前記使用判別部は、前記ソースプログラ
ム中に実行時型情報を使用する予約語が含まれているか
否かによって前記判別を行うことを特徴とする請求項1
〜3のいずれか1項に記載のプログラム翻訳装置。
4. The method according to claim 1, wherein the use determining unit performs the determination based on whether or not a reserved word using runtime type information is included in the source program.
The program translation apparatus according to any one of claims 1 to 3.
【請求項5】 前記使用判別部は、前記オブジェクトモ
ジュール中に前記実行時型情報生成部が生成したセクシ
ョンを参照する機械語命令が含まれているか否かによっ
て前記判別を行うことを特徴とする請求項1〜3のいず
れか1項に記載のプログラム翻訳装置。
5. The method according to claim 1, wherein the use determining unit performs the determination based on whether the object module includes a machine language instruction that refers to a section generated by the runtime type information generating unit. The program translation device according to claim 1.
【請求項6】 前記オブジェクト指向言語はC++であ
り、 前記予約語にはtypeid及びdynamic_castが含まれること
を特徴とする請求項4記載のプログラム翻訳装置。
6. The program translation device according to claim 4, wherein the object-oriented language is C ++, and the reserved words include typeid and dynamic_cast.
【請求項7】 コンピュータを請求項1〜6のいずれか
1項に記載の手段として機能させるためのプログラムを
記録したコンピュータ読み取り可能な記録媒体。
7. A computer-readable recording medium on which a program for causing a computer to function as the means according to claim 1 is recorded.
JP27878198A 1998-09-30 1998-09-30 Program translating device Pending JP2000112770A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP27878198A JP2000112770A (en) 1998-09-30 1998-09-30 Program translating device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP27878198A JP2000112770A (en) 1998-09-30 1998-09-30 Program translating device

Publications (1)

Publication Number Publication Date
JP2000112770A true JP2000112770A (en) 2000-04-21

Family

ID=17602096

Family Applications (1)

Application Number Title Priority Date Filing Date
JP27878198A Pending JP2000112770A (en) 1998-09-30 1998-09-30 Program translating device

Country Status (1)

Country Link
JP (1) JP2000112770A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007265029A (en) * 2006-03-28 2007-10-11 Nomura Research Institute Ltd Job management apparatus and job management method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007265029A (en) * 2006-03-28 2007-10-11 Nomura Research Institute Ltd Job management apparatus and job management method

Similar Documents

Publication Publication Date Title
US5615400A (en) System for object oriented dynamic linking based upon a catalog of registered function set or class identifiers
EP0902363B1 (en) Method and apparatus for efficient operations on primary type values without static overloading
JP3354425B2 (en) Method and system for improving executable file execution efficiency
US5909580A (en) Development system and methods with direct compiler support for detecting invalid use and management of resources and memory at runtime
US5475840A (en) High performance dynamic linking through caching
US5956479A (en) Demand based generation of symbolic information
US5907709A (en) Development system with methods for detecting invalid use and management of resources and memory at runtime
US6973646B1 (en) Method for compiling program components in a mixed static and dynamic environment
US6381737B1 (en) Automatic adapter/stub generator
US5659751A (en) Apparatus and method for dynamic linking of computer software components
US9417931B2 (en) Unified metadata for external components
US6014518A (en) Terminating polymorphic type inference program analysis
US6161217A (en) Accurate method for inlining virtual calls
US20040268301A1 (en) Adding new compiler methods to an integrated development environment
US5367683A (en) Smart recompilation of performing matchup/difference after code generation
US10789047B2 (en) Returning a runtime type loaded from an archive in a module system
US20090320007A1 (en) Local metadata for external components
US11687388B2 (en) Implementing optional specialization when executing code
US10387142B2 (en) Using annotation processors defined by modules with annotation processors defined by non-module code
US5581769A (en) Multipurpose program object linkage protocol for upward compatibility among different compilers
EP1452962A2 (en) System and method for defining and using subclasses declaratively within markup
US20120023488A1 (en) Methods, systems, and computer program products for processing an excludable addressable entity
US5535392A (en) Using hint generation to cause portions of object files to remain the same
KR20190060561A (en) THE INTERGRATED IoT PROGRAMMING METHOD AND SYSTEM WITH SELECTIVE ABSTRACTION OF THIRD-PARTY DEVICES
JP2000112770A (en) Program translating device