JP2017054277A - Migration device, creation method of program and program - Google Patents
Migration device, creation method of program and program Download PDFInfo
- Publication number
- JP2017054277A JP2017054277A JP2015177171A JP2015177171A JP2017054277A JP 2017054277 A JP2017054277 A JP 2017054277A JP 2015177171 A JP2015177171 A JP 2015177171A JP 2015177171 A JP2015177171 A JP 2015177171A JP 2017054277 A JP2017054277 A JP 2017054277A
- Authority
- JP
- Japan
- Prior art keywords
- program
- source
- readability
- original source
- location
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Abstract
Description
本発明は、アセンブラのプログラムから他言語のプログラムを生成するマイグレーション装置等に関するものである。 The present invention relates to a migration apparatus for generating a program in another language from an assembler program.
従来技術において、レガシーシステムのログを元に稼動JCLおよびファイルを抽出して、その抽出された稼動JCLおよびファイルを使用しているCOBOLファイル定義から整理されたデータモデルを作成し、その作成されたデータモデルとMDAツールを繋いだので、新しいオープン系システムを再構築することが可能であるレガシーシステム再構築システムがあった(例えば、特許文献1参照)。 In the prior art, the operating JCL and file are extracted based on the log of the legacy system, and a data model organized from the COBOL file definition that uses the extracted operating JCL and file is created. Since the data model and the MDA tool are connected, there is a legacy system reconstruction system that can reconstruct a new open system (see, for example, Patent Document 1).
しかしながら、従来技術においては、アセンブラのプログラムから他言語のプログラムの全部または一部を生成することはできなかった。 However, in the prior art, it was not possible to generate all or part of a program in another language from an assembler program.
そして、アセンブラとC言語等の他言語とは、仕様、構造が大きく異なり、仮にアセンブラのプログラムをC言語等の他言語のプログラムに変換したとしても、そのプログラムを保守する保守者にとって、読みにくいプログラムとなり、そのプログラムの保守は困難になる。つまり、従来技術においては、アセンブラのプログラムをマイグレーションする場合に、保守性を考慮した、可読性の高い他言語のプログラムを生成できなかった。 The assembler and other languages such as C language are greatly different in specifications and structure, and even if the assembler program is converted into another language program such as C language, it is difficult for a maintainer who maintains the program to read it. The program becomes difficult to maintain. In other words, in the prior art, when an assembler program is migrated, it is not possible to generate a program in another language with high readability in consideration of maintainability.
本第一の発明のマイグレーション装置は、アセンブラ言語で記述されたアセンブラプログラムであり、マイグレーション対象のプログラムである原ソースを格納し得る原ソース格納部と、原ソースに対して、プログラムの可読性を向上させるための処理を行う箇所を特定するための条件である1以上の箇所特定条件を格納し得る箇所特定条件格納部と、原ソース格納部に格納されている原ソースを、他言語のプログラムであり、目的言語のプログラムである目的ソースに変換する変換部と、変換部が変換して、取得した目的ソースを出力する出力部とを具備するマイグレーション装置であって、変換部は、原ソース格納部に格納されている原ソースに対して、1以上の各箇所特定条件を適用し、合致する箇所特定条件に対応する箇所に対して、合致する箇所特定条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行う可読性向上処理手段を具備するマイグレーション装置である。 The migration apparatus according to the first aspect of the present invention is an assembler program written in an assembler language, and improves the readability of the program with respect to the original source storage section that can store the original source that is the migration target program. A location specifying condition storage unit that can store one or more location specifying conditions, which are conditions for specifying a location for performing processing to be performed, and an original source stored in the original source storage unit using a program in another language A migration apparatus comprising: a conversion unit that converts a target language that is a target language program; and an output unit that converts the conversion unit and outputs the acquired target source. The conversion unit stores the original source Apply one or more location identification conditions to the source source stored in the section, and A process corresponding to the matching point specifying condition is a migration apparatus comprising readability enhancement processing means for performing readability enhancement is a process for improving the readability of the program.
かかる構成により、アセンブラのプログラムをマイグレーションする場合に、保守性を考慮した、可読性の高い他言語のプログラムを生成できる。 With this configuration, when an assembler program is migrated, it is possible to generate a program in another language with high readability in consideration of maintainability.
また、本第二の発明のマイグレーション装置は、第一の発明に対して、箇所特定条件は、プログラムのパターンに関する情報であるソースパターン情報であり、可読性向上処理手段は、原ソース格納部に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、合致するソースパターン情報に対応する箇所に対して、合致するソースパターン情報に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行うマイグレーション装置である。 Further, in the migration apparatus of the second invention, in contrast to the first invention, the location specifying condition is source pattern information that is information related to a program pattern, and the readability improvement processing means is stored in the original source storage unit. One or more pieces of source pattern information are applied to the source source being processed, and processing corresponding to the matching source pattern information is applied to the location corresponding to the matching source pattern information, improving the readability of the program This is a migration apparatus that performs readability improvement processing that is processing to be performed.
かかる構成により、予め決められたパターンに合致するアセンブラのプログラムを、保守性を考慮した、可読性の高い他言語のプログラムに変換できる。 With this configuration, an assembler program that matches a predetermined pattern can be converted into a program in another language with high readability in consideration of maintainability.
また、本第三の発明のマイグレーション装置は、第二の発明に対して、ソースパターン情報は、ダミーセクションを示す情報を含み、可読性向上処理手段は、原ソース格納部に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、ダミーセクションを含む箇所を決定し、箇所に対応するプログラムを、構造体を定義するプログラムに変更するマイグレーション装置である。 Further, in the migration apparatus of the third invention, in contrast to the second invention, the source pattern information includes information indicating a dummy section, and the readability improvement processing means is an original source stored in the original source storage unit. On the other hand, the migration apparatus applies one or more pieces of source pattern information, determines a location including a dummy section, and changes a program corresponding to the location to a program defining a structure.
かかる構成により、アセンブラのプログラムの中のダミーセクションのプログラムを、保守性を考慮した、可読性の高い他言語のプログラムに変換できる。 With this configuration, the dummy section program in the assembler program can be converted into a program in another language with high readability in consideration of maintainability.
また、本第四の発明のマイグレーション装置は、第二の発明に対して、ソースパターン情報は、オフセットを持つ戻りであることを示す情報を含み、可読性向上処理手段は、原ソース格納部に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、オフセットを持つ戻りを含む箇所を決定し、箇所に対応するプログラムを、プログラムに含まれるオフセットを条件に用いた分岐を示すプログラムに変更するマイグレーション装置である。 Further, in the migration apparatus of the fourth invention, in contrast to the second invention, the source pattern information includes information indicating that the return has an offset, and the readability improvement processing means is stored in the original source storage unit. Apply one or more pieces of source pattern information to the source source, determine the location that contains the return with the offset, and branch the program corresponding to the location using the offset included in the program as a condition It is a migration device that changes to the program shown.
かかる構成により、アセンブラのプログラムの中のオフセットを持つ戻り処理のプログラムを、保守性を考慮した、可読性の高い他言語のプログラムに変換できる。 With this configuration, it is possible to convert a return processing program having an offset in the assembler program into a program of another language with high readability in consideration of maintainability.
また、本第五の発明のマイグレーション装置は、第二の発明に対して、ソースパターン情報は、一命令の他言語のプログラムに変換可能なアセンブラの2以上の命令の箇所を特定するためのパターンの情報であり、可読性向上処理手段は、原ソース格納部に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、2以上の命令の箇所を決定し、箇所に対応するプログラムを、一命令の他言語のプログラムに変換するマイグレーション装置である。 The migration apparatus of the fifth aspect of the invention provides a pattern for specifying two or more instruction parts of an assembler that can be converted into a program of another language of one instruction in the source pattern information in the second invention. The readability improvement processing means applies one or more source pattern information to the original source stored in the original source storage unit, determines the location of two or more instructions, and corresponds to the location. This is a migration apparatus that converts a program to be converted into a program of another language of one instruction.
かかる構成により、予め決められたパターンに合致する、アセンブラのプログラムの中の2以上の命令からなるプログラムを、保守性を考慮した、可読性の高い他言語の一命令のプログラムに変換できる。 With this configuration, a program composed of two or more instructions in an assembler program that matches a predetermined pattern can be converted into a program of one instruction in another language with high readability in consideration of maintainability.
また、本第六の発明のマイグレーション装置は、第二の発明に対して、ソースパターン情報は、退避コードまたは復帰コードを示す情報を含み、可読性向上処理手段は、原ソース格納部に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、退避コードまたは復帰コードの箇所を決定し、箇所に対応するプログラムを、原ソースまたは目的ソースから削除するマイグレーション装置である。 Further, in the migration apparatus of the sixth invention, in contrast to the second invention, the source pattern information includes information indicating a save code or a return code, and the readability improvement processing means is stored in the original source storage unit. The migration apparatus applies one or more pieces of source pattern information to the original source, determines the location of the save code or the return code, and deletes the program corresponding to the location from the original source or the target source.
かかる構成により、アセンブラのプログラムの中の退避コードまたは復帰コードを、保守性を考慮した、可読性の高い他言語のプログラムに変換できる。 With this configuration, the save code or return code in the assembler program can be converted into a program in another language with high readability in consideration of maintainability.
また、本第七の発明のマイグレーション装置は、第二の発明に対して、ソースパターン情報は、2以上のジャンプ命令が構成する2以上のループの一部が重なっていることを示す情報を含み、可読性向上処理手段は、原ソース格納部に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、2以上のループの一部が重なっている箇所を決定し、箇所に対応するプログラムを、予め決められた条件を満たす一のループを優先し、ジャンプ命令を有さないループを示すプログラムに変更するマイグレーション装置である。 Further, in the migration device of the seventh aspect of the invention, in contrast to the second aspect of the invention, the source pattern information includes information indicating that a part of two or more loops constituted by two or more jump instructions overlap. The readability improving processing means applies one or more pieces of source pattern information to the original source stored in the original source storage unit, determines a portion where two or more loops overlap, Is a migration device that prioritizes one loop that satisfies a predetermined condition and changes it to a program that indicates a loop that does not have a jump instruction.
かかる構成により、アセンブラのプログラムの中の2以上のループの一部が重なっている箇所を、保守性を考慮した、可読性の高い他言語のプログラムに変換できる。 With such a configuration, a portion where two or more loops overlap in the assembler program can be converted into a program of another language having high readability in consideration of maintainability.
また、本第八の発明のマイグレーション装置は、第一の発明に対して、箇所特定条件は、原ソース内において予め決められた条件を満たす箇所の範囲を特定するための条件である範囲条件であり、可読性向上処理手段は、原ソース格納部に格納されている原ソースに対して、1以上の各範囲条件を適用し、合致する範囲条件に対応する箇所に対して、合致する範囲条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行うマイグレーション装置である。 In the migration apparatus of the eighth aspect of the invention, in contrast to the first aspect, the location specifying condition is a range condition that is a condition for specifying a range of locations that satisfy a predetermined condition in the original source. Yes, the readability improvement processing means applies one or more range conditions to the original source stored in the original source storage unit, and sets the matching range condition to the location corresponding to the matching range condition. It is a migration apparatus that performs a readability improvement process that is a corresponding process and a process that improves the readability of a program.
かかる構成により、アセンブラのプログラムの中の予め決められた条件を満たす箇所の範囲を特定し、保守性を考慮して、当該範囲に対応する可読性の高い他言語のプログラムに変換できる。 With this configuration, it is possible to identify a range of locations that satisfy a predetermined condition in the assembler program, and to convert the program into another language program having high readability corresponding to the range in consideration of maintainability.
また、本第九の発明のマイグレーション装置は、第八の発明に対して、範囲条件は、実行され得ないプログラムの範囲を判定するための条件であり、可読性向上処理手段は、原ソースを静的解析し、合致する範囲条件に対応する箇所のプログラムを特定し、プログラムを削除するマイグレーション装置である。 In the migration apparatus of the ninth aspect of the invention, the range condition is a condition for determining the range of programs that cannot be executed, and the readability improvement processing means It is a migration device that performs a statistical analysis, identifies a program corresponding to a matching range condition, and deletes the program.
かかる構成により、静的解析し、到達できない箇所のアセンブラプログラムを削除することにより、可読性の高い他言語のプログラムを得ることができる。 With this configuration, it is possible to obtain a program in another language with high readability by performing static analysis and deleting an assembler program at a location that cannot be reached.
また、本第十の発明のマイグレーション装置は、第八の発明に対して、範囲条件は、変数を特定するための条件であり、可読性向上処理手段は、原ソースまたは目的ソースから変数を取得し、変数の生存区間を取得し、変数を、生存区間におけるローカル変数として定義する可読性向上処理を行うマイグレーション装置である。 In the migration apparatus of the tenth invention, the range condition is a condition for specifying a variable, and the readability improvement processing means acquires the variable from the original source or the target source. The migration apparatus performs a readability improvement process of acquiring a life span of a variable and defining the variable as a local variable in the life span.
かかる構成により、アセンブラプログラム内の変数の生存区間を特定し、当該変数を当該生存区間におけるローカル変数とすることにより、可読性の高い他言語のプログラムを得ることができる。 With this configuration, it is possible to obtain a program in another language with high readability by specifying the life span of a variable in the assembler program and using the variable as a local variable in the life span.
また、本第十一の発明のマイグレーション装置は、第一から第十いずれか1つの発明に対して、原ソースは、アセンブラプログラムとアセンブラ以外の言語のプログラムである他言語プログラムとを有するプログラムであり、原ソースから、アセンブラプログラムを取得するアセンブラプログラム取得部をさらに具備し、変換部は、アセンブラプログラム取得部が取得したアセンブラプログラムを目的ソースに変換するマイグレーション装置である。 In addition, the migration apparatus of the eleventh aspect of the invention is a program having an assembler program and another language program that is a program in a language other than the assembler, as opposed to any one of the first to tenth inventions. And an assembler program acquisition unit that acquires an assembler program from an original source, and the conversion unit is a migration device that converts the assembler program acquired by the assembler program acquisition unit into a target source.
かかる構成により、アセンブラ以外の言語のプログラムである他言語プログラムと連結して動作するアセンブラのプログラムをマイグレーションする場合に、保守性を考慮した、可読性の高い他言語のプログラムを生成できる。 With this configuration, when migrating an assembler program that operates in conjunction with another language program that is a program in a language other than the assembler, a program in another language with high maintainability can be generated in consideration of maintainability.
本発明によるマイグレーション装置によれば、アセンブラのプログラムをマイグレーションする場合に、保守性を考慮した、可読性の高い他言語のプログラムを生成できる。 According to the migration apparatus of the present invention, when an assembler program is migrated, it is possible to generate a program in another language with high readability in consideration of maintainability.
以下、マイグレーション装置等の実施形態について図面を参照して説明する。なお、実施の形態において同じ符号を付した構成要素は同様の動作を行うので、再度の説明を省略する場合がある。 Hereinafter, embodiments of the migration apparatus and the like will be described with reference to the drawings. In addition, since the component which attached | subjected the same code | symbol in embodiment performs the same operation | movement, description may be abbreviate | omitted again.
(実施の形態1) (Embodiment 1)
本実施の形態において、アセンブラのプログラム集合の中から、予め決められたソースパターンに合致するソース列に対して、可読性向上のための処理を施し、蓄積するマイグレーション装置について説明する。予め決められたソースパターンとは、例えば、ダミーセクションの箇所を特定するパターン、オフセットを持つ戻りの箇所を特定するパターン、一命令の他言語のプログラムに変換可能なアセンブラの2以上の命令の箇所を特定するためのパターン、退避コードまたは復帰コードの箇所を特定するためのパターン、2以上のループの一部が重なっている箇所を特定するためのパターン等である。なお、他言語のプログラムとは、アセンブラ以外の言語のプログラムのことである。 In the present embodiment, a description will be given of a migration apparatus that performs processing for improving readability on a source string that matches a predetermined source pattern from an assembler program set, and accumulates it. The predetermined source pattern is, for example, a pattern for specifying a dummy section location, a pattern for specifying a return location having an offset, or a location of two or more instructions of an assembler that can be converted into another language program of one instruction. A pattern for specifying the location of the save code or the return code, a pattern for specifying a location where a part of two or more loops overlap, and the like. The other language program is a program in a language other than the assembler.
また、本実施の形態において、アセンブラのプログラム集合の中の、予め決められた条件を満たす箇所の範囲を特定し、当該箇所に対応する処理を行うマイグレーション装置について説明する。なお、当該箇所に対応する処理とは、例えば、削除処理、ローカル変数の定義を生成する処理等である。 Further, in the present embodiment, a description will be given of a migration apparatus that identifies a range of locations that satisfy a predetermined condition in an assembler program set and performs processing corresponding to the locations. The process corresponding to the location is, for example, a deletion process, a process for generating a local variable definition, or the like.
図1は、本実施の形態におけるマイグレーション装置1のブロック図である。
FIG. 1 is a block diagram of a
マイグレーション装置1は、格納部11、処理部12、および出力部13を備える。
The
格納部11は、原ソース格納部111、箇所特定条件格納部112、および変換情報格納部113を備える。
The storage unit 11 includes an original
処理部12は、アセンブラプログラム取得部121、および変換部122を備える。変換部122は、可読性向上処理手段1221を備える。
The
格納部11は、各種の情報を格納し得る。各種の情報とは、後述する原ソース、箇所特定条件、変換情報などである。 The storage unit 11 can store various types of information. The various types of information include an original source, a location specifying condition, conversion information, and the like which will be described later.
原ソース格納部111は、原ソースを格納し得る。原ソースは、通常、アセンブラ言語で記述されたアセンブラプログラムであり、マイグレーション対象のプログラムである。また、原ソースとは、アセンブラプログラムとアセンブラ以外の言語のプログラムである他言語プログラムとを有するプログラムであっても良い。なお、他言語プログラムは、ここでは、例えば、高級言語のプログラムである。高級言語は、COBOL、C言語、C++、JAVA(登録商標)等、問わない。また、他言語プログラムは、例えば、アセンブラプログラムを呼び出して利用しているプログラムである。また、アセンブラプログラムにおけるアセンブラの種類は問わない。アセンブラは、ここでは、アセンブリ言語と言っても良い。アセンブラは、例えば、IBM System/370で使用されているアセンブラである。
The original
また、原ソース格納部111が格納している原ソースは、アセンブラ言語で記述されたアセンブラプログラムを変換した中間言語のプログラム(中間表現と言っても良い)でも良い。中間言語のプログラムは、例えば、アセンブラプログラムの一の命令が行う複数の処理を2以上の処理に分解し、得られた2以上の命令群である。なお、中間言語のプログラムの一の命令は、アセンブラプログラムの一の命令に対応づいているものがあっても良い。また、アセンブラプログラムを中間言語のプログラムに変換する処理は、後述する変換部122が行っても良いし、他の装置で行われても良い。
Further, the original source stored in the original
箇所特定条件格納部112は、1以上の箇所特定条件を格納し得る。箇所特定条件とは、原ソースに対して、プログラムの可読性を向上させるための処理を行う箇所を特定するための条件である。箇所特定条件は、例えば、アセンブラプログラムのパターンに関する情報であるソースパターン情報である。箇所特定条件は、例えば、原ソース内において、予め決められた条件を満たす箇所の範囲を特定するための条件である範囲条件である。箇所特定条件格納部112は、箇所特定条件に対応付けて、アセンブラプログラムを他言語に変換する情報を保持していても良い。アセンブラプログラムを他言語に変換する情報は、例えば、高級言語のプログラムのパターンに関する高級言語パターン情報である。また、アセンブラプログラムを他言語に変換する情報は、例えば、アセンブラプログラムを他言語に変換するプログラムにより構成されている。なお、ソースパターン情報とは、例えば、ダミーセクションを示す情報、オフセットを持つ戻りであることを示す情報、一命令の他言語のプログラムに変換可能なアセンブラの2以上の命令を有する原ソース部品を特定するためのパターンの情報、退避コードまたは復帰コードを示す情報、2以上のジャンプ命令が構成する2以上のループの一部が重なっていることを示す情報等であっても良い。
The location specifying
変換情報格納部113は、1以上の変換情報を格納し得る。変換情報とは、アセンブラのプログラムを高級言語等の他言語のプログラムに変換するための情報である。変換情報は、通常、可読性を向上するとは限らないプログラム変換のための情報である。変換情報は、例えば、アセンブラプログラムのパターンを示すアセンブラパターン情報と、他言語プログラムのパターンを示す他言語パターン情報とを有する。変換情報は、例えば、アセンブラプログラムのパターンを示すアセンブラパターン情報と、アセンブラプログラムを他言語に変換するプログラムである。
The conversion
変換情報は、アセンブラのプログラムを他のアセンブラのプログラムに変換するための情報でも良い。かかる場合、他のアセンブラのプログラムは、通常、他言語のプログラムへの変換を容易にするプログラムである。 The conversion information may be information for converting an assembler program into another assembler program. In such a case, the other assembler program is usually a program that facilitates conversion to a program in another language.
また、変換情報は、他言語のプログラムを他の他言語のプログラムに変換するための情報でも良い。かかる場合、他の他言語のプログラムは、通常、元の他言語のプログラムより可読性が向上したプログラムである。 The conversion information may be information for converting a program in another language into a program in another language. In such a case, the other language program is usually a program whose readability is improved compared to the original other language program.
また、変換情報は、中間言語のプログラムをアセンブラのプログラムに変換するための情報でも良い。 The conversion information may be information for converting an intermediate language program into an assembler program.
また、変換情報は、中間言語のプログラムを他の中間言語のプログラムに変換するための情報でも良い。かかる場合、他の中間言語のプログラムは、通常、他言語のプログラムへの変換を容易にするプログラムである。 The conversion information may be information for converting an intermediate language program into another intermediate language program. In such a case, the other intermediate language program is usually a program that facilitates conversion to another language program.
変換情報は、例えば、「DSECT以外のUSING命令は削除することを示す情報」「DSECT以外のDROP命令は削除することを示す情報」「アセンブラ"M $変数1,$変数2"はC言語"$変数1=$変数1*$変数2"に変換することを示す情報」「アセンブラ"A $変数1,$変数2"はC言語"$変数1=$変数1+$変数2"に変換することを示す情報」などである。なお、「$変数1」等は、任意の変数を示す文字列である。 The conversion information includes, for example, “information indicating that a USING instruction other than DECT is deleted” “information indicating that a DROP instruction other than DECT is deleted” “assembler“ M $ variable 1, $ variable 2 ”is C language” $ Variable 1 = information indicating conversion to $ variable 1 * $ variable 2 "" assembler "A $ variable 1, $ variable 2" is converted to C language "$ variable 1 = $ variable 1 + $ variable 2" "Information indicating that". “$ Variable 1” or the like is a character string indicating an arbitrary variable.
処理部12は、各種の処理を行う。各種の処理とは、例えば、アセンブラプログラム取得部121、変換部122、可読性向上処理手段1221が行う処理である。
The
アセンブラプログラム取得部121は、原ソースから、アセンブラプログラムを取得する。原ソースがアセンブラプログラムと他言語プログラムとを有するプログラムである場合、アセンブラプログラム取得部121は、原ソースからアセンブラプログラムを抽出する。なお、例えば、アセンブラプログラム取得部121は、アセンブラプログラムの開始を示す文字列と終了を示す文字列とを用いて、開始を示す文字列と終了を示す文字列との間のプログラム(文字列)を、原ソースから取得する。また、例えば、アセンブラプログラム取得部121は、アセンブラプログラムであることを示す拡張子(例えば、「asm」)を有するファイルを原ソース格納部111から取得する。また、例えば、アセンブラプログラム取得部121は、アセンブラプログラムの命令または命令パターンに合致するプログラム(文字列)を、原ソースから取得する。なお、かかる場合、アセンブラプログラムのすべての命令または命令パターンは、格納部11に格納されている、とする。
The assembler
変換部122は、原ソース格納部111に格納されている原ソース(ここでは、アセンブラプログラム)を、他言語のプログラムであり、目的言語のプログラムである目的ソースに変換する。なお、目的言語のプログラムは、C言語などの他言語のプログラムである。
The
変換部122は、アセンブラプログラム取得部121が取得したアセンブラプログラムを目的ソースに変換しても良い。かかる場合、変換部122は、アセンブラプログラム以外のプログラム(例えば、Java、COBOL等のプログラム)を、目的ソースに変換しても良い。アセンブラプログラム以外のプログラムとは、アセンブラプログラム取得部121が原ソース格納部111から取得しなかったプログラムであり、原ソース格納部111に格納されているプログラムである。なお、アセンブラプログラム以外のプログラムを、目的ソースに変換するプログラムは公知技術であるので、詳細な説明は省略する。
The
変換部122は、1以上の変換情報を用いて、アセンブラプログラムを目的ソースに変換しても良い。また、変換部122は、1以上の箇所特定条件を用いて、アセンブラプログラムを目的ソースに変換する。つまり、変換部122は、例えば、箇所特定条件に合致する変換対象のプログラムの箇所に対して、当該箇所特定条件に対応する変換情報を用いて、当該変換対象のプログラムの箇所を変換して、変換後のプログラムを取得する。
The
変換対象のプログラムは、通常、アセンブラプログラムであるが、中間言語のプログラム、目的ソースのプログラムでも良い。また、変換後のプログラムは、通常、目的ソースのプログラムであるが、アセンブラプログラム、中間言語のプログラムでも良い。 The program to be converted is usually an assembler program, but may be an intermediate language program or a target source program. The converted program is usually a target source program, but may be an assembler program or an intermediate language program.
可読性向上処理手段1221は、プログラムの可読性を向上させる処理である可読性向上処理を行う。可読性向上処理は、例えば、アセンブラのダミーセクションの定義をC言語等の他言語の構造体の定義に書き換える処理である。また、可読性向上処理は、例えば、アセンブラのオフセットを持つ戻り処理を、適切な他言語のプログラムに書き換える処理である。また、可読性向上処理は、例えば、2以上の命令群のアセンブラプログラムを、1命令の他言語のプログラムに書き換える処理である。なお、1命令の他言語のプログラムとは、例えば、C言語において、「;」が一つで足りる命令である。また、可読性向上処理は、例えば、アセンブラプログラム中の退避コードまたは復帰コードを削除する処理である。また、可読性向上処理は、例えば、アセンブラプログラム中の複数のループ処理を、適切な他言語のプログラムに書き換える処理である。また、可読性向上処理は、例えば、到達できないアセンブラプログラムの箇所を削除する処理である。また、可読性向上処理は、例えば、アセンブラプログラムの変数の生存区間を検査し、他言語のローカル変数とする処理である。
The readability
また、可読性向上処理は、例えば、2以上の命令群のアセンブラプログラムを、2以上の命令の目的ソースのプログラムに書き換える処理である。つまり、一の命令のアセンブラプログラムは2以上の命令群を有する中間言語のプログラムに変換され得る。また、2以上の命令群の中間言語のプログラムは、一または2以上の命令の目的ソースのプログラムに変換され得る。そして、かかる場合、2以上の命令群のアセンブラプログラムを、2以上の命令の目的ソースのプログラムに書き換えられ得る。さらに具体的には、2以上の命令群(ac1,ac2)のアセンブラプログラムが存在する場合、アセンブラプログラムの第一の命令(ac1)が中間言語のプログラム(mc1,mc2)に変換され、アセンブラプログラムの第二の命令(ac2)が中間言語のプログラム(mc3,mc4)に変換された、とする。そして、中間言語のプログラムの第一の命令(mc1)は、目的ソースのプログラムの命令(ts1)に変換され、中間言語のプログラムの第二、第三の命令(mc2,mc3)は、目的ソースのプログラムの命令(ts2)に変換され、中間言語のプログラムの第四の命令(mc4)は、目的ソースのプログラムの命令(ts3)に変換された、とする。かかる場合、2つの命令を有するアセンブラプログラム(ac1,ac2)が、3つの命令(ts1,ts2,ts3)を有する目的ソースのプログラムに変換される。 The readability improving process is a process of rewriting an assembler program of two or more instruction groups into a program of a target source of two or more instructions, for example. That is, an assembler program of one instruction can be converted into an intermediate language program having two or more instruction groups. Further, an intermediate language program of two or more instruction groups can be converted into a target source program of one or more instructions. In such a case, an assembler program of two or more instruction groups can be rewritten into a program of a target source of two or more instructions. More specifically, if there is an assembler program of two or more instruction groups (ac1, ac2), the first instruction (ac1) of the assembler program is converted into an intermediate language program (mc1, mc2), and the assembler program Is converted to an intermediate language program (mc3, mc4). The first instruction (mc1) of the intermediate language program is converted to the instruction (ts1) of the target source program, and the second and third instructions (mc2, mc3) of the intermediate language program are converted to the target source. It is assumed that the fourth instruction (mc4) of the intermediate language program is converted to the instruction (ts3) of the target source program. In such a case, the assembler program (ac1, ac2) having two instructions is converted into a target source program having three instructions (ts1, ts2, ts3).
さらに具体的には、可読性向上処理は、原ソース格納部111に格納されている原ソースが有するアセンブラプログラムに対して、1以上の各箇所特定条件を適用し、合致する箇所特定条件に対応する箇所に対して、合致する箇所特定条件に対応する処理である。
More specifically, the readability improving process applies one or more location specifying conditions to the assembler program included in the original source stored in the original
第一の可読性向上処理は、箇所特定条件がプログラムのパターンに関する情報であるソースパターン情報である場合である。かかる場合、可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースが有するアセンブラプログラムに対して、1以上の各ソースパターン情報を適用し、合致するソースパターン情報に対応する箇所に対して、合致するソースパターン情報に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行う。合致するソースパターン情報に対応する処理は、通常、プログラムで実現される。
The first readability improving process is a case where the location specifying condition is source pattern information which is information related to a program pattern. In such a case, the readability
第二の可読性向上処理は、箇所特定条件は、原ソース内において予め決められた条件を満たす箇所の範囲を特定するための条件である範囲条件である場合である。かかる場合、可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースが有するアセンブラプログラムに対して、1以上の各範囲条件を適用し、合致する範囲条件に対応する箇所に対して、合致する範囲条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行う。なお、合致する範囲条件に対応する処理は、通常、プログラムで実現される。
The second readability improving process is a case where the location specifying condition is a range condition that is a condition for specifying a range of locations that satisfy a predetermined condition in the original source. In such a case, the readability
また、範囲条件は、例えば、着目した一の変数が使用されている生存区間を特定する条件である。生存区間は、着目した一の変数が出現するプログラムの範囲である、と言える。また、範囲条件は、例えば、アセンブラプログラムを静的解析した結果、実行され得ないプログラムの範囲を特定する条件である。 In addition, the range condition is a condition for specifying, for example, a life span in which one focused variable is used. It can be said that the life span is a range of a program in which one focused variable appears. The range condition is a condition for specifying a range of programs that cannot be executed as a result of static analysis of the assembler program, for example.
(A)以下、第一の可読性向上処理の具体例を説明する。第一の可読性向上処理の例は、以下の(A−1)から(A−5)の5つである。 (A) Hereinafter, a specific example of the first readability improving process will be described. Examples of the first readability improvement process are the following five (A-1) to (A-5).
(A−1)ソースパターン情報が、ダミーセクションを示す情報を含む場合である。かかる場合、可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、ダミーセクションを含む箇所を決定し、箇所に対応するプログラムを、構造体を定義する他言語のプログラムを取得する。
(A-1) This is a case where the source pattern information includes information indicating a dummy section. In such a case, the readability
(A−2)ソースパターン情報が、オフセットを持つ戻りであることを示す情報を含む場合である。かかる場合、可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、オフセットを持つ戻りを含む箇所を決定し、箇所に対応するプログラムを、プログラムに含まれるオフセットを条件に用いた分岐を示す他言語のプログラムを取得する。
(A-2) This is a case where the source pattern information includes information indicating that the return has an offset. In such a case, the readability
(A−3)ソースパターン情報が、一命令の他言語のプログラムに変換可能なアセンブラの2以上の命令の箇所を特定するためのパターンの情報であり含む場合である。かかる場合、可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、2以上の命令の箇所を決定し、箇所に対応するプログラムを、一命令の他言語のプログラムを取得する。
(A-3) This is a case where the source pattern information is pattern information for specifying the location of two or more instructions of the assembler that can be converted into a program of another language of one instruction. In such a case, the readability
(A−4)ソースパターン情報が、退避コードまたは復帰コードを示す情報を含む場合である。かかる場合、可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、退避コードまたは復帰コードの箇所を決定し、箇所に対応するプログラムを、原ソースまたは目的ソースから削除する。可読性向上処理手段1221は、退避コードまたは復帰コードが対象とするレジスタまたは変数が、退避コードまたは復帰コードが出現する関数内で使用されていないか否かを判断し、使用されていない場合に、退避コードまたは復帰コードを削除することは好適である。
(A-4) This is a case where the source pattern information includes information indicating a save code or a return code. In such a case, the readability
(A−5)ソースパターン情報が、2以上のジャンプ命令が構成する2以上のループの一部が重なっていることを示す情報を含む場合である。かかる場合、可読性向上処理手段1221は、原ソース格納部111に格納されている原ソースに対して、1以上の各ソースパターン情報を適用し、2以上のループの一部が重なっている箇所を決定し、箇所に対応するプログラムを、予め決められた条件を満たす一のループを優先し、ジャンプ命令を有さないループを示す他言語のプログラムに変更する。
(A-5) This is a case where the source pattern information includes information indicating that two or more loops formed by two or more jump instructions overlap each other. In such a case, the readability
ここで、予め決められた条件とは、例えば、以下の(1)(2)の2つである。
(1)ボトムが起点から最も遠いループであること。
Here, the predetermined conditions are, for example, the following two (1) and (2).
(1) The bottom is the loop farthest from the starting point.
この条件の場合、ループが複数あれば、 可読性向上処理手段1221は、ボトムが起点から遠いループを優先し、当該優先されたループの箇所を、他言語のループのプログラムに書き換え、当該優先されたループの箇所からジャンプ命令を無くす。これは、複雑な構造がある場合に、なるべくループへの飛び込みを避けることにより、プログラムの可読性を良くする趣旨である。なお、この場合、ループからの飛び出しは容認する。
In the case of this condition, if there are a plurality of loops, the readability
また、ここで、起点とは、複数のループを含むプログラム群の最初の命令(行と言っても良い)または基本ブロックである。また、ボトムとは、複数のループを含むプログラム群の最後の命令(行と言っても良い)または基本ブロックである。さらに、他言語のループのプログラムとは、例えば、C言語の場合、「while」や「for」を用いたプログラムである。
(2)ボトムが同じループが複数ある場合、ループのトップが起点から最も近いループであること。
Here, the starting point is the first instruction (also referred to as a line) or a basic block of a program group including a plurality of loops. The bottom is the last instruction (also referred to as a line) or basic block of a program group including a plurality of loops. Furthermore, the loop program in another language is, for example, a program using “while” or “for” in the case of C language.
(2) When there are a plurality of loops having the same bottom, the top of the loop is the loop closest to the starting point.
この条件の場合、ボトムが同じループが複数あれば、可読性向上処理手段1221は、トップが起点から最も近いループを優先し、当該優先されたループの箇所を、他言語のループのプログラムに書き換え、当該優先されたループの箇所からジャンプ命令を無くす。
In the case of this condition, if there are a plurality of loops having the same bottom, the readability
本条件に対応するマイグレーション処理を行うことにより、可読性が向上するだけではなく、外側のループから処理することになり、全体の計算量が少なくなる、という効果がある。 By performing the migration processing corresponding to this condition, not only the readability is improved, but also the processing is performed from the outer loop, and the entire calculation amount is reduced.
(B)以下、第二の可読性向上処理の具体例を説明する。第二の可読性向上処理の例は、以下の(B−1)から(B−2)の2つである。 (B) Hereinafter, a specific example of the second readability improving process will be described. Examples of the second readability improvement process are the following two (B-1) to (B-2).
(B−1)範囲条件が、実行され得ないプログラムの範囲を判定するための条件である場合である。かかる場合、可読性向上処理手段1221は、原ソースを静的解析し、合致する範囲条件に対応する箇所のプログラムを特定し、プログラムを削除する。
(B-1) This is a case where the range condition is a condition for determining the range of a program that cannot be executed. In such a case, the readability
(B−2)範囲条件が、変数を特定するための条件である場合である。かかる場合、可読性向上処理手段1221は、原ソースまたは目的ソースから変数を取得し、変数の生存区間を取得し、変数を、生存区間におけるローカル変数として定義する可読性向上処理を行う。
(B-2) This is a case where the range condition is a condition for specifying a variable. In such a case, the readability
なお、可読性向上処理手段1221は、例えば、原ソースまたは目的ソースに出現する一の変数に対して、出現する1以上の基本ブロックを特定する。そして、可読性向上処理手段1221は、特定した1以上の基本ブロックを一の関数として定義する。そして、可読性向上処理手段1221は、当該一の関数の命令の前に、当該一の変数を定義する。 例えば、変換する他言語がC言語の場合、可読性向上処理手段1221は、例えば、「function_name(){ 1以上の変数定義; 1以上の基本ブロックを変換した他言語の命令列;}」を取得する。なお、「function_name」は関数名であり、可読性向上処理手段1221が、予め決められた規則に基づいて生成した関数名であることは好適である。また、「1以上の変数定義」は、例えば、「char 変数名;」「int 変数名;」などであり、可読性向上処理手段1221は、C言語の文法に従って、変数の型、変数名を取得し、記載する。なお、変数名は、予め決められたルールに基づいて、決定されることは好適である。
Note that the readability
出力部13は、変換部122が変換して、取得した目的ソースを出力する。また、出力部13は、変換できないアセンブラプログラムが存在する場合、変換できないアセンブラプログラムが存在する旨のエラーを出力しても良い。ここで、出力とは、通常、記録媒体への蓄積であるが、ディスプレイへの表示、プロジェクターを用いた投影、プリンタでの印字、音出力、外部の装置への送信、他の処理装置や他のプログラムなどへの処理結果の引渡しなどを含む概念である。
The
格納部11、原ソース格納部111、箇所特定条件格納部112、および変換情報格納部113は、不揮発性の記録媒体が好適であるが、揮発性の記録媒体でも実現可能である。
The storage unit 11, the original
格納部11等に情報が記憶される過程は問わない。例えば、記録媒体を介して情報が格納部11等で記憶されるようになってもよく、通信回線等を介して送信された情報が格納部11等で記憶されるようになってもよく、あるいは、入力デバイスを介して入力された情報が格納部11等で記憶されるようになってもよい。 The process in which information is stored in the storage unit 11 or the like is not limited. For example, information may be stored in the storage unit 11 or the like via a recording medium, information transmitted via a communication line or the like may be stored in the storage unit 11 or the like, Alternatively, information input via the input device may be stored in the storage unit 11 or the like.
処理部12、アセンブラプログラム取得部121、変換部122、可読性向上処理手段1221、および出力部13は、通常、MPUやメモリ等から実現され得る。処理部12等の処理手順は、通常、ソフトウェアで実現され、当該ソフトウェアはROM等の記録媒体に記録されている。但し、ハードウェア(専用回路)で実現しても良い。
The
出力部13は、例えば、出力デバイスのドライバーソフトまたは、出力デバイスのドライバーソフトと出力デバイス等で実現され得る、と考えても良い。
The
次に、マイグレーション装置1の動作について、図2のフローチャートを用いて説明する。
Next, the operation of the
(ステップS201)アセンブラプログラム取得部121は、原ソース格納部111に格納されている原ソースから、アセンブラプログラムを取得する。
(Step S201) The assembler
(ステップS202)変換部122は、ステップS201で取得されたアセンブラプログラムに対して、静的解析処理を行う。静的解析処理について、図3のフローチャートを用いて説明する。
(Step S202) The
(ステップS203)変換部122は、カウンタiに1を代入する。
(Step S203) The
(ステップS204)変換部122は、i番目の基本ブロックが存在するか否かを判断する。i番目の基本ブロックが存在する場合はステップS205に行き、i番目の基本ブロックが存在しない場合は処理を終了する。
(Step S204) The
(ステップS205)可読性向上処理手段1221は、カウンタjに1を代入する。
(Step S205) The readability
(ステップS206)可読性向上処理手段1221は、j番目の箇所特定条件が箇所特定条件格納部112に存在するか否かを判断する。j番目の箇所特定条件が存在する場合はステップS207に行き、存在しない場合はステップS213に行く。
(Step S <b> 206) The readability
(ステップS207)可読性向上処理手段1221は、箇所特定条件格納部112からj番目の箇所特定条件を取得する。
(Step S207) The readability
(ステップS208)可読性向上処理手段1221は、i番目の基本ブロックがj番目の箇所特定条件に合致するか否かを判断する。合致する場合はステップS209に行き、合致しない場合はステップS212に行く。なお、i番目の基本ブロックの一部のアセンブラプログラムがj番目の箇所特定条件に合致する場合も、i番目の基本ブロックがj番目の箇所特定条件に合致するとする。また、i番目の基本ブロックのアセンブラプログラムが変換された中間表現(中間コードと言っても良い)の全部または一部が、j番目の箇所特定条件に合致する場合も、i番目の基本ブロックがj番目の箇所特定条件に合致するとする。
(Step S208) The readability
(ステップS209)可読性向上処理手段1221は、j番目の箇所特定条件に合致する箇所を対象として、j番目の箇所特定条件に対応する処理を行い、当該合致する箇所に対応する他言語のプログラムを取得する。
(Step S209) The readability
(ステップS210)可読性向上処理手段1221は、i番目の基本ブロックのすべてが、他言語のプログラムに変換されたか否かを判断する。i番目の基本ブロックのすべてが変換された場合はステップS211に行き、i番目の基本ブロックにおいて未変換の箇所を含む場合はステップS212に行く。
(Step S210) The readability
(ステップS211)変換部122は、カウンタiを1、インクリメントする。ステップS204に戻る。
(Step S211) The
(ステップS212)可読性向上処理手段1221は、カウンタjを1、インクリメントする。ステップS206に戻る。
(Step S212) The readability
(ステップS213)変換部122は、カウンタkに1を代入する。
(Step S213) The
(ステップS214)変換部122は、変換情報格納部113にk番目の変換情報が存在するか否を判断する。k番目の変換情報が存在する場合はステップS215に行き、k番目の変換情報が存在しない場合はステップS219に行く。
(Step S214) The
(ステップS215)変換部122は、i番目の基本ブロックがk番目の変換情報に対応するか否かを判断する。i番目の基本ブロックがk番目の変換情報に対応する場合はステップS216に行き、対応しない場合はステップS218に行く。なお、i番目の基本ブロックがk番目の変換情報に対応することは、i番目の基本ブロックの中に、変換情報が有するアセンブラパターン情報に合致するアセンブラプログラムを少なくとも一部に含むことである。
(Step S215) The
(ステップS216)変換部122は、k番目の変換情報を用いて、k番目の変換情報に対応するアセンブラプログラムを、他言語のプログラムに変換する。変換部122は、例えば、k番目の変換情報に対応するアセンブラプログラムを、k番目の変換情報が有する他言語パターン情報を用いて、他言語のプログラムを取得する。
(Step S216) Using the kth conversion information, the
(ステップS217)変換部122は、i番目の基本ブロックに含まれるすべてのアセンブラプログラムの変換が完了したか否かを判断する。i番目の基本ブロックの変換が完了した場合はステップS211に行き、変換が完了していない場合はステップS218に行く。
(Step S217) The
(ステップS218)変換部122は、カウンタkを1、インクリメントする。ステップS214に戻る。
(Step S218) The
(ステップS219)出力部13は、i番目の基本ブロックの中に変換できないプログラムが存在する旨のエラーを出力する。
(Step S219) The
なお、図2のフローチャートにおいて、原ソースがアセンブラ言語以外の他言語のプログラムを含む場合、当該他言語のプログラムも、マイグレーションのために変換することは好適である。かかる変換処理は、例えば、特許第4354514号、特許第4698943号、特許第5124660号、特許第5253115号等に記載の公知技術等を用いて行うことができる。 In the flowchart of FIG. 2, when the source source includes a program in another language other than the assembler language, it is preferable to convert the program in the other language for migration. Such conversion processing can be performed using, for example, known techniques described in Japanese Patent No. 4354514, Japanese Patent No. 4698943, Japanese Patent No. 5124660, Japanese Patent No. 5253115, and the like.
次に、ステップS202の静的解析処理の一例について、図3のフローチャートを用いて説明する。なお、静的解析処理は、ここでは、基本ブロックの範囲を確定する処理と、基本ブロック間のリンクを生成する処理と、実行され得ないプログラムの箇所を特定するための処理である。 Next, an example of the static analysis process in step S202 will be described using the flowchart of FIG. Here, the static analysis process is a process for determining a range of basic blocks, a process for generating a link between basic blocks, and a process for specifying a location of a program that cannot be executed.
(ステップS301)変換部122は、カウンタiに1、カウンタjに1を代入する。
(Step S301) The
(ステップS302)変換部122は、ステップS201で取得されたアセンブラプログラムの中の命令であり、次に実行され得るi番目の命令が存在するか否かを判断する。i番目の命令が存在する場合はステップS303に行き、i番目の命令が存在しない場合はステップS311に行く。
(Step S302) The
(ステップS303)変換部122は、i番目の命令は分岐命令であるか否かを判断する。分岐命令である場合はステップS307に行き、分岐命令でない場合はステップS304に行く。
(Step S303) The
(ステップS304)変換部122は、i番目の命令に対して、他の命令から分岐されてくる可能性があるか否か(ジャンプの先として指定されている命令が存在するか否か)を判断する。他の命令から分岐されてくる可能性がある場合はステップS307に行き、他の命令から分岐されてくる可能性がない場合はステップS305に行く。
(Step S304) The
(ステップS305)変換部122は、i番目をバッファに配置する。なお、バッファは、基本ブロックを作り出すためのワーク用の記憶領域である。
(Step S305) The
(ステップS306)変換部122は、カウンタiを1、インクリメントする。ステップS302に戻る。
(Step S306) The
(ステップS307)変換部122は、バッファ内の1以上の命令群をj番目の基本ブロックとする処理を行う。かかる処理は、例えば、基本ブロックを構成する1以上の命令に対して、「j」を付加したり、「j」をリンク付けたり、基本ブロックを構成する1以上の命令を他と区別してバッファに格納したりすること等である。なお、バッファ内に命令を有しない場合は、何らの処理も行わず、ステップS305に戻る。
(Step S307) The
(ステップS308)変換部122は、j番目の基本ブロックからのリンク先が存在する場合、当該リンク先の基本ブロックの識別子を、j番目の基本ブロックに付加する。かかる処理は、基本ブロック間の制御フローが判断され得る情報を構成する処理であれば、何でも良い。
(Step S308) When there is a link destination from the jth basic block, the
(ステップS309)変換部122は、バッファ内の命令群を削除する。
(Step S309) The
(ステップS310)変換部122は、カウンタjを1、インクリメントする。ステップS305に戻る。
(Step S310) The
(ステップS311)変換部122は、未処理の命令(箇所)に未処理を示すフラグを付す。なお、未処理の命令は、実行され得ない命令である。また、未処理の命令は存在しない可能性もあり、かかる場合、本ステップは実行されない。上位処理にリターンする。なお、 なお、図3のフローチャートにおいて、可読性向上処理手段1221は、未処理を示すフラグを付した箇所のアセンブラプログラムを削除することは好適である。
(Step S311) The
また、図3のフローチャートにおいて示した静的解析処理は一例であり、異なるアルゴリズムにより、基本ブロックの範囲を確定する処理と、基本ブロック間のリンクを生成する処理と、実行され得ないプログラムの箇所を特定するための処理を行っても良い。 Also, the static analysis process shown in the flowchart of FIG. 3 is an example. The process of determining the basic block range, the process of generating a link between the basic blocks, and the location of the program that cannot be executed by different algorithms. You may perform the process for specifying.
以下、本実施の形態におけるマイグレーション装置1の具体的な動作について説明する。今、マイグレーション対象のアセンブラプログラムは、IBMアセンブラである。また、目的言語のプログラムはC言語のプログラムである。
Hereinafter, a specific operation of the
かかる状況において、以下に、4つの具体例を用いて、マイグレーション装置1を説明する。
(具体例1)
In this situation, the
(Specific example 1)
具体例1は、第一の可読性向上処理および第二の可読性向上処理の具体例である。具体例1は、ソースパターン情報が、ダミーセクションを示す情報を含む場合であり、かつ退避コードと復帰コードを示す情報を含む場合である。また、具体例1において、範囲条件が、実行され得ないプログラムの範囲を判定するための条件である場合も述べる。つまり、具体例1は、上記の(A−1)、(A−4)、(B−1)に該当する。 Specific example 1 is a specific example of the first readability improving process and the second readability improving process. Specific Example 1 is a case where the source pattern information includes information indicating a dummy section and includes information indicating a save code and a return code. In the first specific example, a case where the range condition is a condition for determining the range of a program that cannot be executed will be described. That is, the specific example 1 corresponds to the above (A-1), (A-4), and (B-1).
今、原ソース格納部111は、図4に示す原ソースを格納している、とする。原ソースは、アセンブラ言語のプログラムの一部である。
Assume that the original
また、箇所特定条件格納部112は、図5に示す箇所特定条件管理表を格納している、とする。箇所特定条件管理表は、「ID」「箇所特定条件」「変換情報」を有する1以上のレコードを格納している。「ID」はレコードを識別する情報である。「箇所特定条件」は、可読性向上処理を行う変換対象の箇所を特定する情報である。「箇所特定条件」は「開始条件」「終了条件」を有しても良い。「開始条件」は「箇所特定条件」に合致する箇所の開始の箇所を特定する条件である。「終了条件」は「箇所特定条件」に合致する箇所の終了の箇所を特定する条件である。つまり、「開始条件」に合致する箇所と「終了条件」に合致する箇所との間の範囲が「箇所特定条件」により特定される範囲である。また、「箇所特定条件」は一つの条件のみでも良い。また、「変換情報」は、「アセンブラ」「他言語」を有し得る。「アセンブラ」「他言語」は、「箇所特定条件」により特定された範囲において、「アセンブラ」に合致する命令や定義に対して、「他言語」に対応する他言語を生成することを意味する。また、「変換情報」は、変化のための処理を記述する情報等でも良い。
Further, it is assumed that the location specifying
図5において、「ID=1」の開始条件「$1 'DSECT'」の「$1」はすべての文字列が合致する。つまり、例えば、アセンブラプログラム「PKTDSECT DSECT」は開始条件「$1 'DSECT'」に合致する。また、「ID=1」の終了条件「'CSECT' or 'DCECT' or 'COM' or 'DXD' or 'END' or プログラムの終末」は文字列「CSECT」または文字列「DSECT」または文字列「COM」または文字列「END」に合致する、またはプログラムの終端である場合に真となる。さらに、アセンブラ「$2 'DS' 'PL'[1-99]」の[1-99]は、1から99のいずれかの数字であり、「$2 'DS' 'PL'[1-99]」は、例えば、「PKT00 DS PL8」が合致する。そして、他言語「'char' $2'['[1-99]'];'」は、例えば、「char PKT00[8];」を生成することを示す。 また、図5の「ID=2」の箇所特定条件「'STM' 数字','数字','$1」は、例えば、「STM 13,12,REGSAVEA」が合致することを示す。つまり、「$1」は任意の文字列に合致する。
In FIG. 5, “$ 1” of the start condition “$ 1 'DSECT'” of “ID = 1” matches all character strings. That is, for example, the assembler program “PKTDSECT DSECT” matches the start condition “$ 1 'DSECT'”. The end condition of “ID = 1” “CSECT” or “DCECT” or “COM” or “DXD” or “END” or the end of the program is the character string “CSECT” or the character string “DSECT” or the character string. True if it matches "COM" or the string "END" or is at the end of the program. Furthermore, [1-99] of the assembler “$ 2 'DS' 'PL' [1-99]” is any number from 1 to 99, and “$ 2 'DS' 'PL' [1-99” ] "Matches, for example," PKT00 DS PL8 ". The other language “'char' $ 2 ′ ['[1-99]']; '” indicates that “char PKT00 [8];” is generated, for example. Further, the location identification condition “'STM' number ',' number ',' $ 1" of “ID = 2” in FIG. 5 indicates that, for example, “
そして、図5の「ID=2」の変換情報は、「'STM' $レジスタ番号1',' $レジスタ番号2','$1」に合致する命令について、変数$1がレジスタ退避用の番地を指しており、かつ$レジスタ番号1で特定されるレジスタから$レジスタ番号2で特定されるレジスタのうち、当該合致する命令より前に値が定義されていない(使用されていない)レジスタが存在する場合、当該使用されていないレジスタの退避を行う他言語の命令は生成されないことを示す。当該レジスタは使用されていないからである。なお、上記を言い換えれば、「ID=2」の変換情報は、「'STM' $レジスタ番号1',' $レジスタ番号2','$1」に合致する命令について、変数$1がレジスタ退避用の番地を指しており、かつ$レジスタ番号1で特定されるレジスタから$レジスタ番号2で特定されるレジスタのうち、当該命令より前に値が定義されている(使用されている)レジスタのみに対して、退避を行う他言語の命令を生成することを示す。
Then, the conversion information of “ID = 2” in FIG. 5 indicates that the variable $ 1 is used for register saving for an instruction that matches “'STM” $ register
また、図5の「ID=3」の変換情報は、「'LM' $レジスタ番号3',' $レジスタ番号4','$1」内の変数$1がレジスタ退避用の番地を指しており、かつ$レジスタ番号3で特定されるレジスタから$レジスタ番号4で特定されるレジスタのうち、当該命令より後に値が参照されていない(使用されていない)レジスタが存在する場合、当該使用されていないレジスタの復帰を行う他言語の命令は生成されないことを示す。当該レジスタは使用されていないからである。なお、上記を言い換えれば、「ID=3」の変換情報は、「'LM' $レジスタ番号3',' $レジスタ番号4','$1」内の変数$1がレジスタ退避用の番地を指しており、かつ$レジスタ番号3で特定されるレジスタから$レジスタ番号4で特定されるレジスタのうち、当該命令より後に値が参照されている(使用されている)レジスタのみに対して、復帰を行う他言語の命令を生成することを示す。
In addition, the conversion information of “ID = 3” in FIG. 5 indicates that the variable $ 1 in “'LM' $ register
以上に基づいて、マイグレーション装置1は、処理を開始した、とする。すると、アセンブラプログラム取得部121は、原ソース格納部111に格納されている原ソースから、図4に示すアセンブラプログラムを取得する。
Based on the above, it is assumed that the
次に、変換部122は、取得されたアセンブラプログラムに対して、静的解析処理を行う。そして、変換部122は、アセンブラプログラムを基本ブロックに分割する。そして、可読性向上処理手段1221は、未処理の命令(箇所)のアセンブラプログラムを削除する。
Next, the
次に、変換部122は、基本ブロック毎に、C言語に変換する。つまり、可読性向上処理手段1221は、図5の「ID=1」の箇所特定条件を図4のアセンブラプログラムに適用し、当該箇所特定条件に合致するダミーセクションの領域を検知する。そして、「ID=1」の変換情報の各「アセンブラ」に合致する命令や定義を、対応する「他言語」の情報を用いて、C言語に変換する。そして、可読性向上処理手段1221は、アセンブラのダミーセクションの定義を、C言語の構造体の定義に変換する。つまり、可読性向上処理手段1221は、図4の401の箇所のアセンブラプログラムを、図5の「ID=1」のレコードの情報を用いて、図6の601のC言語のプログラムを生成する。
Next, the
次に、変換部122は、図5の「ID=2」の箇所特定条件を図4のアセンブラプログラムに適用し、退避コードの領域を検知する。そして、「ID=2」の変換情報に合致するように、退避コードの箇所を削除する。なお、ここで、変数「REGSAVEA」は、退避コードが出現する関数内では使用されていないとする。つまり、可読性向上処理手段1221は、図4の402の箇所のアセンブラプログラムを、図5の「ID=2」のレコードの情報を用いて、図6の602のC言語のプログラム「BB1: ;」を生成する。なお、「BB1:」はラベルである。また、変換部122は、「すべての基本ブロックの先頭にラベルを生成する」という予め決められたルールに従って、「BB1:」を生成する。なお、予め決められたルールは、例えば、変換部122が保持している。
Next, the
次に、変換部122は、図5の「ID=3」の箇所特定条件を図4のアセンブラプログラムに適用し、復帰コードの領域を検知する。そして、「ID=3」の変換情報に合致するように、復帰コードの箇所を削除する。なお、ここで、変数「REGSAVEA」は、復帰コードが出現する関数内では使用されていないとする。つまり、可読性向上処理手段1221は、図4の403の箇所のアセンブラプログラムを、図5の「ID=3」のレコードの情報を用いて、図6の603のC言語のプログラム「BB2: ;」を生成する。なお、「BB2:」はラベルである。また、変換部122は、予め決められたルールに従って、「BB2:」を生成する。なお、予め決められたルールは、例えば、変換部122が保持している。
Next, the
また、次に、ソースパターン情報が、退避コードを示す情報を含む場合の別の例を説明する。 Next, another example in which the source pattern information includes information indicating a save code will be described.
今、原ソース格納部111の原ソースが有するアセンブラプログラムの一命令は、「STM 5,8,SAVE」であったとする。この一命令は、レジスタ5からレジスタ8の内容を退避する命令である。
Assume that one instruction of the assembler program included in the original source in the original
そして、可読性向上処理手段1221は、この一命令が図5の「ID=2」の箇所特定情報「'STM' $レジスタ番号1',' $レジスタ番号2','$1」に合致する、と判断する。そして、可読性向上処理手段1221は、この一命令を、例えば、レジスタ5(r5)レジスタ6(r6)、レジスタ7(r7)、レジスタ8(r8)の内容を退避する中間表現に変換する。この中間表現は、例えば、以下である。
store(r5,SAVE);
tmp1=SAVE+4;
store(r6,tmp1);
tmp2=SAVE+8;
store(r7,tmp2);
tmp3=SAVE+12;
store(r8,tmp3);
Then, the readability improvement processing means 1221 matches this one instruction with the location identification information “'STM' $ register number 1 ',' $ register number 2 ',' $ 1" of "ID = 2" in FIG. Judge. Then, the readability
store (r5, SAVE);
tmp1 = SAVE + 4;
store (r6, tmp1);
tmp2 = SAVE + 8;
store (r7, tmp2);
tmp3 = SAVE + 12;
store (r8, tmp3);
この中間表現は、変数「SAVE」が示すアドレスを先頭として、4バイトずつずらしなから、r5からr8の各レジスタの値を退避する命令群である。 This intermediate expression is an instruction group that saves the values of the registers r5 to r8 without shifting by 4 bytes starting from the address indicated by the variable “SAVE”.
次に、可読性向上処理手段1221は、レジスタ5からレジスタ8のうち、例えば、レジスタ5のみが、当該命令「STM 5,8,SAVE」の前に使用されている、と判断した、とする。
Next, it is assumed that the readability
次に、可読性向上処理手段1221は、上記の中間表現のうち、レジスタ5(r5)の値のみを退避する目的ソースを生成する。つまり、可読性向上処理手段1221は、上記の中間表現から、レジスタ6からレジスタ8の値の退避に対応する命令群「tmp1=SAVE+4; store(r6,tmp1); tmp2=SAVE+8; store(r7,tmp2); tmp3=SAVE+12; store(r8,tmp3);」を削除する。そして、可読性向上処理手段1221は、中間表現「store(r5,SAVE);」を得る。
Next, the readability
次に、可読性向上処理手段1221は、中間表現「store(r5,SAVE);」を目的ソース「*(unit32_t *)SAVE = r5;」に変換する。そして、可読性向上処理手段1221は、最終的に、C言語のプログラムの命令「*(unit32_t *)SAVE = r5;」を得る。
(具体例2)
Next, the readability
(Specific example 2)
具体例2も、第一の可読性向上処理の具体例である。具体例2は、ソースパターン情報が、オフセットを持つ戻りであることを示す情報を含む場合である。つまり、具体例2は、上記の(A−2)に該当する。 Specific example 2 is also a specific example of the first readability improving process. Specific example 2 is a case where the source pattern information includes information indicating that the return has an offset. That is, the specific example 2 corresponds to the above (A-2).
今、原ソース格納部111の原ソースが有するアセンブラプログラムは、図7に示すアセンブラプログラムである、とする。図7の701の命令は、サブルーチンPROC1の呼び出し命令である。701は、戻り番地(次の命令702)をレジスタ(14で識別されるレジスタ)に保存し、705のPROC1にジャンプするという命令である。また、702は、自分の番地(*)に8バイト足したところ(704の命令)にジャンプすることを示す。さらに、706は、サブルーチンからの戻り命令である。706は、レジスタ14+4(オフセット)の番地(命令703の箇所)にジャンプする命令である。
Assume that the assembler program included in the original source in the original
また、格納部11には、図8に示す変換情報管理表が格納されている。変換情報管理表は、「ID」「箇所特定条件」「適用条件」「変換情報」を有するレコードを1以上有する。「ID」は、レコードを識別する情報である。「適用条件」とは、「変換情報」が適用される条件であり、箇所特定条件に追加される条件である。「適用条件」は、箇所特定条件にさらに付加される条件である、と言える。また、「ID=2」の適用条件「$4のサブルーチンの最終部分が「ID=1」の箇所特定条件の場合」とは、変数$4で特定されるサブルーチンの最終部分が「B $1(,$2)」に合致する場合である。また、「ID=2」の変換情報のうち、$ラベルを含む文字列は、任意のラベルが該当し得る。$ラベルに対して、可読性向上処理手段1221は、$ラベルを含む異なる文字列に対して、ユニークなラベルを生成する。なお、2つの$ラベルXは同じラベルに置き換えられる。
The storage unit 11 stores a conversion information management table shown in FIG. The conversion information management table has one or more records having “ID”, “location specifying condition”, “application condition”, and “conversion information”. “ID” is information for identifying a record. “Applied condition” is a condition to which “conversion information” is applied, and is a condition added to the location specifying condition. It can be said that the “applicable condition” is a condition further added to the location specifying condition. Also, the application condition “ID = 2” “when the final part of the subroutine of $ 4 is the location specifying condition of“ ID = 1 ”” means that the final part of the subroutine specified by the variable $ 4 is “B $ 1”. (, $ 2) ". In addition, in the conversion information of “ID = 2”, a character string including a $ label can correspond to an arbitrary label. For the $ label, the readability
そして、可読性向上処理手段1221は、図7のアセンブラプログラムの中の命令701から命令704が、図8の「ID=2」の箇所特定条件に合致する、と判断する。
Then, the readability
また、可読性向上処理手段1221は、図7のアセンブラプログラムの中の命令705以降のサブルーチンが、図8の「ID=2」の適用条件に合致する、と判断する。
Further, the readability
そして、可読性向上処理手段1221は、図7のアセンブラプログラムの中の命令701から命令706に、図8の「ID=2」の変換情報を適用し、図9の命令901から命令906を得る。
Then, the readability
また、可読性向上処理手段1221は、図7のアセンブラプログラムの中の命令706が、図8の「ID=1」の箇所特定条件に合致する、と判断する。
Further, the readability
そして、可読性向上処理手段1221は、図7のアセンブラプログラムの中の命令706に、図8の「ID=1」の変換情報を適用し、図9の命令907、命令908を得る。
Then, the readability improving
以上により、可読性向上処理手段1221は、原ソース(図7参照)に対して、1以上の各ソースパターン情報を適用し、オフセットを持つ戻りを含む箇所(図7の命令706「B 4(,14)」)を決定し、当該箇所に対応するプログラムを、当該プログラムに含まれるオフセットを条件に用いた分岐(図9の904)を示すプログラム(図9参照)に変更できた。
(具体例3)
As described above, the readability
(Specific example 3)
具体例3も、第一の可読性向上処理の具体例である。具体例3は、ソースパターン情報が、一命令の他言語のプログラムに変換可能なアセンブラの2以上の命令の箇所を特定するためのパターンの情報であり含む場合である。つまり、具体例3は、上記の(A−3)に該当する。 Specific example 3 is also a specific example of the first readability improving process. Specific example 3 is a case in which the source pattern information is pattern information for specifying the location of two or more instructions of the assembler that can be converted into a program of another language of one instruction. That is, the specific example 3 corresponds to the above (A-3).
今、箇所特定条件格納部112は、図10に示す箇所特定条件管理表を保持している。図10の箇所特定条件管理表は「ID」「ソースパターン情報」「他言語パターン情報」を有するレコードを1以上格納している。「ID」はレコードを識別する情報である。「ソースパターン情報」はアセンブラの2以上の命令の箇所を特定するためのパターンの情報である。「他言語パターン情報」は、変換する他言語(ここではC言語)のパターンを示す情報である。
Now, the location specifying
図10の「ID=1」のソースパターン情報の「$1」は任意の文字列であり、「$変数」は任意の変数またはレジスタを示す情報である。また、「ID=1」の他言語パターン情報のlength($1)は、文字列$1の長さを示す。 In FIG. 10, “$ 1” in the source pattern information of “ID = 1” is an arbitrary character string, and “$ variable” is information indicating an arbitrary variable or register. The length ($ 1) of the other language pattern information of “ID = 1” indicates the length of the character string $ 1.
また、図10の「ID=2」のソースパターン情報の「$2」は任意の文字であり、「$変数」は任意の変数またはレジスタを示す情報である。 Further, “$ 2” in the source pattern information of “ID = 2” in FIG. 10 is an arbitrary character, and “$ variable” is information indicating an arbitrary variable or register.
また、図10の「ID=3」「ID=4」のソースパターン情報の各「$変数」は、変数の後の数字が異なれば、異なる変数である、とする。 Further, each “$ variable” of the source pattern information of “ID = 3” and “ID = 4” in FIG. 10 is a different variable if the number after the variable is different.
また、原ソース格納部111には、図11に示すアセンブラプログラムが格納されている。とする。
The original
かかる場合、可読性向上処理手段1221は、図11の1101の箇所が 図10の「ID=1」のソースパターン情報に合致すると判断し、「ID=1」の他言語パターン情報に従って、1101を図12の1201のC言語に変換する。
In this case, the readability
また、可読性向上処理手段1221は、図11の1102の箇所が 図10の「ID=2」のソースパターン情報に合致すると判断し、「ID=2」の他言語パターン情報に従って、1102を図12の1202のC言語に変換する。
Further, the readability
また、可読性向上処理手段1221は、図11の1103の箇所が 図10の「ID=3」のソースパターン情報に合致すると判断し、「ID=3」の他言語パターン情報に従って、1103を図12の1203のC言語に変換する。
Further, the readability
また、可読性向上処理手段1221は、図11の1104の箇所が 図10の「ID=4」のソースパターン情報に合致すると判断し、「ID=4」の他言語パターン情報に従って、1102を図12の1204のC言語に変換する。
Further, the readability
以上の処理の結果、可読性向上処理手段1221は、図11のアセンブラプログラムから、図12のC言語のプログラムを得る。
As a result of the above processing, the readability
なお、可読性向上処理手段1221は、アセンブラプログラムを中間表現に変換し、中間表現からC言語のプログラムを構成しても良い。例えば、可読性向上処理手段1221は、図11の1101のアセンブラ(図13の1301)を、図13の1302の中間表現1に変換する。そして、1302をtree構造にした図が、1303である。そして、可読性向上処理手段1221は、1303のtree構造を、中間表現2の1304のtree構造に変換する。なお、格納部11には、tree構造間の変換のための情報が格納されている、とする。また、1304のtree構造は、1305の中間表現2に対応する。そして、次に、可読性向上処理手段1221は、1305の中間表現2を1306のC言語のプログラムに変換する。なお、tree構造間の変換を行わずに、中間表現1302をC言語に変換した場合、1307のC言語のプログラムとなる。
The readability
同様に、可読性向上処理手段1221は、図11の1102のアセンブラ(1401)を、図14の1402の中間表現1に変換する。そして、1402をtree構造にした図が、1403である。そして、可読性向上処理手段1221は、1403のtree構造を、中間表現2の1404のtree構造に変換する。なお、1404のtree構造は、1405の中間表現2に対応する。そして、次に、可読性向上処理手段1221は、1405の中間表現2を1406のC言語のプログラムに変換する。なお、1402をC言語に変換した場合、1407となる。
(具体例4)
Similarly, the readability
(Specific example 4)
具体例4も、第一の可読性向上処理の具体例である。具体例4は、ソースパターン情報が、2以上のジャンプ命令が構成する2以上のループの一部が重なっていることを示す情報を含む場合である。つまり、具体例4は、上記の(A−5)に該当する。 Specific example 4 is also a specific example of the first readability improving process. Specific example 4 is a case where the source pattern information includes information indicating that two or more loops formed by two or more jump instructions overlap each other. That is, the specific example 4 corresponds to the above (A-5).
また、2以上のジャンプ命令が構成する2以上のループの一部が重なっている箇所が、アセンブラプログラムに存在する場合、変換部122は、(1)「ボトムが起点から最も遠いループを優先する」、(2)「ボトムが同じループが複数ある場合、トップが起点から最も近いループを優先する」の方針により、一のループを優先し、当該一のループをジャンプ命令ではなく、他言語のループのプログラムに変更する。 In addition, when a part where two or more loops formed by two or more jump instructions overlap each other exists in the assembler program, the conversion unit 122 (1) gives priority to the loop whose bottom is farthest from the starting point. ”, (2)“ If there are multiple loops with the same bottom, the top gives priority to the loop closest to the starting point ”gives priority to one loop, and this one loop is not a jump instruction, Change to a loop program.
今、変換部122は、アセンブラプログラムを静的解析し、当該アセンブラプログラムが複数(ここでは、4つ)の基本ブロック間のリンク関係を有する、と判断した、とする。そして、変換部122は、図15(a)に示す、b1、b2、b3、b4の4つの基本ブロック間のリンクを示す情報を得た、とする。なお、基本ブロック間のリンク関係とは、基本ブロック間の処理の流れを示しており、一の基本ブロックから出て行く2以上のリンク(矢印)が存在する場合は分岐があることを示す。また、図15の1501、1502はループを構成するリンクである。そして、図15(a)では、(1)「ボトムが起点から最も遠いループを優先する」の条件に従い、1502のループが優先される。つまり、可読性向上処理手段1221は、1502のループを、C言語の、例えば、「while」文に書き換え、goto文を無くす。なお、基本ブロックb3からb1へのリンク1501を構成するgoto命令は、残ることとなる。
Now, it is assumed that the
さらに具体的には、変換対象のアセンブラプログラムが、図16のプログラムであった、とする。図16において、L0、L1はラベルである。「BE L0」「BE L1」は、ジャンプ命令である。そして、命令1〜命令8は任意の命令である。
More specifically, it is assumed that the assembler program to be converted is the program of FIG. In FIG. 16, L0 and L1 are labels. “BE L0” and “BE L1” are jump instructions.
そして、変換部122は、図16のアセンブラプログラムを静的解析し、当該アセンブラプログラムがb1〜b4の4つの基本ブロックを取得した、とする。
Then, it is assumed that the
そして、変換部122は、2以上のループの一部が重なっている図16の場合に、(1)「ボトムが起点から最も遠いループを優先する」に基づいて、b4のブロックをボトムとするループ(図15の1502のループ)を優先させた場合、変換部122は、図17(a)のプログラムを取得する。そして、b3のブロックをボトムとするループを構成するgoto文1601はそのまま残る。ただし、図17(a)の1701は、ループから飛び出すgoto文であり、可読性の低下度合いは低い。
Then, in the case of FIG. 16 where two or more loops overlap each other, the
一方、仮に、変換部122は、2以上のループの一部が重なっている図16の場合に、b3のブロックをボトムとするループ(図15の1501のループ)を優先させた場合、変換部122は、図17(b)のプログラムを取得する。そして、b4のブロックをボトムとするループを構成するgoto文1702はそのまま残る。そして、図17(b)の1702は、ループへ飛び込むgoto文であり、可読性は著しく低下し、望ましくない。
On the other hand, in the case of FIG. 16 where two or more loops overlap each other, the converting
また、変換部122は、上記とは別のアセンブラプログラムを静的解析し、当該アセンブラプログラムが複数(ここでは、4つ)の基本ブロック間のリンク関係を有する、と判断した、とする。そして、変換部122は、図18(a)に示す、t1、t2、t3、t4の4つの基本ブロック間のリンクを示す情報を得た、とする。また、図18の1801、1802はループを構成するリンクである。そして、図18(a)では、(2)「ボトムが同じループが複数ある場合、トップが起点から最も近いループを優先する」の条件に従い、1801のループが優先される。つまり、可読性向上処理手段1221は、1801のループを、C言語の、例えば、「for」文に書き換え、goto文を無くす。なお、基本ブロックt4からt2へのリンク1802を構成するgoto命令は、残ることとなる。
Further, it is assumed that the
さらに具体的には、変換対象のアセンブラプログラムが、図19のプログラムであった、とする。図19において、L0、L1はラベルである。「BE L1」「B L0」は、ジャンプ命令である。そして、命令1〜命令8は任意の命令である。
More specifically, it is assumed that the assembler program to be converted is the program of FIG. In FIG. 19, L0 and L1 are labels. “BE L1” and “B L0” are jump instructions.
そして、変換部122は、図19のアセンブラプログラムを静的解析し、当該アセンブラプログラムがt1〜t4の4つの基本ブロックを取得した、とする。
Then, it is assumed that the
そして、変換部122は、2以上のループの一部が重なっている図19の場合に、(2)「ボトムが同じループが複数ある場合、トップが起点から最も近いループを優先する」に基づいて、t1のブロックをトップとするループ(図18の1801のループ)を優先させた場合、変換部122は、図20(a)のプログラムを取得する。そして、2001内の他のgoto文はそのまま残る。ただし、図20(a)のgoto文の行き先がループ内に存在するので、可読性はあまり低下しない。
Then, in the case of FIG. 19 where two or more loops overlap each other, the
一方、仮に、変換部122は、2以上のループの一部が重なっている図18の場合に、t2のブロックをトップとするループ(図18の1802のループ)を優先させた場合、変換部122は、図20(b)のプログラムを取得する。そして、2002内の他のgoto文はそのまま残る。そして、図20(b)のgoto文の行き先は、プログラムの任意の箇所になり得るので、プログラム全体の中から、goto文の行き先を探す必要があり、可読性は著しく減少する。
On the other hand, if the
なお、変換部122がすべてのgoto文を他言語のループに変換する場合、図21に示すように、トップにt1 とt2 のどちらを選んでも最終的な変換結果は同じになる。ただし、トップにt1 を選んだ方が計算量が少なくなる。
When the
以上、本実施の形態によれば、アセンブラのプログラムをマイグレーションする場合に、保守性を考慮した、可読性の高い他言語のプログラムを生成できる。 As described above, according to this embodiment, when an assembler program is migrated, it is possible to generate a program in another language with high readability in consideration of maintainability.
また、本実施の形態によれば、予め決められたパターンに合致するアセンブラのプログラムを、保守性を考慮した、可読性の高い他言語のプログラムに変換できる。 Further, according to the present embodiment, an assembler program that matches a predetermined pattern can be converted into a program in another language that has high maintainability in consideration of maintainability.
さらに、本実施の形態によれば、アセンブラのプログラムの中の予め決められた条件を満たす箇所の範囲を特定し、保守性を考慮して、当該範囲に対応する可読性の高い他言語のプログラムに変換できる。 Furthermore, according to the present embodiment, a range of locations satisfying a predetermined condition in the assembler program is identified, and in consideration of maintainability, a program in another language having high readability corresponding to the range is specified. Can be converted.
なお、本実施の形態における処理は、ソフトウェアで実現しても良い。そして、このソフトウェアをソフトウェアダウンロード等により配布しても良い。また、このソフトウェアをCD−ROMなどの記録媒体に記録して流布しても良い。なお、このことは、本明細書における他の実施の形態においても該当する。なお、本実施の形態におけるマイグレーション装置1を実現するソフトウェアは、以下のようなプログラムである。つまり、このプログラムは、コンピュータアクセス可能な記録媒体は、アセンブラ言語で記述されたアセンブラプログラムであり、マイグレーション対象のプログラムである原ソースを格納し得る原ソース格納部と、原ソースに対して、プログラムの可読性を向上させるための処理を行う箇所を特定するための条件である1以上の箇所特定条件を格納し得る箇所特定条件格納部とを具備し、コンピュータを、前記原ソース格納部に格納されている原ソースを、他言語のプログラムであり、目的言語のプログラムである目的ソースに変換する変換部と、前記変換部が変換して、取得した目的ソースを出力する出力部として機能させるためのプログラムであって、前記変換部は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各箇所特定条件を適用し、合致する箇所特定条件に対応する箇所に対して、前記合致する箇所特定条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行う可読性向上処理手段を具備するものとして、コンピュータを機能させるプログラムである。
Note that the processing in the present embodiment may be realized by software. Then, this software may be distributed by software download or the like. Further, this software may be recorded and distributed on a recording medium such as a CD-ROM. This also applies to other embodiments in this specification. Note that the software that implements the
また、上記プログラムにおいて、前記箇所特定条件は、プログラムのパターンに関する情報であるソースパターン情報であり、前記可読性向上処理手段は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、合致するソースパターン情報に対応する箇所に対して、前記合致するソースパターン情報に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行うものとして、コンピュータを機能させるプログラムであることは好適である。 Further, in the program, the location specifying condition is source pattern information that is information relating to a pattern of the program, and the readability improvement processing unit performs the above-described processing on the original source stored in the original source storage unit. Applying each of the above source pattern information, a process corresponding to the matching source pattern information is performed on a location corresponding to the matching source pattern information, and a readability improving process which is a process for improving the readability of the program is performed. As a thing, it is suitable that it is a program which functions a computer.
また、上記プログラムにおいて、前記ソースパターン情報は、ダミーセクションを示す情報を含み、前記可読性向上処理手段は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、ダミーセクションを含む箇所を決定し、当該箇所に対応するプログラムを、構造体を定義するプログラムに変更するものとして、コンピュータを機能させるプログラムであることは好適である。 Further, in the above program, the source pattern information includes information indicating a dummy section, and the readability improvement processing unit performs the one or more source patterns on the original source stored in the original source storage unit. It is preferable that the program is a program that causes a computer to function as a program that applies information, determines a location including a dummy section, and changes a program corresponding to the location to a program that defines a structure.
また、上記プログラムにおいて、前記ソースパターン情報は、オフセットを持つ戻りであることを示す情報を含み、前記可読性向上処理手段は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、オフセットを持つ戻りを含む箇所を決定し、当該箇所に対応するプログラムを、当該プログラムに含まれるオフセットを条件に用いた分岐を示すプログラムに変更するものとして、コンピュータを機能させるプログラムであることは好適である。 Further, in the above program, the source pattern information includes information indicating that the return has an offset, and the readability improvement processing unit performs the above-described processing on the original source stored in the original source storage unit with respect to the source Applying each of the above source pattern information, determining a location including a return having an offset, and changing the program corresponding to the location to a program indicating a branch using the offset included in the program as a condition, It is preferable that the program functions a computer.
また、上記プログラムにおいて、前記ソースパターン情報は、一命令の他言語のプログラムに変換可能なアセンブラの2以上の命令の箇所を特定するためのパターンの情報であり、前記可読性向上処理手段は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、前記2以上の命令の箇所を決定し、当該箇所に対応するプログラムを、一命令の他言語のプログラムに変換するものとして、コンピュータを機能させるプログラムであることは好適である。 Further, in the above program, the source pattern information is pattern information for specifying a location of two or more instructions of an assembler that can be converted into a program of another language of one instruction. The one or more pieces of source pattern information are applied to the original source stored in the original source storage unit, the location of the two or more instructions is determined, and the program corresponding to the location is replaced with one instruction. It is preferable that the program is a program that allows a computer to function as a program to be converted into a language program.
また、上記プログラムにおいて、前記ソースパターン情報は、退避コードまたは復帰コードを示す情報を含み、前記可読性向上処理手段は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、退避コードまたは復帰コードの箇所を決定し、当該箇所に対応するプログラムを、前記原ソースまたは前記目的ソースから削除するものとして、コンピュータを機能させるプログラムであることは好適である。 Further, in the above program, the source pattern information includes information indicating a save code or a return code, and the readability improvement processing unit performs the one or more of the original source stored in the original source storage unit with respect to the original source. It is preferable to apply each source pattern information, determine the location of the save code or return code, and delete the program corresponding to the location from the original source or the target source, and to be a program that causes the computer to function. It is.
また、上記プログラムにおいて、前記ソースパターン情報は、2以上のジャンプ命令が構成する2以上のループの一部が重なっていることを示す情報を含み、前記可読性向上処理手段は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、2以上のループの一部が重なっている箇所を決定し、当該箇所に対応するプログラムを、予め決められた条件を満たす一のループを優先し、ジャンプ命令を有さないループを示すプログラムに変更するものとして、コンピュータを機能させるプログラムであることは好適である。 In the above program, the source pattern information includes information indicating that two or more loops formed by two or more jump instructions overlap each other, and the readability improvement processing means includes the original source storage unit. The one or more source pattern information is applied to the original source stored in the file, the part where two or more loops overlap is determined, and the program corresponding to the part is determined in advance. It is preferable that a program that causes a computer to function as a program that gives priority to one loop that satisfies the conditions and changes to a program that indicates a loop that does not have a jump instruction.
また、上記プログラムにおいて、前記箇所特定条件は、原ソース内において予め決められた条件を満たす箇所の範囲を特定するための条件である範囲条件であり、前記可読性向上処理手段は、前記原ソース格納部に格納されている原ソースに対して、前記1以上の各範囲条件を適用し、合致する範囲条件に対応する箇所に対して、前記合致する範囲条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行うものとして、コンピュータを機能させるプログラムであることは好適である。 In the above program, the location specifying condition is a range condition that is a condition for specifying a range of locations that satisfy a predetermined condition in the original source, and the readability improvement processing means stores the source source storage. A process corresponding to the matching range condition for a portion corresponding to the matching range condition by applying each of the one or more range conditions to the original source stored in the section, and the readability of the program It is preferable that the program is a program that causes a computer to function as a process for improving readability, which is a process for improving the image quality.
また、上記プログラムにおいて、前記範囲条件は、実行され得ないプログラムの範囲を判定するための条件であり、前記可読性向上処理手段は、前記原ソースを静的解析し、前記合致する範囲条件に対応する箇所のプログラムを特定し、当該プログラムを削除するものとして、コンピュータを機能させるプログラムであることは好適である。 In the above program, the range condition is a condition for determining a range of the program that cannot be executed, and the readability improvement processing unit statically analyzes the original source and corresponds to the matching range condition. It is preferable that the program that causes the computer to function as the program that identifies the program to be deleted and deletes the program.
また、上記プログラムにおいて、前記範囲条件は、変数を特定するための条件であり、前記可読性向上処理手段は、前記原ソースまたは目的ソースから変数を取得し、当該変数の生存区間を取得し、当該変数を、当該生存区間におけるローカル変数として定義する可読性向上処理を行うものとして、コンピュータを機能させるプログラムであることは好適である。 In the above program, the range condition is a condition for specifying a variable, and the readability improvement processing unit acquires a variable from the original source or the target source, acquires a life span of the variable, It is preferable that the program causes a computer to function as a program for improving readability in which a variable is defined as a local variable in the life span.
また、上記プログラムにおいて、前記原ソースは、アセンブラプログラムとアセンブラ以外の言語のプログラムである他言語プログラムとを有するプログラムであり、コンピュータを、前記原ソースから、アセンブラプログラムを取得するアセンブラプログラム取得部としてさらに機能させ、前記変換部は、前記アセンブラプログラム取得部が取得したアセンブラプログラムを目的ソースに変換するものとして、コンピュータを機能させるプログラムであることは好適である。 In the above program, the original source is a program having an assembler program and another language program that is a program in a language other than the assembler, and the computer is used as an assembler program acquisition unit that acquires the assembler program from the original source. Further, it is preferable that the conversion unit is a program that causes a computer to function as a program that converts the assembler program acquired by the assembler program acquisition unit into a target source.
また、図22は、本明細書で述べたプログラムを実行して、上述した種々の実施の形態のマイグレーション装置等を実現するコンピュータの外観を示す。上述の実施の形態は、コンピュータハードウェア及びその上で実行されるコンピュータプログラムで実現され得る。図22は、このコンピュータシステム300の概観図であり、図23は、システム300のブロック図である。
FIG. 22 shows the external appearance of a computer that executes the programs described in this specification and realizes the migration apparatus and the like of the various embodiments described above. The above-described embodiments can be realized by computer hardware and a computer program executed thereon. FIG. 22 is an overview diagram of the
図22において、コンピュータシステム300は、CD−ROMドライブを含むコンピュータ301と、キーボード302と、マウス303と、モニタ304とを含む。
In FIG. 22, a
図23において、コンピュータ301は、CD−ROMドライブ3012に加えて、MPU3013と、MPU3013、CD−ROMドライブ3012に接続されたバス3014と、ブートアッププログラム等のプログラムを記憶するためのROM3015と、MPU3013に接続され、アプリケーションプログラムの命令を一時的に記憶するとともに一時記憶空間を提供するためのRAM3016と、アプリケーションプログラム、システムプログラム、及びデータを記憶するためのハードディスク3017とを含む。ここでは、図示しないが、コンピュータ301は、さらに、LANへの接続を提供するネットワークカードを含んでも良い。
23, in addition to the CD-
コンピュータシステム300に、上述した実施の形態のマイグレーション装置1等の機能を実行させるプログラムは、CD−ROM3101に記憶されて、CD−ROMドライブ3012に挿入され、さらにハードディスク3017に転送されても良い。これに代えて、プログラムは、図示しないネットワークを介してコンピュータ301に送信され、ハードディスク3017に記憶されても良い。プログラムは実行の際にRAM3016にロードされる。プログラムは、CD−ROM3101またはネットワークから直接、ロードされても良い。
A program that causes the
プログラムは、コンピュータ301に、上述した実施の形態のマイグレーション装置1等の機能を実行させるオペレーティングシステム(OS)、またはサードパーティープログラム等は、必ずしも含まなくても良い。プログラムは、制御された態様で適切な機能(モジュール)を呼び出し、所望の結果が得られるようにする命令の部分のみを含んでいれば良い。コンピュータシステム300がどのように動作するかは周知であり、詳細な説明は省略する。
The program does not necessarily include an operating system (OS) or a third-party program that causes the
また、上記プログラムを実行するコンピュータは、単数であってもよく、複数であってもよい。すなわち、集中処理を行ってもよく、あるいは分散処理を行ってもよい。 Further, the computer that executes the program may be singular or plural. That is, centralized processing may be performed, or distributed processing may be performed.
また、上記各実施の形態において、各処理は、単一の装置によって集中処理されることによって実現されてもよく、あるいは、複数の装置によって分散処理されることによって実現されてもよい。 In each of the above embodiments, each process may be realized by centralized processing by a single device, or may be realized by distributed processing by a plurality of devices.
本発明は、以上の実施の形態に限定されることなく、種々の変更が可能であり、それらも本発明の範囲内に包含されるものであることは言うまでもない。 The present invention is not limited to the above-described embodiments, and various modifications are possible, and it goes without saying that these are also included in the scope of the present invention.
以上のように、本発明にかかるマイグレーション装置は、アセンブラのプログラムをマイグレーションする場合に、保守性を考慮した、可読性の高い他言語のプログラムを生成できるという効果を有し、マイグレーション装置等として有用である。 As described above, the migration apparatus according to the present invention has the effect of being able to generate a program in another language with high readability in consideration of maintainability when migrating an assembler program, and is useful as a migration apparatus or the like. is there.
1 マイグレーション装置
11 格納部
12 処理部
13 出力部
111 原ソース格納部
112 箇所特定条件格納部
113 変換情報格納部
121 アセンブラプログラム取得部
122 変換部
1221 可読性向上処理手段
DESCRIPTION OF
Claims (13)
原ソースに対して、プログラムの可読性を向上させるための処理を行う箇所を特定するための条件である1以上の箇所特定条件を格納し得る箇所特定条件格納部と、
前記原ソース格納部に格納されている原ソースを、他言語のプログラムであり、目的言語のプログラムである目的ソースに変換する変換部と、
前記変換部が変換して、取得した目的ソースを出力する出力部とを具備するマイグレーション装置であって、
前記変換部は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各箇所特定条件を適用し、合致する箇所特定条件に対応する箇所に対して、前記合致する箇所特定条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行う可読性向上処理手段を具備するマイグレーション装置。 An assembler program written in an assembler language, an original source storage unit capable of storing an original source that is a program to be migrated, and
A location specifying condition storage that can store one or more location specifying conditions that are conditions for specifying a location for performing processing for improving the readability of the program with respect to the original source;
A conversion unit that converts the original source stored in the original source storage unit into a target source that is a program in another language and is a target language program;
An output unit for converting the conversion unit and outputting the acquired target source;
The converter is
The one or more location specifying conditions are applied to the original source stored in the original source storage unit, and the location corresponding to the matching location specifying condition is applied to the matching location specifying condition. A migration apparatus comprising readability improvement processing means for performing readability improvement processing, which is processing and processing for improving the readability of a program.
前記可読性向上処理手段は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、合致するソースパターン情報に対応する箇所に対して、前記合致するソースパターン情報に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行う請求項1記載のマイグレーション装置。 The location specifying condition is source pattern information which is information related to a program pattern,
The readability improvement processing means includes:
The one or more pieces of source pattern information are applied to the original source stored in the original source storage unit, and the corresponding source pattern information corresponds to the corresponding source pattern information. The migration apparatus according to claim 1, wherein the migration apparatus performs a readability improvement process that is a process for improving the readability of a program.
ダミーセクションを示す情報を含み、
前記可読性向上処理手段は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、ダミーセクションを含む箇所を決定し、当該箇所に対応するプログラムを、構造体を定義するプログラムに変更する請求項2記載のマイグレーション装置。 The source pattern information is
Including information indicating the dummy section,
The readability improvement processing means includes:
The one or more pieces of source pattern information are applied to the source source stored in the source source storage unit, a location including a dummy section is determined, and a structure corresponding to the program corresponding to the location is defined. The migration apparatus according to claim 2, wherein the migration apparatus is changed to a program.
オフセットを持つ戻りであることを示す情報を含み、
前記可読性向上処理手段は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、オフセットを持つ戻りを含む箇所を決定し、当該箇所に対応するプログラムを、当該プログラムに含まれるオフセットを条件に用いた分岐を示すプログラムに変更する請求項2記載のマイグレーション装置。 The source pattern information is
Contains information indicating that the return has an offset,
The readability improvement processing means includes:
The one or more source pattern information is applied to the original source stored in the original source storage unit, a location including a return having an offset is determined, and a program corresponding to the location is assigned to the program. The migration apparatus according to claim 2, wherein the program is changed to a program indicating a branch using an included offset as a condition.
一命令の他言語のプログラムに変換可能なアセンブラの2以上の命令の箇所を特定するためのパターンの情報であり、
前記可読性向上処理手段は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、前記2以上の命令の箇所を決定し、当該箇所に対応するプログラムを、一命令の他言語のプログラムに変換する請求項2記載のマイグレーション装置。 The source pattern information is
It is pattern information for specifying the location of two or more instructions of the assembler that can be converted into a program of another language of one instruction.
The readability improvement processing means includes:
The one or more source pattern information is applied to the original source stored in the original source storage unit, the location of the two or more instructions is determined, and a program corresponding to the location is stored in one instruction. The migration apparatus according to claim 2, wherein the migration apparatus converts the program into another language program.
退避コードまたは復帰コードを示す情報を含み、
前記可読性向上処理手段は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、退避コードまたは復帰コードの箇所を決定し、当該箇所に対応するプログラムを、前記原ソースまたは前記目的ソースから削除する請求項2記載のマイグレーション装置。 The source pattern information is
Contains information indicating the evacuation code or return code,
The readability improvement processing means includes:
The one or more source pattern information is applied to the original source stored in the original source storage unit, the location of the save code or the return code is determined, and the program corresponding to the location is stored in the source source. The migration apparatus according to claim 2, wherein the migration apparatus is deleted from the target source.
2以上のジャンプ命令が構成する2以上のループの一部が重なっていることを示す情報を含み、
前記可読性向上処理手段は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各ソースパターン情報を適用し、2以上のループの一部が重なっている箇所を決定し、当該箇所に対応するプログラムを、予め決められた条件を満たす一のループを優先し、ジャンプ命令を有さないループを示すプログラムに変更する請求項2記載のマイグレーション装置。 The source pattern information is
Including information indicating that a part of two or more loops formed by two or more jump instructions overlap,
The readability improvement processing means includes:
A program that applies the one or more pieces of source pattern information to the original source stored in the original source storage unit, determines a place where a part of two or more loops overlap, and corresponds to the place The migration apparatus according to claim 2, wherein a first loop satisfying a predetermined condition is prioritized and a program indicating a loop having no jump instruction is changed.
前記可読性向上処理手段は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各範囲条件を適用し、合致する範囲条件に対応する箇所に対して、前記合致する範囲条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行う請求項1記載のマイグレーション装置。 The location specifying condition is a range condition that is a condition for specifying a range of locations that satisfy a predetermined condition in the original source,
The readability improvement processing means includes:
A process corresponding to the matching range condition for a portion corresponding to the matching range condition by applying each of the one or more range conditions to the source source stored in the source source storage unit The migration apparatus according to claim 1, wherein a readability improving process that is a process for improving the readability of the program is performed.
実行され得ないプログラムの範囲を判定するための条件であり、
前記可読性向上処理手段は、
前記原ソースを静的解析し、前記合致する範囲条件に対応する箇所のプログラムを特定し、当該プログラムを削除する請求項8記載のマイグレーション装置。 The range condition is
It is a condition for determining the range of programs that cannot be executed,
The readability improvement processing means includes:
The migration apparatus according to claim 8, wherein the original source is statically analyzed, a program corresponding to the matching range condition is specified, and the program is deleted.
変数を特定するための条件であり、
前記可読性向上処理手段は、
前記原ソースまたは目的ソースから変数を取得し、当該変数の生存区間を取得し、当該変数を、当該生存区間におけるローカル変数として定義する可読性向上処理を行う請求項8記載のマイグレーション装置。 The range condition is
It is a condition to specify the variable,
The readability improvement processing means includes:
The migration apparatus according to claim 8, wherein a variable is acquired from the original source or the target source, a life span of the variable is obtained, and readability improvement processing is performed to define the variable as a local variable in the life span.
アセンブラプログラムとアセンブラ以外の言語のプログラムである他言語プログラムとを有するプログラムであり、
前記原ソースから、アセンブラプログラムを取得するアセンブラプログラム取得部をさらに具備し、
前記変換部は、
前記アセンブラプログラム取得部が取得したアセンブラプログラムを目的ソースに変換する請求項1から請求項10いずれか一項に記載のマイグレーション装置。 The original source is
A program having an assembler program and another language program which is a program in a language other than the assembler,
An assembler program acquisition unit for acquiring an assembler program from the original source;
The converter is
The migration apparatus according to any one of claims 1 to 10, wherein the assembler program acquired by the assembler program acquisition unit is converted into a target source.
アセンブラ言語で記述されたアセンブラプログラムであり、マイグレーション対象のプログラムである原ソースを格納し得る原ソース格納部と、
原ソースに対して、プログラムの可読性を向上させるための処理を行う箇所を特定するための条件である1以上の箇所特定条件を格納し得る箇所特定条件格納部とを具備し、
変換部、および出力部により実現され得るプログラムの製造方法であって、
前記変換部が、前記原ソース格納部に格納されている原ソースを、他言語のプログラムであり、目的言語のプログラムである目的ソースに変換する変換ステップと、
前記出力部が、前記変換ステップで変換されて、取得された目的ソースを出力する出力ステップとを具備する他言語プログラムの製造方法であって、
前記変換部は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各箇所特定条件を適用し、合致する箇所特定条件に対応する箇所に対して、前記合致する箇所特定条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行うステップを具備するプログラムの製造方法。 The recording medium is
An assembler program written in an assembler language, an original source storage unit capable of storing an original source that is a program to be migrated, and
A location specifying condition storage unit that can store one or more location specifying conditions that are conditions for specifying a location for performing processing for improving the readability of the program with respect to the original source;
A method of manufacturing a program that can be realized by a conversion unit and an output unit,
The conversion unit converts the original source stored in the original source storage unit into a target source which is a program in another language and is a target language program;
The output unit is a method for producing another language program comprising an output step of outputting the acquired target source after being converted in the conversion step,
The converter is
The one or more location specifying conditions are applied to the original source stored in the original source storage unit, and the location corresponding to the matching location specifying condition is applied to the matching location specifying condition. A method of manufacturing a program comprising a step of performing a readability improving process, which is a process for improving the readability of a program.
アセンブラ言語で記述されたアセンブラプログラムであり、マイグレーション対象のプログラムである原ソースを格納し得る原ソース格納部と、
原ソースに対して、プログラムの可読性を向上させるための処理を行う箇所を特定するための条件である1以上の箇所特定条件を格納し得る箇所特定条件格納部とを具備し、
コンピュータを、
前記原ソース格納部に格納されている原ソースを、他言語のプログラムであり、目的言語のプログラムである目的ソースに変換する変換部と、
前記変換部が変換して、取得した目的ソースを出力する出力部として機能させるためのプログラムであって、
前記変換部は、
前記原ソース格納部に格納されている原ソースに対して、前記1以上の各箇所特定条件を適用し、合致する箇所特定条件に対応する箇所に対して、前記合致する箇所特定条件に対応する処理であり、プログラムの可読性を向上させる処理である可読性向上処理を行う可読性向上処理手段を具備するものとして、コンピュータを機能させるプログラム。 Computer-accessible recording media
An assembler program written in an assembler language, an original source storage unit capable of storing an original source that is a program to be migrated, and
A location specifying condition storage unit that can store one or more location specifying conditions that are conditions for specifying a location for performing processing for improving the readability of the program with respect to the original source;
Computer
A conversion unit that converts the original source stored in the original source storage unit into a target source that is a program in another language and is a target language program;
A program for converting the conversion unit to function as an output unit that outputs the acquired target source,
The converter is
The one or more location specifying conditions are applied to the original source stored in the original source storage unit, and the location corresponding to the matching location specifying condition is applied to the matching location specifying condition. A program that causes a computer to function as a process that includes a readability improvement processing unit that performs a readability improvement process that is a process that improves the readability of a program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2015177171A JP2017054277A (en) | 2015-09-09 | 2015-09-09 | Migration device, creation method of program and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2015177171A JP2017054277A (en) | 2015-09-09 | 2015-09-09 | Migration device, creation method of program and program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2017054277A true JP2017054277A (en) | 2017-03-16 |
Family
ID=58320810
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2015177171A Pending JP2017054277A (en) | 2015-09-09 | 2015-09-09 | Migration device, creation method of program and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2017054277A (en) |
-
2015
- 2015-09-09 JP JP2015177171A patent/JP2017054277A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8799299B2 (en) | Schema contracts for data integration | |
US9424003B1 (en) | Schema-less system output object parser and code generator | |
US20150278231A1 (en) | System and method for customizing archive of a device driver generator tool for a user | |
US20090055421A1 (en) | Migration and transformation of data structures | |
US11029924B2 (en) | Program optimization by converting code portions to directly reference internal data representations | |
US20110209135A1 (en) | Program Change Management Apparatus, Computer Readable Record Medium Storing Program Change Management Program, And Program Change Management Method | |
US8935657B2 (en) | Model-to-model transformation by kind | |
US20100218200A1 (en) | Method for programmatic editing of text files | |
JP2020060919A (en) | System migration support device, system migration support method and program | |
JP4724387B2 (en) | Program conversion program, program conversion apparatus, and program conversion method | |
JP2009169864A (en) | Compile method and compile program | |
US20110296373A1 (en) | Command line shell command generation based on schema | |
JP2017054277A (en) | Migration device, creation method of program and program | |
JP2017062746A (en) | Document generation device, generation method for document, and program | |
JP2014228990A (en) | Control program creation apparatus and control program creation method | |
JP5932707B2 (en) | Computer, program, and data generation method | |
JP6175306B2 (en) | Control program dividing apparatus, control program dividing method and recording medium therefor | |
JP2017126176A (en) | Migration apparatus, production method of target source, and program | |
KR101905675B1 (en) | Module structural analysis supporting device and program | |
US9792197B2 (en) | Apparatus and program | |
JP4405571B1 (en) | program | |
CN113031952A (en) | Method and device for determining execution code of deep learning model and storage medium | |
US20170344351A1 (en) | Information processing apparatus, compiling management method, and recording medium | |
WO2021084657A1 (en) | Conversion device, conversion method, and program | |
JP2009080681A (en) | Program structure parsing method and device |