JPH05257672A - Patch processing system for compiled code object - Google Patents
Patch processing system for compiled code objectInfo
- Publication number
- JPH05257672A JPH05257672A JP4089728A JP8972892A JPH05257672A JP H05257672 A JPH05257672 A JP H05257672A JP 4089728 A JP4089728 A JP 4089728A JP 8972892 A JP8972892 A JP 8972892A JP H05257672 A JPH05257672 A JP H05257672A
- Authority
- JP
- Japan
- Prior art keywords
- area
- compiled code
- patch
- code object
- correction
- 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
- 238000012545 processing Methods 0.000 title claims abstract description 32
- 238000012937 correction Methods 0.000 claims abstract description 120
- 238000000034 method Methods 0.000 claims abstract description 51
- 238000012986 modification Methods 0.000 claims description 38
- 230000004048 modification Effects 0.000 claims description 38
- 238000002715 modification method Methods 0.000 claims description 15
- 238000003672 processing method Methods 0.000 claims description 6
- 230000006870 function Effects 0.000 description 9
- 238000010586 diagram Methods 0.000 description 4
Landscapes
- Debugging And Monitoring (AREA)
- Stored Programmes (AREA)
Abstract
Description
【0001】[0001]
【産業上の利用分野】本発明は、インタプリタとコンパ
イラとを備え、コンパイラが生成出力したコンパイルド
コードオブジェクトをインタプリタが記憶領域にロード
しその実行管理を行う言語処理システムに関し、特にコ
ンパイルドコードオブジェクトのパッチ処理方式に関す
る。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a language processing system which comprises an interpreter and a compiler, and in which the interpreter loads a compiled code object generated and output by the compiler into a storage area and manages its execution, and more particularly to a compiled code object Patch processing method.
【0002】[0002]
【従来の技術】言語処理システムの一種に、ソースプロ
グラムやデータオブジェクトを解釈実行するインタプリ
タと実行効率を向上させるためにソースプログラムを翻
訳するコンパイラとから構成され、コンパイラが関数単
位にソースプログラムをコンパイルして出力する機械語
命令列を含むコンパイルドコードオブジェクトを、イン
タプリタが記憶領域にロードして実行管理する言語処理
システムがある。なお、このような言語処理システムを
記載した文献としては、例えば、特願昭63−3108
27号添付明細書および図面がある。2. Description of the Related Art A type of language processing system is composed of an interpreter that interprets and executes a source program and data objects, and a compiler that translates the source program to improve execution efficiency. The compiler compiles the source program in function units. There is a language processing system in which an interpreter loads a compiled code object including a machine language instruction sequence to be output by the interpreter and manages the execution. As a document describing such a language processing system, for example, Japanese Patent Application No. 63-3108.
No. 27 attached to the specification and drawings.
【0003】ところで、コンパイルして生成された既に
存在するコンパイルドコードオブジェクトが一部不正な
機械語命令列を含む場合、所期の機能を実現することが
できないので、その修正が必要となる。By the way, if the existing compiled code object generated by compiling includes a partially invalid machine language instruction string, the intended function cannot be realized, so that the correction is necessary.
【0004】ここで、一般にコンパイルユニットの修正
方法としては、ソースプログラムを修正してこれを再コ
ンパイルする方法と、所謂パッチによってコンパイルユ
ニット中の機械語を直接に修正する方法とがあるが、こ
の種の言語処理システムでは、コンパイルドコードオブ
ジェクトがそのオペレーティングシステム上で定められ
たコンパイルユニット形式を有していないため、コンパ
イルユニットに対する既存のパッチシステムが存在して
もそれを使用することができない。Generally, as a method of modifying the compile unit, there are a method of modifying the source program and recompiling it, and a method of directly modifying the machine language in the compile unit by a so-called patch. In some language processing systems, the compiled code object does not have the compile unit type defined on its operating system, so that it cannot be used even if there is an existing patch system for the compile unit.
【0005】そこで、従来は、ソースプログラムを修正
し、これを再コンパイルすることによって、修正された
コンパイルドコードオブジェクトを生成していた。Therefore, conventionally, a modified compiled code object is generated by modifying the source program and recompiling it.
【0006】[0006]
【発明が解決しようとする課題】従って、修正する機械
語命令列が全体のほんの一部でもソースプログラム全体
を再コンパイルするために多くの労力と時間を必要とし
ていた。Therefore, it takes a lot of labor and time to recompile the entire source program even if the machine language instruction sequence to be modified is a small part of the whole.
【0007】また、元のコンパイルドコードオブジェク
トが生成されたときのコンパイル環境を再現できない場
合には、再コンパイルすることができないので修正する
ことはできなかった。Further, if the compile environment at the time when the original compiled code object was generated cannot be reproduced, it cannot be recompiled and therefore cannot be corrected.
【0008】本発明はこのような事情に鑑みて為された
ものであり、その目的は、既に存在するコンパイルドコ
ードオブジェクトをパッチ方式によって修正することが
できる新規なコンパイルドコードオブジェクトのパッチ
処理方式を提供することにある。The present invention has been made in view of the above circumstances, and an object thereof is to provide a novel compiled code object patch processing system capable of modifying an already existing compiled code object by a patch system. To provide.
【0009】[0009]
【課題を解決するための手段】本発明は上記の目的を達
成するために、ソースプログラムを翻訳してコンパイル
ドコードオブジェクトを出力するコンパイラと該コンパ
イラが出力したコンパイルドコードオブジェクトを記憶
領域にロードして解釈実行するインタプリタとを含む言
語処理システムにおけるコンパイルドコードオブジェク
トのパッチ処理方式において、修正対象のコンパイルド
コードオブジェクトを格納するファイルと、修正内容で
ある機械語命令列を格納するパッチイメージ格納部と、
前記修正対象のコンパイルドコードオブジェクトの修正
位置と該修正位置に適用すべき前記パッチイメージ格納
部中の機械語命令列との関係を示す修正情報を入力する
修正情報入力手段と、追加パッチ領域とを備え、且つ、
前記インタプリタ内のローダに、前記入力された修正情
報に基づき、前記ファイル中のコンパイルドコードオブ
ジェクトの修正箇所を認識すると共に該修正箇所を短命
令列修正方法で修正するか、長命令列修正方法で修正す
るかを判定する判定部と、該判定部により短命令列修正
方法で修正すると判定された前記コンパイルドコードオ
ブジェクトの修正箇所を前記パッチイメージ格納部に格
納された該当する機械語命令列で書き換える短命令列修
正手段と、前記判定部により長命令列修正方法で修正す
ると判定された前記コンパイルドコードオブジェクトの
修正箇所をパッチエリアに分岐する命令で書き換えると
共に、前記パッチイメージ格納部に格納された該当する
機械語命令列と前記修正箇所へ制御を戻す命令とを前記
追加パッチ領域に格納する長命令列修正手段と、前記修
正後のコンパイルドコードオブジェクトおよび前記追加
パッチ領域の内容を前記記憶領域にロードする修正ファ
イルロード手段とを備えている。In order to achieve the above object, the present invention provides a compiler that translates a source program and outputs a compiled code object, and a compiled code object output by the compiler into a storage area. In a patch processing method of a compiled code object in a language processing system including an interpreter that interprets and executes a file, a file that stores a compiled code object to be modified and a patch image storage that stores a machine language instruction string that is the content of modification Department,
Modification information input means for inputting modification information indicating a relationship between a modification position of the compiled code object to be modified and a machine language instruction sequence in the patch image storage unit to be applied to the modification position; and an additional patch area. And
The loader in the interpreter recognizes the modified portion of the compiled code object in the file based on the inputted modification information, and modifies the modified portion by the short instruction string correcting method or the long instruction string correcting method. And a corresponding machine language instruction sequence stored in the patch image storage unit for the correction location of the compiled code object determined to be corrected by the short instruction sequence correction method by the determination unit. And a short instruction string correcting means for rewriting with a command for branching to a patch area of the compiled code object determined to be corrected by the long instruction string correcting method by the judging section, and stored in the patch image storing section. The corresponding machine language instruction sequence and the instruction to return the control to the correction location are added to the additional patch area. It includes a long instruction string correcting means for paying, and fix the load means for loading the compiled code object and content of the additional patch area after the correction in the storage area.
【0010】[0010]
【作用】本発明のコンパイルドコードオブジェクトのパ
ッチ処理方式においては、ファイルが修正対象のコンパ
イルドコードオブジェクトを保持すると共にパッチイメ
ージ格納部が修正内容である機械語命令列を保持し、修
正情報入力手段が修正対象のコンパイルドコードオブジ
ェクトの修正位置とその修正位置に適用すべきパッチイ
メージ格納部中の機械語命令列との関係を示す修正情報
を入力する。In the patch processing method for the compiled code object of the present invention, the file holds the compiled code object to be modified, the patch image storage section holds the machine language instruction string as the modification content, and the modification information is input. The means inputs modification information indicating a relationship between a modification position of the compiled code object to be modified and a machine language instruction string in the patch image storage unit to be applied to the modification position.
【0011】インタプリタ内のローダによるコンパイル
ドコードオブジェクトのロードに際し、ローダ内の判定
部が、入力された修正情報に基づき、ファイル中のコン
パイルドコードオブジェクトの修正箇所を認識すると共
にその修正箇所を短命令列修正方法で修正するか、長命
令列修正方法で修正するかを判定し、短命令列修正方法
で修正すると判定された場合、短命令列修正手段が、コ
ンパイルドコードオブジェクトの修正箇所をパッチイメ
ージ格納部に格納された該当する機械語命令列で書き換
え、長命令列修正方法で修正すると判定された場合、長
命令列修正手段が、コンパイルドコードオブジェクトの
修正箇所をパッチエリアに分岐する命令で書き換えると
共に、パッチイメージ格納部に格納された該当する機械
語命令列と前記修正箇所へ制御を戻す命令とを追加パッ
チ領域に格納する。When the compiled code object is loaded by the loader in the interpreter, the determination unit in the loader recognizes the corrected portion of the compiled code object in the file based on the input correction information and shortens the corrected portion. It is determined whether the instruction sequence modification method or the long instruction sequence modification method is used. If it is determined that the short instruction string modification method is used, the short instruction sequence modification means determines the modification location of the compiled code object. When it is determined to rewrite with the corresponding machine language instruction string stored in the patch image storage unit and to correct with the long instruction string correction method, the long instruction string correction means branches the correction location of the compiled code object to the patch area. In addition to rewriting with a command, the corresponding machine language command sequence stored in the patch image storage section Storing instructions and to return control to where the additional patch area.
【0012】そして、修正ファイルロード手段が、修正
後のコンパイルドコードオブジェクトおよび前記追加パ
ッチ領域の内容を記憶領域にロードする。Then, the modified file loading means loads the modified compiled code object and the contents of the additional patch area into the storage area.
【0013】[0013]
【実施例】次に本発明の実施例について図面を参照して
詳細に説明する。Embodiments of the present invention will now be described in detail with reference to the drawings.
【0014】図1を参照すると、本発明を適用した言語
処理システム1は、コンパイラ2とインタプリタ3と記
憶領域4とを含み、ファイル5,パッチイメージ格納部
6,修正情報入力部7および追加パッチ領域9が接続さ
れている。Referring to FIG. 1, a language processing system 1 to which the present invention is applied includes a compiler 2, an interpreter 3 and a storage area 4, a file 5, a patch image storage section 6, a correction information input section 7 and an additional patch. Area 9 is connected.
【0015】インタプリタ3はコンパイルドコードオブ
ジェクトを記憶領域4にロードするローダ8を有し、こ
のローダ8には修正部85および修正ファイルロード手
段84が設けられている。また、修正部85には判定部
81,短命令列修正手段82および長命令列修正手段8
3が設けられている。The interpreter 3 has a loader 8 for loading the compiled code object into the storage area 4, and the loader 8 is provided with a correction section 85 and a correction file loading means 84. Further, the correction unit 85 includes a determination unit 81, a short instruction sequence correction unit 82, and a long instruction sequence correction unit 8.
3 is provided.
【0016】ファイル5には、修正対象のコンパイルド
コードオブジェクト51が格納されている。このコンパ
イルドコードオブジェクト51はコンパイラ2が図示し
ないソースプログラムを翻訳することにより生成出力し
たものである。A compiled code object 51 to be modified is stored in the file 5. The compiled code object 51 is generated and output by the compiler 2 translating a source program (not shown).
【0017】パッチイメージ格納部6には、修正内容で
ある機械語命令列61が格納されている。The patch image storage unit 6 stores a machine language instruction sequence 61 which is the content of modification.
【0018】修正情報入力部7は、修正対象のコンパイ
ルドコードオブジェクト51の修正位置とその修正位置
に適用すべき機械語命令列61との関係を示す修正情報
71を入力するための手段である。The modification information input unit 7 is means for inputting modification information 71 indicating the relationship between the modification position of the compiled code object 51 to be modified and the machine language instruction sequence 61 to be applied to the modification position. ..
【0019】言語処理システム1は、コンパイラ2が出
力したコンパイルドコードオブジェクトをインタプリタ
3が記憶領域4にロードして解釈実行することで所定の
機能を達成しているが、既に存在するコンパイルドコー
ドオブジェクトの一部に不正な機械語命令が含まれてい
ると所期の機能を達成することができない。そこで、コ
ンパイルドコードオブジェクトを正しい機械語命令で置
き換えるパッチ処理を施すわけであるが、本実施例で
は、このパッチ処理をインタプリタ3のローダ8におい
て、以下のように実施する。The language processing system 1 achieves a predetermined function by the interpreter 3 loading the compiled code object output by the compiler 2 into the storage area 4 and interpreting and executing the compiled code object. If a part of the object contains an illegal machine language instruction, the intended function cannot be achieved. Therefore, patch processing for replacing the compiled code object with a correct machine language instruction is performed. In this embodiment, the patch processing is performed in the loader 8 of the interpreter 3 as follows.
【0020】先ず、利用者は置き換えに使用する正しい
機械語命令列61を作成してパッチイメージ格納部6に
記憶し、また修正対象のコンパイルドコードオブジェク
ト51の修正位置とその修正位置に適用すべきパッチイ
メージ格納部6中の機械語命令列61との関係を示す修
正情報71を作成する。First, the user creates a correct machine language instruction sequence 61 to be used for replacement, stores it in the patch image storage unit 6, and applies it to the modified position of the compiled code object 51 to be modified and its modified position. The modification information 71 indicating the relationship with the machine language instruction sequence 61 in the power patch image storage unit 6 is created.
【0021】例えば、コンパイルドコードオブジェクト
の先頭から100バイト目〜107バイト目にある合計
8バイトの機械語命令列を図2に示すような4バイトの
機械語命令M1で修正し、200バイト目〜207バイ
ト目にある合計8バイトの機械語命令を図2に示すよう
な合計12バイトの機械語命令M2−1,M2−2,M
2−3で修正する場合、機械語命令M1から構成される
機械語命令列61−1と機械語命令M2−1,M2−
2,M2−3から構成される機械語命令列61−2とを
パッチイメージ格納部6に記憶すると共に、(修正開始
位置=100バイト目,修正終了位置=108バイト
目,適用機械語命令列=61−1)という修正情報と、
(修正開始位置=200バイト目,修正終了位置=20
8バイト目,適用機械語命令列=61−2)という修正
情報とを含む修正情報71を作成する。For example, a machine language instruction string of a total of 8 bytes at the 100th to 107th bytes from the head of the compiled code object is modified by a 4-byte machine language instruction M1 as shown in FIG. The machine language instruction of 8 bytes in total at the 207th byte is a machine language instruction M2-1, M2-2, M of 12 bytes in total as shown in FIG.
In the case of correction by 2-3, a machine language instruction sequence 61-1 composed of machine language instructions M1 and machine language instructions M2-1, M2-
A machine language instruction sequence 61-2 composed of M2-3 and M2-3 is stored in the patch image storage unit 6, and (correction start position = 100th byte, correction end position = 108th byte, applied machine language command sequence). = 61-1) correction information,
(Correction start position = 200th byte, correction end position = 20
The modification information 71 including the modification information of the 8th byte, the applied machine language instruction string = 61-2) is created.
【0022】このような修正情報71が修正情報入力部
7から入力されてインタプリタ3に対しコンパイルドコ
ードオブジェクト51のロードが指示されると、ローダ
8が以下のような処理を行う。When such modification information 71 is input from the modification information input unit 7 and the interpreter 3 is instructed to load the compiled code object 51, the loader 8 performs the following processing.
【0023】ローダ8の修正部85における判定部81
は、修正情報入力部7から1つの修正情報を読み込み、
この修正情報によって指示されているコンパイルドコー
ドオブジェクト51の修正箇所のサイズとその修正箇所
に適用すべき機械語命令列のサイズとを比較し、前者が
後者より大きいか等しければ修正方法を短命令列修正方
法と決定し、前者が後者より小さければ修正方法を長命
令列修正方法と決定する。Judgment unit 81 in correction unit 85 of loader 8
Reads one piece of correction information from the correction information input unit 7,
The size of the modified part of the compiled code object 51 indicated by the modification information is compared with the size of the machine language instruction string to be applied to the modified part, and if the former is larger than the latter or equal, the modification method is short instruction. If the former is smaller than the latter, the modification method is determined to be the long instruction string modification method.
【0024】修正部85の短命令列修正手段82は、判
定部81により短命令列修正方法で修正すると決定され
たコンパイルドコードオブジェクト51の修正箇所を、
パッチイメージ格納部6に格納された該当する機械語命
令列で書き換える。The short instruction sequence correcting means 82 of the correction unit 85 determines the correction location of the compiled code object 51 which is determined by the determination unit 81 to be corrected by the short instruction sequence correction method.
It is rewritten with the corresponding machine language instruction sequence stored in the patch image storage unit 6.
【0025】他方、長命令列修正手段83は、判定部8
1により長命令列修正方法で修正すると決定されたコン
パイルドコードオブジェクト51の修正箇所を、パッチ
エリア42に分岐する命令で書き換えると共に、パッチ
イメージ格納部6に格納された該当する機械語命令列と
前記修正箇所へ制御を戻す命令とを追加パッチ領域9に
格納する。On the other hand, the long instruction sequence correcting means 83 is provided with the judging section 8
The modified location of the compiled code object 51 determined to be modified by the long instruction sequence modification method according to 1 is rewritten by the instruction branching to the patch area 42, and the corresponding machine language instruction sequence stored in the patch image storage unit 6 is stored. The instruction to return the control to the correction location is stored in the additional patch area 9.
【0026】例えば図2の場合、(修正開始位置=10
0バイト目,修正終了位置=108バイト目,適用機械
語命令列=61−1)という修正情報に基づき、判定部
81は、修正箇所のサイズ=8(108−100)バイ
トと、その修正箇所に適用すべき機械語命令列61−1
のサイズ=4バイトとを比較し、前者が後者より小さい
ので、短命令列修正方法で修正すると決定する。For example, in the case of FIG. 2, (correction start position = 10
Based on the correction information of the 0th byte, the correction end position = 108th byte, the applied machine language instruction string = 61-1), the determination unit 81 determines that the size of the correction point = 8 (108-100) bytes and the correction point. Machine language instruction sequence 61-1 to be applied to
Size = 4 bytes, and the former is smaller than the latter, it is decided to modify by the short instruction sequence modification method.
【0027】このため、短命令列修正手段82は、図2
に示すように、コンパイルドコードオブジェクト51の
修正箇所の100バイト目の内容を機械語命令列61−
1を構成する機械語命令M1で書き換え、修正箇所の残
りの4バイトを何もしない命令であるNOP命令で書き
換える。For this reason, the short instruction sequence correcting means 82 operates as shown in FIG.
As shown in, the contents of the 100th byte of the modified portion of the compiled code object 51 are the machine language instruction sequence 61-
1 is rewritten by the machine language instruction M1 that composes 1, and the remaining 4 bytes of the corrected portion are rewritten by the NOP instruction which is an instruction that does nothing.
【0028】また、(修正開始位置=200バイト目,
修正終了位置=208バイト目,適用機械語命令列=6
1−2)という修正情報に基づき、判定部81は、修正
箇所のサイズ=8(208−200)バイトと、その修
正箇所に適用する機械語命令列61−2のサイズ=12
バイトとを比較し、前者が後者より大きいので、長命令
列修正方法で修正すると決定する。Further, (correction start position = 200th byte,
Correction end position = 208th byte, applied machine language instruction string = 6
Based on the modification information 1-2), the determination unit 81 determines that the size of the modified part = 8 (208-200) bytes and the size of the machine language instruction sequence 61-2 applied to the modified part = 12.
The byte is compared, and the former is larger than the latter, so it is decided to correct by the long instruction sequence correction method.
【0029】このため、長命令列修正手段83は、図2
に示すように、コンパイルドコードオブジェクト51の
修正箇所の200バイト目の内容をパッチエリア42に
分岐する命令B1で書き換える。更に、追加パッチ領域
9の先頭から16バイトの領域に、今回の修正箇所に適
用すべき機械語命令列61−2を構成する機械語命令M
2−1,M2−2,M2−3と、これらの命令実行後に
修正箇所の終端つまり修正すべき機械語命令列の次の命
令が実行されるように制御をコンパイルドコードオブジ
ェクト51に移す命令B2とを格納する。For this reason, the long instruction sequence correction means 83 is provided in FIG.
As shown in, the contents of the 200th byte of the corrected portion of the compiled code object 51 are rewritten by the instruction B1 branching to the patch area 42. Further, in the 16-byte area from the head of the additional patch area 9, the machine language instruction M that constitutes the machine language instruction sequence 61-2 to be applied to the correction location at this time
2-1 and M2-2 and M2-3, and an instruction that transfers control to the compiled code object 51 so that the end of the correction point, that is, the next instruction of the machine language instruction sequence to be corrected, is executed after these instructions are executed. B2 and are stored.
【0030】次に、修正部85の上述した処理が終了す
ると、ローダ8の修正ファイルロード手段84は、ファ
イル5中の修正後のコンパイルドコードオブジェクト5
1を記憶領域4のコンパイルドコードオブジェクトをロ
ードするための領域41にロードすると共に追加パッチ
領域9の内容を記憶領域4のパッチエリア42にロード
する。Next, when the above-described processing of the modifying unit 85 is completed, the modified file loading means 84 of the loader 8 causes the modified compiled code object 5 in the file 5 to be modified.
1 is loaded into the area 41 for loading the compiled code object in the storage area 4, and the contents of the additional patch area 9 are loaded into the patch area 42 of the storage area 4.
【0031】以上のような処理が行われることにより、
記憶領域4には修正後のコンパイルドコードオブジェク
ト51がロードされたことになる。By performing the above processing,
The modified compiled code object 51 is loaded in the storage area 4.
【0032】次に、記憶領域4上の一関数のコンパイル
ドコードオブジェクトの終端からの領域をパッチエリア
42として使用し、且つ、ファイル5上のコンパイルド
コードオブジェクト51の終端からの領域を追加パッチ
領域9として使用する実施例について説明する。Next, the area from the end of the compiled code object of one function on the storage area 4 is used as the patch area 42, and the area from the end of the compiled code object 51 on the file 5 is additionally patched. An embodiment used as the area 9 will be described.
【0033】図3はこのような実施例においてローダ8
が実行する処理の一例を示すフローチャートである。な
お、図3中、ステップS1〜S4は判定部81で、ステ
ップS5は短命令列修正手段82で、ステップS6〜S
10は長命令列修正手段83で、ステップS11は修正
ファイルロード手段84で実行される。FIG. 3 shows a loader 8 in such an embodiment.
5 is a flowchart showing an example of processing executed by the. Note that in FIG. 3, steps S1 to S4 are the determination unit 81, step S5 is the short instruction sequence correction means 82, and steps S6 to S.
10 is executed by the long instruction sequence correction means 83, and step S11 is executed by the correction file loading means 84.
【0034】図3に示すようにローダ8は動作を開始す
ると、先ず、パッチエリア42の使用領域を管理するポ
インタPEを0に初期化する(S1)。As shown in FIG. 3, when the loader 8 starts its operation, first, the pointer PE for managing the used area of the patch area 42 is initialized to 0 (S1).
【0035】次に、修正情報入力部7から1つの修正情
報を読み込み(S2)、修正情報の終了か否かを判断し
(S3)、終了でなければ、今回ステップS2で読み込
んだ修正情報に基づきコンパイルドコードオブジェクト
51の修正箇所のサイズとその修正箇所に適用すべき機
械語命令列のサイズとを比較し(S4)、前者が後者よ
り大きいか等しければ修正方法を短命令列修正方法と決
定し、前者が後者より小さければ修正方法を長命令列修
正方法と決定する。そして、短命令列修正方法で修正す
る場合はステップS5を実行してステップS2に戻り、
長命令列修正方法で修正する場合はステップS6〜S8
を実行してステップS2に戻る。Next, one piece of correction information is read from the correction information input section 7 (S2), and it is judged whether or not the correction information has ended (S3). If not, the correction information read in step S2 this time is used. Based on this, the size of the modified part of the compiled code object 51 is compared with the size of the machine language instruction string to be applied to the modified part (S4), and if the former is larger than the latter or the same, the modification method is changed to the short instruction string modification method. If the former is smaller than the latter, the modification method is determined to be the long instruction sequence modification method. If the short instruction sequence correction method is used, step S5 is executed and the process returns to step S2.
When the correction is performed by the long instruction sequence correction method, steps S6 to S8
Is executed and the process returns to step S2.
【0036】従って、図2に示した例では、(修正開始
位置=100バイト目,修正終了位置=108バイト
目,適用機械語命令列=61−1)という修正情報の場
合、修正箇所のサイズが修正箇所に適用すべき機械語命
令列61−1のサイズより大きいので、短命令列修正方
法で修正すると判定され(S4でYES)、図2に示す
ように、コンパイルドコードオブジェクト51の修正箇
所の100バイト目の内容を機械語命令列61−1を構
成する機械語命令M1で書き換え、修正箇所の残りの4
バイトを何もしない命令であるNOP命令で書き換える
(S5)。Therefore, in the example shown in FIG. 2, in the case of the correction information (correction start position = 100th byte, correction end position = 108th byte, applied machine language instruction string = 61-1), the size of the correction point Is larger than the size of the machine language instruction sequence 61-1 to be applied to the correction location, it is determined to be corrected by the short instruction sequence correction method (YES in S4), and the compiled code object 51 is corrected as shown in FIG. The content of the 100th byte of the location is rewritten by the machine language instruction M1 that constitutes the machine language instruction sequence 61-1 and the remaining 4 portions of the correction location are rewritten.
The byte is rewritten by the NOP instruction, which is an instruction that does nothing (S5).
【0037】また、(修正開始位置=200バイト目,
修正終了位置=208バイト目,適用機械語命令列=6
1−2)という修正情報の場合、修正箇所のサイズが修
正箇所に適用する機械語命令列61−2のサイズより小
さいので、長命令列修正方法で修正すると判定される
(S4でNO)。Further, (correction start position = 200th byte,
Correction end position = 208th byte, applied machine language instruction string = 6
In the case of the correction information 1-2), since the size of the corrected portion is smaller than the size of the machine language instruction string 61-2 applied to the corrected portion, it is determined that the correction is performed by the long instruction string correction method (NO in S4).
【0038】このため、先ずステップS6が実行され、
修正箇所からパッチエリア42内の今回使用する場所ま
での分岐幅を計算する。Therefore, first, step S6 is executed,
The branch width from the correction location to the location currently used in the patch area 42 is calculated.
【0039】本実施例の場合、コンパイルドコードオブ
ジェクトの終端からの領域をパッチエリアとして使用す
るので、分岐幅は以下の計算式で求められる。 分岐幅=コンパイルドコードオブジェクト51のサイズ −今回の修正箇所の修正開始位置 +ポインタPEの値In the case of this embodiment, since the area from the end of the compiled code object is used as the patch area, the branch width can be calculated by the following formula. Branch width = size of compiled code object 51-correction start position of current correction point + pointer PE value
【0040】なお、コンパイルドコードオブジェクト5
1のサイズは、図4に示すようにコンパイルドコードオ
ブジェクト51中のヘッダ情報中に記述されているもの
を使用する。The compiled code object 5
As the size of 1, the size described in the header information in the compiled code object 51 as shown in FIG. 4 is used.
【0041】従って、コンパイルドコードオブジェクト
51のサイズを1000バイトとすると、今回の修正箇
所の修正開始位置は200バイト目であり、現時点のポ
インタPEの値は0なので、分岐幅は1000−200
+0=800となる。Therefore, assuming that the size of the compiled code object 51 is 1000 bytes, the modification start position of the modification location this time is the 200th byte and the value of the pointer PE at the present time is 0, so the branch width is 1000-200.
+ 0 = 800.
【0042】次に、ステップS7において、分岐幅80
0の分岐命令を生成し、図4に示すように修正箇所の先
頭の内容をその分岐命令B11で書き換える。Next, in step S7, the branch width 80
A branch instruction of 0 is generated, and as shown in FIG. 4, the content at the beginning of the modified portion is rewritten by the branch instruction B11.
【0043】そして、今回の修正に使用する機械語命令
例61−2は12バイトであり、この命令列実行後に修
正箇所の直後に分岐する命令として4バイトが必要なの
で、合計16バイトに相当する値「16」をポインタP
Eに加算し(S8)、ステップS2に戻る。The machine language instruction example 61-2 used for the correction this time is 12 bytes, and 4 bytes are required as an instruction branching immediately after the correction location after execution of this instruction sequence, so that it corresponds to a total of 16 bytes. The value "16" is set to the pointer P
It is added to E (S8), and the process returns to step S2.
【0044】以上のような処理を行い、ステップS3で
YESと判定されたら、即ち修正情報71の全てを処理
し終えたら、ステップS9へ進み、全ての長命令列修正
方法による機械語命令列について、修正エリア分岐命令
を生成して付加し、ファイル5中のコンパイルドコード
オブジェクト51の後ろの追加パッチ領域91にまとめ
て追加する。When the above processing is performed and YES is determined in step S3, that is, when all the correction information 71 has been processed, the process proceeds to step S9, and the machine language instruction sequence by all the long instruction sequence correction methods is processed. , A modified area branch instruction is generated and added, and is added collectively to an additional patch area 91 behind the compiled code object 51 in the file 5.
【0045】図2の場合、長命令列修正方法による修正
箇所は1つだけなので、図4に示すように、その修正箇
所に適用する機械語命令M2−1,M2−2,M2−3
とコンパイルドコードオブジェクト51の208バイト
目に分岐する修正エリア分岐命令B21とが追加パッチ
領域91に格納される。In the case of FIG. 2, since there is only one correction point by the long instruction sequence correction method, as shown in FIG. 4, machine language instructions M2-1, M2-2, M2-3 applied to the correction point.
And the modified area branch instruction B21 that branches at the 208th byte of the compiled code object 51 are stored in the additional patch area 91.
【0046】次に、追加パッチ領域91に格納された機
械語命令列のサイズ分だけ図4のコンパイルドコードオ
ブジェクト51中のサイズ情報を修正し(S10)、そ
の後、ファイル5中の修正後のコンパイルドコードオブ
ジェクト51(追加パッチ領域の内容を含む)を記憶領
域4にロードする。Next, the size information in the compiled code object 51 of FIG. 4 is modified by the size of the machine language instruction string stored in the additional patch area 91 (S10), and then the modified information in the file 5 is corrected. The compiled code object 51 (including the contents of the additional patch area) is loaded into the storage area 4.
【0047】次に、記憶領域4上のコンパイルドコード
オブジェクトの終端からの領域とは別の領域であって或
るレジスタRによって先頭が指示され且つ複数のコンパ
イルドコードオブジェクトで共用される領域をパッチエ
リア42として使用すると共に、追加パッチ領域9をコ
ンパイルドコードオブジェクト毎に備える実施例につい
て説明する。なお、この場合、各追加パッチ領域9は対
応するコンパイルドコードオブジェクトが格納されてい
るファイル5中に設けられているものとする。Next, an area different from the area from the end of the compiled code object on the storage area 4 and having the head designated by a certain register R and shared by a plurality of compiled code objects is set. An embodiment will be described in which the patch area 42 is used and an additional patch area 9 is provided for each compiled code object. In this case, each additional patch area 9 is provided in the file 5 in which the corresponding compiled code object is stored.
【0048】図5および図6はこのような実施例におい
てローダ8が実行する処理の一例を示すフローチャート
である。FIGS. 5 and 6 are flow charts showing an example of the processing executed by the loader 8 in such an embodiment.
【0049】図5および図6の処理が図3の処理と相違
するところは、図3のステップS6〜S8がステップS
21,S22に変更され、図3のステップS9〜S11
がステップS23〜S31に変更されていることなの
で、相違点にかかる動作のみ以下説明する。5 is different from the process of FIG. 3 in that steps S6 to S8 of FIG.
21, S22, and steps S9 to S11 in FIG.
Has been changed to steps S23 to S31, so only the operation relating to the difference will be described below.
【0050】ローダ8は、ステップS4で長命令列修正
方法で修正すると判定した場合、レジスタRおよびスタ
ックを使用する仮のサブルーチン分岐命令を生成し、フ
ァイル5中のコンパイルドコードオブジェクト51の修
正箇所を、その仮のサブルーチン分岐命令および必要に
応じNOP命令で書き換える(S21)。When the loader 8 determines in step S4 that the correction is to be made by the long instruction sequence correction method, it generates a temporary subroutine branch instruction that uses the register R and the stack and corrects the compiled code object 51 in the file 5. Is rewritten with the temporary subroutine branch instruction and the NOP instruction if necessary (S21).
【0051】ここで、仮のサブルーチン分岐命令とは、
現在のアドレスをスタックに積んだ後、命令中に記述さ
れた分岐幅だけ離れた場所へ分岐する命令(本来のサブ
ルーチン分岐命令)であって、その分岐幅が未だ確定し
ておらず従って分岐幅の記述箇所に目印となる記号およ
び或る数値が埋込まれた命令をいう。Here, the temporary subroutine branch instruction is
An instruction (original subroutine branch instruction) that branches to a location separated by the branch width described in the instruction after stacking the current address, and the branch width has not yet been determined. An instruction in which a mark and a certain numerical value are embedded in the description part of.
【0052】このような仮のサブルーチン分岐命令を使
用するのは、本実施例の場合、記憶領域4中のパッチエ
リアを複数のコンパイルドコードオブジェクトで共用す
るが、追加パッチ領域は各コンパイルドコードオブジェ
クトで独立に管理され、そのロードも別々に行われるた
め、現在処理しているコンパイルドコードオブジェクト
の長命令列修正方法による機械語命令列がパッチエリア
のどの箇所以降の領域に格納されるかは、未だこの時点
では確定していないことによる。In the case of the present embodiment, such a temporary subroutine branch instruction is used so that the patch area in the storage area 4 is shared by a plurality of compiled code objects, but the additional patch area is used for each compiled code. Since the object is managed independently and the loading is also done separately, which part of the patch area and after which the machine language instruction string by the method of modifying the long instruction string of the compiled code object currently being processed is stored Is due to not being determined at this point.
【0053】また、仮のサブルーチン分岐命令の分岐幅
部分に埋込まれる数値は、ポインタPEの値である。The numerical value embedded in the branch width portion of the temporary subroutine branch instruction is the value of the pointer PE.
【0054】従って、図2のコンパイルドコードオブジ
ェクト51の200バイト目〜203バイト目の修正箇
所の場合、その時点のポインタPEの値は0なので、分
岐幅部分に仮のサブルーチン分岐命令であることを示す
目印と数値0とが埋込まれた仮のサブルーチン分岐命令
が生成され、これで図7に示すようにファイル5中のコ
ンパイルドコードオブジェクト51の修正箇所の200
バイト目の内容が書き換えられ、続く4バイトの内容が
NOP命令で書き換えられる。Therefore, in the case of the modified portion of the 200th byte to the 203rd byte of the compiled code object 51 of FIG. 2, the value of the pointer PE at that time is 0, so that the branch width portion is a temporary subroutine branch instruction. A temporary subroutine branch instruction in which a mark indicating "1" and the numerical value 0 are embedded is generated, and as a result, 200
The contents of the byte are rewritten, and the contents of the following 4 bytes are rewritten by the NOP instruction.
【0055】なお、ステップS21の実行後、ステップ
S22にて、今回の修正に使用する機械語命令例61−
2のサイズとこの命令列実行後に修正箇所に制御を戻す
命令のサイズとの合計サイズに相当する16バイト分だ
けポインタPEが更新される。After the execution of step S21, in step S22, a machine language instruction example 61- used for this correction is displayed.
The pointer PE is updated by 16 bytes corresponding to the total size of the size of 2 and the size of the instruction to return the control to the corrected position after the execution of this instruction sequence.
【0056】次にステップS3で全ての修正情報の処理
を終えたことを判定すると、全ての長命令列修正方法に
よる機械語命令列について、修正エリアリターン命令を
生成して付加し、図7のファイル5中の追加パッチ領域
92にまとめて格納する(S23)。Next, when it is determined in step S3 that the processing of all modification information has been completed, a modification area return command is generated and added to the machine language command string by all the long command string modification methods, and the modification area return command is added as shown in FIG. The files are collectively stored in the additional patch area 92 in the file 5 (S23).
【0057】ここで、修正エリアリターン命令とは、ス
タックに積まれたアドレスにもどる命令である。Here, the modified area return instruction is an instruction for returning to the address stacked on the stack.
【0058】図2の場合、長命令列修正方法による修正
箇所は1つだけなので、図7に示すように、その修正箇
所に適用する機械語命令M2−1,M2−2,M2−3
と修正エリアリターン命令B22とが追加パッチ領域9
2に格納される。In the case of FIG. 2, since there is only one correction point by the long instruction sequence correction method, as shown in FIG. 7, machine language instructions M2-1, M2-2, M2-3 applied to the correction point.
And the correction area return command B22 are added patch area 9
Stored in 2.
【0059】以上の処理後、以下のようにして、ファイ
ル5中の修正後のコンパイルドコードオブジェクト51
と追加パッチ領域92の内容を記憶領域4にロードす
る。After the above processing, the modified compiled code object 51 in the file 5 is processed as follows.
And the contents of the additional patch area 92 are loaded into the storage area 4.
【0060】先ず、追加パッチ領域92の内容を図7の
記憶領域4のパッチエリア42’にロードする(S2
4)。このとき、パッチエリア42’が空であれば先頭
の領域にロードするが、既に別の内容がロードされてい
る場合にはその直後の領域にロードする。そして、この
ときパッチエリア42’のどの箇所からロードしたかを
示すロード位置を変数Lに設定しておく(S25)。図
7の場合、パッチエリア42’の10バイト目以降にロ
ードしたので、L=10と設定しておく。First, the contents of the additional patch area 92 are loaded into the patch area 42 'of the storage area 4 of FIG. 7 (S2).
4). At this time, if the patch area 42 'is empty, the patch area 42' is loaded in the first area, but if another content is already loaded, it is loaded in the area immediately after that. Then, at this time, the load position indicating from which part of the patch area 42 'the data is loaded is set in the variable L (S25). In the case of FIG. 7, since it is loaded in the 10th byte and later of the patch area 42 ', L = 10 is set.
【0061】次にファイル5中の修正後のコンパイルド
コードオブジェクト51を4バイトずつ読み出し(S2
6)、読み出した4バイトの内容が仮のサブルーチン分
岐命令か否かを判定し(S28)、仮のサブルーチン分
岐命令でなければ(S28でNO)、読み出し内容を図
7の記憶領域4の領域41にロードする(S29)。Next, the modified compiled code object 51 in the file 5 is read by 4 bytes (S2
6), it is determined whether the read 4-byte contents are a temporary subroutine branch instruction (S28), and if the contents are not a temporary subroutine branch instruction (NO in S28), the read contents are stored in the storage area 4 of FIG. It is loaded into 41 (S29).
【0062】他方、読み出し内容が仮のサブルーチン分
岐命令のときは(S28でYES)、変数Lの値を用い
て仮のサブルーチン分岐命令を修正し(S30)、この
修正したサブルーチン分岐命令を記憶領域4の領域41
にロードする(S31)。On the other hand, when the read content is a temporary subroutine branch instruction (YES in S28), the temporary subroutine branch instruction is modified using the value of the variable L (S30), and the modified subroutine branch instruction is stored in the storage area. Area 41 of 4
(S31).
【0063】例えば、図7の仮のサブルーチン分岐命令
B12の場合、分岐幅部分に埋込まれた数値は0であ
り、変数Lの値は10なので、0と10を加算した値1
0を分岐幅として分岐幅部分に書き込んでサブルーチン
分岐命令B13をロードする。For example, in the case of the temporary subroutine branch instruction B12 of FIG. 7, the value embedded in the branch width part is 0 and the value of the variable L is 10, so the value 1 obtained by adding 0 and 10 is 1.
0 is written as a branch width in the branch width portion and the subroutine branch instruction B13 is loaded.
【0064】以上のような処理を繰り返し、ステップS
27でコンパイルドコードオブジェクト51の全ての内
容を処理し終えたことを判定すると処理を終了する。The above processing is repeated, and step S
When it is determined in 27 that all the contents of the compiled code object 51 have been processed, the process ends.
【0065】次に、記憶領域4上のコンパイルドコード
オブジェクトの終端からの領域とは別の領域であって或
るレジスタRによって先頭が指示され且つ複数のコンパ
イルドコードオブジェクトで共用される領域をパッチエ
リアとして使用すると共に、追加パッチ領域9を複数の
コンパイルドコードオブジェクトで共用されるパッチ格
納ファイルで構成して関数単位のパッチ内容をコンパイ
ルドコードオブジェクト単位に管理するのではなく一つ
の言語処理システムにおける全関数のパッチ内容を一括
して格納管理する実施例について説明する。Next, an area different from the area from the end of the compiled code object in the storage area 4, the area whose head is designated by a certain register R and which is shared by a plurality of compiled code objects is set. It is used as a patch area, and the additional patch area 9 is configured by a patch storage file shared by a plurality of compiled code objects to manage the patch contents in function units in compiled code object units, and to perform one language processing. An example of collectively storing and managing patch contents of all functions in the system will be described.
【0066】図8はこのような実施例においてローダ8
が実行する処理の一例を示すフローチャートである。FIG. 8 shows a loader 8 in such an embodiment.
5 is a flowchart showing an example of processing executed by the.
【0067】図8の処理が図3の処理と相違するところ
は、図3のステップS1とS2の間にステップS41,
S42が挿入され、ステップS6〜S8がステップS4
3〜S45に変更され、ステップS9〜S11がステッ
プS46,S47に変更されていることである。以下、
相違点にかかる動作のみ説明する。The process of FIG. 8 is different from the process of FIG. 3 in that step S41, step S41, and step S41 of FIG.
S42 is inserted, and steps S6 to S8 are step S4.
3 to S45, and steps S9 to S11 are changed to steps S46 and S47. Less than,
Only the operation related to the difference will be described.
【0068】ローダ8は、ロードすべきコンパイルドコ
ードオブジェクトが複数存在する場合、先ず、その1つ
に注目し(S41)、この注目したコンパイルドコード
オブジェクトについてステップS2〜S5,S43〜S
45の処理を行い、それが終了すれば別のコンパイルド
コードオブジェクトに注目し同様の処理を行う。そし
て、全てのコンパイルドコードオブジェクトについてス
テップS2〜S5,S43〜S45の処理を行うと(S
42でYES)、ステップS46,S47の処理を行
う。When there are a plurality of compiled code objects to be loaded, the loader 8 first pays attention to one of them (S41), and steps S2 to S5 and S43 to S for this noted compiled code object.
The process of 45 is performed, and when the process is completed, another compiled code object is focused on and the same process is performed. When the processes of steps S2 to S5 and S43 to S45 are performed for all the compiled code objects (S
(YES in 42), the processes of steps S46 and S47 are performed.
【0069】或るコンパイルドコードオブジェクトを処
理している過程において、ローダ8は、ステップS4で
長命令列修正方法で修正すると判定すると、レジスタR
およびスタックを使用するサブルーチン分岐命令を生成
し、ファイル5中のコンパイルドコードオブジェクト5
1の修正箇所を、そのサブルーチン分岐命令および必要
に応じNOP命令で書き換える(S43)。In the process of processing a certain compiled code object, if the loader 8 determines in step S4 to modify by the long instruction string modifying method, the register R
And a subroutine branch instruction that uses the stack is generated, and the compiled code object 5 in the file 5 is generated.
The correction point of 1 is rewritten by the subroutine branch instruction and the NOP instruction if necessary (S43).
【0070】本実施例の場合、関数に対する全てのパッ
チ内容は図9に示す共通のパッチ格納ファイル93に格
納され且つその内容が図9のパッチエリア42”にその
まま格納されるため、上記のサブルーチン分岐命令の分
岐幅はこの時点で決定できる。即ち、現時点のポインタ
PEの値そのものが分岐幅となる。In the case of this embodiment, all the patch contents for the function are stored in the common patch storage file 93 shown in FIG. 9 and the contents are stored as they are in the patch area 42 "of FIG. The branch width of the branch instruction can be determined at this point, that is, the value itself of the pointer PE at the current point becomes the branch width.
【0071】次に、修正エリアリターン命令を生成し、
今回の長命令列修正方法による機械語命令列に付加し、
パッチ格納ファイル93に格納する(S44)。そし
て、ポインタPEの値をその機械語命令列および修正エ
リアリターン命令のサイズ分だけ更新する(S45)。Next, a modified area return instruction is generated,
Added to the machine language instruction sequence by this long instruction sequence correction method,
It is stored in the patch storage file 93 (S44). Then, the value of the pointer PE is updated by the size of the machine language instruction string and the modified area return instruction (S45).
【0072】従って、図2のコンパイルドコードオブジ
ェクト51の200バイト目〜203バイト目の修正箇
所の場合、その時点のポインタPEの値は0なので、図
9に示すように分岐幅=0のサブルーチン分岐命令B1
3が生成され、これで図9に示すようにコンパイルドコ
ードオブジェクト51の修正箇所の200バイト目の内
容が書き換えられ、続く4バイトの内容がNOP命令で
書き換えられる。Therefore, in the case of the corrected portion of the 200th byte to the 203rd byte of the compiled code object 51 of FIG. 2, the value of the pointer PE at that time is 0, so that the branch width = 0 subroutine as shown in FIG. Branch instruction B1
3, the contents of the 200th byte of the modified portion of the compiled code object 51 are rewritten, and the contents of the following 4 bytes are rewritten by the NOP instruction.
【0073】ローダ8はコンパイルドコードオブジェク
ト51に対する処理を終えると、次に処理すべきコンパ
イルドコードオブジェクトがあれば同様の動作を行う。
ここで、図9に示すように別のコンパイルドコードオブ
ジェクト51’を格納するファイル5’があり、その修
正箇所を長命令列修正方法で修正する場合、その修正箇
所に挿入するサブルーチン分岐命令の分岐幅は、その時
点のポインタPEの値16が使用され、またその長命令
列修正方法で使用する機械語命令列を構成する機械語命
令M3−1,M3−2と修正エリアリターン命令B23
とはパッチ格納ファイル93中の上記修正エリアリター
ン命令B22の直後に格納される。When the loader 8 finishes the processing for the compiled code object 51, it performs the same operation if there is a compiled code object to be processed next.
Here, as shown in FIG. 9, there is a file 5'that stores another compiled code object 51 ', and when the correction location is to be modified by the long instruction string modification method, the subroutine branch instruction to be inserted at the modification location As the branch width, the value 16 of the pointer PE at that time is used, and the machine language instructions M3-1 and M3-2 and the correction area return instruction B23 that form the machine language instruction sequence used in the long instruction sequence correction method are used.
Is stored immediately after the correction area return command B22 in the patch storage file 93.
【0074】さて、以上のようにして必要とする全ての
コンパイルドコードオブジェクトに対する修正処理を終
えると(S42でYES)、ローダ8は、修正後のコン
パイルドコードオブジェクト51,51’を記憶領域4
にロードし(S46)、パッチ格納ファイル93の内容
をパッチエリア42”にロードし(S47)、処理を終
える。When the modification process for all the required compiled code objects is completed as described above (YES in S42), the loader 8 stores the modified compiled code objects 51, 51 'in the storage area 4
(S46), the contents of the patch storage file 93 are loaded into the patch area 42 ″ (S47), and the process is terminated.
【0075】[0075]
【発明の効果】以上説明したように、本発明によれば、
既に存在するコンパイルドコードオブジェクトを直接に
修正することができる。As described above, according to the present invention,
You can directly modify an already existing compiled code object.
【0076】従って、ソースプログラムを再コンパイル
することなく修正済みのコンパイルドコードオブジェク
トを得ることができ、修正したい機械語命令列が全体の
ほんの一部である場合には特に効果がある。Therefore, a modified compiled code object can be obtained without recompiling the source program, and it is particularly effective when the machine language instruction sequence to be modified is only a part of the whole.
【0077】また、元のコンパイルドコードオブジェク
トが生成されたときのコンパイル環境を再現できない場
合でも、修正したコンパイルドコードオブジェクトを生
成することができる。Further, even when the compilation environment at the time when the original compiled code object is generated cannot be reproduced, the modified compiled code object can be generated.
【図1】本発明を適用した言語処理システムの一例を示
すブロック図である。FIG. 1 is a block diagram showing an example of a language processing system to which the present invention is applied.
【図2】修正に使う機械語命令列,修正情報,追加パッ
チ領域の内容の一例と修正後のコンパイルドコードオブ
ジェクトの例を示す図である。FIG. 2 is a diagram showing an example of the contents of a machine language instruction string used for modification, modification information, an additional patch area, and an example of a compiled code object after modification.
【図3】記憶領域上の一関数のコンパイルドコードオブ
ジェクトの終端からの領域をパッチエリアとして使用
し、且つ、ファイル上のコンパイルドコードオブジェク
トの終端からの領域を追加パッチ領域として使用する実
施例においてローダが実行する処理の一例を示すフロー
チャートである。FIG. 3 is an embodiment in which an area from the end of a compiled code object of one function on a storage area is used as a patch area, and an area from the end of a compiled code object on a file is used as an additional patch area. 5 is a flowchart showing an example of processing executed by a loader in FIG.
【図4】ファイル上のコンパイルドコードオブジェクト
の終端からの領域に設定された追加パッチ領域に格納さ
れた命令列の例とその命令で修正されるコンパイルドコ
ードオブジェクトの修正箇所の内容例とを示す図であ
る。FIG. 4 shows an example of an instruction string stored in an additional patch area set in an area from the end of a compiled code object on a file, and an example of contents of a modified portion of a compiled code object modified by the instruction. FIG.
【図5】記憶領域上のコンパイルドコードオブジェクト
の終端からの領域とは別の領域であって所定のレジスタ
によって先頭が指示され且つ複数のコンパイルドコード
オブジェクトで共用される領域をパッチエリアとして使
用すると共に、追加パッチ領域をコンパイルドコードオ
ブジェクト毎に備える実施例においてローダが実行する
処理の一例の一部を示すフローチャートである。FIG. 5 is an area different from the area from the end of the compiled code object in the storage area, where the head is designated by a predetermined register and shared by a plurality of compiled code objects is used as a patch area. 15 is a flowchart showing a part of an example of processing executed by a loader in the embodiment in which an additional patch area is provided for each compiled code object.
【図6】図5の処理の続きの処理の一例を示すフローチ
ャートである。FIG. 6 is a flowchart showing an example of a process that follows the process of FIG.
【図7】記憶領域上のコンパイルドコードオブジェクト
の終端からの領域とは別の領域であって所定のレジスタ
によって先頭が指示され且つ複数のコンパイルドコード
オブジェクトで共用されるパッチエリアの内容例と、コ
ンパイルドコードオブジェクト毎に備わる追加パッチ領
域の内容例と、修正後のコンパイルドコードオブジェク
トの内容例とを示す図である。FIG. 7 shows an example of the contents of a patch area which is different from the area from the end of the compiled code object in the storage area and whose head is designated by a predetermined register and which is shared by a plurality of compiled code objects. FIG. 7 is a diagram showing an example of contents of an additional patch area provided for each compiled code object and an example of contents of a compiled code object after correction.
【図8】記憶領域上のコンパイルドコードオブジェクト
の終端からの領域とは別の領域であって所定のレジスタ
によって先頭が指示され且つ複数のコンパイルドコード
オブジェクトで共用される領域をパッチエリアとして使
用すると共に、追加パッチ領域を複数のコンパイルドコ
ードオブジェクトで共用されるパッチ格納ファイルで構
成した実施例ににおいてローダが実行する処理の一例を
示すフローチャートである。FIG. 8 is an area different from the area from the end of the compiled code object in the storage area, the area whose head is designated by a predetermined register and shared by a plurality of compiled code objects is used as a patch area. 15 is a flowchart showing an example of processing executed by the loader in the embodiment in which the additional patch area is configured by a patch storage file shared by a plurality of compiled code objects.
【図9】記憶領域上のコンパイルドコードオブジェクト
の終端からの領域とは別の領域であって所定のレジスタ
によって先頭が指示され且つ複数のコンパイルドコード
オブジェクトで共用されるパッチエリアの内容例と、パ
ッチ格納ファイルの内容例と、修正後のコンパイルドコ
ードオブジェクトの内容例とを示す図である。FIG. 9 shows an example of the contents of a patch area which is different from the area from the end of the compiled code object in the storage area and whose head is designated by a predetermined register and which is shared by a plurality of compiled code objects. FIG. 5 is a diagram showing an example of contents of a patch storage file and an example of contents of a compiled code object after correction.
1…言語処理システム 2…コンパイラ 3…インタプリタ 4…記憶領域 5…ファイル 6…パッチイメージ格納部 7…修正情報入力部 8…ローダ 9,91…追加パッチ領域 41…コンパイルドコードオブジェクトをロードする領
域 42,42’,42”…パッチエリア 51,51’…コンパイルドコードオブジェクト 61,61−1,61−2…機械語命令列 71…修正情報 81…判定部 82…短命令列修正手段 83…長命令列修正手段 84…修正ファイルロード手段 85…修正部 93…パッチ格納ファイル1 ... Language processing system 2 ... Compiler 3 ... Interpreter 4 ... Storage area 5 ... File 6 ... Patch image storage section 7 ... Correction information input section 8 ... Loader 9, 91 ... Additional patch area 41 ... Area for loading compiled code object 42, 42 ', 42 "... Patch area 51, 51' ... Compiled code object 61, 61-1, 61-2 ... Machine language instruction sequence 71 ... Correction information 81 ... Judgment unit 82 ... Short instruction sequence correction means 83 ... Long instruction sequence correction means 84 ... Correction file loading means 85 ... Correction section 93 ... Patch storage file
Claims (4)
ドコードオブジェクトを出力するコンパイラと該コンパ
イラが出力したコンパイルドコードオブジェクトを記憶
領域にロードして解釈実行するインタプリタとを含む言
語処理システムにおけるコンパイルドコードオブジェク
トのパッチ処理方式において、 修正対象のコンパイルドコードオブジェクトを格納する
ファイルと、 修正内容である機械語命令列を格納するパッチイメージ
格納部と、 前記修正対象のコンパイルドコードオブジェクトの修正
位置と該修正位置に適用すべき前記パッチイメージ格納
部中の機械語命令列との関係を示す修正情報を入力する
修正情報入力手段と、 追加パッチ領域とを備え、且つ、 前記インタプリタ内のローダに、 前記入力された修正情報に基づき、前記ファイル中のコ
ンパイルドコードオブジェクトの修正箇所を認識すると
共に該修正箇所を短命令列修正方法で修正するか、長命
令列修正方法で修正するかを判定する判定部と、 該判定部により短命令列修正方法で修正すると判定され
た前記コンパイルドコードオブジェクトの修正箇所を前
記パッチイメージ格納部に格納された該当する機械語命
令列で書き換える短命令列修正手段と、 前記判定部により長命令列修正方法で修正すると判定さ
れた前記コンパイルドコードオブジェクトの修正箇所を
パッチエリアに分岐する命令で書き換えると共に、前記
パッチイメージ格納部に格納された該当する機械語命令
列と前記修正箇所へ制御を戻す命令とを前記追加パッチ
領域に格納する長命令列修正手段と、 前記修正後のコンパイルドコードオブジェクトおよび前
記追加パッチ領域の内容を前記記憶領域にロードする修
正ファイルロード手段とを備えることを特徴とするコン
パイルドコードオブジェクトのパッチ処理方式。1. Compiled code in a language processing system including a compiler that translates a source program and outputs a compiled code object, and an interpreter that loads the compiled code object output by the compiler into a storage area and interprets and executes the object. In the object patch processing method, a file that stores a compiled code object to be modified, a patch image storage unit that stores a machine language instruction sequence that is the content of modification, a modification position of the compiled code object to be modified, and Correction information input means for inputting correction information indicating a relationship with a machine language instruction sequence in the patch image storage unit to be applied to a correction position; and an additional patch area, and a loader in the interpreter, Based on the correction information entered, The determination unit that recognizes the correction location of the compiled code object in the file and determines whether the correction location is corrected by the short instruction sequence correction method or the long instruction sequence correction method, and A short instruction sequence correcting means for rewriting a modified portion of the compiled code object determined to be corrected by the instruction sequence correction method with a corresponding machine language instruction sequence stored in the patch image storage unit; and a long instruction sequence by the determination unit. The modified location of the compiled code object determined to be modified by the modification method is rewritten with an instruction for branching to the patch area, and control is returned to the corresponding machine language instruction string stored in the patch image storage section and the modified location. Instructions for storing in the additional patch area, and the compiled code object after the modification. -Object and patching method compiled code object, characterized in that it comprises a modified file loading means for loading the contents of the additional patch area in the storage area.
ドオブジェクトの終端からの領域を前記パッチエリアと
して使用すると共に、前記ファイル上の前記コンパイル
ドコードオブジェクトの終端からの領域を前記追加パッ
チ領域として使用し、且つ、 前記長命令列修正手段は、前記判定部により長命令列修
正方法で修正すると判定された前記コンパイルドコード
オブジェクトの修正箇所を前記パッチエリアの今回使用
する領域に分岐する命令で書き換えると共に、前記パッ
チイメージ格納部に格納された該当する機械語命令列と
前記修正箇所へ分岐する命令とを前記追加パッチ領域に
格納し、更に前記追加パッチ領域に格納した機械語命令
列のサイズ分だけ前記コンパイルドコードオブジェクト
のサイズ情報を修正することを特徴とする請求項1記載
のコンパイルドコードオブジェクトのパッチ処理方式。2. An area from the end of the compiled code object on the storage area is used as the patch area, and an area from the end of the compiled code object on the file is used as the additional patch area. In addition, the long instruction sequence correction means rewrites the correction location of the compiled code object determined by the determination unit to be corrected by the long instruction sequence correction method with an instruction branching to the area currently used in the patch area. At the same time, the corresponding machine language instruction sequence stored in the patch image storage unit and the instruction branching to the correction location are stored in the additional patch area, and the size of the machine language instruction sequence stored in the additional patch area is further stored. A contract characterized by only modifying the size information of the compiled code object. Patching scheme compiled code object claim 1.
ブジェクトの終端からの領域とは別の領域であって所定
のレジスタによって先頭が指示され且つ複数のコンパイ
ルドコードオブジェクトで共用される領域を前記パッチ
エリアとして使用すると共に、前記追加パッチ領域をコ
ンパイルドコードオブジェクト毎に備え、且つ、 前記長命令列修正手段は、前記判定部により長命令列修
正方法で修正すると判定された前記コンパイルドコード
オブジェクトの修正箇所を、前記レジスタおよびスタッ
クを使用して前記パッチエリアに分岐する仮のサブルー
チン分岐命令で書き換えると共に、前記パッチイメージ
格納部に格納された該当する機械語命令列と前記修正箇
所へ前記スタックを使用して制御を戻すリターン命令と
を前記追加パッチ領域に格納し、 前記修正ファイルロード手段は、前記修正後のコンパイ
ルドコードオブジェクトおよびそれに対応する前記追加
パッチ領域の内容を前記記憶領域にロードする際に、前
記追加パッチ領域の内容をロードした前記パッチエリア
の領域に基づき、前記修正後のコンパイルドコードオブ
ジェクト中の前記仮のサブルーチン分岐命令を修正する
ことを特徴とする請求項1記載のコンパイルドコードオ
ブジェクトのパッチ処理方式。3. The patch is an area different from the area from the end of the compiled code object in the storage area, the area whose head is designated by a predetermined register and shared by a plurality of compiled code objects. While being used as an area, the additional patch area is provided for each compiled code object, and the long instruction sequence correction means is for the compiled code object determined to be corrected by the determination unit by the long instruction sequence correction method. The correction location is rewritten with a temporary subroutine branch instruction for branching to the patch area using the register and stack, and the corresponding machine language instruction string stored in the patch image storage unit and the stack are moved to the correction location. Use the return command to return control to the additional patch area The correction file loading means loads the contents of the additional patch area into the storage area when the corrected compiled code object and the contents of the additional patch area corresponding thereto are loaded into the storage area. 2. The patch processing method for a compiled code object according to claim 1, wherein the temporary subroutine branch instruction in the modified compiled code object is modified based on the area.
ブジェクトの終端からの領域とは別の領域であって所定
のレジスタによって先頭が指示され且つ複数のコンパイ
ルドコードオブジェクトで共用される領域を前記パッチ
エリアとして使用すると共に、前記追加パッチ領域を複
数のコンパイルドコードオブジェクトで共用されるパッ
チ格納ファイルで構成し、且つ、 前記長命令列修正手段は、前記判定部により長命令列修
正方法で修正すると判定された前記コンパイルドコード
オブジェクトの修正箇所を、前記レジスタおよびスタッ
クを使用して前記パッチエリアの今回使用する領域に分
岐するサブルーチン分岐命令で書き換えると共に、前記
パッチイメージ格納部に格納された該当する機械語命令
列と前記修正箇所へ前記スタックを使用して制御を戻す
リターン命令とを前記パッチ格納ファイルに格納し、 前記修正ファイルロード手段は、前記修正後のコンパイ
ルドコードオブジェクトを前記記憶領域にロードすると
共に前記パッチ格納ファイルの内容を前記パッチエリア
にロードすることを特徴とする請求項1記載のコンパイ
ルドコードオブジェクトのパッチ処理方式。4. The patch is an area different from the area from the end of the compiled code object in the storage area, the area whose head is designated by a predetermined register and which is shared by a plurality of compiled code objects. When used as an area, the additional patch area is configured by a patch storage file shared by a plurality of compiled code objects, and the long instruction sequence correction means corrects the long instruction sequence correction method by the determination unit. The corrected location of the determined compiled code object is rewritten by a subroutine branch instruction for branching to the area currently used in the patch area by using the register and stack, and the corresponding location stored in the patch image storage section is rewritten. Use the stack for the machine language instruction string and the modified part And a return instruction for returning control to the patch storage file, the modified file loading means loads the modified compiled code object into the storage area and the contents of the patch storage file into the patch area. The method for patching a compiled code object according to claim 1, wherein the patch processing method is for loading.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP4089728A JPH05257672A (en) | 1992-03-13 | 1992-03-13 | Patch processing system for compiled code object |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP4089728A JPH05257672A (en) | 1992-03-13 | 1992-03-13 | Patch processing system for compiled code object |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH05257672A true JPH05257672A (en) | 1993-10-08 |
Family
ID=13978822
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP4089728A Pending JPH05257672A (en) | 1992-03-13 | 1992-03-13 | Patch processing system for compiled code object |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH05257672A (en) |
-
1992
- 1992-03-13 JP JP4089728A patent/JPH05257672A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP4931583B2 (en) | Method and apparatus for performing native binding | |
| US7992131B2 (en) | Macro to instantiate a variable used with a first macro requiring use of a second macro suitable for said variable | |
| US20060026575A1 (en) | Method and system of adaptive dynamic compiler resolution | |
| US6983458B1 (en) | System for optimizing data type definition in program language processing, method and computer readable recording medium therefor | |
| US7386843B2 (en) | Method and system for register allocation | |
| US5832273A (en) | System for deleting redundant instructions from high level language source code containing in-line assembly instructions | |
| JPH09152961A (en) | Method and apparatus for attaching version setting information to software program | |
| EP0833246A2 (en) | A method of producing a computer program | |
| EP1728155B1 (en) | Method and system for performing link-time code optimization without additional code analysis | |
| WO2004097631A2 (en) | Architecture for generating intermediate representations for program code conversion | |
| US20050071809A1 (en) | System and method for serializing objects in a compiled programming language | |
| JP3539613B2 (en) | Array summary analysis method for loops containing loop jump statements | |
| US7810086B2 (en) | Safe code-motion of dangerous instructions during compiler optimization | |
| US20010042241A1 (en) | Apparatus and method for executing program using just-in time-compiler system | |
| Bravenboer et al. | Rewriting strategies for instruction selection | |
| JPH05257739A (en) | Patch processing system for compiled code object | |
| JP2864955B2 (en) | Patch processing method for compiled code objects | |
| Hawblitzel et al. | A garbage-collecting typed assembly language | |
| JP3596570B2 (en) | Method of allocating classes to main storage | |
| JP3889227B2 (en) | Program execution device, program execution method, recording medium, and control program | |
| Leroy | Compiling functional languages | |
| Strecker | Investigating type-certifying compilation with Isabelle | |
| JPH04321135A (en) | Instruction system for object correction of compiler | |
| Scott | Towards a Verified Compiler from Cogent to LLVM | |
| WO2022215185A1 (en) | Code correction device and code correction method |