JP2006285584A - Program code generation device, program code generation method, and computer program - Google Patents

Program code generation device, program code generation method, and computer program Download PDF

Info

Publication number
JP2006285584A
JP2006285584A JP2005103870A JP2005103870A JP2006285584A JP 2006285584 A JP2006285584 A JP 2006285584A JP 2005103870 A JP2005103870 A JP 2005103870A JP 2005103870 A JP2005103870 A JP 2005103870A JP 2006285584 A JP2006285584 A JP 2006285584A
Authority
JP
Japan
Prior art keywords
program code
design drawing
information
code generation
class
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
JP2005103870A
Other languages
Japanese (ja)
Inventor
Toshio Yabe
俊夫 矢部
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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP2005103870A priority Critical patent/JP2006285584A/en
Publication of JP2006285584A publication Critical patent/JP2006285584A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To properly erase a memory use quantity when executing a program code. <P>SOLUTION: In a method existing in a design drawing information 203, information relating to a method which is not called and a method which is called only once is collected, and as for the method which is not called, any function definition is not generated in a program code, and as for the method which is called only once, attributes are changed so that resources accessed by the method can be accessed by the calling origin of the method, and a program code for in-line developing the method to the calling origin is generated. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、プログラムコード生成装置、プログラムコード生成方法、及びコンピュータプログラムに関し、特に、プログラムコードを生成するために用いて好適なものである。   The present invention relates to a program code generation device, a program code generation method, and a computer program, and is particularly suitable for use in generating a program code.

近年のソフトウェア設計技術として、モデル駆動型アーキテクチャー(Model Driven Architecture)技術(以降、MDA技術と称す)が採用されるようになってきている。一般的にMDA技術とは、オペレータが入力したソフトウェアの設計図面情報から各プラットフォームのプログラムコードを自動的に生成し、且つ、入力したソフトウェアの設計図面情報をMDA専用ツール上で動作させることが可能な技術である。
これらソフトウェアの設計図面情報の代表的な例としては、オブジェクト指向技術のモデル表記言語であるUML(Unified Modeling Language)などが挙げられる。
As a software design technique in recent years, a model driven architecture (Model Drive Architecture) technique (hereinafter referred to as an MDA technique) has been adopted. In general, MDA technology automatically generates program codes for each platform from software design drawing information input by an operator, and allows the input software design drawing information to run on a dedicated MDA tool. Technology.
Typical examples of design drawing information of these software include UML (Unified Modeling Language) which is a model notation language of object-oriented technology.

従来のプログラムコード生成装置により自動生成されるプログラムコードは、ソフトウェアの設計図面情報とほぼ等価であることが前提とされていた。プログラムコード生成装置において以下の(1)〜(3)などの制約があるためである。
(1)全てのプログラムコードを生成するのに必要な設計図面情報を、プログラムコード生成装置に入力できなかった。
(2)設計図面情報から全てのプログラムコードを生成できず、プログラムコードのスケルトンのみを自動生成していた。
(3)自動生成されたプログラムコード上でしかデバッグ作業が出来なかった
It has been assumed that the program code automatically generated by the conventional program code generation device is almost equivalent to the software design drawing information. This is because the program code generation apparatus has the following restrictions (1) to (3).
(1) Design drawing information necessary for generating all program codes could not be input to the program code generating device.
(2) Not all program codes can be generated from the design drawing information, and only the skeleton of the program code is automatically generated.
(3) Debugging was possible only on automatically generated program code

したがって、オペレータは、設計図面情報とプログラムコードとを常に見比べ、プログラムコードを手動で追加する必要がある。このため、設計図面と、自動生成されるプログラムコードとは、視覚的な静的な側面で完全に等価であることが必修条件であった。
このような状況において、オペレータが入力する設計図面情報には、最適化という観点から注目すると冗長的な部分が多々あり、自動生成されるプログラムコードにおいても、その冗長的な部分が忠実にプログラムコードとして生成されることになる。その結果、プログラムコードがコンパイル・リンクされることで出来上がる実行可能形式のサイズは、冗長的な処理が含まれる分大きくなる。更に、実行可能形式の動作時に使用するメモリサイズも大きくなり、且つ実行スピードも遅くなるという問題が存在した。
Therefore, the operator must always compare the design drawing information with the program code and manually add the program code. For this reason, it is a necessary condition that the design drawing and the automatically generated program code are completely equivalent in terms of visual static.
In such a situation, the design drawing information input by the operator has many redundant portions from the viewpoint of optimization, and even in the automatically generated program code, the redundant portions are faithfully programmed. Will be generated. As a result, the size of the executable format that is created by compiling and linking the program code is increased by including redundant processing. Furthermore, there has been a problem that the memory size used in the operation of the executable format becomes large and the execution speed becomes slow.

この問題を解決する技術としては、プログラムコードのコード・コンパイル時に最適化を施すのが通例である。しかしながら、コード・コンパイル時の最適化は、プログラムコードの格納された1ファイルを対象とした最適化であり、プログラムコードの全てのファイルを対象とした最適化については現状では考慮されていない。   As a technique for solving this problem, optimization is usually performed at the time of code compilation of program code. However, optimization at the time of code compilation is optimization for one file in which program code is stored, and optimization for all files of program code is not considered at present.

近年、MDA技術が進歩したことにより、上述した従来のプログラムコード生成装置における制約を除くことができる。その結果、ソフトウェアの設計図面情報から全てのプログラムコードを自動生成することが可能になり、且つ、設計図面情報をMDA専用ツール上でデバッグ動作させることが可能になっている。これにより、オペレータはプログラムコードを参照することなしにソフトウェアの開発作業を進めることが可能になっている。つまり、従来のように設計図面情報とプログラムコードとが、視覚的な静的な側面においては必ずしも等価である必要性がなくなってきている。このような状況の中、最適化されていない設計図面情報の問題に対して、特開平11−237980号公報に掲載の「オブジェクト指向最適化コード生成装置および方法」、特開2004−118865号公報に掲載の「最適化ソフトウェア生成方法」においては、オブジェクト指向機能排除手段を用いて仮想関数の機能を排除、もしくはインスタンスの動的生成の機能を排除することで、必要なメモリ容量を増加させることなく組み込み制御システムに適用可能なコードの最適化を行なうことを可能にしている。   In recent years, with the advancement of MDA technology, it is possible to remove the restrictions in the conventional program code generation apparatus described above. As a result, all program codes can be automatically generated from the software design drawing information, and the design drawing information can be debugged on the MDA dedicated tool. As a result, the operator can proceed with software development work without referring to the program code. That is, it is no longer necessary that the design drawing information and the program code are always equivalent in terms of visual staticity. Under such circumstances, the “object-oriented optimization code generation apparatus and method” disclosed in Japanese Patent Laid-Open No. 11-237980 and Japanese Patent Application Laid-Open No. 2004-118865 address the problem of unoptimized design drawing information. In the "optimized software generation method" described in, the required memory capacity is increased by eliminating the function of virtual functions or eliminating the function of dynamic generation of instances using object-oriented function exclusion means. This makes it possible to optimize code applicable to embedded control systems.

特開平11−237980号公報Japanese Patent Laid-Open No. 11-237980 特開2004−118865号公報JP 2004-118865 A

しかしながら、上述のような装置および方法では、オブジェクト指向機能の排除として、仮想関数機能の排除と、インスタンスの動的生成機能の排除だけしか提案されていない。したがって、設計図面を用いてプログラムコードを自動生成するに際してメモリ容量を適切に削減することが困難であるという問題点があった。   However, in the apparatus and method as described above, only the elimination of the virtual function function and the elimination of the instance dynamic generation function have been proposed as the exclusion of the object-oriented function. Therefore, there is a problem that it is difficult to appropriately reduce the memory capacity when the program code is automatically generated using the design drawing.

本発明は、このような問題点に鑑みてなされたもので、プログラムコードを実行するに際し、メモリ使用量を適切に削減することができるようにすることを目的とする。   The present invention has been made in view of such problems, and an object of the present invention is to appropriately reduce the amount of memory used when executing a program code.

本発明のプログラムコード生成装置は、設計図面を用いてプログラムコードを自動生成するプログラムコード生成装置であって、前記設計図面に含まれるメソッドの呼び出し回数を解析する解析手段と、前記解析手段によって解析された呼び出し回数が所定回数以下のメソッドに対してインライン展開処理を行い、前記呼び出し回数が所定回数以下ではないメソッドに対して関数として展開処理を行うことにより、プログラムコードを生成するプログラムコード生成手段とを有することを特徴とする。   The program code generation device of the present invention is a program code generation device that automatically generates a program code using a design drawing, and analyzes the number of method calls included in the design drawing; Code generation means for generating program code by performing inline expansion processing for a method whose number of calls is less than a predetermined number of times and performing expansion processing as a function for a method whose number of calls is not less than a predetermined number of times It is characterized by having.

本発明のプログラムコード生成方法は、設計図面を用いてプログラムコードを自動生成するプログラムコード生成方法であって、前記設計図面に含まれるメソッドの呼び出し回数を解析する解析ステップと、前記解析ステップにおいて解析された呼び出し回数が所定回数以下のメソッドに対してインライン展開処理を行い、前記呼び出し回数が所定回数以下ではないメソッドに対して関数として展開処理を行うことにより、プログラムコードを生成するプログラムコード生成ステップとを有することを特徴とする。   The program code generation method of the present invention is a program code generation method for automatically generating a program code using a design drawing, wherein an analysis step for analyzing the number of times a method is included in the design drawing, and an analysis in the analysis step A program code generation step of generating a program code by performing inline expansion processing on a method whose number of calls is equal to or less than a predetermined number of times and performing expansion processing as a function on a method whose number of calls is not equal to or less than the predetermined number of times It is characterized by having.

本発明のコンピュータプログラムは、設計図面を用いてプログラムコードを自動生成することをコンピュータに実行させるためのコンピュータプログラムであって、前記設計図面に含まれるメソッドの呼び出し回数を解析する解析ステップと、前記解析ステップにおいて解析された呼び出し回数が所定回数以下のメソッドに対してインライン展開処理を行い、前記呼び出し回数が所定回数以下ではないメソッドに対して関数として展開処理を行うことにより、プログラムコードを生成するプログラムコード生成ステップとをコンピュータに実行させることを特徴とする。   The computer program of the present invention is a computer program for causing a computer to automatically generate a program code using a design drawing, wherein the analysis step analyzes the number of times the method is included in the design drawing; A program code is generated by performing inline expansion processing for a method whose number of calls analyzed in the analysis step is a predetermined number or less and performing expansion processing as a function for a method whose number of calls is not less than the predetermined number A program code generation step is executed by a computer.

本発明によれば、プログラムコードを実行する際のメモリ使用量を削減することができる。   According to the present invention, it is possible to reduce the amount of memory used when executing the program code.

(第1の実施形態)
次に、図面を参照しながら、本発明の第1の実施形態について説明する。
図1は、本実施形態のプログラムコード生成装置の構成の一例を示すブロック図である。
図1において、1はCPUである。CPU1は、プログラムコード生成装置を統括制御し、例えば、バス2に接続された装置3、5、7、9にアクセスして制御を行なう。
3は、バス2を介してCPU1からアクセス可能な読み出し専用メモリ(ROM)である。本実施形態では、処理プログラム3a及び処理プログラム3aにより使用されるパラメータ3bがROM3に格納されている。
(First embodiment)
Next, a first embodiment of the present invention will be described with reference to the drawings.
FIG. 1 is a block diagram showing an example of the configuration of the program code generation device of the present embodiment.
In FIG. 1, 1 is a CPU. The CPU 1 performs overall control of the program code generation device, for example, accesses and controls the devices 3, 5, 7, and 9 connected to the bus 2.
A read-only memory (ROM) 3 is accessible from the CPU 1 via the bus 2. In this embodiment, the processing program 3a and the parameter 3b used by the processing program 3a are stored in the ROM 3.

4は読み書き可能なメモリ(RAM)である。RAM4には、設計図面情報、プラットフォーム情報、最適化可能箇所情報、実行環境制約情報、最適化予定情報、プログラムコード、プロジェクトファイル、ライブラリ、及び実行可能形式をそれぞれ格納するためのデータ格納領域4a〜4iが確保されている。これらデータ格納領域4a〜4iに格納される情報は、それぞれ処理プログラム3aにより作成及び変更される。   Reference numeral 4 denotes a readable / writable memory (RAM). The RAM 4 includes data storage areas 4a to 4d for storing design drawing information, platform information, optimizable location information, execution environment constraint information, optimization schedule information, program code, project file, library, and executable format, respectively. 4i is secured. Information stored in the data storage areas 4a to 4i is created and changed by the processing program 3a.

5は入力インターフェイスであり、キーボード、ボタン、マウス、ダイアル、タブレット等の入力装置6を介してなされる入力を受け取る。
7は出力インターフェイスであり、例えばCRT(又はLCD)8aや、プリンタ(又はプロッタ)8b等を備える出力装置8に対し、データの表示指示や出力指示を行なう。
9は外部記憶装置インターフェイスであり、HD、FD、CD−ROM、MDなどの外部記憶装置10に対するデータの入出力を行なうものである。
An input interface 5 receives an input made via an input device 6 such as a keyboard, a button, a mouse, a dial, or a tablet.
Reference numeral 7 denotes an output interface, which gives data display instructions and output instructions to the output device 8 including, for example, a CRT (or LCD) 8a and a printer (or plotter) 8b.
Reference numeral 9 denotes an external storage device interface for inputting / outputting data to / from the external storage device 10 such as HD, FD, CD-ROM, and MD.

本実施形態では、処理プログラム3aやパラメータ3bがROM3にあるものとし、また、処理対象となる各データ格納領域4a〜4iがRAM4にあるものとして説明を行なうが、これら全て又は一部を、外部記憶装置10に配置することも可能であり、更に、必要に応じて、外部記憶装置10からRAM4にロードして使用することも可能である。また、CPU1のキャッシュメモリにこれらを配置することも可能である。   In the present embodiment, the processing program 3a and the parameter 3b are assumed to be in the ROM 3, and the data storage areas 4a to 4i to be processed are assumed to be in the RAM 4. It is also possible to arrange in the storage device 10, and it is also possible to load the RAM 4 from the external storage device 10 for use as required. Further, these can be arranged in the cache memory of the CPU 1.

図2は、図1に示した処理プログラム3aの構成要件と、その構成要件と図1に示したデータ格納領域4a〜4iに格納されるデータとの関係と、を示す図である。   FIG. 2 is a diagram showing the configuration requirements of the processing program 3a shown in FIG. 1 and the relationship between the configuration requirements and the data stored in the data storage areas 4a to 4i shown in FIG.

図2において、200は、入力インターフェイス5を介して入力されるデータを扱うGUI入力処理部である。オペレータはこのGUI入力処理部200によりデータの入力や編集ができるようになっている。   In FIG. 2, reference numeral 200 denotes a GUI input processing unit that handles data input via the input interface 5. An operator can input and edit data using the GUI input processing unit 200.

201は、実行可能な設計図面を外部記憶装置10内から読み出し、構文解析を行なう実行可能設計図面解析部である。この実行可能設計図面解析部201によって、処理プログラム3aが実行可能設計図面を解釈することを可能にする。なお、設計図面は、プラットフォームに依存せず、オブジェクト指向であるのが好ましい。
202は、外部記憶装置10内から実行ファイルの動作するOSや、プログラミング言語や、利用フレームワークといったプラットフォームデータを読み込み、構文解析を行なうプラットフォーム依存解析部である。このプラットフォーム依存解析部202によって、処理プログラム3aがプラットフォーム情報を解釈することを可能にする。
An executable design drawing analysis unit 201 reads out an executable design drawing from the external storage device 10 and performs syntax analysis. The executable design drawing analysis unit 201 enables the processing program 3a to interpret the executable design drawing. The design drawing is preferably platform-independent and object-oriented.
Reference numeral 202 denotes a platform-dependent analysis unit that reads platform data such as an OS on which an execution file operates, a programming language, and a usage framework from the external storage device 10 and performs syntax analysis. The platform dependence analysis unit 202 enables the processing program 3a to interpret the platform information.

203は、実行可能設計図面解析部201により生成された設計図面情報である。この設計図面情報203は、処理プログラム3aが解釈することが可能な情報である。
204は、プラットフォーム依存解析部202により生成されたプラットフォーム情報である。このプラットフォーム情報は、処理プログラム3aが解釈することが可能な情報である。
205は、全ての設計図面情報203を解析することで、利用されていないクラス、メソッド、イベントや、書き込みアクセスインスタンス、クラスの有無といった最適化が可能な箇所を特定する最適化可能箇所抽出部205である。この最適化可能箇所抽出部205は、実行可能な設計図面内における最適化が可能な箇所を絞り込む。
Reference numeral 203 denotes design drawing information generated by the executable design drawing analysis unit 201. The design drawing information 203 is information that can be interpreted by the processing program 3a.
Reference numeral 204 denotes platform information generated by the platform dependence analysis unit 202. This platform information is information that can be interpreted by the processing program 3a.
An optimizable location extraction unit 205 that analyzes all design drawing information 203 to identify locations that can be optimized, such as unused classes, methods, events, write access instances, and the presence of classes. It is. The optimizable location extraction unit 205 narrows down locations that can be optimized in the executable design drawing.

206は、プラットフォーム情報204から、32bit演算の禁止や、使用メモリ量の制限といった、最適化の際に行なうべき制約を解析する実行環境制約解析部である。この実行環境制約解析部206は、速度やメモリ量といったトレードオフの選択が必要となる情報を抽出する。
207は、最適化可能箇所抽出部205より生成された最適化可能箇所である。この最適化可能箇所207は、最適化が可能な箇所を特定するための情報である。
208は、実行環境制約部206より抽出された実行環境制約である。この実行環境制約208は、実行環境における制約条件の情報である。
Reference numeral 206 denotes an execution environment constraint analysis unit that analyzes constraints to be performed at the time of optimization, such as prohibition of 32-bit computation and limitation of the amount of memory used, from the platform information 204. The execution environment constraint analysis unit 206 extracts information that requires trade-off selection such as speed and memory capacity.
Reference numeral 207 denotes an optimizable location generated by the optimizable location extraction unit 205. This optimizable location 207 is information for specifying a location that can be optimized.
208 is an execution environment constraint extracted by the execution environment constraint unit 206. The execution environment constraint 208 is information on constraint conditions in the execution environment.

209は、最適化可能箇所207と実行環境制約208とを用いて、プログラムコードやプロジェクトファイルを自動生成する際にどのような最適化が効果的且つ適用可能かを示す情報(最適化予定リスト)を抽出する最適化予定リスト抽出部である。
210は、最適化予定リスト抽出部209より抽出された最適化予定リストである。上述したように、最適化予定リスト210は、プログラムコードやプロジェクトファイルを自動生成する際にどのような最適化が効果的且つ適用可能かを示す情報である。
211は、設計図面情報203と、プラットフォーム情報204と、最適化予定リスト210とを用いて、プログラムコードを自動生成するプログラムコード生成部である。このプログラムコード生成部211によって、設計図面の依存関係や実行対象となるプラットフォームに応じて最適化されたプログラムコードの自動生成が可能になる。
Reference numeral 209 denotes information (optimization schedule list) indicating what kind of optimization is effective and applicable when program code and project files are automatically generated using the optimizable location 207 and the execution environment constraint 208. Is an optimization schedule list extraction unit for extracting.
Reference numeral 210 denotes an optimization schedule list extracted by the optimization schedule list extraction unit 209. As described above, the optimization schedule list 210 is information indicating what kind of optimization is effective and applicable when automatically generating program codes and project files.
A program code generation unit 211 automatically generates a program code using the design drawing information 203, the platform information 204, and the optimization schedule list 210. The program code generation unit 211 can automatically generate a program code optimized according to the dependency relationship of the design drawings and the platform to be executed.

212は、設計図面情報203と、プラットフォーム依存情報204と、最適化予定リスト210とを用いて、プログラムコードやライブラリを管理するプロジェクトファイルを自動生成するプロジェクトファイル生成部である。
213は、プログラムコード生成部211により生成されたプログラムコードである。
214は、プロジェクトファイル生成部212により生成されたプロジェクトファイルである。
215は、プログラムコード213から参照されるライブラリである。
216は、プロジェクトファイル214が管理するプログラムコード213と、プロジェクトファイル214と、ライブラリ215とを用いて、実行可能形式217を生成するコード・コンパイラである。
A project file generation unit 212 automatically generates a project file for managing program codes and libraries using the design drawing information 203, the platform-dependent information 204, and the optimization schedule list 210.
Reference numeral 213 denotes a program code generated by the program code generation unit 211.
Reference numeral 214 denotes a project file generated by the project file generation unit 212.
Reference numeral 215 denotes a library referenced from the program code 213.
A code compiler 216 generates an executable format 217 using the program code 213 managed by the project file 214, the project file 214, and the library 215.

次に、図3のフローチャートを参照しながら、本実施形態のプログラムコード生成装置の処理手順の概要の一例を説明する。本実施の形態におけるプログラムコード生成装置の処理は、ROM3に記憶された処理プログラム3aをRAM4に展開し、CPU1が処理プログラム3aに基づいて処理を実行することによって達成される。
まず、ステップS301にて起動したプログラムコード生成装置は、ステップS302において、外部記憶装置10などに記憶されている実行可能な設計図面を読み込み、実行可能設計図面解析部201により設計図面情報203を生成する。
Next, an example of the outline of the processing procedure of the program code generation device of this embodiment will be described with reference to the flowchart of FIG. The processing of the program code generation device in the present embodiment is achieved by expanding the processing program 3a stored in the ROM 3 into the RAM 4 and executing the processing based on the processing program 3a by the CPU 1.
First, the program code generation apparatus activated in step S301 reads an executable design drawing stored in the external storage device 10 or the like in step S302, and generates the design drawing information 203 by the executable design drawing analysis unit 201. To do.

そして、ステップS303において、プラットフォーム情報がある場合にはステップS304へ、プラットフォーム情報がない場合にはステップS306へ分岐する。プラットフォーム情報がない場合には、ステップS306において、最適化可能個所抽出部205は、設計図面情報203から図面の依存関係を解析することで最適化可能箇所207を生成する。   In step S303, if there is platform information, the process branches to step S304, and if there is no platform information, the process branches to step S306. If there is no platform information, in step S306, the optimizable location extraction unit 205 generates an optimizable location 207 by analyzing the dependency relationship of the drawings from the design drawing information 203.

一方、プラットフォーム情報がある場合には、ステップS304において、外部記憶装置10などに記憶されているプラットフォーム情報を読み込み、プラットフォーム依存解析部202によりプラットフォーム情報204を生成する。そして、ステップ305において、実行環境制約解析部206は、プラットフォーム情報204から実行環境制約情報を解析することで実行環境制約208を生成する。その後、上述したように、ステップS306において最適化可能箇所207を生成する。   On the other hand, if there is platform information, the platform information stored in the external storage device 10 or the like is read in step S304, and the platform dependence analysis unit 202 generates platform information 204. In step 305, the execution environment constraint analysis unit 206 generates the execution environment constraint 208 by analyzing the execution environment constraint information from the platform information 204. Thereafter, as described above, the optimizable portion 207 is generated in step S306.

最適化可能箇所207が生成されると、ステップS307において、最適化予定リスト生成部209は、最適化可能箇所207と実行環境制約208とを用いて、プログラムコードを生成するときに最適化を施すために必要な情報のリストである最適化予定リスト210を生成する。このとき、実行環境制約208がない場合や、最適化予定リスト210の作成に影響がない場合には、最適化可能箇所207と最適化予定リスト210とは同じ情報であっても構わない。   When the optimizable location 207 is generated, in step S307, the optimization schedule list generation unit 209 performs optimization when generating the program code using the optimizable location 207 and the execution environment constraint 208. For this purpose, an optimization schedule list 210, which is a list of information necessary for this purpose, is generated. At this time, when there is no execution environment restriction 208 or when there is no influence on the creation of the optimization schedule list 210, the optimizable location 207 and the optimization schedule list 210 may be the same information.

次に、ステップS308において、設計図面情報203と、プラットフォーム情報204と、最適化予定リスト210とを用いて、プロジェクトファイル生成部212は、プロジェクトファイル214を生成する。
次に、ステップ309において、設計図面情報203と、プラットフォーム情報204と最適化予定リスト210とを用いて、プログラムコード生成部211は、プログラムコード213を生成する。プログラムコード213の生成に必要なプラットフォーム情報204は、プラットフォームに依存した制約情報である。具体的にプラットフォーム情報204は、例えば、タスクやスレッドをどこのドメインやクラスなどにマッピングさせるかを示す情報や、実行スピードとメモリ容量との何れを優先させるのかを示す情報などである。
In step S308, the project file generation unit 212 generates a project file 214 using the design drawing information 203, the platform information 204, and the optimization schedule list 210.
Next, in step 309, the program code generation unit 211 generates a program code 213 using the design drawing information 203, the platform information 204, and the optimization schedule list 210. The platform information 204 necessary for generating the program code 213 is platform-dependent constraint information. Specifically, the platform information 204 is, for example, information indicating to which domain or class a task or thread is mapped, information indicating which of execution speed or memory capacity is to be prioritized, and the like.

最後に、ステップ310において、コード・コンパイラ216は、プロジェクトファイル214を基にして、プログラムコード213とライブラリ215に対して、コンパイルとリンクを実施し、実行可能形式217を生成する。   Finally, in step 310, the code compiler 216 compiles and links the program code 213 and the library 215 based on the project file 214 to generate an executable format 217.

図4は、設計図面情報203の一例を示した図である。図4では、設計図面情報203のうち、一部分のみの情報の一例を示している。
図4において、701は、クラス「A」であり、非公開属性としてint型の「a」、公開関数として戻り値がvoid型の「func_a」、非公開関数として戻り値がint型の「pri_func」という構成を示している。
702は、クラス「B」であり、公開関数として戻り値がvoid型の「func_b」という構成を示している。
なお、図4では、クラス701とクラス702が関連を持つことを示している。
FIG. 4 is a diagram showing an example of the design drawing information 203. FIG. 4 shows an example of only a part of the design drawing information 203.
In FIG. 4, reference numeral 701 denotes a class “A”, an int type “a” as a private attribute, a void type “func_a” as a public function, and a “pri_func” return value as a private function. Is shown.
Reference numeral 702 denotes a class “B”, which shows a configuration of “func_b” whose return value is a void type as a public function.
FIG. 4 shows that the class 701 and the class 702 are related.

704は、クラス702のインスタンスがある状態のときの動作定義である。この動作定義704は、「eventB1」というイベントによりメソッド「func_b」を実行し、且つ、メソッド「func_b」の内部動作の指示として「クラス「A」のfunc_aメソッドを実行する」ということを示している。705は、クラス701のメソッドである「func_a」の内部動作の定義である。この内部動作の指示として、属性「a」を用いた計算が定義されている。706は、クラス701のメソッド「pri_func」の内部動作の定義である。   Reference numeral 704 denotes an operation definition when there is an instance of the class 702. The operation definition 704 indicates that the method “func_b” is executed by an event “eventB1” and “the func_a method of the class“ A ”is executed” as an instruction of the internal operation of the method “func_b”. . Reference numeral 705 denotes an internal operation definition of “func_a” that is a method of the class 701. As an instruction for this internal operation, calculation using the attribute “a” is defined. Reference numeral 706 denotes an internal operation definition of the method “pri_func” of the class 701.

図5は、最適化可能個所207または最適化予定リスト210の一例を示した図である。
図5において、801は、プログラムコードを生成するときに削除する対象のメソッドの一覧(削除対象メソッド)である。802は、プログラムコードを生成するときにインライン展開(設計図面上での関数またはサブルーチン呼び出しに対するコードとして、呼び出される関数またはサブルーチンの中身を直接出力する処理)する対象のメソッドの一覧(インライン対象メソッド)である。803は、設計図面情報203では元々非公開で定義されている属性を、プログラムコードを生成するときに、公開に変更して定義する属性の一覧(公開対象属性)を示している。
FIG. 5 is a diagram showing an example of the optimizable part 207 or the optimization schedule list 210.
In FIG. 5, reference numeral 801 denotes a list of methods to be deleted (deletion target methods) when the program code is generated. Reference numeral 802 denotes a list of methods (inline target methods) to be inlined when generating program code (processing for directly outputting the contents of a function or subroutine to be called as code for a function or subroutine call on a design drawing). It is. Reference numeral 803 denotes a list of attributes (publication target attributes) that are defined in the design drawing information 203 by changing publicly defined attributes to public when the program code is generated.

804は、設計図面情報203では元々非公開で定義されているメソッドを、プログラムコードを生成するときに、公開に変更して定義するメソッドの一覧(公開対象メソッド)を示している。なお、ここでは、最適化可能個所抽出部205により抽出された最適可能化個所207と、最適化予定リスト作成部209により作成された最適化予定リスト210とは、同じ情報として扱う。つまり、実行環境制約208が無かった場合を例に挙げて説明する。   Reference numeral 804 denotes a list of methods (publication target methods) that are defined in the design drawing information 203 by changing the methods originally defined as private to public when the program code is generated. Note that, here, the optimization possible location 207 extracted by the optimization possible location extraction unit 205 and the optimization schedule list 210 created by the optimization schedule list creation unit 209 are treated as the same information. That is, the case where there is no execution environment restriction 208 will be described as an example.

図6は、本実施形態における最適化を設計図面情報203に施さないで自動生成されたプログラムコードの一例を示す図である。
図6において、901、902は、クラス701と、内部動作の定義705、706の情報から生成されたプログラムコードの一例である。903は、クラス702と、動作定義704の情報から生成されたプログラムコードの一例である。なお、ここでは、説明を簡潔にするために、説明する上で必要な最低限の情報のみを示している。
FIG. 6 is a diagram showing an example of a program code automatically generated without applying optimization to the design drawing information 203 in the present embodiment.
In FIG. 6, reference numerals 901 and 902 are examples of program codes generated from information of a class 701 and internal operation definitions 705 and 706. Reference numeral 903 denotes an example of a program code generated from information of the class 702 and the action definition 704. Here, for the sake of brevity, only the minimum information necessary for explanation is shown.

例えば、図4において、属性やメソッド以外の設計図面情報203がクラス701、702に存在していても構わないがここでは表記していない。また、各クラスやメソッドがプログラムコードとして生成される場合に、そのプログラムコードがどこのファイルに展開されるか等の情報についての設計図面情報203も存在している。本実施形態では、これら全部の設計図面情報203を用いてプログラムコードは自動生成されるものとする。   For example, in FIG. 4, design drawing information 203 other than attributes and methods may exist in the classes 701 and 702, but is not shown here. In addition, when each class or method is generated as a program code, there is also design drawing information 203 regarding information such as to which file the program code is expanded. In the present embodiment, it is assumed that the program code is automatically generated using all the design drawing information 203.

図7は、本実施形態における最適化を設計図面情報203に施して自動生成されたプログラムコードの一例を示す図である。つまり、図7は、図5に示した最適化予定リスト210を加味して自動生成されたプログラムコードの一例を示している。
図7において、1001は、クラス701と、削除対象メソッド801と、インライン対象メソッド802と、公開対象属性803の情報から生成されたプログラムコードの一例である。1002は、クラス702と、動作定義704と、インライン対象メソッド802と、公開対象属性803の情報から生成されたプログラムコードの一例である。
FIG. 7 is a diagram showing an example of a program code automatically generated by applying optimization to the design drawing information 203 in the present embodiment. That is, FIG. 7 shows an example of program code that is automatically generated in consideration of the optimization schedule list 210 shown in FIG.
In FIG. 7, 1001 is an example of a program code generated from information of a class 701, a deletion target method 801, an inline target method 802, and a disclosure target attribute 803. Reference numeral 1002 denotes an example of a program code generated from information of the class 702, the action definition 704, the inline target method 802, and the disclosure target attribute 803.

ここで、図4に示した設計図面情報203と、図5に示した最適化予定リスト210と、図7に示したプログラムコードの詳細に関して、CPU1が処理プログラム3aに基づいて実行する図8〜図10の動作処理フローチャートを参照しながら説明する。   Here, regarding the details of the design drawing information 203 shown in FIG. 4, the optimization schedule list 210 shown in FIG. 5, and the program code shown in FIG. 7, the CPU 1 executes based on the processing program 3a in FIGS. This will be described with reference to the operation processing flowchart of FIG.

図8のフローチャートによる処理は、図3に示したステップS307内での処理である。この図8のフローチャートによるが開始するのは、設計図面情報203における1つのメソッドについて注目し最適化が可能かどうかの判断を行なう場合である。つまり、設計図面情報203の全てのメソッドについて、この図8のフローチャートが繰り返し実施されることになる。   The processing according to the flowchart of FIG. 8 is processing within step S307 shown in FIG. The process shown in the flowchart of FIG. 8 starts when it is determined whether optimization is possible by paying attention to one method in the design drawing information 203. That is, the flowchart of FIG. 8 is repeatedly executed for all methods of the design drawing information 203.

まず、ステップS1101では、CPU1は、対象メソッドについて設計図面情報203内の全情報を解析して、その対象メソッドが何回呼び出されているかをカウントする。具体的に非公開メソッドの場合についてはそのメソッドが所属するクラス内における設計図面情報203を解析する対象範囲とし、公開メソッドの場合については全クラスの設計図面情報203を解析する対象範囲とし、対象範囲から対象メソッドが呼び出されている回数をカウントする。処理の詳細については、図9のフローチャートを用いて説明する。   First, in step S1101, the CPU 1 analyzes all information in the design drawing information 203 for the target method, and counts how many times the target method is called. Specifically, in the case of a private method, the design drawing information 203 in the class to which the method belongs is set as a target range to be analyzed. In the case of a public method, the design drawing information 203 of all classes is set as a target range to be analyzed. Count the number of times the target method is called from the range. Details of the processing will be described with reference to the flowchart of FIG.

次に、ステップS1102では、CPU1は、ステップS1101にて解析した対象メソッドの呼び出し回数が0回であったか否かを判定する。この判定の結果、0回の呼び出し、つまり対象メソッドがどこからも使われていないメソッドであった場合には、ステップS1104へ進む。一方、1回以上の呼び出し、つまり対象メソッドがどこかで使われているメソッドであった場合には、ステップS1103へ進む。   Next, in step S1102, the CPU 1 determines whether the number of calls of the target method analyzed in step S1101 is zero. As a result of this determination, if the number of calls is zero, that is, if the target method is not used anywhere, the process proceeds to step S1104. On the other hand, if it is called once or more, that is, if the target method is used somewhere, the process proceeds to step S1103.

そして、ステップS1104では、CPU1は、対象メソッドが使われていないということを最適化予定リスト210へ記憶する。図5に示した削除対象メソッド801では、使われていないメソッド、つまりプログラムコードの生成から削除対象となるメソッドのリストに登録されることになる。この削除対象メソッド801のリストに登録されたメソッドは、設計図面情報203には存在するが、プログラムコード生成部211によって生成されるプログラムコード213には存在しないことになる。   In step S1104, the CPU 1 stores in the optimization schedule list 210 that the target method is not used. The deletion target method 801 shown in FIG. 5 is registered in a list of methods that are not used, that is, methods to be deleted from generation of program code. The method registered in the list of deletion target methods 801 exists in the design drawing information 203 but does not exist in the program code 213 generated by the program code generation unit 211.

図4に示した例では、クラス701では、「pri_func」メソッドがこの削除対象メソッドにあたる。よって、図6に示した最適化を施さない場合のプログラムコードでは、プログラムコード901に、「pri_func」メソッドのプログラムコードが生成されているが、図7に示した最適化を施す場合のプログラムコードでは、プログラムコード1001に、「pri_func」メソッドは生成されていない。   In the example illustrated in FIG. 4, in the class 701, the “pri_func” method corresponds to this deletion target method. Therefore, in the program code when the optimization shown in FIG. 6 is not performed, the program code of the “pri_func” method is generated in the program code 901. However, the program code when the optimization shown in FIG. In the program code 1001, the “pri_func” method is not generated.

ステップS1103では、CPU1は、ステップS1101にて解析した対象メソッドの呼び出し回数が1回であったか否かを判定する。1回の呼び出し、つまり対象メソッドが1箇所だけからしか使われていないメソッドであった場合には、ステップS1106へ進む。一方、2回以上の呼び出し、つまり対象メソッドが複数箇所から使われているメソッドであった場合には、ステップS1105へ進む。なお、ステップS1103では、メソッドの呼び出し回数が1回以下か否かを判断基準としているが、RAM4の残容量に余裕がある場合、2回,3回などを判断基準としてもよい。この場合、RAM4の残容量を参照し、容量が多くなるに従って判断基準とすべき読出し回数を増やす処理が行われることになる。   In step S1103, the CPU 1 determines whether or not the number of calls of the target method analyzed in step S1101 is one. If the method is called once, that is, if the target method is a method that is used only from one place, the process proceeds to step S1106. On the other hand, if it is called twice or more, that is, if the target method is a method used from a plurality of locations, the process proceeds to step S1105. In step S1103, whether or not the number of method calls is one or less is used as a criterion. However, if there is a margin in the remaining capacity of the RAM 4, two or three times may be used as a criterion. In this case, the remaining capacity of the RAM 4 is referred to, and processing for increasing the number of readings that should be used as a determination criterion is performed as the capacity increases.

そして、ステップS1106では、CPU1は、対象メソッドが1箇所だけからしか使われていないということを最適化予定リスト210へ記憶し、且つ、その対象メソッドを使っている1箇所にその対象メソッドをインライン展開してコード生成する(ソース上での関数またはサブルーチン呼び出しに対するコードとして、呼び出される関数またはサブルーチンの中身を直接出力する)ための処理をする。処理の詳細については、図13のフローチャートにて説明する。   In step S1106, the CPU 1 stores in the optimization schedule list 210 that the target method is used only from one place, and inline the target method in one place where the target method is used. Processing is performed to expand and generate code (directly output the contents of the called function or subroutine as code for the function or subroutine call on the source). Details of the processing will be described with reference to the flowchart of FIG.

また、ステップS1105では、対象メソッドについては最適化せずにメソッドを関数として展開する、すなわち、メソッドを関数の呼出しに用いられる命令のプログラムコードとして生成する処理を行うこと決定する。なお、本実施形態においては、最適化予定リスト210に対象メソッドを登録しないことでプログラムコードを生成すると決定しているが、最適化予定リスト210に「最適化しないメソッド」のリストとして対象メソッドを記憶することも可能である。   Also, in step S1105, it is determined that the target method is not optimized and the method is expanded as a function, that is, the method is generated as a program code of an instruction used for calling the function. In this embodiment, it is determined that the program code is generated by not registering the target method in the optimization schedule list 210, but the target method is selected as a list of “methods not to be optimized” in the optimization schedule list 210. It is also possible to memorize.

次に、図9のフローチャートを参照しながら、図8に示したステップS1101(メソッドの呼び出し回数カウント処理)の詳細の一例について説明する。
まず、ステップS1201では、対象メソッドが所属するクラスと関連のあるクラスを設計図面情報203から抽出する。例えば、図4に示したクラス701における「func_a」メソッドが対象メソッドの場合には、関連のあるクラスは所属するクラス701と、クラス702であることを抽出する。また、「pri_func」メソッドが対象メソッドの場合には、この「pri_func」メソッドが非公開メソッドであることから関連のあるクラスは所属するクラス701のみであることを抽出する。
Next, an example of details of step S1101 (method call count processing) shown in FIG. 8 will be described with reference to the flowchart of FIG.
First, in step S1201, a class related to the class to which the target method belongs is extracted from the design drawing information 203. For example, when the “func_a” method in the class 701 shown in FIG. 4 is the target method, it is extracted that the related classes are the class 701 to which the class belongs and the class 702. When the “pri_func” method is a target method, it is extracted that the related class is only the class 701 to which the method belongs because the “pri_func” method is a private method.

次に、ステップS1202では、ステップS1201で抽出した全てのクラスについて、対象メソッドが使われているかどうかの走査が終わったかどうかを判定する。この判定の結果、走査が終わっていない場合にはステップS1203へ進む。一方、走査が終わった場合には、そのままこのフローチャートを抜けて、図8に示したステップS1102に進む。   Next, in step S1202, it is determined whether scanning for whether or not the target method is used has been completed for all the classes extracted in step S1201. If the result of this determination is that scanning has not ended, processing advances to step S1203. On the other hand, when the scanning is finished, the process directly exits the flowchart and proceeds to step S1102 shown in FIG.

一方、走査が終わっておらずステップS1203に進むと、ステップS1201で抽出したクラスに関する設計図面情報203を走査し、対象メソッドが使われているかどうかを判別し、使われている場合には使われている回数分カウントアップしていく。   On the other hand, if scanning has not ended and the process proceeds to step S1203, the design drawing information 203 relating to the class extracted in step S1201 is scanned to determine whether the target method is used. Count up as many times as you have.

図4に示したクラス701の対象メソッドが「func_a」の場合には、ステップS1201で、関連のあるクラスはクラス701とクラス702との判定されたことから、それらクラス701、702の設計図面情報203を走査することになる。その結果、クラス702の動作定義704において対象メソッドとして、クラス701の「func_a」が使用されていることが確認され、使われている回数が1だけカウントアップされる。   When the target method of the class 701 shown in FIG. 4 is “func_a”, since the related classes are determined as the class 701 and the class 702 in step S1201, design drawing information of the classes 701 and 702 is determined. 203 is scanned. As a result, it is confirmed that “func_a” of the class 701 is used as the target method in the operation definition 704 of the class 702, and the number of times used is counted up by one.

また、図4に示したクラス701の対象メソッドが「pri_func」の場合には、ステップS1201で、関連のあるクラスはクラス701と判定されたことから、そのクラス701の設計図面情報203を走査することになる。その結果、対象メソッドとして、クラス701の「pri_func」が使用されていないことが確認され、使われている回数が0にセットされる。   If the target method of the class 701 shown in FIG. 4 is “pri_func”, since the related class is determined to be the class 701 in step S1201, the design drawing information 203 of the class 701 is scanned. It will be. As a result, it is confirmed that “pri_func” of the class 701 is not used as the target method, and the number of times used is set to 0.

次に、図10のフローチャートを参照しながら、図8に示したステップS1106(メソッドをインライン展開するための処理)の詳細の一例について説明する。図4に示したクラス701では、呼び出し回数が1個所であると確認された対象メソッド(「func_a」)のときに、このフローチャートが開始する。   Next, an example of the details of step S1106 (processing for inline development of a method) shown in FIG. 8 will be described with reference to the flowchart of FIG. In the class 701 shown in FIG. 4, this flowchart is started when the target method (“func_a”) is confirmed to have one call.

まず、ステップS1301では、対象メソッドをインライン展開するための登録を最適化予定リスト210に対して行なう。図5に示した例では、インライン対象メソッド802のリストに「クラスAのfunc_a」がインライン展開の対象メソッドであると登録される。   First, in step S1301, registration for optimizing the target method is performed on the optimization schedule list 210. In the example shown in FIG. 5, “func_a of class A” is registered in the list of inline target methods 802 as a target method for inline expansion.

次に、ステップS1310では、対象メソッドが、所属するクラス以外でも呼び出されているか否かを判定し、所属するクラス以外でも呼び出されている場合にはステップS1302へ進む。図5に示した例では、インライン対象メソッド802である「クラスAのfunc_a」は、図4に示した動作定義704より、クラス702(クラスB)から呼び出されていると判断され、ステップS1302へ進むことになる。もし所属するクラス以外から呼び出されていない場合には、インライン展開される箇所はクラス内であり、対象メソッドが非公開な属性やメソッドを操作していたとしても、その属性やメソッドを操作するスコープには影響しないので、そのまま図10に示すフローチャートを抜けることになる。   Next, in step S1310, it is determined whether or not the target method is called by a class other than the class to which the target method belongs. If the target method is also called by a class other than the class to which the target method belongs, the process proceeds to step S1302. In the example illustrated in FIG. 5, it is determined that “class_func_a”, which is the inline target method 802, is called from the class 702 (class B) based on the operation definition 704 illustrated in FIG. 4, and the process proceeds to step S <b> 1302. Will go on. If it is not called from other than the class to which it belongs, the inline expanded part is in the class, and even if the target method is operating a private attribute or method, the scope for operating that attribute or method Is not affected, and the flowchart shown in FIG.

ステップS1302では、設計図面情報203を参照して、対象メソッドが非公開属性を操作しているかどうかを確認する。この確認の結果、非公開属性を操作している場合にはステップS1303へ進み、非公開属性を操作していない場合にはステップS1304へ進む。図3に示した例では、クラス701に所属する対象メソッド「func_a」により、クラス701に所属する非公開属性のうち「int型のa」が操作されていると判断されステップS1303へ進むことになる。   In step S1302, it is confirmed with reference to the design drawing information 203 whether the target method is operating the non-public attribute. As a result of the confirmation, if the private attribute is operated, the process proceeds to step S1303. If the private attribute is not operated, the process proceeds to step S1304. In the example illustrated in FIG. 3, it is determined that “int a” among the private attributes belonging to the class 701 is operated by the target method “func_a” belonging to the class 701, and the process proceeds to step S <b> 1303. Become.

ステップS1303では、対象メソッドが操作している非公開属性を、対象メソッドが所属するクラス以外のクラスにインライン展開するので、非公開属性を公開属性に変更するための登録を、最適化予定リスト210に対して行なう。図5に示した公開対象属性803では、非公開属性であった属性「a」を公開属性に変更することを登録している。   In step S1303, since the private attribute operated by the target method is expanded inline to a class other than the class to which the target method belongs, registration for changing the private attribute to the public attribute is performed in the optimization schedule list 210. To. In the disclosure target attribute 803 shown in FIG. 5, it is registered that the attribute “a”, which was a private attribute, is changed to a public attribute.

ステップS1304では、設計図面情報203を参照して、対象メソッドが非公開関数を操作しているかどうかを確認する。この確認の結果、非公開関数を操作している場合にはステップS1305へ進む。図4に示した例では、クラス701に所属する対象メソッドである「func_a」ではクラス701に所属する非公開関数は操作されていないと判断され、そのまま図10のフローチャートを抜けることになる。   In step S1304, with reference to the design drawing information 203, it is confirmed whether or not the target method is operating a secret function. If the result of this confirmation is that a private function is being operated, the process advances to step S1305. In the example shown in FIG. 4, it is determined that the private function belonging to the class 701 is not operated in “func_a” that is the target method belonging to the class 701, and the process exits the flowchart of FIG. 10 as it is.

ステップS1305では、対象メソッドが操作している非公開関数を、対象メソッドが所属するクラス以外のクラスにインライン展開するために、非公開関数を公開関数に変更するための登録を最適化予定リスト210に対して行なう。図5に示した公開対象メソッド804では、本ステップで対象とするメソッドがないことにより、リストに登録されずに空の状態であることを示している。   In step S1305, in order to inline the private function operated by the target method into a class other than the class to which the target method belongs, registration for changing the private function to the public function is the optimization schedule list 210. To. The disclosure target method 804 shown in FIG. 5 indicates that there is no method targeted in this step, and that the disclosure target method 804 is empty without being registered in the list.

図3、図8〜図10のフローチャートの処理によって、設計図面情報203より最適化予定リスト210が生成され、図3のステップS309の処理により設計図面情報203や最適化予定リスト210の情報を基に、最適化されたプログラムコードが生成されることになる。   The optimization schedule list 210 is generated from the design drawing information 203 by the processes of the flowcharts of FIGS. 3 and 8 to 10, and the design drawing information 203 and the information of the optimization schedule list 210 are based on the process of step S 309 in FIG. 3. In addition, an optimized program code is generated.

以上のように本実施形態では、設計図面情報203に存在するメソッドにおいて、呼び出しが行なわれないメソッドと、1回しか呼び出されることがないメソッドに関する情報を収集し、呼び出しが行なわれないメソッドに関してはプログラムコードに関数定義を生成しない。一方、1回しか呼び出されることがないメソッドに関しては、メソッドがアクセスする資源に対してメソッドの呼び出し元がアクセスできるように属性を変更し、且つ呼び出し元へメソッドをインライン展開するプログラムコードを生成する。このようにすることで、最終的にコンパイル・リンクされた実行可能形式のファイルが、設計図面情報203にある使用されない関数を含むこともないのでメモリ使用量を削減でき、設計図面情報203上にある関数コールによるオーバーヘッドも少なくなることにより処理を高速化することができる。   As described above, in the present embodiment, among the methods existing in the design drawing information 203, information on methods that are not called and methods that are called only once is collected, and methods that are not called are collected. Do not generate function definitions in program code. On the other hand, for a method that can be called only once, the attribute is changed so that the caller of the method can access the resource accessed by the method, and program code for inline expansion of the method to the caller is generated. . In this way, the executable file finally compiled and linked does not include an unused function in the design drawing information 203, so that the memory usage can be reduced. The processing speed can be increased by reducing the overhead caused by a certain function call.

なお、前述した本実施形態で示したフローチャートによる処理手順は、一例であり、本発明はこれらの処理手順に限定されることはなく、本発明の結果を満たす限りいかなる手順の組み合わせも可能である。例えば、複数の処理をまとめることも、処理を細分化することも可能であり、また、各処理を個々に切り出してひとつの機能要素として単体として機能することも可能である。さらに、フローチャートに示した処理とフローチャートに示している処理以外の処理とを組み合わせて使用することも可能である。   Note that the processing procedure according to the flowchart shown in the above-described embodiment is an example, and the present invention is not limited to these processing procedures, and any combination of procedures is possible as long as the result of the present invention is satisfied. . For example, a plurality of processes can be combined, or the processes can be subdivided, and each process can be cut out individually and function as a single functional element. Furthermore, it is possible to use a combination of the process shown in the flowchart and a process other than the process shown in the flowchart.

(第2の実施形態)
次に、本発明の第2の実施形態について説明する。本実施形態では、設計図面情報203の読み出しが行なわれないメソッドや、1回しか呼び出されることがないメソッドに関する情報をオペレータに通知するようにしている点が第1の実施形態と異なる。したがって、本実施形態の説明において、第1の実施形態と同一の部分については、図1〜図10に付した符号と同一の符号を付すなどして詳細な説明を省略する。
(Second Embodiment)
Next, a second embodiment of the present invention will be described. This embodiment is different from the first embodiment in that an operator is notified of information regarding a method for which design drawing information 203 is not read or a method that is called only once. Therefore, in the description of the present embodiment, the same parts as those in the first embodiment are denoted by the same reference numerals as those in FIGS.

図11は、最適化予定リスト作成部209により最適化予定リスト210を作成する前に、最適化可能箇所207をオペレータに通知する場合に、出力装置8にGUIで表示される最適化設定ダイアログ1401の一例を示す図である。   FIG. 11 shows an optimization setting dialog 1401 displayed on the output device 8 using a GUI when notifying the operator of the optimizable location 207 before creating the optimization schedule list 210 by the optimization schedule list creation unit 209. It is a figure which shows an example.

図14において、1402は、設計図面情報203でどこからも呼び出されていない削除対象の候補のメソッドをリスト形式で表示する削除対象メソッド表示部である。1403は、設計図面情報203で1個所だけから呼び出されているインライン展開対象の候補のメソッドをリスト形式で表示するインライン展開対象メソッド表示部である。   In FIG. 14, reference numeral 1402 denotes a deletion target method display unit that displays candidate methods to be deleted that are not called from anywhere in the design drawing information 203 in a list format. Reference numeral 1403 denotes an inline expansion target method display unit that displays inline expansion target candidate methods called from only one place in the design drawing information 203 in a list format.

例えば、最適化可能箇所抽出部により、設計図面情報203から最適化可能箇所207を抽出した結果に基づいて、1回も使用されていないメソッドが削除対象メソッド表示部1402に削除対象の候補として表示され、1箇所からだけしか呼び出されていないメソッドがインライン展開対象メソッド表示部1403にインライン展開対象メソッドの候補として表示される。   For example, a method that has not been used once is displayed on the deletion target method display unit 1402 as a deletion target candidate based on the result of extracting the optimizable part 207 from the design drawing information 203 by the optimizable part extraction unit. A method that is called only from one place is displayed as a candidate for the inline expansion target method on the inline expansion target method display unit 1403.

オペレータは、削除対象メソッド表示部1402やインライン展開対象メソッド表示部1403の各メソッドに対応したチェックボックスを設定(オン)したり、設定を解除(オフ)したりすることができる。最終的にOKボタン1405を押した時点で設定されているメソッドについては、最適化可能箇所207の情報が、そのまま最適化予定リスト210にも登録され、設定が解除されたメソッドについては、最適化可能箇所207の情報から最適化予定リスト210への登録はなされない。   The operator can set (turn on) check boxes corresponding to the methods in the deletion target method display unit 1402 and the inline expansion target method display unit 1403, and cancel (turn off) the settings. For the method that is set when the OK button 1405 is finally pressed, the information of the optimizable portion 207 is registered in the optimization schedule list 210 as it is, and the method that has been unset is optimized. Registration to the optimization schedule list 210 is not performed from the information of the possible locations 207.

また、最適化可能箇所抽出部は、例えば、オペレータが削除対象メソッド表示部1402やインライン展開対象メソッド表示部1403の設定がオン・オフされる度に、「コードステップ量の削減量」や「予想ROM使用削減量」や「予想実行速度アップ率」などの情報を、表示部1404にリアルタイムに表示することでオペレータに通知する。オペレータはこれらの情報を基に、削除対象メソッド表示部1402やインライン展開対象メソッド表示部1403に表示された候補の各メソッドに対してプログラムコードを生成する際の最適化を実際に行なうかどうかを判断する情報として参考にすることができる。表示部1404に表示するような情報の計算方法は、例えば、ツール独自の計算方法など、どのようなものであってもよく、最適化可能箇所抽出部はその算出された情報をオペレータへ通知するだけである。   In addition, the optimizable location extraction unit, for example, every time the operator turns on / off the setting of the deletion target method display unit 1402 or the inline expansion target method display unit 1403, the “reduction amount of code step amount” or “prediction” Information such as “ROM usage reduction amount” and “expected execution speed increase rate” is displayed on the display unit 1404 in real time to notify the operator. Based on these pieces of information, the operator determines whether to actually perform optimization when generating the program code for each candidate method displayed in the deletion target method display unit 1402 or inline expansion target method display unit 1403. It can be referred to as information to be judged. The calculation method of the information displayed on the display unit 1404 may be any method such as a calculation method unique to the tool, and the optimizable part extraction unit notifies the operator of the calculated information. Only.

以上のように本実施形態では、設計図面情報203の呼び出しが行なわれないメソッドや、呼び出しが1回しか呼び出されることがないメソッドに関する情報をオペレータに通知するようにしたので、前述した第1の実施形態の効果に加え、オペレータは、最適化を行なう候補として表示されたメソッドに関してプログラムコードの生成に関する最適化を行なうのか否かの選択をすることができ、使用メモリ容量や実行スピードのトレードオフに関する検討を行なうことができる。また、設計図面情報上の使用されていないメソッドや呼び出しが1回しか呼び出されることがないメソッドに関する情報をオペレータに通知することで、オペレータの消し忘れのメソッドやソフトウェアの設計自体を見直す機会をオペレータに与えることができる。   As described above, in the present embodiment, the operator is notified of information on a method that does not call the design drawing information 203 and a method that can be called only once. In addition to the effects of the embodiment, the operator can select whether or not to perform optimization related to generation of program code for a method displayed as a candidate for optimization, and a trade-off between memory capacity used and execution speed. Can be considered. In addition, by notifying the operator of methods that are not used in the design drawing information and methods that are called only once, the operator has an opportunity to review the method that the operator has forgotten to erase and the design of the software itself. Can be given to.

(本発明の他の実施形態)
上述した実施形態の機能を実現するべく各種のデバイスを動作させるように、該各種デバイスと接続された装置あるいはシステム内のコンピュータに対し、前記実施形態の機能を実現するためのソフトウェアのプログラムコードを供給し、そのシステムあるいは装置のコンピュータ(CPUあるいはMPU)に格納されたプログラムに従って前記各種デバイスを動作させることによって実施したものも、本発明の範疇に含まれる。
(Other embodiments of the present invention)
In order to operate various devices to realize the functions of the above-described embodiments, program codes of software for realizing the functions of the above-described embodiments are provided to an apparatus or a computer in the system connected to the various devices. What is implemented by operating the various devices according to a program supplied and stored in a computer (CPU or MPU) of the system or apparatus is also included in the scope of the present invention.

また、この場合、前記ソフトウェアのプログラムコード自体が上述した実施形態の機能を実現することになり、そのプログラムコード自体、及びそのプログラムコードをコンピュータに供給するための手段、例えば、かかるプログラムコードを格納した記録媒体は本発明を構成する。かかるプログラムコードを記憶する記録媒体としては、例えばフレキシブルディスク、ハードディスク、光ディスク、光磁気ディスク、CD−ROM、磁気テープ、不揮発性のメモリカード、ROM等を用いることができる。   In this case, the program code of the software itself realizes the functions of the above-described embodiments, and the program code itself and means for supplying the program code to the computer, for example, the program code are stored. The recorded medium constitutes the present invention. As a recording medium for storing the program code, for example, a flexible disk, a hard disk, an optical disk, a magneto-optical disk, a CD-ROM, a magnetic tape, a nonvolatile memory card, a ROM, or the like can be used.

また、コンピュータが供給されたプログラムコードを実行することにより、上述の実施形態の機能が実現されるだけでなく、そのプログラムコードがコンピュータにおいて稼働しているOS(オペレーティングシステム)あるいは他のアプリケーションソフト等と共同して上述の実施形態の機能が実現される場合にもかかるプログラムコードは本発明の実施形態に含まれることは言うまでもない。   Further, by executing the program code supplied by the computer, not only the functions of the above-described embodiments are realized, but also the OS (operating system) or other application software in which the program code is running on the computer, etc. It goes without saying that the program code is also included in the embodiment of the present invention even when the functions of the above-described embodiment are realized in cooperation with the embodiment.

さらに、供給されたプログラムコードがコンピュータの機能拡張ボードやコンピュータに接続された機能拡張ユニットに備わるメモリに格納された後、そのプログラムコードの指示に基づいてその機能拡張ボードや機能拡張ユニットに備わるCPU等が実際の処理の一部または全部を行い、その処理によって上述した実施形態の機能が実現される場合にも本発明に含まれることは言うまでもない。   Further, after the supplied program code is stored in the memory provided in the function expansion board of the computer or the function expansion unit connected to the computer, the CPU provided in the function expansion board or function expansion unit based on the instruction of the program code Needless to say, the present invention also includes a case where the functions of the above-described embodiment are realized by performing part or all of the actual processing.

本発明の第1の実施形態を示し、プログラムコード生成装置の構成の一例を示すブロック図である。It is a block diagram which shows the 1st Embodiment of this invention and shows an example of a structure of a program code generation apparatus. 本発明の第1の実施形態を示し、処理プログラムの構成要件と、その構成要件とデータ格納領域格納されるデータとの関係とを示す図である。It is a figure which shows the 1st Embodiment of this invention and shows the relationship between the structural requirement of a processing program, and the structural requirement and the data stored in a data storage area. 本発明の第1の実施形態を示し、プログラムコード生成装置の処理手順の概要の一例を説明するフローチャートである。It is a flowchart which shows the 1st Embodiment of this invention and demonstrates an example of the outline | summary of the process sequence of a program code generation apparatus. 本発明の第1の実施形態を示し、設計図面情報の一例を示した図である。It is the figure which showed the 1st Embodiment of this invention and showed an example of design drawing information. 本発明の第1の実施形態を示し、最適化予定リスト(最適化可能個所)の一例を示した図である。It is the figure which showed the 1st Embodiment of this invention and showed an example of the optimization plan list | wrist (location which can be optimized). 本発明の第1の実施形態を示し、最適化を設計図面情報に施さないで自動生成されたプログラムコードの一例を示す図である。It is a figure which shows the 1st Embodiment of this invention and shows an example of the program code automatically produced | generated without performing optimization on design drawing information. 本発明の第1の実施形態を示し、最適化を設計図面情報に施して自動生成されたプログラムコードの一例を示す図である。It is a figure which shows the 1st Embodiment of this invention and shows an example of the program code | symbol automatically produced | generated by performing optimization on design drawing information. 本発明の第1の実施形態を示し、最適化情報を生成する際の処理の一例を説明するフローチャートである。It is a flowchart which shows the 1st Embodiment of this invention and demonstrates an example at the time of producing | generating optimization information. 本発明の第1の実施形態を示し、メソッドの呼び出し回数をカウントする際の処理の一例を説明するフローチャートである。6 is a flowchart illustrating an example of processing when counting the number of method calls according to the first embodiment of this invention. 本発明の第1の実施形態を示し、メソッドをインライン展開する際の処理の一例を説明するフローチャートである。FIG. 5 is a flowchart illustrating an example of processing when an inline expansion of a method is performed according to the first embodiment of this invention. 本発明の第2の実施形態を示し、最適化設定ダイアログの一例を示す図である。It is a figure which shows the 2nd Embodiment of this invention and shows an example of an optimization setting dialog.

符号の説明Explanation of symbols

201 実行可能設計図面解析部
202 プラットフォーム依存解析部
203 設計図面情報
204 プラットフォーム情報
205 最適化可能箇所抽出部
206 実行環境制約解析部
207 最適化可能箇所
208 実行環境制約
209 最適化予定リスト作成部
210 最適化予定リスト
211 プログラムコード生成部
212 プロジェクトファイル生成部
213 プログラムコード
214 プロジェクトファイル
215 ライブラリ
216 コード・コンパイラ
217 実行可能形式
701、702 クラス
704 動作定義
705、706 内部動作の定義
801 削除対象メソッド
802 インライン対象メソッド
803 公開対象属性
804 公開対象メソッド
201 Executable Design Drawing Analysis Unit 202 Platform Dependency Analysis Unit 203 Design Drawing Information 204 Platform Information 205 Optimizeable Location Extraction Unit 206 Execution Environment Constraint Analysis Unit 207 Optimizable Location 208 Execution Environment Constraint 209 Optimization Schedule List Creation Unit 210 Optimal Scheduled list 211 Program code generation unit 212 Project file generation unit 213 Program code 214 Project file 215 Library 216 Code compiler 217 Executable format 701, 702 Class 704 Operation definition 705, 706 Internal operation definition 801 Delete target method 802 Inline target Method 803 disclosure target attribute 804 disclosure target method

Claims (5)

設計図面を用いてプログラムコードを自動生成するプログラムコード生成装置であって、
前記設計図面に含まれるメソッドの呼び出し回数を解析する解析手段と、
前記解析手段によって解析された呼び出し回数が所定回数以下のメソッドに対してインライン展開処理を行い、前記呼び出し回数が所定回数以下ではないメソッドに対して関数として展開処理を行うことにより、プログラムコードを生成するプログラムコード生成手段とを有することを特徴とするプログラムコード生成装置。
A program code generation device that automatically generates a program code using a design drawing,
An analysis means for analyzing the number of times the method is included in the design drawing;
A program code is generated by performing inline expansion processing on a method whose number of calls analyzed by the analyzing means is a predetermined number or less and performing expansion processing as a function on a method whose number of calls is not less than the predetermined number And a program code generation means.
前記プログラムコード生成手段は、前記設計図面内のクラスの操作関数のうち、どこからも呼び出されていないメソッドをプログラムコードとして生成しないことを特徴とする請求項1に記載のプログラムコード生成装置。   2. The program code generation device according to claim 1, wherein the program code generation unit does not generate, as program code, a method that is not called from anywhere among the operation functions of the classes in the design drawing. 前記プログラムコード生成手段は、前記インライン展開処理するメソッドが操作する関数が非公開関数の場合、公開関数に変更することを特徴とする請求項1又は2に記載のプログラムコード生成装置。   3. The program code generation device according to claim 1, wherein the program code generation unit changes to a public function when a function operated by the method for performing inline expansion processing is a private function. 設計図面を用いてプログラムコードを自動生成するプログラムコード生成方法であって、
前記設計図面に含まれるメソッドの呼び出し回数を解析する解析ステップと、
前記解析ステップにおいて解析された呼び出し回数が所定回数以下のメソッドに対してインライン展開処理を行い、前記呼び出し回数が所定回数以下ではないメソッドに対して関数として展開処理を行うことにより、プログラムコードを生成するプログラムコード生成ステップとを有することを特徴とするプログラムコード生成方法。
A program code generation method for automatically generating a program code using a design drawing,
An analysis step for analyzing the number of times the method is called in the design drawing;
Generate program code by performing inline expansion processing for a method whose number of calls analyzed in the analysis step is a predetermined number or less, and performing expansion processing as a function for a method whose number of calls is not a predetermined number or less A program code generation method comprising: a program code generation step.
設計図面を用いてプログラムコードを自動生成することをコンピュータに実行させるためのコンピュータプログラムであって、
前記設計図面に含まれるメソッドの呼び出し回数を解析する解析ステップと、
前記解析ステップにおいて解析された呼び出し回数が所定回数以下のメソッドに対してインライン展開処理を行い、前記呼び出し回数が所定回数以下ではないメソッドに対して関数として展開処理を行うことにより、プログラムコードを生成するプログラムコード生成ステップとをコンピュータに実行させることを特徴とするコンピュータプログラム。
A computer program for causing a computer to automatically generate a program code using a design drawing,
An analysis step for analyzing the number of times the method is called in the design drawing;
Generate program code by performing inline expansion processing for a method whose number of calls analyzed in the analysis step is a predetermined number or less, and performing expansion processing as a function for a method whose number of calls is not a predetermined number or less A computer program for causing a computer to execute a program code generation step.
JP2005103870A 2005-03-31 2005-03-31 Program code generation device, program code generation method, and computer program Pending JP2006285584A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005103870A JP2006285584A (en) 2005-03-31 2005-03-31 Program code generation device, program code generation method, and computer program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005103870A JP2006285584A (en) 2005-03-31 2005-03-31 Program code generation device, program code generation method, and computer program

Publications (1)

Publication Number Publication Date
JP2006285584A true JP2006285584A (en) 2006-10-19

Family

ID=37407457

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005103870A Pending JP2006285584A (en) 2005-03-31 2005-03-31 Program code generation device, program code generation method, and computer program

Country Status (1)

Country Link
JP (1) JP2006285584A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011055417A1 (en) * 2009-11-09 2011-05-12 三菱電機株式会社 Software library reconfiguration device and method, and navigation device using the same

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011055417A1 (en) * 2009-11-09 2011-05-12 三菱電機株式会社 Software library reconfiguration device and method, and navigation device using the same
JP4964352B2 (en) * 2009-11-09 2012-06-27 三菱電機株式会社 Software library reconstruction apparatus and method, and navigation apparatus using the same

Similar Documents

Publication Publication Date Title
US8201140B2 (en) System and method for creating and using graphical object instances in a statechart environment
US8656352B2 (en) System and method for synchronized workflow management
US9594856B2 (en) System and method to embed behavior in a CAD-based physical simulation
JPH0844547A (en) Visualization of object-oriented software
US20080235660A1 (en) Depicting Changes to Structures in an Integrated Development Environment
EP3244306A1 (en) A computer-implemented method for allowing modification of a region of original code
JP2013518321A (en) Pattern-based user interface
Van Cam Pham et al. Complete code generation from UML state machine
Bandener et al. Extending DMM behavior specifications for visual execution and debugging
CN110554861B (en) Software development environment with compile and read-evaluate-print-loop operations
US9170783B1 (en) Class creation assistant for textual programming languages
JP2008276735A (en) Program code converter and program code conversion method
US9342276B1 (en) Optimization tracing
Combemale et al. A Solution to the TTC'15 Model Execution Case Using the GEMOC Studio
CN101501638B (en) Plasma processing system component analysis software and methods and systems for creating the same
JP2005063136A (en) Design system, design method, and design program of semiconductor integrated circuit
WO2003023612A1 (en) Computer program having an integrated source code file
JP4938991B2 (en) Program code generating apparatus, program code generating method, and computer program
JP2008305337A (en) Program converter, program conversion method, program, storage medium, debugging device, debugging method and program development system
JP2006285584A (en) Program code generation device, program code generation method, and computer program
CN101923466B (en) Access method of decorator mode order
JP2011165051A (en) Development support device, method and program
JP2007226358A (en) Application generation device, application generation method, and application generation program
Randak et al. Extending ATL for Native UML Profile Support: An Experience Report.
Mayerhofer et al. xMOF: A Semantics Specification Language for Metamodeling.