JP3776132B2 - Microprocessor improvements - Google Patents

Microprocessor improvements Download PDF

Info

Publication number
JP3776132B2
JP3776132B2 JP50436199A JP50436199A JP3776132B2 JP 3776132 B2 JP3776132 B2 JP 3776132B2 JP 50436199 A JP50436199 A JP 50436199A JP 50436199 A JP50436199 A JP 50436199A JP 3776132 B2 JP3776132 B2 JP 3776132B2
Authority
JP
Japan
Prior art keywords
target
host
instruction
instructions
microprocessor
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.)
Expired - Fee Related
Application number
JP50436199A
Other languages
Japanese (ja)
Other versions
JP2001519953A (en
Inventor
クメリク,ロバート・エフ
ディッツェル,デイヴィッド・アール
ケリー,エドマンド・ジェイ
ハンター,コリン・ビー
レアード,ダグラス・エイ
ウィング,マルコム・ジョン
ザイナー,グレゴルツ・ビー
Original Assignee
トランスメタ・コーポレーション
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by トランスメタ・コーポレーション filed Critical トランスメタ・コーポレーション
Publication of JP2001519953A publication Critical patent/JP2001519953A/en
Application granted granted Critical
Publication of JP3776132B2 publication Critical patent/JP3776132B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/52Binary to binary
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/3017Runtime instruction translation, e.g. macros
    • G06F9/30174Runtime instruction translation, e.g. macros for non-native instruction set, e.g. Javabyte, legacy code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3836Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
    • G06F9/3842Speculative instruction execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3861Recovery, e.g. branch miss-prediction, exception handling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3885Concurrent instruction execution, e.g. pipeline, look ahead using a plurality of independent parallel functional units
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45554Instruction set architectures of guest OS and hypervisor or native processor differ, e.g. Bochs or VirtualPC on PowerPC MacOS

Description

発明の背景
発明の分野
本発明は、コンピュータ・システムに関し、更に特定すれば、マイクロプロセッサを改良するための方法および装置に関するものである。
従来技術の歴史
特定のマイクロプロセッサ・ファミリを中心に設計された、コンピュータ上で走るアプリケーション・プログラムは、数千種にも上る。既存のプログラムでは、カリフォルニア州サンタクララのIntel Corporation(インテル社)が設計し製造する、”X86”ファミリ・マイクロプロセッサ(Intel8088、Intel8086、Intel80186、Intel80286、i386、i486、および種々のPentiumマイクロプロセッサの発展型を含む:IntelおよびPentiumは登録商標)を用いたコンピュータ(IBM互換パーソナル・コンピュータと一般的に呼ばれている)上で走るように設計されたものの数が最も多い。他のプロセッサ・ファミリを用いたコンピュータ上で走るように設計された他のプログラムの例も多くある。これらのコンピュータ上で走る多くのアプリケーション・プログラムがあるので、かかるコンピュータ、特にX86プログラムを処理するように設計されたプログラムにおいて使用可能なマイクロプロセッサの市場は膨大である。マイクロプロセッサの市場は大きいだけでなく、非常に収益性が高い。
多数のアプリケーション・プログラムを走らせることができるマイクロプロセッサの市場は大きく収益性が高いが、競争力のある新たなマイクロプロセッサを設計することは非常に難しい。例えば、X86プロセッサ・ファミリは長年にわたって存在し続け、これらのプロセッサは販売および使用されたコンピュータの大部分に含まれるが、X86のプログラムを走らせることができる競合プロセッサで成功したものは殆どない。その理由は多くある。
成功するためには、このプロセッサ・ファミリに設計されたプログラム全て(オペレーティング・システムおよび旧来のプログラムも含む)を、しかも既存のプロセッサと同じくらい速く走らせることができるマイクロプロセッサでなければならず、更に既存のプロセッサよりもコストを抑えなければならない。加えて、経済的に成功するためには、新たなマイクロプロセッサは、これらの条件の少なくとも1つにおいて、既存のプロセッサよりも勝っていることによって、既存の認められているプロセッサを差し置いて新たなプロセッサを選択する理由を、購入者に与えなければならない。
最新のマイクロプロセッサと同じ位速くマイクロプロセッサを走らせるのは困難であり、かつ費用もかかる。プロセッサは、ロード、シフト、加算、格納のような原始な動作および同様の低レベルの動作によって命令を実行し、アプリケーション・プログラムによって与えられるいずれの命令を実行する際にも、このような原始な命令にのみ応答する。例えば、X86のような、命令が比較的高いレベルで実行すべきプロセスを指定することができる、複雑命令セット・コンピュータ(CISC:complicated instruction set computer)の命令を走らせるように設計されたプロセッサは、従来よりリード・オンリ・メモリ(ROM)を含み、その中にいわゆるマイクロ命令を格納している。各マイクロ命令は、一連の原始命令を含み、これらを連続して走らせることにより、高いレベルのCISC命令によって命令された結果がもたらされる。典型的に、"add A to B"(AをBに加算する)というCISC命令がデコードされると、この"add A to B"命令の機能を実行するマイクロ命令が格納されているROM内のアドレスを参照する。このマイクロ命令がロードされ、その原始命令を順次走らせることによって、"add A to B"命令を実行する。このようなCISCコンピュータでは、マイクロ命令内の原始動作は、プログラムの実行中決して変化させることはできない。各CISC命令は、命令をデコードし、マイクロ命令をアドレスしてこれを取り込み、当該マイクロ命令内に与えられている順序で一連の原始動作を走らせることによってのみ、走らせることができる。マイクロ命令を走らせる毎に、同じシーケンスが発生しなければならない。
X86アプリケーションを走らせるための先進のプロセッサは、多数の技術を利用し、可能な限り高速に、しかも経済的に低い価格で処理を行おうとしている。プロセッサが走ることができる速度を加速させるための公知のハードウエア技術を実装する新たなプロセッサは、いずれも処理ハードウエアの洗練性を高める必要がある。これには、ハードウエア・コストの増大が必要となる。
例えば、複数の処理チャネルを用いて一度に2つ以上の動作を実行するスーパースカラー・マイクロプロセッサには、多数の追加要件がある。最も基本的なレベルでは、単純なスーパースカラー・マイクロプロセッサは、各アプリケーション命令をマイクロ命令にデコードし、当該アプリケーション命令の機能を実行することができる。そこで、単純なスーパースカラー・マイクロプロセッサは、2つのマイクロ命令が同じハードウエア資源を要求せず、一方のマイクロ命令の実行が他方のマイクロ命令の処理結果に依存しないのであれば、これら2つのマイクロ命令を一緒に走らせるようにスケジューリングを行う。
更に進んだスーパースカラー・マイクロプロセッサには、典型的に、各アプリケーション命令を一連の原始命令にデコードし、これらの原始命令の順序を変更し、最も効率的な実行順序でスケジューリングを行うことを可能にするものがある。これには、個々の原始動作各々をアドレスし、取り込むことが必要となる。順序変更を行うためには、プロセッサは、他の原始命令から生ずるデータを必要とする原始命令を、他の原始命令が必要なデータを生成した後に、実行することを保証できなければならない。このようなスーパースカラー・マイクロプロセッサは、一緒に走らせる2つの原始命令が同じハードウエア資源を要求しないことを保証しなければならない。また、このようなプロセッサは、条件付き分岐を解決し、その後に分岐動作の効果が完了することを可能にしなければならない。
このように、スーパースカラー・マイクロプロセッサは、複数の原始命令の関係を互いに比較し、これら原始命令のシーケンスを並び替え、あらゆる命令をスケジューリングして実行するために、広範なハードウエアを必要とする。処理チャネル数が増大するに連れて、これらスーパースカラー加速技術を達成するためのハードウエアの量およびコストはほぼ4倍に増大する。これらのハードウエア要件は全て、関連する回路の複雑化および高コスト化を招く。マイクロ命令を扱う際と同様、アプリケーション命令を実行する毎に、スーパースカラー・マイクロプロセッサは、その比較的複雑なアドレシング・ハードウエアおよび取り込みのためのハードウエアを用いてこれらの原始命令の各々を取り込まなければならず、他の原始命令およびハードウエアの使用状況に基づいてこれらの原始命令の並び替えおよび再スケジュールを行わなければならず、更に、再スケジュールした原始命令全てを実行しなければならない。各アプリケーション命令を実行する度に、ハードウエア・シーケンス全体でこれを走らせなければならないので、スーパースカラー・プロセッサがその命令を実行可能な速度は限定される。
更に、これら種々のハードウエア技術が処理速度を高めるとしても、このようなハードウエアを備えるために伴う複雑性のために、このようなマイクロプロセッサの大幅なコスト上昇を招くことになる。例えば、インテルi486DX4プロセッサは、約150万個のトランジスタを使用する。Intel Pentiumのような基本的なスーパースカラー・マイクロプロセッサにおいて、2つのチャネルによって命令を処理するために必要な依存性およびスケジューリングのチェックを行うために必要なハードウエアを追加するには、300万個以上のトランジスタの使用が必要となる。異なるターゲット命令から派生する原始命令間の並び替えを行い、投機的実行(speculative execution)を行い、レジスタの名称変更を可能とし、分岐予測を行うためにハードウエアを追加すると、トランジスタ数は、Intel Pentium Pro(登録商標)では、600万個以上にも増大する。したがって、動作速度を高めるためにハードウエアを追加する毎に、最新のマイクロプロセッサではトランジスタ数が激増したことがわかる。
これら公知の技術を用いても、既存のマイクロプロセッサよりも高速のマイクロプロセッサは生産することができない場合もある。何故なら、製造者は既存のマイクロプロセッサの動作を加速させる公知の技術で、経済的に実現可能なものを利用するからである。その結果、より速いプロセッサの設計は非常に困難でありしかも費用がかかる作業となる。
プロセッサのコスト削減も非常に困難である。先に例示したように、十分な能力のあるプロセッサを生産するハードウエア加速技術は非常に高価である。新たなプロセッサを設計しようとする者は、ハードウエアを生産する設備を獲得しなければならない。このような設備の獲得は非常に困難である。何故なら、チップ製造者は典型的に少量のデバイスに資産を費やすことはない。チップ製造設備を生産するために必要な資本投下は非常に大きく、殆どの会社に可能な範囲を超えている。
競合プロセッサと少なくとも同じ位速く、あるプロセッサ・ファミリに設計されたアプリケーション・プログラムの全てを走らせる新たなプロセッサを設計することができる者がいるとしても、競合プロセッサの価格は、十分な利益を含んでおり、いずれの競合も大幅な値下げに直面することは確実である。
ハードウエアの複雑度を高めることによって競争力のあるプロセッサを設計することは非常に困難であるが、特定のマイクロプロセッサ・ファミリ(ターゲット・マイクロプロセッサ)に設計されたアプリケーション・プログラム(ターゲット・アプリケーション・プログラム)を走らせる他の方法として、ソフトウエアで他のより速いマイクロプロセッサ(ホスト・マイクロプロセッサ)上でターゲット・マイクロプロセッサをエミュレートすることが行われてきた。これは、各段に安価にこれらのプログラムを走らせる方法である。何故なら、より速いマイクロプロセッサ上でアプリケーション・プログラムを走らせる、ある形態のエミュレーション・ソフトウエアを追加しさえすればよいからである。エミュレーション・ソフトウエアは、ターゲット・プロセッサ・ファミリに書かれたアプリケーション・プログラムのターゲット命令を、ホスト・プロセッサによって実行可能なホスト命令に変更する。これら変更した命令を、より速いホスト・マイクロプロセッサ上のオペレーティング・システムの制御の下で走らせる。
ターゲット・コンピュータのプロセッサよりも速いプロセッサを有するホスト・コンピュータ上で、ターゲット・アプリケーションを走らせることを可能にする設計には、これまでにも多種多様なものがある。一般に、エミュレーション・ソフトウエアを用いてターゲット・プログラムを実行するホスト・コンピュータは、縮小命令セット(RISC:reduced instruction set)マイクロプロセッサを利用する。何故なら、RISCプロセッサは、理論上他の形式のプロセッサよりも単純で、その結果より速く走らせることができるからである。
しかしながら、エミュレータ・ソフトウエアを走らせるRISCコンピュータ・システムは多くの場合X86(またはその他の)プログラムを走らせることができるが、これらがこれを行うレートは、通常、技術的現状のX86コンピュータ・システムが同じプログラムを走らせるレートよりもはるかに遅い。更に、これらのエミュレータ・プログラムは、入手可能なターゲット・プログラムの全てまたは大多数を走らせることができる訳ではない。
エミュレータ・プログラムが、ターゲット・マイクロプロセッサ程速くターゲット・プログラムを走らせることができない理由は、非常に複雑であり、異なるエミュレーション動作の理解がある程度必要となる。図1は、複数の異なる種別のマイクロプロセッサがターゲット・アプリケーション・プログラムを実行する異なる方法を表す一連の図を含む。
図1(a)では、IntelX86マイクロプロセッサのような典型的なCISCマイクロプロセッサが、当該ターゲット・プロセッサ上で走らせるために設計されたターゲット・アプリケーション・プログラムを走らせる場合を示す。図に見られるように、コンピュータのハードウエアへのアクセスを得るためのインターフェースを与えるように設計されたCISCオペレーティング・システム(X86コンピュータと共に用いられる、MS DOS(商標)、Windows3.1(商標)、WindowsNT(商標)、およびOS/2(商標)のような)を用いて、CISCプロセッサ上でアプリケーションを走らせる。通常、アプリケーション・プログラムの命令は、オペレーティング・システムによって与えられるアクセスのみを通じて、コンピュータのデバイスを利用するように選択される。したがって、オペレーティング・システムは、コンピュータのメモリおよび種々の入出力デバイスへのアクセスをアプリケーションに許可する操作を処理する。ターゲット・コンピュータは、オペレーティング・システムが認識するメモリおよびハードウエアを含み、ターゲット・アプリケーションからオペレーティング・システムへのコールによって、オペレーティング・システムのデバイス・ドライバは、定義されたターゲット・コンピュータのデバイスを用いて、予想される動作を行わせる。アプリケーションの命令は、プロセッサ上で実行するが、この場合、当該プロセッサが実行可能な動作(マイクロコード、またはマイクロコードがアセンブルされる、更に原始な動作で実体化する)にこれらは変更される。前述のように、複雑なターゲット命令を実行する毎に、命令は、マイクロコードとして(または同じ原始動作セットとして)格納されている同じサブルーチンをコールする。同じサブルーチンが常に実行される。プロセッサがスーパースカラーである場合、ターゲット命令を実行するためのこれら原始動作は、多くの場合プロセッサによって並び替えが行われ、再スケジューリングが行われ、前述と同様に種々の処理チャネルを用いて実行可能となる。しかしながら、依然としてサブルーチンを取り込み実行する。
図1(b)は、図1(a)のCISCプロセッサ上で走らせるように設計された、同じターゲット・アプリケーション・プログラムを走らせる、Apple Macintoshコンピュータにおいて用いられているPowerPCマイクロプロセッサのような典型的なRISCマイクロプロセッサを表す。図に見られるように、当該ターゲット・アプリケーションが発生するコールの一部に応答する、少なくとも部分的なターゲット・オペレーティング・システムを用いて、ホスト・プロセッサ上でターゲット・アプリケーションを実行する。通常、これらは、ディスプレイ上にグラフィカル・インターフェースを備えるために用いられる、ターゲット・オペレーティング・システムのアプリケーション状部分へのコール、および概してアプリケーション状の短いユーティリティ・プログラムである。ターゲット・アプリケーションおよびターゲット・オペレーティング・システムのこれらの部分は、SoftPC(登録商標)のようなソフトウエア・エミュレータによって変換される。ソフトウエア・エミュレータは、ターゲット・アプリケーション・プログラムおよびアプリケーション状ターゲット・オペレーティング・システム・プログラムによって与えられる命令を分解し、ホスト・プロセッサおよびそのホスト・オペレーティング・システムが実行可能な命令にする。ホスト・オペレーティング・システムは、RISCコンピュータのメモリおよび入出力ハードウエアへのアクセスが得られるインターフェースを提供する。
しかしながら、ホストRISCコンピュータ内のホストRISCプロセッサおよびそれと連動するハードウエア・デバイスは、通常、ターゲット・アプリケーションの設計対象としたプロセッサと連動するデバイスとは非常に異なっている。更に、ターゲット・アプリケーション・プログラムによって与えられる種々の命令は、ターゲット・コンピュータの種々の部分にアクセスする際に、ターゲット・オペレーティング・システムのデバイス・ドライバと協同するように設計されたものである。その結果、ターゲット・アプリケーション・プログラムの命令を、ホスト・オペレーティング・システムが利用可能な原始ホスト命令に変換するエミュレーション・プログラムは、何らかの方法で、ターゲット・コンピュータ内のハードウエア・デバイスを動作させるように設計された動作を、ホスト・システムのハードウエア・デバイスが実現可能な動作にリンクしなければならない。多くの場合、このために、エミュレータ・ソフトウエアは、ターゲット・アプリケーションの命令に応答する仮想デバイスを作成し、ホスト・システムが実行できない命令を実行するようにしなければならない。何故なら、ターゲット・デバイスは、ホスト・コンピュータのものではないからである。時として、エミュレータは、これら仮想デバイスからホスト・オペレーティング・システムを通じて、存在するがホスト・オペレーティング・システムによって異なる方法でアドレスされるホスト・ハードウエア・デバイスに至るリンクを作成しなければならない場合もある。
このようにターゲット・プログラムを実行すると、多くの理由のため、比較的遅く走ることになる。第1に、ターゲット・アプリケーション・プログラムおよびターゲット・オペレーティング・システムからの各ターゲット命令は、エミュレータによって、ホスト・プロセッサが用いるホストの原始機能に変換しなければならない。ターゲット・アプリケーションがX86のようなCISCマシンに設計されたものである場合、ターゲット命令の長さは様々に変化し非常に複雑であるので、これらをホストの原始命令に変換することは多くの混乱を伴う。元のターゲット命令を最初にデコードし、当該ターゲット命令を構成する原始ホスト命令のシーケンスを決定する。次いで、原始ホスト命令の各シーケンスのアドレス(または複数のアドレス)を決定し、原始ホスト命令の各シーケンスを取り込み、これら原始ホスト命令を順番に、または順序を外して実行する。命令を実行する毎に、ターゲット・アプリケーションおよびオペレーティング・システム命令を、ホスト・プロセッサが理解するホスト命令に変更するために、エミュレータに必要な膨大な追加の工程を実施しなければならず、エミュレーションのプロセスは遅くなる。
第2に、多くのターゲット命令は、ホスト・コンピュータでは使用できない、ターゲット・コンピュータのハードウエアにおいて、特定の方法で機能する特定のハードウエア・デバイスが行う動作への参照を含む。この動作を実行するために、エミュレーション・ソフトウエアは、既存のホスト・オペレーティング・システムを通じて、ホスト・コンピュータのハードウエア・デバイスにソフトウエアによる接続を行わなければならないか、あるいはエミュレーション・ソフトウエアが仮想ハードウエア・デバイスを備えなければならない。他のコンピュータのハードウエアをソフトウエアでエミュレートすることは、非常に困難である。エミュレーション・ソフトウエアは、ホスト・オペレーティング・システムに対するターゲット・アプリケーション・コールの各々に対して、仮想デバイスを生成しなければならず、更にこれら仮想デバイスの各々が実際のホスト・デバイスにコールを与えなければならない。ハードウエア・デバイスをエミュレートするには、ターゲット命令がデバイスを使用しようとする場合に、当該命令が要求する仮想デバイスを表すコードをメモリから取り込み、これを走らせて当該デバイスを実現しなければならない。前述の問題を解決するこれらの方法は、いずれも、命令のシーケンスの実行に、更に一連の動作を追加することになる。
エミュレーションの問題を複雑化するのは、ターゲット・アプリケーションが様々な例外を発生し、コンピュータ・システムが動作するために、ターゲット・コンピュータのハードウエアおよびターゲット・オペレーティング・システムがこれを実行しなければならないためである。ターゲット・コンピュータの動作中にターゲットの例外が発生した場合、例外の時点におけるコンピュータの状態をセーブしなければならない。通常、これを行うには、この動作を達成するためのマイクロコード・シーケンスをコールする。更に、正しい例外ハンドラを検索しなければならず、例外を処理しなければならず、更にプログラムを継続するために、プログラム内の正しい地点を発見しなければならない。時として、このために、例外が発生した時点、および例外ハンドラが与えた分岐が行われた他の時点のターゲット・コンピュータの状態にプログラムを逆戻りさせる必要性がある。いずれの場合でも、これらの動作を行うために必要なターゲット・コンピュータのハードウエアおよびソフトウエアを、何らかの方法でエミュレーションのプロセス内に備えなければならない。適正な実行のためには、このような例外のいずれの時点においても、正しいターゲットの状態が得られなければならないので、エミュレータは、これらの例外に正しく応答できるように、常にこの状態を精度高く追跡することを強いられる。従来技術では、このために、ターゲット・アプリケーションが与える順序で各命令を行う必要があった。何故なら、正しいターゲットの状態が維持できるのは、この方法を置いて他になかったからである。
更に、従来技術のエミュレータは、その他の理由でも、ターゲット・アプリケーションの実行順序を常に維持する必要があった。ターゲット命令は2つの種別、即ち、メモリに影響を与えるものおよびメモリ・マップ入出力(I/O)デバイスに影響を与えるものとすることができる。ある動作がメモリに影響を与えるのか、またはメモリ・マップI/Oデバイスに影響を与えるのかについては、命令を実行してみないことには、他に知る方法がない。命令がメモリ上で動作する場合、最適化および並び替えが可能であり、システム動作の高速化に非常に役立つ。しかしながら、I/Oデバイスに影響を与える動作は、ステップを全く除去せずに、動作がプログラムされた順序で正確に実施しなければならない。さもないと、I/Oデバイスの動作に何らかの悪影響を及ぼす可能性がある。例えば、特定のI/O動作には、I/Oレジスタをクリアする結果をもたらすものもあり得る。動作が順序通りには行われず、未だ必要な値がレジスタからクリアされた場合、その動作の結果は、ターゲット命令が命令した動作とは異なるものとなる可能性がある。メモリをメモリ・マップI/Oから区別する手段がないと、全ての命令を、それらがメモリ・マップI/Oに影響を与えるかのように扱うことが必要となる。これは、達成可能な最適化を厳しく制限する。従来技術のエミュレータは、アドレスされたメモリの特性(nature)を検出する手段、およびこのような障害から復元する手段の双方を欠いているので、各動作がメモリ・マップI/Oに影響を与えるかのように、ターゲット命令全体を通じて順次進んでいく必要がある。これによって、ホスト命令を最適化する可能性が著しく阻害される。
従来技術のエミュレータのホスト・コードを最適化する能力を妨げる他の問題に、自己変更コード(self-modifying code)によって発生するものがある。ターゲット命令がホスト命令のシーケンスに変換され、次いで書き戻されて、元のターゲット命令が変化した場合、ホスト命令はもはや有効ではない。その結果、エミュレータは、格納(store)がターゲット・コード・エリアに対するものか否かについて判定を行うために、常にチェックしていなければならない。これらの問題全てのために、この種のエミュレーションは、ターゲット・プロセッサ上でターゲット・アプリケーションを走らせるよりも、大幅に遅くなる。
図1(b)に示す種類のエミュレーション・ソフトウエアの他の例が、"Talisman: Fast and Accurate Multicomputer Simulation"(タリスマン:高速で高精度のマルチコンピュータ・シミュレーション)(R. C. Bedichek, Laboratory for Computer Sciences, Massachusetts Institute of Technology(R.C.ベディチェック、コンピュータ科学研究所、マサチューセッツ工科大学)と題する論文に記載されている。これは、更に複雑な変換の例であり、これは完全な開発システムをエミュレートし、開発用ターゲット・オペレーティング・システムを走らせることができる。タリスマンは、ホストUNIXオペレーティング・システムを用いている。
図1(c)に、他のエミュレーションの一例を示す。この場合、元のMachintoshコンピュータに用いられていたMotorola68000ファミリCISCプロセッサ上で走るように設計されたターゲット・アプリケーション・プログラムを走らせる、Apple Machintoshコンピュータに用いられているPowerPCマイクロプロセッサを示している。この種の構成は、Appleの旧来のプログラムを、RISCプロセッサを有するMachintoshコンピュータ上で走らせるために必要であった。図に見られるように、少なくとも部分的にターゲット・オペレーティング・システムを用いて、ホスト・プロセッサ上でターゲット・アプリケーションを走らせ、ターゲット・オペレーティング・システムのアプリケーション状部分に応答する。ソフトウエア・エミュレータには、ターゲット・アプリケーション・プログラムやアプリケーション状ターゲット・オペレーティング・システム・プログラムが与える命令を、ホスト・プロセッサやそのホスト・オペレーティング・システムが実行可能な命令に分解するものがある。ホスト・オペレーティング・システムは、インターフェースを与え、これを通じてホスト・コンピュータのメモリおよび入出力ハードウエアへのアクセスが得られるようにしている。
この場合も、ホストRISCコンピュータにおけるホストRISCプロセッサおよびそれと連動するデバイスは、MotorolaのCISCプロセッサと連動するデバイスとは全く異なり、種々のターゲット命令は、ターゲット・コンピュータの種々の部分にアクセスする際に、ターゲットCISCオペレーティング・システムと協同するように設計されている。その結果、エミュレーション・プログラムは、ターゲット・コンピュータにおけるハードウエア・デバイスを動作させるように設計された動作を、ホスト・システムのハードウエア・デバイスが実現可能な動作にリンクしなければならない。このために、エミュレータは、ターゲット・アプリケーションの命令に応答するソフトウエアの仮想デバイスを作成し、これらの仮想デバイスから、ホスト・オペレーティング・システムを通じて、存在するがホスト・オペレーティング・システムによって異なる方法でアドレスされるホスト・ハードウエア・デバイスへのリンクを作成する必要がある。
このようにして走らせるターゲット・ソフトウエアは、図1(b)のエミュレーションが走るのが遅いのと同じ理由で、比較的走るのが遅い。第1に、ターゲット・アプリケーションおよびターゲット・オペレーティング・システムからの各ターゲット命令は、当該命令を取り込むことによって変換しなければならず、更に、命令を実行する毎に、当該命令から派生するホスト原始機能の全てを順次走らせなければならない。第2に、エミュレーション・ソフトウエアは、ホスト・オペレーティング・システムへのターゲット・アプリケーションのコール毎に、仮想デバイスを生成しなければならない。更に、これら仮想デバイスの各々は、実際のホスト・デバイスへのコールを与えなければならない。第3に、エミュレータは、メモリ・マップI/Oデバイスに向けられた命令、またはそれが復元することができない例外を生成する危険を処理するために、全ての命令を保存的に処理しなければならない。最後に、エミュレータは、常に正しいターゲット状態を維持し、格納動作は、予め当該格納がターゲット・コード・エリアに対するものか否かについて判定するために、常にチェックしなければならない。これらの要件全ては、エミュレータのホスト・プロセッサ上で走るコードの重要な最適化を行う能力を奪い取り、ターゲット・プロセッサ上でターゲット・アプリケーションを走らせるよりも、この種のエミュレータの速度を大幅に低下させる。
技術的現状のプロセッサの1/4未満のエミュレーション・レートは非常に良好と考えられる。概して、このために、この種のエミュレーション・ソフトウエアが、他のプロセッサに設計されたアプリケーションを走らせる機能は有用ではあるが主要ではない使用に追いやられている。
図1(d)では、ホスト・プロセッサ上でターゲット・アプリケーション・プログラムをエミュレーションし、非常に限られた一連のターゲット・アプリケーションに対して比較的良好な処理能力(performance)を与える、特定の方法を示す。ターゲット・アプリケーションは、命令をエミュレータに与え、エミュレータはこれらの命令を、ホスト・プロセッサおよびホスト・オペレーティング・システムに対する命令に変更する。ホスト・プロセッサは、Digital Equipment Corporation(ディジタル エクイップメント社)のAlpha RISCプロセッサであり、ホスト・オペレーティング・システムは、Microsoft NTである。このシステムによって走らせることができるターゲット・アプリケーションは、Windows WIN32sに準拠するオペレーティング・システムを有するターゲットX86プロセッサによって実行されるように設計された32ビット・アプリケーションのみである。ホストおよびターゲット・オペレーティング・システムは殆ど同一であり、これら同じ命令を処理するように設計されているので、エミュレータ・ソフトウエアは命令を非常に簡単に変換することができる。更に、ホスト・オペレーティング・システムは、既に、ターゲット・アプリケーションが発生する同じコールに応答するように設計されているので、仮想デバイスの生成は大幅に減少する。
これは技術的にホスト・プロセッサ上でターゲット・アプリケーションを走らせるエミュレーション・システムであるが、非常に特殊な場合である。ここでは、エミュレーション・ソフトウエアは、同様のアプリケーションを走らせるように既に設計されているホスト・オペレーティング・システム上で走っている。このため、ターゲット・アプリケーションからのコールを、ホストおよびホスト・オペレーティング・システムの補正機構に向けるのが一層容易となる。更に重要なのは、このシステムは、恐らく全てのX86アプリケーションの1パーセントにも満たない量の32ビットのWindowsアプリケーションのみを走らせることである。更にまた、このシステムは、1つのオペレーティング・システム、即ち、WindowsNT上でのみアプリケーションを走らせるが、一方X86プロセッサは、多数のオペレーティング・システムに設計されたアプリケーションを走らせる。したがって、このようなシステムは、この明細書で当初示した意味の範囲内では、互換性があると見なすことはできない。したがって、このようなエミュレータを走らせるプロセッサは、競合のX86プロセッサと見なすことはできない。
異なる命令セットを認識するコンピュータ上で、ソフトウエアを用いて第1命令セットに対して書かれたアプリケーションの部分を走らせることを可能にする他のエミュレーション方法を、図1(e)に示す。この形態のエミュレーション・ソフトウエアは、通常、あるコンピュータ・システムから他のシステムにアプリケーションを移植(port)しようとしているプログラマによって利用される。通常、ターゲット・アプリケーションは、エミュレータを走らせるホスト・マシン以外のいずれかのターゲット・コンピュータ用に設計されている。エミュレータ・ソフトウエアは、ターゲット命令を分析し、これらの命令を、ホスト・マシン上で走らせることができる命令に変換し、これらのホスト命令をキャッシュし、それらを再利用可能とする。この動的な変換およびキャッシングによって、アプリケーションの部分を非常に高速に走らせることが可能となる。この形態のエミュレータは、通常ソフトウエア・トレース・ツールと共に用いられ、実行中のターゲット・プログラムの挙動に関する詳細な情報を提供する。一方、トレース・ツールの出力はトレース情報を分析するアナライザ・プログラムを駆動するために用いることができる。
実際にコードがどのように機能するのかについて判定するために、とりわけ、この種のエミュレータは、ホスト・マシン上でホスト・オペレーティング・システムによって走らせ、ホスト・オペレーティング・システムが備えていない仮想ハードウエアを与え、そうでなければ、アプリケーションの設計対象であるコンピュータの動作を、ホスト・マシンのハードウエア資源にマップし、走らせているプログラムの動作を実行する。このソフトウエアによるハードウエアの仮想化およびホスト・コンピュータへのマッピングは、非常に遅く、しかも不完全な可能性がある。
更に、ターゲット命令の1つを実行するために複数のホスト命令を必要とする場合が多いので、ターゲット・オペレーション・システムの例外ハンドラを必要とするフォールトやトラップを含む例外が発生する可能性があり、ターゲット命令の境界とは無関係な地点で、ホストにホスト命令の処理を中止させる場合がある。これが発生した場合、例外を正しく処理することは不可能となる場合がある。何故なら、ホスト・プロセッサおよびメモリの状態は正しくないからである。このような場合、エミュレータを停止し、再度走らせて、例外を発生した動作を追跡しなければならない。したがって、このようなエミュレータはターゲット・コードのシーケンスを非常に迅速に走らせることはできるが、これらの例外から復元する方法がなく、したがってアプリケーションの重要な部分を迅速に走らせることは全くできない。
これは、この形態のエミュレータに伴う特異の問題ではない。何故なら、エミュレータ、トレーサおよび運動するアナライザが実行する機能は、新たなプログラムを発生するか、あるいは古いプログラムを別のマシンに移植して、エミュレータ・ソフトウエアが走る速度が殆ど問題にならないようにすることを目的とするからである。即ち、プログラマは、エミュレータが生成したコードがホスト・マシン上でどれ位速く走るかに常に関心がある訳ではなく、エミュレータが生成するコードが、そのために設計した機械上で実行可能か、そして当該マシン上で迅速に走るか否かに関心があるのである。結果的に、この種のエミュレーション・ソフトウエアは、プログラミング以外の目的で異なる種類のマイクロプロセッサ上で走らせるために第1命令セットで書かれたアプリケーション・プログラムを走らせる方法を提供するものではない。この種のエミュレーション・ソフトウエアの一例が、"Shade: A First Instruction-Set Simulator for Execution Profiling"(シェード:実行の特性を知るための高速命令セット・シミュレータ)と題するCmelik(スメリック)およびKeppel(ケッペル)の論文に記載されている。
技術的現状のマイクロプロセッサよりも高速でかつ安価でありながら、しかも技術的現状のマイクロプロセッサに設計されたターゲット・アプリケーション・プログラムと完全に互換性があり、これらのマイクロプロセッサに入手可能なあらゆるオペレーティング・システムを走らせることができる、競争力のあるマイクロプロセッサを提供することが望ましい。
発明の概要
したがって、本発明の目的は、従来の技術的現状のマイクロプロセッサよりも安価であり、しかも他のマイクロプロセッサのために設計されたアプリケーション・プログラムやオペレーティング・システムと互換性があり、他のマイクロプロセッサよりも速いレートでこれらを走らせることが可能なマイクロプロセッサを提供することである。
本発明のこの目的およびその他の目的は、ターゲット命令セットを有するターゲット・コンピュータのためのターゲット・プログラムを実行するように設計されたホスト・コンピュータ用マイクロプロセッサによって実現され、このマイクロプロセッサは、ソフトウエアと、ホスト命令セットの命令を実行するように設計された改良ホスト処理ハードウエアとの組み合わせから成り、ソフトウエアと改良ホスト処理ハードウエアとの組み合わせは、1組のターゲット命令をホスト命令セットの命令に変換する手段を備えている。
好適な実施形態では、ソフトウエアと改良ホスト処理ハードウエアとの組み合わせは、ある条件の発生を推測して、ターゲット・プログラムから変換されたホスト命令セットの命令を最適化する手段と、マイクロプロセッサによるターゲット・プログラムの実行中に、1組のターゲット命令の変換の開始時に存在した、前記ターゲット・コンピュータのオフィシャル状態を、ソフトウエアの制御の下で判定する手段と、推測に応じて1組のホスト命令を実行するとき、ターゲット・コンピュータの状態をホスト・コンピュータの状態から更新する手段と、1組のホスト命令の実行中条件が満たされなかったことを検出する手段と、1組のホスト命令が推測に応じて実行し損ねた場合、ホスト・コンピュータの状態をターゲット・コンピュータの状態から更新する手段と、1組のホスト命令が推測に応じて実行し損ねた場合、推測を用いずに、新たな1組のホスト命令を変換する手段とを含む。
好適な実施形態では、モーフ・ホストの改良処理ハードウエアは、ターゲット命令セットの多数の命令の変換、最適化、並び替え、および超長命令ワードへの再スケジューリングを可能にするように設計された超長命令ワード(VLIW)プロセッサを含む。超長命令ワードは、後に再使用するためにキャッシュしておくことができ、これによって、ターゲット命令を発見する毎にこれらのステップ各々の必要性をなくすことにより、実行速度を高める。これは、ターゲット命令セットの多数の命令から発生したホスト命令セットの複数の原始命令を並び替え、共にスケジューリングすることにより、先進のスーパースカラー処理や、その他の時間節約処理を実行することが可能となり、不要なハードウエア動作を除去し、処理全体を加速する。
本発明のこれらおよびその他の目的は、以下の詳細な説明を図面と共に参照することによって、より良く理解されよう。尚、図面においては、同様のエレメントには種々の図にわたって同様の符号によって引用することとする。
【図面の簡単な説明】
図1(a)ないし図1(e)は、従来技術にしたがって設計されたマイクロプロセッサの動作態様を示す図である。
図2は、異なるマイクロプロセッサに設計されたアプリケーションを走らせる、本発明によるマイクロプロセッサのブロック図である。
図3は、図2に示すマイクロプロセッサの一部を示す図である。
図4は、本発明によるマイクロプロセッサにおいて用いられるレジスタ・ファイルを示すブロック図である。
図5は、本発明にしたがって設計したゲート格納バッファを示すブロック図である。
図6(a)ないし図6(c)は、従来技術の種々のマイクロプロセッサおよび本発明によるマイクロプロセッサにおいて用いられる命令を示す。
図7は、本発明によるマイクロプロセッサのソフトウエア部分によって実施される方法を示す。
図8は、本発明によるマイクロプロセッサのソフトウエア部分によって実施される別の方法を示す。
図9は、本発明による改良されたコンピュータ・システムを示すブロック図である。
図10は、図2に示すマイクロプロセッサの一部を示すブロック図である。
表記および名称
以下の詳細な説明では、コンピュータ・メモリ内のデータ・ビットに対する動作を象徴的な表現で提示する部分がある。これらの記載および表現は、データ処理技術における当業者によって用いられ、他の当業者にそれらの動作の本質を最も効果的に伝える手段である。動作は、物理的な量の物理的な操作を必要とするものである。通常、これらの量は、格納、転送、結合、比較、およびそれ以外の操作が可能な電気的または磁気的信号の形態を取るが、必ずしもそうとは限らない。主に共通の使用という理由のために、これらの信号を、ビット、値、エレメント、シンボル、文字、言葉、数値等として言及すると便利であることが時として認められている。しかしながら、これらおよび同様の用語は全て、適切な物理量に関連付けられており、これらの量に適用された単に便宜上の名称に過ぎないことは、念頭に置いておくべきであろう。
更に、実行される操作は、多くの場合、加算または比較というような用語で言及するが、これらは、人のオペレータが実行する精神的な動作と一般的に関連がある。人のオペレータのこのような能力は、殆どの場合、本発明の一部を形成する、ここに記載する動作のいずれにも必要でも望ましくもない。動作とは、機械的動作である。本発明の動作を実行するために有用なマシンは、汎用ディジタルコンピュータ、またはその他の同様のデバイスを含む。全ての場合において、コンピュータを動作させる方法動作と、計算自体の方法との間の区別を、念頭に置いておくべきである。本発明は、電気的またはその他の(例えば、機械的、化学的)物理的信号を処理し、その他の所望の物理信号を発生するように、コンピュータを動作させる方法および装置に関するものである。
以下の説明の間、場合によっては、詳細な動作例を与えるために、ターゲット・プログラムとは、X86マイクロプロセッサ上で実行するように設計されたプログラムを意味するものとする。何故なら、殆どのエミュレータはX86アプリケーションを走らせるからである。しかしながら、ターゲット・プログラムは、いずれのターゲット・コンピュータ・ファミリ上で走るように設計されたものでもよい。これは、Pcodeマシン、Postscriptマシン、またはJava仮想マシンのような、ターゲット仮想コンピュータを含む。
詳細な説明
本発明は、従来技術の問題を克服し、従来技術のマイクロプロセッサよりも高速に、従来技術の多数のファミリのマイクロプロセッサによって走らせることができるオペレーティング・システムの全てに対してソフトウエアの全てを走らせることができ、しかも従来技術のマイクロプロセッサよりも安価なマイクロプロセッサを提供する。
更に複雑化したハードウエアによってその動作を加速させるマイクロプロセッサを用いる代わりに、本発明は、技術的現状のマイクロプロセッサよりも各段に単純な改良ハードウエア処理部(この明細書では「モーフ・ホスト」と呼ぶ)と、エミュレート・ソフトウエア部(この明細書では、「コード・モーフィング・ソフトウエア」と呼ぶ)とを組み合わせ、これら2つの部分が一体となってマイクロプロセッサとして機能し、公知のいずれの競合マイクロプロセッサよりも高い性能を有するようにしたものである。更に具体的には、モーフ・ホストとは、例外またはエラーが発生した場合、その後直ちにターゲット・コンピュータの状態を得る際に補佐するハードウエア機能強化を含むプロセッサであり、一方コード・モーフィング・ソフトウエアとは、ターゲット・プログラムの命令を、モーフ・ホストのためのモーフ・ホスト命令に変換し、例外およびエラーに応答して、必要に応じてワーキング状態を正しいターゲット状態と置換することにより、正しい再変換が行われるようにするソフトウエアである。また、コード・モーフィング・ソフトウエアは、処理速度を高めるための種々のプロセスを含むことも可能である。従来技術の超高速マイクロプロセッサは、その全てがハードウエアを備えて処理速度を高めるが、その代わりに、本発明は、コード・モーフィング・ソフトウエアによって、多数の加速補強技術を選択可能な段階において実行可能とする。コード・モーフィング・ソフトウエアに速度補強技術を備えることにより、複雑度が格段に低いハードウエアを用いて、モーフ・ホストを実現することが可能となる。これは、従来技術のマイクロプロセッサのハードウエアよりも高速であると共に大幅に安価である。比較として、入手可能なX86アプリケーション全てを走らせるように設計した本発明の一実施形態は、Pentium Proマイクロプロセッサのゲート数の約1/4を含むモーフ・ホストによって実現され、しかもPentium Proマイクロプロセッサ、またはX86アプリケーションを処理可能な他の公知のマイクロプロセッサのいずれよりも、これらのアプリケーションを大幅に速く走らせる。
コード・モーフィング・ソフトウエアは、新たなソフトウエアを設計したり、あるいは新たなハードウエアをエミュレートするプログラムによってのみ以前から用いられていた、ある種の技術を利用する。モーフ・ホストは、特に、コード・モーフィング・ソフトウエアが提供する加速技術を効率的に利用可能とするように構成された、複数のハードウエア機能強化を含む。これらのハードウエア機能強化は、コード・モーフィング・ソフトウエアが、より広い範囲の命令に対して、加速技術を実現可能とするものである。また、これらのハードウエア機能強化は、ハードウエア・プロセッサでは得ることができず、法外なコストをかけたプロセッサでなければ実現できないような、追加の加速技術を、コード・モーフィング・ソフトウエアによって実施可能とする。これらの技術は、ネーティブの命令セットの実行を行う従来技術のマイクロプロセッサの速度と比較して、本発明のマイクロプロセッサの速度を格段に高めるものである。
例えば、改良モーフ・ホストと組み合わせたコード・モーフィング・ソフトウエアは、大量の回路を追加する必要なく、ターゲット命令のシーケンスによって発生した原始命令の並び替えや再スケジューリングを可能にする技術の使用を可能にできる。多数のターゲット命令全体の並び替えおよび再スケジューリングを可能にすることによって、他の最適化技術を用いて、ターゲット命令群を実行するのに必要なプロセッサ・ステップ数を、ターゲット・アプリケーションを走らせる他のいずれのマイクロプロセッサが必要とするよりも削減することができる。
改良モーフ・ホストと組み合わせたコード・モーフィング・ソフトウエアは、ターゲット命令を、実行中に、モーフ・ホストの命令に変換し、これらのホスト命令をメモリ・データ構造(この明細書では、「変換バッファ」と呼ぶ)にキャッシュする。変換バッファを用いて変換した命令を保持することにより、どの原始命令が各ターゲット命令を実現するために必要かを判定し、各原始命令をアドレスし、各原始命令を取り込み、原始命令のシーケンスを最適化し、各原始命令にアセットを割り当て、原始命令を並び替え、そして各ターゲット命令を実行する毎に、必要な原始命令の各シーケンスの各ステップを実行するという長大なプロセスを再度走らせることなく、命令を呼び出すことが可能となる。一旦ターゲット命令を変換したなら、これら無数のステップを全く必要とすることなく、変換バッファからこれを呼び出し、実行することができる。
従来技術のエミュレーション技術の第1の問題は、これらの技術が、ターゲット・プログラムの実行中に発生する例外を、良好なパーフォーマンスで処理することができない点にある。これは、特に、ターゲット・オペレーティング・システムを対象とするターゲット・アプリケーションを走らせている際に発生する例外のときに該当する。この場合、例外およびそれに続く命令の適正な実行のためには、正しいターゲット状態が、このような例外のいずれの時点でも得ることができなければならない。その結果、エミュレータは常にターゲット状態を高精度に追跡することを強いられ、格納がターゲット・コード・エリアに対するものか否かについて判定するために、常にチェックしていなければならない。他の例外も同様の問題を引き起こす。例えば、エミュレータが、ある特定のホスト機能によって置換された特定のターゲット動作を検出する場合に、例外が発生することがある。即ち、ターゲット・プロセッサの種々のハードウエア動作は、エミュレータ・ソフトウエアが提供するソフトウエア動作で置換することができる。加えて、ターゲット命令から派生したホスト命令を実行するホスト・プロセッサも、例外を発生する可能性がある。これらの例外は全て、エミュレータがターゲット命令をホスト命令に変換しようとしている間、またはホスト変換がホスト・プロセッサ上で実行されるときのいずれかに発生する可能性がある。効率的なエミュレーションのためには、例外を正しく処理しつつ、これらの例外から効率的に復元する何らかの方法を備える必要がある。エミュレートされ得る全てのソフトウエアに対してこれを行うものは、従来技術にはない。
これら従来技術の限界を克服するために、本発明は、その改良モーフ・ホストに、多数のハードウエアの改善を組み込んでいる。これらの改善には、ゲート格納バッファ(gated store buffer)および複数の大量の追加プロセッサ・レジスタが含まれる。追加レジスタのいくつかによって、レジスタの名称変更を用い、同じハードウエア資源を必要とする命令の問題を軽減することができる。また、追加レジスタによって、ホスト命令を処理する1組のホスト・レジスタまたはワーキング・レジスタ、および1組のターゲット・レジスタを維持し、ターゲット・アプリケーションを作成したターゲット・プロセッサのオフィシャル状態(official state)を保持することができる。ターゲット(またはシャドウ)レジスタは、専用のインターフェースを介して、それらのワーキング・レジスタの同等物に接続されている。専用インターフェースは、「コミット」(commit)と呼ばれる動作によって、全てのワーキング・レジスタの内容を素早くオフィシャル・ターゲット・レジスタに転送させ、かつ「ロールバック」(rollback)と呼ばれる動作によって、全てのオフィシャル・ターゲット・レジスタの内容をそれらのワーキング・レジスタ同等物に素早く逆転送させることを可能にする。ゲート格納バッファは、ハードウエア「ゲート」の「アンコミット」側(uncommit side)のワーキング・メモリの状態変化を格納し、更にハードウエア・ゲートの「コミット」側のオフィシャル・メモリの状態変化を格納する。この場合、コミットされた格納は、主メモリに「流出」する。コミット動作は、ゲートのアンコミット側からゲートのコミット側に格納を転送する。一旦1つまたは1群のターゲット命令を変換し、エラーなく走らせたなら、追加のオフィシャル・レジスタおよびゲート格納バッファによって、メモリ状態およびターゲット・レジスタ状態を一緒に更新することが可能となる。
これらの更新は、コード・モーフィング・ソフトウエアによって、整数ターゲット命令境界(integral target instruction boundary)上で生じるように選択される。したがって、一連のターゲット命令の変換を構成する原始ホスト命令が、例外を発生せずに、ホスト・プロセッサによって走らされた場合、これらの命令によって発生したワーキング・メモリの格納およびワーキング・レジスタ状態は、オフィシャル・メモリに、次いでオフィシャル・ターゲット・レジスタに転送される。このように、変換される1つまたは1組のターゲット命令の境界上にない点において、ホスト命令を処理している際に例外が発生した場合、最後の更新(またはコミット)におけるターゲット・レジスタ内の元の状態は、ワーキング・レジスタに呼び出すことができ、ゲート格納バッファ内のアンコミット・メモリ格納を消去する(dump)ことができる。次に、発生した例外がターゲット例外である場合、このターゲット例外を生じたターゲット命令を1回に1つずつ再変換し、それらがターゲット・マイクロプロセッサによって実行されるように、一連のシーケンスで実行することができる。各ターゲット命令はエラーなく正しく実行されるので、ターゲット・レジスタの状態を更新でき、格納バッファ内のデータをメモリに通過させる(gete)ことができる。次に、ホスト命令を走らせている際に例外が再び発生した場合、ターゲット・コンピュータの正しい状態は、モーフ・ホストのターゲット・レジスタおよびメモリ内に保持され、動作を遅延なく正しく処理することができる。この正しい変換によって得られる新たな変換の各々は、今後のためにキャッシュしておき、それを変換する際、または一旦それを消去する際、あるいはページ・フォールトのような稀な出来事の際に使用することができる。これによって、コード・モーフィング・ソフトウエアとモーフ・ホストとの組み合わせによって作成したマイクロプロセッサが、元来ソフトウエアを書いた対象であるプロセッサよりも速く、命令を実行することが可能になる。
尚、本発明のマイクロプロセッサを用いてターゲット・プログラムを実行する場合、多くの異なる種類の例外が発生する可能性があり、これらは異なる方法で処理することを注記しておく。例えば、例外には、例外を発生するターゲット・ソフトウエアが原因のものもあり、これにはターゲット・オペレーティング・システムの例外ハンドラを利用する。このような例外ハンドラの使用では、プロセスの処理のために、コード・モーフィング・ソフトウエアは、ターゲット・コンピュータが備えるあらゆるハードウエアを含む、例外処理プロセス全体をエミュレートするルーチンを含むことが必要である。このためには、コード・モーフィング・ソフトウエアが、ターゲット・プロセッサの状態をセーブする機能を備え、例外を処理し終わった後に、正しく移行できるようにする必要がある。ページ・フォールトのように、変換されるプロセスを実施する前に、メモリの新たなページにデータを取り込む必要がある例外では、例外を処理し終えた後に、変換対象のプロセスの先頭に戻る必要がある。他の例外は、動作がハードウエアによって与えられない場合、ソフトウエアで特定の動作を実現する。これらは、例外ハンドラが、例外を処理し終えた後に、変換における次のステップに動作を戻すことを必要とする。これら異なる種類の例外は各々、本発明によって効率的に処理することができる。
加えて、例外には、ホスト・ハードウエアが発生し、種々のホストおよびターゲット状態を検出するものがある。また、例外には、従来のマイクロプロセッサ上の例外のように振る舞うものもあるが、その他のものは、コード・モーフィング・ソフトウエアによって、種々の推測(speculation)の失敗を検出するために用いられる。これらの場合、コード・モーフィング・ソフトウエアは、前述の状態セーブおよび復元機構を用いて、ターゲット状態をその最近のオフィシャル・バージョンに復元させ、失敗した推測を回避する新たな変換を発生しセーブする(あるいは、以前に行った安全な変換を用いる)。次に、この変換を実行する。
モーフ・ホストは、追加のハードウエア例外検出機構を含み、前述のロールバックおよび再変換方法と共に、一層の最適化を可能にする。例として、メモリをメモリ・マップI/Oから区別する手段、およびアドレスまたはアドレス範囲を保護することによってメモリの参照を不要とし、ターゲット変数をレジスタに保持可能とする手段を挙げる。
動作がメモリまたはメモリ・マップI/Oに影響を与えるか否かというように、例外を用いて他の推測の失敗を検出する場合、新たな変換の生成によって復元が達成されるが、メモリ動作は異なり、最適化も異なる。
図2は、図1(a)のCISプロセッサ上で走っているのと同じアプリケーション・プログラムを走らせる、本発明にしたがって設計したモーフ・ホスト・ハードウエアを表わす図である。図に見られるように、マイクロプロセッサは、前述のコード・モーフィング・ソフトウエア部と、改良ハードウエア・モーフ・ホスト部とを含む。ターゲット・アプリケーションは、ターゲット命令をコード・モーフィング・ソフトウエアに与え、モーフ・ホストが実行可能なホスト命令に変換させる。その間、ターゲット・オペレーティング・システムは、ターゲット・アプリケーション・プログラムからのコールを受け取り、これらをコード・モーフィング・ソフトウエアに転送する。本発明の好適な実施形態では、モーフ・ホストは、超長命令ワード(VLIW:very long instruction word)マイクロプロセッサであり、複数の処理チャネルによって設計されている。このようなプロセッサの全体的な動作については、図6(c)に更に示されている。
図6(a)ないし図6(c)は、CISCプロセッサ、RISCプロセッサ、およびVLIWプロセッサの各々と使用するように構成された命令を示す。図に見られるように、CISC命令は可変長であり、より多くの原始動作(例えば、ロードおよび加算)を複数個含むことができる。一方、RISC命令は、長さが等しく、本質的に原始動作である。図示のVLIWプロセッサに対する単一の超長命令は、CISCおよびRISC命令のより多くの原始動作(即ち、ロード、格納、整数加算、比較、浮動小数点乗算、分岐)の各々を含む。図6(c)に見られるように、一体となって単一の超長命令ワードを構成する原始命令の各々は、他の原始命令と並列に、VLIWプロセッサの複数の別個の処理チャネルの1つ、またはメモリのいずれかに与えられ、処理チャネルおよびメモリによって並列に扱われる。これら並列動作の全ての結果は、マルチポート・レジスタ・ファイルに転送される。
モーフ・ホストの基本であるVLIWプロセッサは、前述の他のプロセッサよりもはるかに単純なプロセッサである。これは、発行依存性(issue dependency)を検出する回路も、原始命令を並び替え、最適化し、再スケジューリングする回路も含まない。このために、元来ターゲット・アプリケーション・プログラムを設計した対象のプロセッサや、エミュレーション・プログラムを用いてターゲット・アプリケーション・プログラムを走らせるその他のプロセッサのいずれかが可能なクロック・レートよりも高いクロック・レートで速い処理が可能となる。しかしながら、本発明は、VLIWプロセッサに限定される訳ではなく、RISCプロセッサのようなあらゆる種類のプロセッサとでも同様に機能することができる。
図2に示すマイクロプロセッサのコード・モーフィング・ソフトウエアは、変換部を含む。これは、ターゲット・アプリケーションの命令をデコードし、これらのターゲット命令を、モーフ・ホストによる実行が可能な原始ホスト命令に変換し、ターゲット命令が要求する動作を最適化し、原始命令を並び替えスケジューリングしてモーフ・ホストのVLIW命令(変換)とし、このホストVLIW命令を実行する。変換部の動作を図7に示す。図7は、コード・モーフィング・ソフトウエアの主ループの動作を示す。
コード・モーフィング・ソフトウエアおよび改良モーフ・ホスト・ハードウエアを含むマイクロプロセッサの動作を加速するために、コード・モーフィング・ソフトウエアは、図2に示すような変換バッファを含む。一実施形態の変換バッファは、メモリに格納可能なソフトウエア・データ構造である。特定の実施形態では、ハードウエアのキャッシュも利用できる場合がある。変換バッファは、ターゲット命令の完了した変換各々を実体化するホスト命令を格納するために用いられる。図に見られるように、一旦個々のターゲット命令を変換し、得られたホスト命令の最適化、並び替え、および再スケジューリングを行ったなら、得られたホスト変換を変換バッファに格納する。次に、変換を構成するホスト命令を、モーフ・ホストによって実行する。ホスト命令を実行し例外が発生しない場合、その後ターゲット命令または命令群が必要とする動作が要求されるときにはいつでも、変換を呼び出すことができる。
したがって、図7に示すように、アプリケーション・プログラムによってターゲット命令のアドレスが与えられたときの、マイクロプロセッサのコード・モーフィング・ソフトウエアの典型的な動作は、最初に、当該ターゲット・アドレスにおけるターゲット命令が変換されているか否かについて判定することである。ターゲット命令が変換されていない場合、変換部によって、それおよび後続のターゲット命令を取り込み、デコードし、変換し、次いで(恐らく)最適化し、並び替え、新たなホスト変換に再スケジューリングし、変換バッファに格納する。後でわかるであろうが、可能な最適化には様々な度合いがある。この明細書では、「最適化」という用語は、処理を加速するための技術のことを総称的に呼ぶために用いることが多い。例えば、並び替えは、処理の高速化を可能とする最適化の一形態であり、この用語に含まれるものである。可能な最適化の多くは、コンパイラの最適化の従来技術において説明されており、「スーパー・ブロック」(super-block)のように、従来技術の範囲内では実行が困難であったいくつかの最適化が、VLIWの研究から明らかとなった。次に、制御を変換に転移し、改良モーフ・ホスト・ハードウエアによって実行し、再開する。
アプリケーションを走らせている際に、特定のターゲット命令シーケンスが次に発見された場合、変換バッファ内にホスト変換が存在し、変換、最適化、並び替えまたは再スケジュールの必要性なく、直ちに実行する。以下で述べる先進の技術を用いることによって、ターゲット命令(一旦完全に変換された)に対する変換は、ほぼ100万回の変換の実行毎に1回変換バッファ中に発見されることが推測されている。その結果、最初の変換後には、デコード、原始命令の取り込み、原始命令の最適化、ホスト変換への再スケジューリング、および変換バッファへの格納というような変換に必要なステップの全ては、必要な処理から除外することができる。ターゲット命令を書いた対象のプロセッサは、命令を実行する毎に、各命令のデコード、取り込み、並び替え、および再スケジューリングを行わなければならないので、これは、ターゲット命令を実行するために必要な作業を激減させ、本発明のマイクロプロセッサの速度を高めることになる。
従来技術のプロセッサによるターゲット・アプリケーションの実行に必要なこれらのステップ全てを除去するため、本発明のマイクロプロセッサは、従来技術において、いずれの正当な速度でも本発明の動作を不可能とする問題を克服する。例えば、本発明の技術のいくつかは、アプリケーションを他のシステムに移植するために用いられる、前述のエミュレータにおいて用いられていた。しかしながら、これらのエミュレータのいくつかは、アプリケーションの短い部分以外を走らせる方法がなかった。何故なら、変換された命令を処理する際、種々のシステム例外ハンドラへのコールを発生する例外は、ホスト・プロセッサの状態が同じ命令を処理しているターゲット・プロセッサの状態には関係がない動作時点で発生するからである。このため、このような例外が発生する時点におけるターゲット・プロセッサの状態はわからなかった。したがって、ターゲット・マシンの正しい状態を判定することができず、動作を停止し、再起動し、正しい状態を把握してからでないと、例外に対処し(service)、実行を継続することができなかった。このため、アプリケーション・プログラムをホストの速度で走らせることが不可能であった。
本発明のモーフ・ホスト・ハードウエアは、この問題を克服する多数の機能強化を含む。これらの機能強化を、各々図3、図4および図5に示す。エラーが発生した時点におけるレジスタの正しい状態を判定するために、1組のオフィシャル・ターゲット・レジスタが改良ハードウエアによって与えられ、元のアプリケーションを設計した対象のターゲット・プロセッサのレジスタの状態を保持する。これらのターゲット・レジスタは、浮動小数点ユニット、あらゆる整数ユニットおよびその他のあらゆる実行ユニットの各々に含ませることができる。これらのオフィシャル・レジスタを本発明のモーフ・ホストに追加しつつ、通常のワーキング・レジスタ数も増加させることによって、レジスタの名称変更を含む多数の最適化を実施可能とする。改良ハードウエアの一実施形態は、64個のワーキング・レジスタを整数ユニット内に、32個のワーキング・レジスタを浮動小数点ユニット内に含む。また、この実施形態は、補強した1組のターゲット・レジスタも含む。その中には、ターゲット・プロセッサの状態を与えるために必要な、当該プロセッサの頻繁に変化するレジスタ全てが含まれる。これらには、条件制御レジスタや、シミュレーション対象システムの制御に必要な他のレジスタが含まれる。
尚、モーフ・ホストが利用する改良処理ハードウエアの種類によっては、変換された命令シーケンスが、元のアプリケーションからの複数のターゲット命令を構成する原始動作を含む場合があることを注記しておく。例えば、VLIWマイクロプロセッサは、図6(a)ないし図6(c)に示すように、CISCまたはRISCのいずれかの複数の命令を同時に走らせることができる場合がある。モーフ・ホストの種類が何であれ、本発明のモーフ・ホスト・ハードウエアのターゲット・レジスタの状態は、整数ターゲット命令境界(integral target instruction boundary)以外では変化せず、次いで全てのターゲット・レジスタは更新される。したがって、並び替えられホスト変換に再スケジューリングされた可能性がある一連の原始命令に変換されたターゲット命令または命令群を本発明のマイクロプロセッサが実行している場合、プロセッサがその変換された命令シーケンスを実行し始めるとき、オフィシャル・ターゲット・レジスタは、最初のターゲット命令がアドレスされたときに、アプリケーションの設計対象のターゲット・プロセッサのレジスタが保持していた値を保持する。モーフ・ホストが変換後の命令を実行し始めた後は、しかしながら、ワーキング・レジスタは、その時点までに実行された変換後の命令の原始動作によって決定される値を保持する。したがって、これらのワーキング・レジスタのいくつかは、オフィシャル・ターゲット・レジスタにおける値と同一の値を保持する可能性があるが、他のワーキング・レジスタはターゲット・プロセッサには無意味な値を保持する。これは、特定のターゲット・マシンよりもはるかに多いレジスタを与え、先進の加速技術を可能にしようとする実施例には、特に当てはまる。一旦変換後のホスト命令が開始したなら、これらの変換後のホスト命令がワーキング・レジスタの状態を決定し、これらのレジスタ内の値は、変換後のホスト命令が決定したいずれかの値となる。例外を発生せずに1組の変換後のホスト命令が実行された場合、この1組の命令の終了時に決定された新たなワーキング・レジスタ値が一緒にオフィシャル・ターゲット・レジスタに転送される(恐らく、ターゲット命令ポインタ・レジスタを含む)。本発明のこの実施形態では、この転送は、追加のパイプライン段において、ホスト命令の実行以外で行われるので、モーフ・ホストの動作を遅らせることはない。
同様に、図5に示す実施形態のようなゲート格納バッファを、本発明において利用し、データのメモリへの転送を制御する。ゲート格納バッファは、多数のエレメントを含み、その各々はメモリ格納動作に対してアドレスおよびデータを保持する格納位置として作用することができる。これらのエレメントは、多数の異なるハードウエア構成のいずれでも実現可能であり(例えば、先入れ先出しバッファ)、図示の実施形態は、ランダム・アクセス・メモリおよび3つの専用ワーキング・レジスタを利用して実現している・3つのレジスタは、それぞれ、メモリ格納のキューの先頭に対するポインタ、ゲートに対するポインタ、およびメモリ格納のキューの末尾に対するポインタを格納する。キューの先頭とゲートとの間の格納位置にあるメモリ格納は、既にメモリにコミットされており、一方キューのゲートと末尾との間の格納位置にあるメモリ格納は未だメモリにコミットされていない。ホスト変換の実行中に発生したメモリ格納は、モーフ・ホストによるホスト命令の実行中に発生した順序で、整数ユニットによって格納バッファに置かれるが、ホスト命令においてコミット動作が見出されるまで、メモリへの書き込みは許されない。このように、変換を実行すると、格納動作がキュー内に置かれる。これらが最初の格納であって他の格納がゲート格納バッファ内にないと仮定すると、先頭ポインタおよびゲート・ポインタは同じ位置を示している。各格納を実行するにつれて、キュー内の次の場所に置かれ、末尾ポインタが次の位置(図では上向き)に増分される。これは、コミット・コマンドが実行されるまで続けられる。コミット・コマンドの実行が行われるのは、通常、例外やエラー終了状態を発生することなく、1組のターゲット命令の変換を完了したときである。エラーなくモーフ・ホストによって変換が実行された場合、実行中に発生した格納バッファ内のメモリ格納は、一緒に格納バッファ(コミットされている)のゲートを通過し、続いてメモリに書き込まれる。図示の実施形態では、これは、末尾ポインタを保持するレジスタ内の値を、ゲートポインタを保持するレジスタにコピーすることによって行われる。
このように、ワーキング・レジスタからオフィシャル・ターゲット・レジスタへのレジスタ状態の転送、およびワーキング・メモリ格納のオフィシャル・メモリへの転送の双方は、一緒に行われ、明示的なコミット動作に応答して、整数ターゲット命令間の境界上でのみ行われることがわかる。
これによって、マイクロプロセッサは、改良モーフ・ホストによる実行中に発生したターゲット例外から、重大な遅延を全く伴うことなく、復元することができる。変換された命令または命令群のいずれかの実行中に、ターゲット例外が発生した場合、この例外は、モーフ・ホスト・ハードウエアまたはソフトウエアによって検出する。ターゲット例外の検出に応答して、コード・モーフィング・ソフトウエアは、オフィシャル・レジスタ内に保持されている値を、ワーキング・レジスタに戻し、ゲート格納バッファ内のコミットされていないメモリ格納を全て消去する(「ロールバック」と呼ばれる動作)。図5のゲート格納バッファ内メモリ格納の消去は、ゲート・ポインタを保持するレジスタ内の値を、末尾ポインタを保持するレジスタにコピーすることによって、行うことができる。
ターゲット・レジスタからワーキング・レジスタに値を移すことにより、例外が発生したときに走っていたターゲット命令の最初のもののアドレスを、ワーキング命令ポインタ・レジスタ内に置くことができる。
ワーキング・レジスタ内のターゲット・プロセッサのこのオフィシャル状態から開始して、例外が発生したときに走っていたターゲット命令を連続順序で再変換するが、並び替えやその他の最適化はまったく行わない。各ターゲット命令を新たにデコードし新たなホスト変換に変換した後、ターゲット命令を表す変換されたホスト命令をモーフ・ホストによって実行すると、例外が発生する場合あるいは発生しない場合がある。(モーフ・ホストがVLIWプロセッサ以外である場合、ホスト変換の原始動作の各々が順次実行される。ホスト変換を走らせている際に例外が発生しなかった場合、次の原始機能を走らせる。)これは、例外が再度発生するか、あるいは単一のターゲット命令が変換され実行し終えるまで続けられる。一実施形態では、例外を発生せずにターゲット命令の変換が実行された場合、ワーキング・レジスタの状態がターゲット・レジスタに転送され、更にゲート格納バッファ内のあらゆるデータがコミットされるので、メモリに転送することができる。しかしながら、変換の実行中に例外が再度発生した場合、ターゲット・レジスタおよびメモリの状態は変化せず、例外が発生したときにターゲット・コンピュータ内に生じた状態と同一である。その結果、ターゲット例外が発生した場合、この例外は、ターゲット・オペレーティング・システムによって正しく処理される。
同様に、変換によって例外が発生した一連の命令の内第1のターゲット命令が一旦実行され、例外が発生しなかったのであれば、ターゲット命令ポインタは、次のターゲット命令を示す。この第2のターゲット命令は、第1の場合と同様に、最適化または並び替えを行わず、デコードし再変換する。単一のターゲット命令のホスト変換の各々がモーフ・ホストによって処理されていくと、ターゲット・レジスタおよびメモリの状態が、ターゲット・コンピュータ内に生ずる状態と同一である場合、何らかの例外が発生する。その結果、例外を直ちにかつ正しく処理することができる。これら新たな変換は、ターゲット・アプリケーションにおける命令のシーケンスに対する正しい変換として、変換バッファ内に格納され、命令を再度走らせるときにはいつでも呼び出すことができる。
図5のゲート格納バッファと同じ結果を得る本発明の他の実施形態は、格納を直接メモリに転送しつつ、変換の例外の結果ロールバックを必要とする例外またはエラーを生じた場合にターゲット・コンピュータの状態を復元するために十分なデータを記録する構成を含むものとすることができよう。このような場合、変換および実行の間に発生したいずれのメモリ格納についてもその効果を逆転させ、変換の開始時に存在していたメモリ状態を復元しなければならない。一方、ワーキング・レジスタは、先に論じたように、オフィシャル・ターゲット・レジスタ内に保持されているデータを受け取らなければならない。これを行う一実施形態は、別個のターゲット・メモリを維持して元のメモリ状態を保持しておき、ロールバックが発生した場合に、これを利用して、上書きされたメモリを置換する。メモリ・ロールバックを行う他の実施形態は、各格納を記録し、メモリ・データが発生する毎にこれを置換し、次いでロールバックが必要な場合に、格納プロセスを逆転させる。
本発明のコード・モーフィング・ソフトウエアは、変換されているプログラムを処理する速度を大幅に高める、追加の動作を備えている。単純に命令を変換し、最適化し、並び替え、再スケジューリングし、キャッシュし、各変換を実行して、1組の命令を実行する必要があるときにはいつでも再度走らせることができるようにしておくことに加えて、変換部は異なる変換をリンクし、殆ど全ての場合に、変換プロセスの主ループへのリターンを不要にする。図8は、このリンク・プロセスを行う際に、コード・モーフィング・ソフトウエアの変換部が実行するステップを示す。このリンク動作は、殆どの命令の変換について、本質的に主ループへのリターンを不要とし、このオーバーヘッドをなくするものであることは、当業者には理解されよう。
例示の目的のために、走らせるターゲット・プログラムがX86の命令で構成されていると仮定する。ターゲット命令のシーケンスの変換を行い、原始ホスト命令を並び替え再スケジューリングする場合、各ホスト変換の終了時に、2つの原始命令が発生する可能性がある。最初のものは、ターゲット・プロセッサに対する命令ポインタの値(またはその同等物)を更新する原始命令である。この命令は、次のターゲット命令の正しいアドレスを、ターゲット命令ポインタ・レジスタに置くために用いられる。この原始命令に続くのは、分岐命令であり、当該分岐に対する2つの可能なターゲットの各々のアドレスを含む。分岐命令に先立つ原始命令がターゲット・プロセッサに対する命令ポインタの値を更新する方法は、条件コード・レジスタ内の当該分岐に対する条件コードを試験し、分岐を制御する条件が示す2つの分岐アドレスの一方が変換バッファ内に格納されているか否かについて判定を行うことである。最初にターゲット命令のシーケンスを変換する場合、ホスト命令の2つの分岐ターゲットは双方とも、変換部ソフトウエアの主ループに対して、同じホスト・プロセッサ・アドレスを保持している。
ホスト変換が完了し、変換バッファに格納され、最初に実行されるとき、ターゲット命令ポインタ・レジスタにおいて、命令ポインタを更新し(ターゲット・レジスタの残りと同様に)、動作は分岐して主ループに戻る。主ループでは、変換ソフトウエアは、ターゲット命令ポインタ・レジスタ内において、次のターゲット命令への命令ポインタを参照する。次いで、次のターゲット命令シーケンスをアドレスする。このターゲット命令のシーケンスが未だ変換されておらず、したがって変換が変換バッファ内にないと仮定すると、次の1組のターゲット命令をメモリから取り込み、デコードし、変換し、最適化し、並び替え、再スケジューリングを行い、変換バッファ内にキャッシュし、実行する。第2組のターゲット命令が第1組のターゲット命令に続くので、第1組のターゲット命令のホスト変換の最後の原始分岐命令は自動的に更新され、第2組のターゲット命令のホスト変換のアドレスを、当該分岐を制御する特定の条件に対する分岐アドレスとして置換する。
次に、第2の変換されたホスト命令が第1の変換されたホスト命令にループ・バックする場合、第2の変換の最後における分岐動作は、主ループのアドレス、および第1の変換のX86アドレスを、当該分岐に可能な2つのターゲットとして含む。分岐に先立つ更新−命令−ポインタ原始動作は、条件を試験し、第1の変換へのループ・バックを行うことを決定し、最初の変換のX86アドレスへのターゲット命令ポインタを更新する。これによって、変換部は変換バッファを調べ、捜索中のX86アドレスがそこにあるか否か確かめる。最初の変換のアドレスを発見したなら、ホスト・メモリ空間内におけるその値を、第2のホスト変換命令の最後の分岐内のX86アドレスと置換する。次に、第2のホスト変換命令をキャッシュし実行する。これによって、第1の変換から第2の変換への分岐を行わせる条件が満たされなくなるまで、このループを走らせ、主ループに戻る経路を取る分岐を行う。これが行われた場合、第1の変換されたホスト命令は主ループに戻るように分岐し、ターゲット命令ポインタによって指定される次の1組のターゲット命令を変換バッファ内で探索し、キャッシュからホスト変換を取り込む。あるいは、変換バッファ内の探索が失敗した場合、ターゲット命令をメモリから取り込み、変換する。この変換されたホスト命令が変換バッファにキャッシュされるとき、そのアドレスが、ループを終了した分岐命令内の主ループ・アドレスと置換する。
このように、種々の変換されたホスト命令が互いに連鎖されているので、変換主ループを通過する長い経路を辿る必要があるのは、リンクが存在しない場合のみである。最終的に、ホスト命令の分岐命令における主ループの参照は、殆ど完全に無用となる。この条件に達した場合、いずれのホスト命令を走らせる前であっても、ターゲット命令を取り込み、ターゲット命令をデコードし、当該ターゲット命令を構成する原始命令を取り込み、これらの原始動作を最適化し、原始動作を並び替え、これら原始動作の再スケジュールを行うために必要な時間が不要となる。したがって、いずれのアプリケーションの命令シーケンスを走らせる場合にもその都度これらのステップの各々を実行しなければならない全ての従来技術のマイクロプロセッサとは対照的に、本発明を用いれば、最初の変換を行った後には、いずれの1組のターゲット命令を走らせるために必要な作業も激減する。この作業は、各組の変換されたホスト命令を他の組の変換されたホスト命令にリンクすることによって、更に減少する。実際、アプリケーションを走らせている間、交換が必要となるのは、100万回の命令実行中1回未満となることが推定される。
変換する各組の命令を順にキャッシュし、再度変換する必要をなくすようにするため、この本発明の実現には、大きな変換バッファが必要であることを当業者は認識するであろう。異なるシステムに対してプログラムされたアプリケーションと共に機能するように設計された変換部の支援用バッファ・メモリに対する必要性は様々に変化する。しかしながら、X86プログラムを走らせるように設計された本発明の一実施形態は、2メガバイトのランダム・アクセス・メモリを変換バッファとして利用している。
2つの追加のハードウエア機能強化が、本発明のマクロプロセッサがアプリケーションを処理可能な速度を高めるのに役立つ。これらの内最初のものは、異常/正常(A/N)保護ビットであり、ターゲット命令の物理アドレスの参照を最初に行った変換ルック・アサイド・バッファ(TLB)(図3参照)内の各アドレス変換とともに格納される。変換内部のターゲット・メモリの動作には、2種類あり、一方はメモリ上で動作するもの(正常)、他方はメモリ・マップI/Oデバイス上で動作するもの(異常)とすることができる。
メモリに影響を与える正常アクセスは、正常に完了する。命令がメモリ上で動作する場合、これらの命令の最適化および並び替えを行うことが適当であり、本発明のマイクロプロセッサを用いたいずれのシステムでも、その速度を高めるのに非常に役立つ。一方、I/Oデバイスに影響を与える異常アクセスの動作は、いずれのステップも除去することなく、これらの動作がプログラムされた正確な順序で行わなければならない場合が多い。さもないと、I/Oデバイスに何らかの悪影響を与える可能性がある。例えば、特定のI/O動作が、I/Oレジスタをクリアする結果をもたらす場合があり、原始動作が順序を外して行われた場合、動作の結果は、ターゲット命令が指令した動作とは異なる場合がある。メモリをメモリ・マップI/Oと区別する手段がないと、メモリ・マップI/Oに影響を与える命令を変換する際に用いられる旧来の仮定を用いて、全てのメモリを扱わなければならない。これは、達成可能な最適性を著しく制限することになる。従来技術のエミュレータは、アドレスされているメモリの特性に対する推測の失敗を検出する手段、およびこのような失敗から復元する手段の双方を欠いていたので、その処理能力には限界があった。
本発明の一実施形態では、A/Nビットは、メモリ・ページを示すために変換ルック・アサイド・バッファ内に最初にセットされる。メモリに影響を与える動作を、メモリ動作であるかのように変換することは、実際には、この動作がメモリに影響を与えるものとする推測である。変換が行われ実行した後、アクセス型(正常、または異常)を、LTB A/N保護ビットと比較することによって、ターゲット・メモリ参照をチェックする。アクセス型がA/N保護と一致しない場合、例外が発生する。実際に動作がメモリに影響を与える場合、前述の最適化、並び替え、および再スケジューリング技術が正しく適用されたことになる。しかしながら、TLB内のA/Nビットの比較が、動作がI/Oデバイスに影響を与えることを示す場合、実行によって例外が発生し、変換部は、いずれの種類の最適化、並び替え、再スケジューリングも行わず、1度に1つのターゲット命令ずつ、新たな変換を行う。同様に、変換が、実際にはメモリに影響を与える動作をI/O動作を誤って仮定した場合、実行によって例外が発生し、最適化技術、並び替え技術および再スケジューリング技術を用いて、ターゲット命令を再変換する。このように、本発明は、従来可能であった性能を超える改良をもたらすことができる。
本発明が最も頻繁に実施する推測の1つは、変換中にターゲット例外が発生しないことに関するものである。これによって、従来技術に対して各段の最適化が可能となる。第1に、ターゲット状態を各ターゲット命令境界毎に更新する必要がなく、変換境界上に生ずるターゲット命令境界上でのみ更新すればよい。これによって、各ターゲット命令境界毎にターゲット状態をセーブするために必要な命令が不要となる。スケジューリングや冗長な動作を除去することに対する、従来では不可能であった最適化も可能となる。
驚くべきことに、本発明は、適切な変換プロセスを選択するように構成されている。前述の変換方法によれば、最初に1組の命令を、それがメモリに影響を与えるかのように、変換することができる。次に、ホスト命令の最適化、並び替え、および再スケジューリングを実行すると、変換ルック・アサイド・バッファ内に備えられているA/Nビットの状態によって、I/Oデバイスを参照するアドレスを得ることができる。A/Nビットと、ある動作がI/O動作であることを示す変換命令アドレスとの比較により、エラー例外が発生し、これによってソフトウエアが開始するロールバック手順が行われ、あらゆるアンコミット・メモリ格納が消去され、ターゲット・レジスタ内の値はワーキング・レジスタ内に戻される。次に、1度に1ターゲット命令ずつ変換が開始され、最適化、並び替え、あるいは再スケジューリングは行われない。この再変換は、I/Oデバイスに適したホスト変換である。
同様に、メモリ動作を、I/O動作として誤って変換する可能性がある。発生するエラーを用いて、その正しい再変換を行わせ、最適化、並び替え、および再スケジューリングを行うことにより、より速い動作を与える。
従来技術のエミュレータは、一般的に自己変更コード(self modifying code)と呼ばれるものにも苦闘していた。ターゲット・プログラムが、ターゲット命令を収容しているメモリに書き込みを行った場合、これらのターゲット命令のために存在する変換は「古く」なり、もはや有効でなくなる。これらの格納が発生する際に、動的にこれらを検出する必要がある。従来技術では、各格納に対して余分な命令を用いてこのような検出を行わなければならない。この問題は、プログラムがそれ自体を変更することよりも、範囲が広い。第2のプロセッサやDMAデバイスのような、メモリに書き込みを行う可能性のあるあらゆるエージェントも、この問題を発生する可能性がある。
本発明は、モーフ・ホストに対する別の機能強化によって、この問題に対処する。同様に変換ルック・アサイド・バッファに格納することができる変換ビット(Tビット)を用いて、変換が存在する原因であるターゲット・メモリ・ページを示す。したがって、Tビットは、ターゲット・メモリの特定のページが、ホスト変換が存在する原因であるターゲット命令を含むことを示すことができる。これらのターゲット命令が上書きされた場合、変換は陳腐化することになる。メモリ内で保護されているページに書き込みを行おうとした場合、変換ビットの存在によって例外が発生し、これをコード・モーフィング・ソフトウエアで処理すると、該当する変換(複数の変換)を無効化し、変換バッファから除去することができる。また、Tビットは、書き込まれていないターゲット・ページにマークを付けるために用い、これに基づいて変換を行うことも可能である。
本発明のマイクロプロセッサの全体的な機能エレメントをブロック図状で示す図3を参照することによって、これは理解することができる。モーフ・ホストがターゲット・プログラムを実行する場合、実際には、変換されていない元のホスト命令のみを含む、コード・モーフィング・ソフトウエアの変換部部分を走らせる。変換されていない元のホスト命令は、事実上、モーフ・ホスト上で走る。図の右側に、本質的に変換部および変換バッファを含むホスト部分と、ターゲット・オペレーティング・システムを含み、ターゲット命令およびデータを含むターゲット部分とに分割されたメモリが示されている。モーフ・ホスト・ハードウエアは、変換部を実行開始する際、メモリからホスト命令を取り込み、これらの命令を命令キャッシュ内に置く。変換部の命令は、メモリのターゲット部分に格納されている最初のターゲット命令のフェッチ(fetch)を発生する。ターゲット・フェッチを実行することにより、整数ユニットは、ターゲット命令の第1のアドレスを求めて、オフィシャル・ターゲット命令ポインタ・レジスタを探る。次に、メモリ管理ユニットの変換ルック・アサイド・バッファ内の最初のアドレスにアクセスする。メモリ管理ユニットは、ページング用ハードウエアを含み、TLBにメモリ・マッピング機能(facilities)を与える。TLBが正しくマップされており、ターゲット・メモリの正しいページに対する参照データを保持していると仮定すると、ターゲット命令ポインタ値は、ターゲット命令の物理アドレスに変換される。この時点において、変換がターゲット命令に対して行われたか否かを示すビット(Tビット)の状態が検出されるが、アクセスは読み取り動作であり、Tビットの例外は発生しない。アクセスがメモリまたはメモリ・マップI/Oのどちらに対するものかを示すA/Nビットの状態も検出される。最後に述べたビットがメモリ位置を示すと仮定すると、変換が存在しないので、ターゲット・メモリ内のターゲット命令にアクセスする。このターゲット命令および後続のターゲット命令は、モーフ・ホスト計算機ユニットへのデータとして転送され、命令キャッシュに格納されている変換命令の制御の下で変換される。変換命令は、このターゲット命令がメモリに影響を与えるかのように、並び替え技術、最適化技術、および再スケジューリング技術を利用する。次に、ホスト命令のシーケンスを含む変換が得られ、これをホスト・メモリ内の変換バッファに格納する。変換は、ゲート格納バッファを介して、ホスト・メモリ内の変換バッファに直接転送される。一旦変換がホスト・メモリに格納されたなら、変換部は変換に分岐し、次いでこれを実行する。この実行(および後続の実行)は、変換が例外およびメモリに関して正しい仮定を行ったか否かについて判定を行う。変換を実行する前に、変換したターゲット命令を収容しているターゲット・ページ(群)に対するTビットをセットする。この指示は、命令が変換されたこと、およびターゲット・アドレスに対する書き込みを行おうとすると、この試行は例外を発生し、変換が無効になるかあるいは除去される可能性があることを警告する。
モーフ・ホストに対する追加のハードウエア機能強化の1つは、通常はメモリに格納されるが動作の実行において頻繁に用いられるデータを、実行ユニット・レジスタ内に複製(即ち、「エイリアス」)し、各使用毎に当該データをメモリから取り出す際に要する時間を不要にするために利用する回路である。一実施形態においてこれを行うためには、図11に示す実行ユニット110内のワーキング。レジスタ111にメモリ・データをコピーする「ロードおよび保護」コマンドに応答するように設計し、そのメモリ・アドレスを当該ユニット内のレジスタ112内に置く。アドレス・レジスタと連動するのは、比較器113である。比較器は、変換中メモリに向けられたゲート格納バッファへのロードおよび格納のアドレスを受け取る。ロードまたは格納のいずれかに対するメモリ・アドレスをレジスタ112(または実施形態によっては追加のレジスタ)内のアドレスと比較した場合、例外が発生する可能性がある。コード・モーフィング・ソフトウエアは、メモリ・アドレスおよびレジスタが同じ正しいデータを保持していることを確認することによって、この例外に応答する。一実施形態では、変換をロール・バックし、実行レジスタ内に「エイリアス」データが全くない状態で、再実行することによって、これを行う。この問題を補正する他の可能な方法として、レジスタを最新のメモリ・データで更新するか、あるいはメモリを最新のロード・データで更新することが挙げられる。
本発明のホスト・プロセッサは、典型的なコンピュータ・エレメントを有する回路に接続すれば、図9に示すようなコンピュータを形成可能であることは、当業者には認められよう。図に見られるように、最近のX86コンピュータに用いる場合、ホスト・プロセッサをプロセッサ・バスを介して、メモリおよびバス制御回路に結合する。メモリおよびバス制御回路は、主メモリおよび、マイクロプロセッサと共に利用可能なキャッシュ・メモリへのアクセスを与えるように構成されている。また、メモリおよびバス制御回路は、PCIまたはその他のローカル・バスのようなバスへのアクセスも与え、このバスを通じてI/Oデバイスにアクセスすることができる。個々のコンピュータ・システムは、本発明のプロセッサによって置換される本発明のマイクロプロセッサと共に用いられる回路に依存する。
本発明のプロセッサの動作、および実行の加速化を行う態様を示すために、X86ターゲットコードの小さなサンプルのホスト原始命令への変換を、ここで提示する。このサンプルは、X86のターゲット命令のモーフ・ホスト命令への変換を示し、本発明のマイクロプロセッサによる、最適化、並び替え、および再スケジューリングのステップの様々な例を含む。例示するプロセスを追って行くことにより、ターゲット・プロセッサを用いて元の命令を実行する際に必要な動作と、ホスト・プロセッサ上で変換を実行する際に必要な動作との間の大幅な差が、当業者には明白となろう。
C言語のソース・コードで例示した元の命令は、非常に短いループ処理を記述する。本質的に、各ループの後に減分される変数「n」が「0」より大きい間、値「c」が、ポインタ「*s」が示すアドレスに格納される。ポインタ「*s」は各ループの後に増分される。

Figure 0003776132
表記:[...]は、メモリ・オペランドに対するアドレス表現を示す。先の例では、メモリ・オペランドに対するアドレスは、レジスタの内容を、Oxプレフィクスが示す16進定数に加算することによって形成される。ターゲット・レジスタは、%プレフィクスで示される。例えば、%ecxは、excレジスタを示す。動作の宛先は左側である。
Figure 0003776132
このサンプルの第1部分では、C言語の命令文によって定義される動作の実行を行うための個々のX86アセンブリ言語の命令は各々、当該動作に対するアセンブリ言語のニモニックによって表に纏められており、特定の原始動作に含まれるパラメータがこれに続く。動作の説明も、各命令毎のコメントにおいて与えることにする。実行の順序は、ターゲット・プロセッサでは、図示のものとは異なる場合もあるが、これらのアセンブリ言語命令の各々は、ターゲットC言語命令を実行する際に、ループを実行する毎に実行しなければならない。したがって、ループを100回行われる場合、以上に示した各命令は100回実行されなければならない。
Figure 0003776132
Figure 0003776132
次のサンプルは、C言語命令を実行する、同じターゲット原始命令を示す。しかしながら、各原始ターゲット命令の次に、本発明のマイクロプロセッサの一特定実施形態において同じ動作を行うために必要な原始ホスト命令を纏めてある。このマイクロプロセッサでは、モーフ・ホストはここに記載したように設計されたVLIWプロセッサである。オフィシャル・ターゲット・レジスタによってシャドウされたホスト・レジスタは、「R」で示し、その後ろにX86レジスタ名称が続くので、例えば、Reaxは、EAXオフィシャル・ターゲット・レジスタと連動するワーキング・レジスタであることを注記しておく。
Figure 0003776132
Figure 0003776132
Figure 0003776132
次のサンプルは、原始ターゲット命令の各々について、ホスト原始命令の追加を示し、これによって、ターゲット動作に必要なアドレスを、コード・モーフィング・ソフトウエアによって発生することができるものである。ホスト・アドレス発生命令は、アドレス発生ハードウエアの代わりに、コード・モーフィング・ソフトウエアをアドレス発生に用いるマイクロプロセッサの実施形態においてのみ必要となることを注記しておく。X86マイクロプロセッサのようなターゲット・プロセッサでは、アドレス発生ハードウエアを用いてこれらのアドレスを発生する。このような本発明の実施例においてアドレスが発生したときはいつでも、計算が行われ、また、ホスト原始命令が追加され、アドレス値をチェックすることによって、算出されたアドレスが適切なX86セグメントの限度内にあることを判定する。
Figure 0003776132
Figure 0003776132
Figure 0003776132
Figure 0003776132
このサンプルは、原始ホスト命令の各組に2ステップを追加することによって、ゲート格納バッファ内のアンコミット値をメモリにコミットするために必要なホスト命令の実行後に、各原始ターゲット命令を実行し、オフィシャル・ターゲット・レジスタを更新することを例示する。サンプルに見られるように、各場合において、ターゲット命令の長さを、ワーキング命令ポインタ・レジスタ(Reip)内の値に加算する。次に、コミット命令を実行する。一実施形態では、コミット命令は、連動するオフィシャル・ターゲット・レジスタにシャドウされている各ワーキング・レジスタの現在値をコピーし、ゲート格納バッファのゲートの位置を指定するポインタ値を、アンコミットの格納の直前から、それらの格納の直後に移動させ、それらをメモリ内に置くようにする。
上記の最後に示した命令のリストは、元のターゲット・アセンブリ言語命令のホスト変換を形成するために必要な命令の全てであることは認められよう。変換がこの時点で停止した場合、原始ホスト命令の数は、ターゲット命令の数よりもはるかに多くなり(恐らく、6倍多い命令)、その実行は、ターゲット・プロセッサ上での実行よりも長くかかる可能性がある。しかしながら、この時点では、並び替えや、最適化や、再スケジューリングは未だ行われていない。
命令を1度だけ走らせる場合、更に並び替えやその他の最適化も行うために要する時間は、この時点で存在する変換を実行するための時間よりも長くなるということになり得る。その場合、本発明の一実施形態では、この時点で変換を中止し、変換を格納し、次いでそれを実行して例外またはエラーが発生するか否かについて判定を行う。この実施形態では、並び替えおよびその他の最適化のステップが行われるのは、特定の変換をある回数走らせることまたは最適化すべきことを決定した場合のみである。これは、例えば、ホスト命令を各変換に置き、変換を実行した回数を数え、ある値に達したときに例外(または分岐)を発生することによって行われる。例外(または分岐)は、動作をコード・モーフィング・ソフトウエアに転送し、次いでコード・モーフィング・ソフトウエアは、以下の最適化の一部または全部、および当該変換に有用と判定されたあらゆる追加の最適化を実現する。変換を走らせた回数を判定し、最適化を要求する第2の方法は、ある頻度でまたはある統計的基準に基づいて、変換の実行を中断し、その時点で走っているいずれの変換も最適化することである。これは、究極的に、最も頻繁に走らせる命令を最適化しようとするものである。別の解決策として、ループを形成するものや、その他に最も頻繁に走らせる可能性があるもののような、ある特定の形式のホスト命令の各々を最適化することも挙げられよう。
Figure 0003776132
Figure 0003776132
Figure 0003776132
Figure 0003776132
このサンプルは、本発明を利用して実施可能な最適化の第1段を例示する。この最適化段は、コード・モーフィング・ソフトウエアの他の動作の多くと同様、最適な結果を想定する。特定の最適化は、X86プロセッサ・ファミリによって与えられるフラット・メモリ・モデルに対して書かれた32ビット・プログラムとして開始したターゲット・アプリケーション・プログラムが、そのようなプログラムとして継続することを想定する。このような想定は、X86ファミリに特定なものであり、エミュレート対象の他のプロセッサ・ファミリでは必ずしも適用される訳ではないことを注記しておく。
この想定を行った場合、X86用アプリケーションでは、全てのセグメントが同一アドレス空間にマップされる。これによって、X86セグメンテーション・プロセスが要求する原始ホスト命令を除去することが可能となる。サンプルに見られるように、最初にセグメント値をゼロにセットする。次に、データのベースをゼロにセットし、限度を最大使用可能メモリにセットする。すると、ターゲット原始命令を実行するための各組の原始ホスト命令において、セグメンテーションに必要なセグメント・ベース値のチェック、およびセグメント・ベース・アドレスの計算双方が不要となる。これによって、アドレシング機能を必要とする各ターゲット原始命令に対して、2つのホスト原始命令が実行すべきループを減少する。この時点では、メモリ上限に対するホスト命令チェックは未だ存在する。
この最適化には、アプリケーションが32ビット・フラット・メモリ・モデルを利用することを記した推測を必要とすることを注記すべきであろう。これが真ではない場合、主ループが制御転送の宛先を解明し、転送元の想定が宛先の想定と一致しないことを検出する際に、エラーが発見される。すると、新たな変換が必要となる。この技法は非常に一般的であり、種々のセグメンテーションおよびその他の「モード化」の場合において、デバッグ、システム管理モード、または「リアル」モードのように、「モード」が頻繁に変化する場合に適用可能である。
Figure 0003776132
Figure 0003776132
Figure 0003776132
このサンプルは、最適化の次の段階を例示する。この場合、推測的な変換(speculative translation)によって、メモリ・アドレス空間の上端においてメモリ参照と交差する整合されていないページに対してのみ必要な、上側のメモリ境界チェックを不要にする。この想定の失敗は、ハードウエアまたはソフトウエアの整合解決(fix up)によって検出される。これによって、アドレシングを必要とする各ターゲット原始命令毎に、ホスト原始命令1つだけ変換が減少する。この最適化は、アプリケーションが32ビット・フラット・メモリ・モデルを利用するという先に記した想定、および命令が整合されているという推測の双方を必要とする。これらが真でない場合、変換を実行した際に失敗に終わり、新たな変換が必要となる。
Figure 0003776132
Figure 0003776132
Figure 0003776132
このサンプルは、次の最適化を例示する。この場合、共通のホスト表現を除去する。即ち、2番目のターゲット原始命令を変換する際、ワーキング・レジスタRebp(X86プロセッサのスタック・ペース・ポイント・レジスタを表すワーキング・レジスタ)内の値を、オフセット値0x8に加算し、ホスト・ワーキング・レジスタR2に置く。直前のサンプルにおいてターゲット原始命令5を変換する際に同じ動作を行ったが、加算の結果はワーキング・レジスタR5に置かれたことを注記しておく。その結果、ワーキング・レジスタR5に置かれる値は、ホスト原始命令5が生じようとするときには、既にワーキング・レジスタR2に存在する。したがって、ホストの加算命令を、ターゲット原始命令5の変換から除去することができ、ワーキング・レジスタR2内の値をワーキング・レジスタR5にコピーすればよい。同様に、ワーキング・レジスタRebp内の値をオフセット値0x10と加算するホスト命令も、ターゲット原始命令8の変換では除去することができる。何故なら、このステップは既にターゲット原始命令6の変換において行われており、結果はレジスタR7にあるからである。この最適化は思索に依存せず、そのため失敗や再変換がないことを注記しておく。
Figure 0003776132
Figure 0003776132
この例は、変換全体を構成する原始ターゲット命令の変換が、例外を発生することなく行うことができると推測する最適化を例示する。これが真であれば、オフィシャル・ターゲット・レジスタを更新したり、個々のターゲット原始命令を実行するホスト原始命令の各シーケンス毎に、その終了時に格納バッファにおけるアンコミットの格納をコミットする必要がなくなる。推測が真であれば、ターゲット原始命令のシーケンスの終了時に、オフィシャル・ターゲット・レジスタだけを更新すればよく、格納をコミットするのは一度だけでよい。これによって、各原始ターゲット命令を実行するための原始ホスト命令を2つ除去することが可能となる。これらは、オフィシャル・ターゲット・レジスタをアンコミットの格納をメモリにコミットする単一のホスト原始命令と置換する。
これは、別の推測的動作であり、これも正しい推測を含む可能性が非常に高いことは理解されよう。このステップは、推測が真であれば、従来技術のエミュレーション技術全てに対して、非常に大きな利点を提供することになる。これは、ターゲット原始命令のシーケンス全体を実行する原始ホスト命令の全てを、1つのシーケンスに集合化し、その中で個々のホスト原始命令の全てを一緒に最適化することができる。これには、超長命令ワード技術を利用したモーフ・ホスト上で多数の動作を並列に走らせることができるという利点がある。また、これによって、より多数のその他の最適化も可能となる。何故なら、このような最適化に対する選択肢が広がるからである。更にまた、しかしながら、推測が真でないことが判明し、ループの実行時に例外が発生した場合、オフィシャル・ターゲット・レジスタおよびメモリは、ターゲット原始命令のシーケンスの開始時に存在したオフィシャル・ターゲットの状態を保持している。何故なら、ホスト命令のシーケンスが実際に実行されるまで、コミットは生じないからである。例外から復元するために必要な全ては、アンコミットの格納を消去し、オフィシャル・レジスタをワーキング・レジスタにロールバックし、シーケンスの開始時にターゲット原始命令の変換を再度開始することである。この再変換は、1度に1ターゲット命令ずつの変換を行い、各ターゲット原始命令を表すホスト・シーケンスを変換した後に、オフィシャル状態を更新する。次に、この変換を実行する。この再変換において例外が発生した場合、この例外を実行するために、オフィシャル・ターゲット・レジスタおよびメモリにおいて、正しいターゲット状態を直ちに得ることができる。
Figure 0003776132
この要約は、最適化プロセスのこの時点において残っているホスト原始命令のシーケンスを例示する。この例は、ターゲット命令ポインタ(EIP)インラインの維持を示すが、変換時に分岐のためのポインタEIPをライン外に維持することが可能である。この場合、ポインタEIP更新シーケンスをこのステップおよび本例の後続のステップから除去することができる。
Figure 0003776132
このサンプルは、通常レジスタ名称変更と呼ばれる、最適化の次のステップを示す。ここでは、ホスト原始命令のシーケンスにおいて1回以上の動作に用いられるワーキング・レジスタを必要とする動作は、異なる不使用のワーキング・レジスタを利用するように変更され、2つのホスト命令が同じハードウエアを必要とするという可能性をなくす。したがって、例えば、先の2つのサンプルにおいて、2番目のホスト原始命令は、オフィシャル・ターゲット・レジスタECXを表すワーキング・レジスタRecxを使用する。10番目のホスト原始命令も、ワーキング・レジスタRecxを使用する。2番目のホスト原始命令における動作を変更し、R0内のアドレスによって示される値を、レジスタRecxではなく、ワーキング・レジスタR1に格納することにより、先の2つのホスト命令が双方とも同じレジスタを使用する事態は避けられる。同様に、4番目、5番目、および6番目の原始命令も、先のサンプルでは、全てワーキング・レジスタReaxを利用する。4番目のホスト原始命令を変更し、ワーキング・レジスタReaxの代わりに、それまで不使用のワーキング・レジスタR3を利用するようにし、更に6番目のホスト原始命令を変更して、レジスタReaxの代わりに、それまで不使用のワーキング・レジスタR4を利用することによって、これらのハードウエア依存性がなくなる。
Figure 0003776132
このサンプルは、モーフ・ホスト上で実行するためのホスト原始命令のスケジューリングを示す。この例では、モーフ・ホストをVLIWプロセッサと仮定し、コード・モーフィング・ソフトウエアと協同するために備えられたハードウエア機能強化に加えて、処理ユニットの中でもとりわけ、2つの算術および論理(ALU)ユニットが含まれている。最初の行は、モーフ・ホスト上で一緒に走るようにスケジュールされた2つの個別の加算命令を示す。サンプルに見られるように、これらは、先の要約の直前のサンプルにおける3番目および8番目の原始ホスト命令である。2番目の行は、NOP(無動作であるが、次の命令に進む)命令および別の加算命令を含む。NOP命令は、何らかのスケジューリング最適化を行った後でも、一緒に走らせることができる命令が常に2つあるとは限らないことを示す。いずれにしても、このサンプルは、この時点では9組の原始ホスト命令のみが、元の10個のターゲット命令を実行するために残されていることを示す。
Figure 0003776132
このサンプルは、本質的に、ホスト原始命令の同じ組を例示するが、命令はこの時点では、変換バッファに格納され、1回以上実行されている点で異なる。何故なら、最後のジャンプ(jp)命令が、ここでは、変換された命令の別のシーケンスに連鎖することによって与えられたジャンプ・アドレスを示すからである。連鎖プロセスは、シーケンスの変換が完了していれば、変換部のメイン・ループから命令のシーケンスを取り出す。
Figure 0003776132
この例は、大抵は多数回繰り返されるシーケンスでのみ利用される進んだ最適化ステップを例示する。このプロセスは、最初に、ループを形成する変換を検出し、個々の原始ホスト命令を調べて、ループ本体内で一定の結果を生成する命令を判定する。これらの命令をループ本体から除去し、1回だけ実行して、レジスタ内に値を置く。その時点以降、このレジスタに格納した値を用い、命令を再度走らせることはしない。
Figure 0003776132
これら繰り返しのない命令をループから除去し、シーケンスを実行のためにスケジューリングすると、スケジューリングされた命令は、この最後のサンプルのようになる。最初の命令は実行されるが、ループの最初の繰り返しの間に1度だけであり、その後は、図示の7つのクロック・インタバルに残っているホスト原始命令のみが、ループの間に実行されることがわかる。したがって、実行時間は、原始ターゲット命令を実行するために必要な10命令から、7命令インタバルに短縮した。
サンプルからわかるように、ループから除去したステップは、アドレス発生ステップである。したがって、アドレス発生は、本発明では、ループ呼び出し毎に1回だけ行えばよい。即ち、アドレス発生は1回だけ行えばよい。一方、X86ターゲット・プロセッサのアドレス発生ハードウエアは、これらのアドレスを、ループを実行する毎に発生しなければならない。ループを100回実行する場合、本発明は1回だけアドレスを発生するのに対して、ターゲット・プロセッサは、各アドレスを100回発生することになる。
Figure 0003776132
これは、変数を安全にメモリからレジスタに移動させることができる。モーフ・ホストのレジスタ・エイリアス検出ハードウエアの使用を示す。開始点は、「逆方向コード移動」の後のコードである。これは、ロードを除去することができる最適化を示す。
最初にロードを実行する。エイリアス・ハードウエアによってアドレスは保護されており、このアドレスに対する格納が行われると、「エイリアス」例外が発生する。次に、ループ本体内のロードをコピーと置換する。ループの本体の後、エイリアス・ハードウエアを解放する。
Figure 0003776132
Figure 0003776132
このサンプルは、更に進んだ最適化を例示し、本発明のマイクロプロセッサによって実施することができる。このサンプルより2つ前のサンプルを再度参照すると、最初の3つの加算命令が、スタック上のアドレスの計算を伴っていたことに気が付くであろう。これらのアドレスは、ホスト動作のシーケンスの実行中変化しない。つまり、これらのアドレスに格納されている値は、メモリから検索し、実行のために直ちに得ることができるレジスタにロードしておけばよい。サンプルに見られるように、これはホスト原始命令6,8,および10において行われる。命令7,9および11では、メモリ・アドレスの各々に、特殊なホスト・エイリアス・ハードウエアによって保護されているという印が付けられており、レジスタは、これらのメモリ・アドレスのエイリアスとして示されているので、そのデータを変更しようとするいずれの試みも、例外の原因となる。この点において、これらのスタック・メモリ・アドレスからのデータ移動を伴うロード動作の各々は、単純なレジスタ間コピー動作となり、これは、メモリ・アドレスからのロードよりも格段に速く進展する。n=0まで一旦ループを実行し終えたなら、エイリアス・レジスタを他のために利用できるように、メモリ・アドレスの各々から保護を除去しなければならないことを注記しておく。
Figure 0003776132
Figure 0003776132
このサンプルは、最適化の次の段階を示す。ここでは、最後のサンプルで示した最適化においてロード命令を置換したコピー命令の殆どが不要であり、除外してもよいことを認識する。即ち、レジスタ間コピー動作が行われると、データをコピーした元のレジスタ内に、その動作前のデータが存在する。この場合、データは、それがコピーされたレジスタではなく、最初のレジスタにアクセスすることができ、コピー動作を除去することができる。これからわかるように、最後のサンプルのループ内に示す、先頭、2番目、5番目および9番目の原始ホスト命令が除去される。加えて、ホスト原始命令の他のものに用いられているレジスタも変更され、当該データに対する正しいレジスタを反映する。したがって、例えば、最初と2番目のコピー命令を除去した場合、3番目の格納命令は、データが存在するワーキング・レジスタRc(レジスタR1ではなく)からデータをコピーし、ワーキング・レジスタRs(レジスタR3ではなく)内に示されるアドレスにそのデータを置かなければならない。ワーキング・レジスタRsには、そのアドレスが存在する。
Figure 0003776132
上のサンプルにスケジューリング後のホスト命令を示す。このシーケンスは、ソース・コードから当初デコードされた原始ターゲット命令を実行するよりも、ループを実行するのに必要なクロックが少なくて済むことを注記しておく。したがって、行われた他の加速化の全てとは別に、結合された動作を走らせる総回数は、元のターゲット・コードを実行するために必要な動作よりも、単純に少なくなる。
Figure 0003776132
このサンプルに示す最終的な最適化は、エイリアス・ハードウエアの使用による格納の除去である。これは、ループ本体内から格納を除去し、それらをループの結びにおいてのみ実行する。これによって、ループ本体内のホスト命令数が、元の10個のターゲット命令と比較して、3つに減少する。
以上、好適な実施形態に関して本発明の説明を行ったが、本発明の精神および範囲から逸脱することなく、当業者には種々の変更や変形も可能であることは認められよう。例えば、本発明は、X86プロセッサのエミュレーションに関して説明したが、本発明は、同様に、他のプロセッサ・アーキテクチャに設計されたプログラム、およびPコード、Postscript、またはJavaプログラムのような仮想マシン上で実行するプログラムにも適用されることは理解されよう。したがって、本発明は、以下の請求範囲に沿って解釈すべきものとする。Background of the Invention
Field of Invention
The present invention relates to computer systems, and more particularly to methods and apparatus for improving microprocessors.
History of conventional technology
There are thousands of application programs running on computers designed around a particular microprocessor family. Existing programs include the development of the “X86” family of microprocessors (Intel 8088, Intel 8086, Intel 80186, Intel 80286, i386, i486, and various Pentium microprocessors, designed and manufactured by Intel Corporation of Santa Clara, California. Including molds: Intel and Pentium are registered trademarks, the most being designed to run on computers (commonly referred to as IBM compatible personal computers). There are many examples of other programs designed to run on computers using other processor families. Because there are many application programs that run on these computers, the market for microprocessors that can be used in such computers, particularly programs designed to process X86 programs, is enormous. Not only is the microprocessor market large, it is very profitable.
Although the market for microprocessors capable of running many application programs is large and profitable, it is very difficult to design new competitive microprocessors. For example, the X86 processor family has existed for many years and these processors are included in most of the computers sold and used, but few successful processors can run X86 programs. There are many reasons for this.
To succeed, all the programs designed for this processor family (including the operating system and legacy programs) must be microprocessors that can run as fast as existing processors, Furthermore, the cost must be kept lower than existing processors. In addition, in order to be economically successful, a new microprocessor must be replaced with an existing recognized processor by surpassing an existing processor in at least one of these conditions. The purchaser must be given a reason for choosing a processor.
Running a microprocessor as fast as a modern microprocessor is difficult and expensive. The processor executes instructions with primitive operations such as load, shift, add, store, and similar low-level operations, and when executing any instruction provided by an application program, Responds only to commands. For example, a processor designed to run a complex instruction set computer (CISC) instruction, such as X86, that can specify a process whose instructions are to be executed at a relatively high level. Conventionally, a read-only memory (ROM) is included, and so-called microinstructions are stored therein. Each microinstruction contains a series of primitive instructions, and running them in sequence yields the results commanded by the high level CISC instructions. Typically, when the CISC instruction “add A to B” (adding A to B) is decoded, the microinstructions that perform the function of this “add A to B” instruction are stored in the ROM. Refer to the address. This microinstruction is loaded and the "add A to B" instruction is executed by running the primitive instructions sequentially. In such a CISC computer, the primitive operations within the microinstructions can never be changed during program execution. Each CISC instruction can only be run by decoding the instruction, addressing and fetching the microinstruction, and running a series of primitive operations in the order given within the microinstruction. Each time a microinstruction is run, the same sequence must occur.
Advanced processors for running X86 applications utilize a number of technologies and are trying to process as fast and economically as possible. Any new processor that implements known hardware techniques to accelerate the speed at which the processor can run must increase the sophistication of the processing hardware. This requires increased hardware costs.
For example, a superscalar microprocessor that uses multiple processing channels to perform more than one operation at a time has a number of additional requirements. At the most basic level, a simple superscalar microprocessor can decode each application instruction into microinstructions and perform the functions of that application instruction. Thus, a simple superscalar microprocessor requires that two microinstructions do not require the same hardware resources and if the execution of one microinstruction does not depend on the processing result of the other microinstruction, Schedule the instructions to run together.
Advanced superscalar microprocessors typically can decode each application instruction into a series of primitive instructions, change the order of these primitive instructions, and schedule them in the most efficient execution order There is something to do. This requires addressing and capturing each individual primitive action. To perform the reordering, the processor must be able to guarantee that a primitive instruction that requires data originating from another primitive instruction is executed after the other primitive instruction has generated the necessary data. Such a superscalar microprocessor must ensure that two primitive instructions that run together do not require the same hardware resources. Such a processor must also be able to resolve a conditional branch and then complete the effect of the branch operation.
Thus, a superscalar microprocessor requires extensive hardware to compare the relationships of multiple primitive instructions with each other, rearrange the sequence of these primitive instructions, and schedule and execute every instruction. . As the number of processing channels increases, the amount and cost of hardware to achieve these superscalar acceleration techniques increases almost fourfold. All of these hardware requirements lead to associated circuit complexity and cost. As with microinstructions, each time an application instruction is executed, a superscalar microprocessor captures each of these primitive instructions using its relatively complex addressing hardware and capture hardware. They must be reordered and rescheduled based on other primitive instructions and hardware usage, and all the rescheduled primitive instructions must be executed. Since each application instruction must be run through the entire hardware sequence, the speed at which the superscalar processor can execute the instruction is limited.
Furthermore, even though these various hardware technologies increase processing speed, the complexity associated with providing such hardware will result in a significant increase in the cost of such a microprocessor. For example, the Intel i486DX4 processor uses about 1.5 million transistors. In a basic superscalar microprocessor such as Intel Pentium, 3 million to add the necessary hardware to perform the dependency and scheduling checks needed to process instructions by two channels The use of the above transistors is necessary. Sorting between primitive instructions derived from different target instructions, performing speculative execution, enabling register renaming, adding hardware to perform branch prediction, the number of transistors is Intel With Pentium Pro (registered trademark), the number increases to 6 million or more. Therefore, it can be seen that the number of transistors in the latest microprocessor has increased dramatically each time hardware is added to increase the operation speed.
Even using these known techniques, it may not be possible to produce a microprocessor that is faster than existing microprocessors. This is because the manufacturer uses a known technology that accelerates the operation of existing microprocessors, which is economically feasible. As a result, designing a faster processor is a very difficult and expensive task.
Processor cost reduction is also very difficult. As illustrated above, hardware acceleration techniques that produce fully capable processors are very expensive. Anyone trying to design a new processor must have the equipment to produce the hardware. Obtaining such equipment is very difficult. This is because chip manufacturers typically do not spend their assets on a small amount of devices. The capital investment required to produce chip manufacturing equipment is very large and beyond what most companies can do.
Even if someone can design a new processor that will run all of the application programs designed for a processor family at least as fast as the competing processor, the price of the competing processor will include sufficient benefits. It is certain that both competitors will face significant price cuts.
Although it is very difficult to design a competitive processor by increasing the complexity of hardware, application programs (target application programs) designed for a specific microprocessor family (target microprocessor) Another way to run the program) has been to emulate the target microprocessor in software on another faster microprocessor (host microprocessor). This is a method of running these programs at each stage at low cost. This is because it is only necessary to add some form of emulation software that runs application programs on faster microprocessors. The emulation software changes the target instruction of the application program written in the target processor family to a host instruction that can be executed by the host processor. These modified instructions are run under the control of the operating system on a faster host microprocessor.
There are a wide variety of designs that allow a target application to run on a host computer that has a faster processor than the target computer's processor. In general, a host computer that executes a target program using emulation software utilizes a reduced instruction set (RISC) microprocessor. This is because RISC processors are theoretically simpler than other types of processors and as a result can run faster.
However, RISC computer systems that run emulator software can often run X86 (or other) programs, but the rate at which they do this is usually the state of the art X86 computer system. Is much slower than the rate at which the same program runs. Furthermore, these emulator programs cannot run all or the majority of the available target programs.
The reason why the emulator program cannot run the target program as fast as the target microprocessor is very complex and requires some understanding of different emulation operations. FIG. 1 includes a series of diagrams representing different ways in which a plurality of different types of microprocessors execute a target application program.
FIG. 1 (a) shows the case where a typical CISC microprocessor, such as the Intel X86 microprocessor, runs a target application program designed to run on the target processor. As seen in the figure, the CISC operating system (MS DOS ™, Windows 3.1 ™, used with X86 computers) designed to provide an interface for gaining access to computer hardware. Applications such as WindowsNT ™ and OS / 2 ™ are used to run the application on the CISC processor. Typically, application program instructions are selected to utilize a computer device only through access provided by the operating system. Thus, the operating system handles operations that allow applications to access the computer's memory and various input / output devices. The target computer includes memory and hardware that is recognized by the operating system, and by a call from the target application to the operating system, the operating system device driver uses the defined target computer device. Let the expected behavior occur. Application instructions execute on the processor, but in this case they are changed to operations that the processor can perform (microcode or microcode is assembled and materialized with primitive operations). As described above, each time a complex target instruction is executed, the instruction calls the same subroutine stored as microcode (or as the same primitive action set). The same subroutine is always executed. If the processor is a superscalar, these primitive operations to execute the target instruction are often reordered and rescheduled by the processor and can be performed using various processing channels as before. It becomes. However, the subroutine is still fetched and executed.
FIG. 1 (b) is typical of a PowerPC microprocessor used in an Apple Macintosh computer that runs the same target application program designed to run on the CISC processor of FIG. 1 (a). Represents a typical RISC microprocessor. As can be seen, the target application is executed on the host processor using at least a partial target operating system that responds to some of the calls that the target application generates. These are typically calls to the application-like portion of the target operating system and generally a short application-like utility program that is used to provide a graphical interface on the display. These portions of the target application and target operating system are converted by a software emulator such as SoftPC®. The software emulator decomposes instructions provided by the target application program and the application-like target operating system program into instructions that can be executed by the host processor and its host operating system. The host operating system provides an interface that provides access to the memory and input / output hardware of the RISC computer.
However, the host RISC processor in the host RISC computer and the hardware devices that work with it are usually very different from the devices that work with the processor for which the target application was designed. Further, the various instructions provided by the target application program are designed to cooperate with the target operating system device driver in accessing various parts of the target computer. As a result, the emulation program that translates the instructions of the target application program into primitive host instructions that can be used by the host operating system in some way causes the hardware device in the target computer to operate. The designed operation must be linked to an operation that the host system hardware device can achieve. In many cases, this requires the emulator software to create a virtual device that responds to the instructions of the target application and execute instructions that the host system cannot execute. This is because the target device does not belong to the host computer. Sometimes an emulator must create a link from these virtual devices through the host operating system to a host hardware device that exists but is addressed differently by the host operating system. .
Running the target program in this way will run relatively slowly for a number of reasons. First, each target instruction from the target application program and target operating system must be converted by the emulator into a host primitive used by the host processor. If the target application is designed for a CISC machine such as X86, the length of the target instructions varies and is very complex, so converting them into host primitive instructions is a lot of confusion Accompanied by. The original target instruction is first decoded to determine the sequence of primitive host instructions that make up the target instruction. Then, determine the address (or addresses) of each sequence of primitive host instructions, capture each sequence of primitive host instructions, and execute these primitive host instructions in sequence or out of order. Each time an instruction is executed, the enormous additional steps required by the emulator must be performed to change the target application and operating system instructions into host instructions understood by the host processor. The process is slow.
Second, many target instructions include references to operations performed by a particular hardware device that functions in a particular manner in the target computer's hardware that is not available on the host computer. To perform this operation, the emulation software must either make a software connection to the host computer hardware device through the existing host operating system, or the emulation software must You must have a hardware device. It is very difficult to emulate other computer hardware in software. The emulation software must create a virtual device for each target application call to the host operating system, and each of these virtual devices must give a call to the actual host device. I must. To emulate a hardware device, when the target instruction wants to use the device, it must fetch the code representing the virtual device required by the instruction from memory and run it to implement the device . Any of these methods that solve the aforementioned problems add an additional set of operations to the execution of the sequence of instructions.
To complicate the emulation problem, the target computer hardware and target operating system must do this for the target application to throw various exceptions and the computer system to work Because. If a target exception occurs while the target computer is operating, the state of the computer at the time of the exception must be saved. Usually this is done by calling a microcode sequence to accomplish this operation. In addition, the correct exception handler must be retrieved, the exception must be handled, and the correct point in the program must be found to continue the program. Occasionally, this requires the program to revert to the state of the target computer at the time that the exception occurred and at some other time when the branch provided by the exception handler was taken. In any case, the target computer hardware and software necessary to perform these operations must be provided in some way within the emulation process. For proper execution, the correct target state must be obtained at any point in such an exception, so the emulator will always accurately state this state so that it can respond correctly to these exceptions. Forced to track. In the prior art, for this purpose, it is necessary to execute each instruction in the order given by the target application. This is because there was no other way to maintain the correct target state.
Furthermore, the prior art emulator has always had to maintain the execution order of the target applications for other reasons. Target instructions can be of two types: memory affecting and memory mapped input / output (I / O) devices. There is no other way to know if an operation affects memory or memory mapped I / O devices by not trying to execute the instruction. When instructions operate on memory, optimization and reordering are possible, which is very useful for speeding up system operations. However, operations that affect I / O devices must be performed in the order in which the operations are programmed, without removing any steps. Otherwise, the operation of the I / O device may be adversely affected. For example, certain I / O operations may result in clearing I / O registers. If the operations are not performed in order and the required value is still cleared from the register, the result of the operation may be different from the operation commanded by the target instruction. Without a means to distinguish memory from memory mapped I / O, all instructions need to be treated as if they affect memory mapped I / O. This severely limits the optimization that can be achieved. Prior art emulators lack both a means of detecting the nature of the addressed memory and a means of recovering from such failures, so that each operation affects memory mapped I / O. As such, it is necessary to proceed sequentially throughout the entire target instruction. This significantly hinders the possibility of optimizing host instructions.
Another problem that hinders the ability of prior art emulators to optimize host code is caused by self-modifying code. If the target instruction is converted to a sequence of host instructions and then written back to change the original target instruction, the host instruction is no longer valid. As a result, the emulator must always check to determine whether the store is for the target code area. Because of all these problems, this type of emulation is significantly slower than running the target application on the target processor.
Another example of emulation software of the type shown in FIG. 1 (b) is “Talisman: Fast and Accurate Multicomputer Simulation” (RC Bedichek, Laboratory for Computer Sciences, It is described in a paper entitled Massachusetts Institute of Technology (RC Beddy Check, Computer Science Institute, Massachusetts Institute of Technology), which is an example of a more complex transformation that emulates a complete development system. You can run and run a development target operating system, Talisman uses the host UNIX operating system.
FIG. 1C shows an example of another emulation. In this case, a PowerPC microprocessor used in an Apple Macintosh computer running a target application program designed to run on a Motorola 68000 family CISC processor used in the original Macintosh computer is shown. This type of configuration was necessary to run Apple's legacy program on a Macintosh computer with a RISC processor. As seen in the figure, the target application is run on the host processor at least partially using the target operating system and responds to the application-like portion of the target operating system. Some software emulators break down instructions given by a target application program or an application-like target operating system program into instructions that can be executed by the host processor or its host operating system. The host operating system provides an interface through which access to the host computer's memory and input / output hardware is obtained.
Again, the host RISC processor and associated devices in the host RISC computer are quite different from the devices associated with Motorola's CISC processor, and different target instructions are used to access different parts of the target computer. Designed to work with the target CISC operating system. As a result, the emulation program must link the operation designed to operate the hardware device in the target computer to the operation that can be realized by the hardware device of the host system. To this end, the emulator creates software virtual devices that respond to the instructions of the target application and addresses them from these virtual devices through the host operating system, but in different ways depending on the host operating system. Link to the host hardware device to be created.
The target software running in this way is relatively slow to run for the same reason that the emulation of FIG. 1 (b) is slow to run. First, each target instruction from the target application and target operating system must be converted by capturing the instruction, and each time the instruction is executed, a host primitive function that is derived from the instruction All of these must be run sequentially. Second, the emulation software must create a virtual device for each call of the target application to the host operating system. In addition, each of these virtual devices must provide a call to the actual host device. Third, the emulator must process all instructions conservatively to handle the danger of generating instructions directed to memory mapped I / O devices, or exceptions that it cannot restore. Don't be. Finally, the emulator always maintains the correct target state and the store operation must always be checked to determine beforehand whether the store is for the target code area. All of these requirements take away the ability to perform significant optimizations on the code running on the emulator's host processor, making this type of emulator much slower than running the target application on the target processor. Let
An emulation rate of less than a quarter of the state of the art processor is considered very good. In general, this has forced this type of emulation software to be useful but not the primary use of the ability to run applications designed on other processors.
FIG. 1 (d) shows a specific method for emulating a target application program on a host processor and providing relatively good performance for a very limited set of target applications. Show. The target application provides instructions to the emulator, which changes these instructions to instructions for the host processor and host operating system. The host processor is an Alpha RISC processor from Digital Equipment Corporation, and the host operating system is Microsoft NT. The only target application that can be run by this system is a 32-bit application designed to be executed by a target X86 processor with an operating system compliant with Windows WIN32s. Since the host and target operating systems are almost identical and designed to handle these same instructions, the emulator software can convert the instructions very easily. Furthermore, since the host operating system is already designed to respond to the same call that the target application originates, virtual device creation is greatly reduced.
This is technically an emulation system that runs a target application on a host processor, but it is a very special case. Here, the emulation software is running on a host operating system that is already designed to run a similar application. This makes it easier to direct calls from the target application to the correction mechanism of the host and host operating system. More importantly, the system only runs 32 bit Windows applications, perhaps less than 1% of all X86 applications. Furthermore, the system runs applications only on one operating system, namely Windows NT, while the X86 processor runs applications designed for multiple operating systems. Accordingly, such systems cannot be considered interchangeable within the meaning originally presented in this specification. Therefore, a processor that runs such an emulator cannot be considered a competing X86 processor.
FIG. 1 (e) shows another emulation method that allows a portion of an application written for the first instruction set to be run using software on a computer that recognizes a different instruction set. This form of emulation software is typically used by programmers trying to port an application from one computer system to another. Typically, the target application is designed for any target computer other than the host machine that runs the emulator. The emulator software analyzes the target instructions, converts these instructions into instructions that can be run on the host machine, caches these host instructions, and makes them reusable. This dynamic conversion and caching makes it possible to run parts of the application very fast. This form of emulator is typically used with a software trace tool to provide detailed information about the behavior of the target program being executed. On the other hand, the output of the trace tool can be used to drive an analyzer program that analyzes the trace information.
In order to determine how the code actually works, among other things, this type of emulator is run by the host operating system on the host machine and uses virtual hardware that the host operating system does not have. Otherwise, it maps the operation of the computer that is the application design object to the hardware resources of the host machine and executes the operation of the running program. The hardware virtualization and mapping to the host computer by this software can be very slow and incomplete.
In addition, because multiple host instructions are often required to execute one of the target instructions, exceptions including faults and traps that require an exception handler in the target operation system may occur. In some cases, the host may stop processing the host command at a point unrelated to the target command boundary. If this happens, it may not be possible to handle the exception correctly. This is because the state of the host processor and memory is incorrect. In such a case, you must stop the emulator and run it again to track the operation that caused the exception. Thus, although such an emulator can run the target code sequence very quickly, there is no way to recover from these exceptions, and thus no important part of the application can be run quickly.
This is not a unique problem with this form of emulator. Because the functions performed by emulators, tracers, and moving analyzers can generate new programs or port old programs to another machine so that the speed at which the emulator software runs is of little concern. It is because it aims to do. That is, programmers are not always interested in how fast the code generated by the emulator will run on the host machine, and whether the code generated by the emulator can be executed on the machine designed for it, and I'm interested in whether to run quickly on the machine. As a result, this type of emulation software does not provide a way to run application programs written in the first instruction set to run on different types of microprocessors for purposes other than programming. . An example of this type of emulation software is Cmelik and Keppel, which are titled "Shade: A First Instruction-Set Simulator for Execution Profiling". ).
Any operating system available to these microprocessors that is faster and cheaper than state-of-the-art microprocessors, yet is fully compatible with the target application programs designed for the state-of-the-art microprocessors It is desirable to provide a competitive microprocessor that can run the system.
Summary of the Invention
Therefore, the object of the present invention is cheaper than conventional state-of-the-art microprocessors, yet compatible with application programs and operating systems designed for other microprocessors. It is to provide a microprocessor capable of running these at a faster rate.
This and other objects of the present invention are realized by a microprocessor for a host computer designed to execute a target program for a target computer having a target instruction set. And a modified host processing hardware designed to execute instructions of the host instruction set, and the combination of software and modified host processing hardware combines a set of target instructions with instructions of the host instruction set. Means for converting to
In a preferred embodiment, the combination of software and improved host processing hardware comprises a means for inferring the occurrence of certain conditions and optimizing instructions in the host instruction set translated from the target program; Means for determining the official state of the target computer under the control of software, which existed at the start of conversion of a set of target instructions during execution of the target program; Means for updating the state of the target computer from the state of the host computer when executing the instructions, means for detecting that the executing condition of the set of host instructions has not been satisfied, and a set of host instructions If execution fails according to guesses, the status of the host computer is changed to the target computer. Means for updating the state, if a pair of hosts instruction fails to run according to speculation, without a guess, and means for converting the new set of host instructions.
In a preferred embodiment, the morph host refinement processing hardware was designed to allow conversion, optimization, reordering, and rescheduling of the target instruction set to a very long instruction word. Includes a very long instruction word (VLIW) processor. Very long instruction words can be cached for later reuse, thereby increasing execution speed by eliminating the need for each of these steps each time a target instruction is discovered. It is possible to execute advanced superscalar processing and other time-saving processing by rearranging and scheduling together multiple host instruction sets generated from a large number of instructions in the target instruction set. Remove unnecessary hardware operations and accelerate the entire process.
These and other objects of the invention will be better understood by reference to the following detailed description in conjunction with the drawings. In the drawings, like elements are referred to by like numerals throughout the various drawings.
[Brief description of the drawings]
FIG. 1A to FIG. 1E are diagrams showing an operation mode of a microprocessor designed according to the prior art.
FIG. 2 is a block diagram of a microprocessor according to the present invention running applications designed on different microprocessors.
FIG. 3 shows a part of the microprocessor shown in FIG.
FIG. 4 is a block diagram showing a register file used in the microprocessor according to the present invention.
FIG. 5 is a block diagram illustrating a gate storage buffer designed in accordance with the present invention.
FIGS. 6 (a) to 6 (c) show instructions used in various prior art microprocessors and microprocessors according to the present invention.
FIG. 7 shows the method implemented by the software part of the microprocessor according to the invention.
FIG. 8 illustrates another method implemented by the software portion of the microprocessor according to the present invention.
FIG. 9 is a block diagram illustrating an improved computer system according to the present invention.
FIG. 10 is a block diagram showing a part of the microprocessor shown in FIG.
Notation and name
In the detailed description that follows, there are portions that present symbolic representations of operations on data bits within a computer memory. These descriptions and representations are used by those skilled in the data processing arts and are the means to most effectively convey the nature of their operation to others skilled in the art. The operation is one that requires physical manipulation of physical quantities. Usually, these quantities take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared, and otherwise manipulated, but this is not necessarily the case. It is sometimes recognized that it is convenient to refer to these signals as bits, values, elements, symbols, characters, words, numbers, etc. mainly for reasons of common use. However, it should be borne in mind that all of these and similar terms are associated with the appropriate physical quantities and are merely convenient names applied to these quantities.
Furthermore, the operations performed are often referred to in terms such as addition or comparison, which are generally related to the mental actions performed by a human operator. Such a capability of a human operator is in most cases not necessary or desirable for any of the operations described herein that form part of the present invention. An operation is a mechanical operation. Useful machines for performing the operations of the present invention include general purpose digital computers or other similar devices. In all cases, a distinction should be borne in mind between the method operation that operates the computer and the method of computation itself. The present invention relates to methods and apparatus for operating a computer to process electrical or other (eg, mechanical, chemical) physical signals and generate other desired physical signals.
During the following description, in some cases, in order to give a detailed example of operation, a target program shall mean a program designed to run on an X86 microprocessor. This is because most emulators run X86 applications. However, the target program may be designed to run on any target computer family. This includes a target virtual computer, such as a Pcode machine, a Postscript machine, or a Java virtual machine.
Detailed description
The present invention overcomes the problems of the prior art and brings all of the software to all of the operating systems that can be run by multiple families of microprocessors of the prior art faster than prior art microprocessors. A microprocessor is provided that can be run and is less expensive than prior art microprocessors.
Instead of using a microprocessor that accelerates its operation with more complex hardware, the present invention provides an improved hardware processor (in this specification, “morph host”) that is simpler than each state-of-the-art microprocessor. ) And an emulated software section (referred to as “code morphing software” in this specification), and these two parts work together as a microprocessor, It has higher performance than any competing microprocessor. More specifically, a morph host is a processor that includes hardware enhancements that assist in obtaining the state of the target computer immediately after an exception or error occurs, while code morphing software Means that the instructions in the target program are converted to morph host instructions for the morph host, and in response to exceptions and errors, the working state is replaced with the correct target state as necessary, so that Software that allows conversion to occur. The code morphing software can also include various processes to increase processing speed. Prior art ultrafast microprocessors all have hardware to increase processing speed, but instead, the present invention is in a stage where a number of accelerated reinforcement techniques can be selected by code morphing software. Make it executable. By providing speed enhancement technology in the code morphing software, it is possible to implement a morph host using hardware with much lower complexity. This is faster and significantly less expensive than prior art microprocessor hardware. By way of comparison, one embodiment of the present invention designed to run all available X86 applications is implemented by a morph host containing about 1/4 of the number of gates of a Pentium Pro microprocessor, and the Pentium Pro microprocessor. Or run any of these applications significantly faster than any other known microprocessor capable of handling X86 applications.
Code morphing software utilizes certain techniques that were previously used only by programs that design new software or emulate new hardware. The morph host includes a plurality of hardware enhancements specifically configured to efficiently utilize the acceleration technology provided by the code morphing software. These hardware enhancements allow code morphing software to implement acceleration technology for a wider range of instructions. In addition, these hardware enhancements cannot be obtained with hardware processors, but with code morphing software, additional acceleration technologies that can only be realized with processors that are prohibitively expensive. Can be implemented. These techniques significantly increase the speed of the microprocessor of the present invention compared to the speed of prior art microprocessors that execute native instruction sets.
For example, code morphing software combined with an improved morph host allows the use of techniques that allow the reordering and rescheduling of the source instructions generated by the target instruction sequence without the need for additional circuitry Can be. By enabling reordering and rescheduling of a large number of target instructions, other optimization techniques can be used to run the target application for the number of processor steps required to execute the target instructions. This can be reduced more than any microprocessor requires.
Code morphing software in combination with an improved morph host converts target instructions into morph host instructions during execution, and converts these host instructions into a memory data structure (in this specification, a “translation buffer”). "). By holding the instructions converted using the conversion buffer, it is determined which primitive instructions are necessary to realize each target instruction, each primitive instruction is addressed, each primitive instruction is taken in, and the sequence of the primitive instructions is determined. Optimize, assign assets to each source instruction, reorder the source instructions, and run each step of each sequence of required source instructions each time you execute each target instruction, without having to run the long process again It becomes possible to call the instruction. Once the target instruction has been translated, it can be called and executed from the translation buffer without requiring these infinite steps.
The first problem with prior art emulation techniques is that they cannot handle exceptions that occur during execution of the target program with good performance. This is especially true for exceptions that occur when running a target application that targets the target operating system. In this case, for proper execution of the exception and subsequent instructions, the correct target state must be able to be obtained at any point of such exception. As a result, the emulator is always forced to track the target state with high accuracy and must always check to determine if the storage is for the target code area. Other exceptions cause similar problems. For example, an exception may occur when an emulator detects a specific target action that has been replaced by a specific host function. That is, various hardware operations of the target processor can be replaced with software operations provided by the emulator software. In addition, a host processor that executes a host instruction derived from the target instruction may also generate an exception. All of these exceptions can occur either while the emulator is trying to convert the target instruction to a host instruction or when the host conversion is performed on the host processor. For efficient emulation, it is necessary to have some way to efficiently recover from these exceptions while handling them correctly. There is nothing in the prior art that does this for all software that can be emulated.
To overcome these limitations of the prior art, the present invention incorporates numerous hardware improvements in its improved morph host. These improvements include a gated store buffer and a number of additional processor registers. Some of the additional registers can use register renaming to alleviate the problem of instructions that require the same hardware resources. The additional registers maintain a set of host or working registers that process host instructions, and a set of target registers, and the official state of the target processor that created the target application. Can be held. Target (or shadow) registers are connected to their working register equivalents via a dedicated interface. The dedicated interface allows the contents of all working registers to be quickly transferred to the official target register by an action called “commit” and all official registers by an action called “rollback”. Allows the contents of target registers to be quickly transferred back to their working register equivalents. The gate storage buffer stores the state change of the working memory on the “uncommit” side of the hardware “gate”, and further stores the state change of the official memory on the “commit” side of the hardware gate. To do. In this case, the committed store “spills” out to main memory. The commit operation transfers the storage from the uncommitted side of the gate to the commit side of the gate. Once one or a group of target instructions have been converted and ran without error, additional official registers and gate store buffers allow the memory state and target register state to be updated together.
These updates are selected by the code morphing software to occur on an integral target instruction boundary. Thus, if the primitive host instructions that make up a series of target instruction transformations are run by the host processor without raising an exception, the working memory storage and working register states generated by these instructions are: It is transferred to the official memory and then to the official target register. Thus, in the target register at the last update (or commit) if an exception occurs when processing a host instruction at a point that is not on the boundary of one or a set of target instructions to be converted The original state of can be called into the working register and the uncommitted memory store in the gate store buffer can be dumped. Then, if the exception that occurred is a target exception, re-convert the target instructions that caused this target exception one at a time and execute them in a sequence so that they are executed by the target microprocessor can do. Since each target instruction is executed correctly without error, the state of the target register can be updated and the data in the storage buffer can be passed to memory. Second, if the exception occurs again while running the host instruction, the correct state of the target computer is retained in the morph host's target register and memory, allowing the operation to be handled correctly without delay . Each new conversion resulting from this correct conversion should be cached for future use and used to convert it, erase it once, or in rare events such as page faults. can do. This allows a microprocessor created by a combination of code morphing software and a morph host to execute instructions faster than the processor that originally wrote the software.
It should be noted that when executing a target program using the microprocessor of the present invention, many different types of exceptions can occur and these are handled differently. For example, some exceptions are caused by the target software that generates the exception, which uses the target operating system's exception handler. The use of such exception handlers requires that the code morphing software include routines that emulate the entire exception handling process, including any hardware provided by the target computer, for processing the process. is there. This requires that the code morphing software has the ability to save the state of the target processor so that it can migrate correctly after handling the exception. For exceptions that need to populate a new page of memory before performing the converted process, such as a page fault, you must return to the beginning of the process to be converted after handling the exception. is there. Another exception is that certain actions are implemented in software if the action is not given by hardware. These require the exception handler to return to the next step in the transformation after it has handled the exception. Each of these different types of exceptions can be handled efficiently by the present invention.
In addition, exceptions include those in which host hardware occurs and detects various host and target conditions. Some exceptions behave like exceptions on traditional microprocessors, while others are used by code morphing software to detect various speculation failures. . In these cases, the code morphing software uses the state save and restore mechanism described above to restore the target state to its most recent official version and generate and save a new transformation that avoids the failed guess. (Alternatively, use a safe conversion done earlier). Next, this conversion is performed.
The morph host includes an additional hardware exception detection mechanism, allowing further optimization along with the rollback and reconversion methods described above. Examples include means for distinguishing the memory from memory mapped I / O and means for protecting the address or address range so that no memory reference is required and the target variable can be held in a register.
If an exception is used to detect other speculative failures, such as whether the operation affects memory or memory-mapped I / O, restoration is achieved by generating a new transformation, but the memory operation Is different and optimization is different.
FIG. 2 is a diagram representing morph host hardware designed in accordance with the present invention for running the same application program running on the CIS processor of FIG. As seen in the figure, the microprocessor includes the code morphing software portion described above and an improved hardware morph host portion. The target application provides the target instruction to the code morphing software for conversion into a host instruction that can be executed by the morph host. Meanwhile, the target operating system receives calls from the target application program and forwards them to the code morphing software. In the preferred embodiment of the present invention, the morph host is a very long instruction word (VLIW) microprocessor and is designed with multiple processing channels. The overall operation of such a processor is further illustrated in FIG.
FIGS. 6 (a) -6 (c) illustrate instructions configured for use with each of the CISC processor, the RISC processor, and the VLIW processor. As can be seen, the CISC instruction is variable length and can include a plurality of more primitive operations (eg, load and add). On the other hand, RISC instructions are equal in length and are essentially primitive operations. The single very long instruction for the illustrated VLIW processor includes each of the more primitive operations (ie, load, store, integer add, compare, floating point multiply, branch) of the CISC and RISC instructions. As seen in FIG. 6 (c), each of the primitive instructions that together make up a single very long instruction word is connected to one of the multiple separate processing channels of the VLIW processor in parallel with the other primitive instructions. Or memory and are handled in parallel by the processing channel and memory. All the results of these parallel operations are transferred to the multiport register file.
The VLIW processor that is the basis of the morph host is a much simpler processor than the other processors mentioned above. This does not include circuitry that detects issue dependency, nor circuitry that reorders, optimizes, and reschedules the source instructions. For this purpose, a clock rate higher than the clock rate possible by either the target processor that originally designed the target application program or any other processor that uses the emulation program to run the target application program. Fast processing is possible at the rate. However, the present invention is not limited to VLIW processors and can function in the same manner with any type of processor such as a RISC processor.
The code morphing software of the microprocessor shown in FIG. 2 includes a conversion unit. It decodes the target application instructions, converts these target instructions into source host instructions that can be executed by the morph host, optimizes the operations required by the target instructions, and schedules the source instructions for reordering. The morph host VLIW instruction (conversion) is executed, and the host VLIW instruction is executed. The operation of the conversion unit is shown in FIG. FIG. 7 shows the operation of the main loop of the code morphing software.
In order to accelerate the operation of a microprocessor including code morphing software and improved morph host hardware, the code morphing software includes a conversion buffer as shown in FIG. The conversion buffer of one embodiment is a software data structure that can be stored in memory. In certain embodiments, a hardware cache may also be utilized. The translation buffer is used to store host instructions that materialize each completed translation of the target instruction. As seen in the figure, once individual target instructions are converted and the obtained host instructions are optimized, rearranged, and rescheduled, the obtained host conversion is stored in a conversion buffer. The host instructions that make up the transformation are then executed by the morph host. If the host instruction is executed and no exception occurs, the transformation can be invoked whenever the target instruction or group of operations is required thereafter.
Thus, as shown in FIG. 7, when a target instruction address is given by an application program, the typical operation of the microprocessor's code morphing software is to first start with the target instruction at the target address. Is to determine whether or not is converted. If the target instruction has not been converted, the conversion unit captures it and subsequent target instructions, decodes, converts, then optimizes (possibly), reorders, reschedules to a new host conversion, and into the conversion buffer Store. As will be seen later, there are various degrees of optimization that are possible. In this specification, the term “optimization” is often used generically to refer to techniques for accelerating processing. For example, rearrangement is a form of optimization that enables high-speed processing, and is included in this term. Many of the possible optimizations are described in the prior art of compiler optimization, such as some "super-blocks" that were difficult to execute within the prior art. Optimization was revealed from VLIW studies. Control is then transferred to the transformation, executed by the modified morph host hardware, and resumed.
When the application is running, the next time a specific target instruction sequence is found, there is a host translation in the translation buffer that executes immediately without the need for translation, optimization, reordering or rescheduling. By using the advanced techniques described below, it is speculated that the translation for the target instruction (once fully translated) is found in the translation buffer approximately once every 1 million conversions are performed. . As a result, after the first conversion, all of the steps necessary for the conversion, such as decoding, fetching the source instruction, optimizing the source instruction, rescheduling to host conversion, and storing in the conversion buffer, are all necessary. Can be excluded. This is the work required to execute the target instruction because the target processor that wrote the target instruction must decode, fetch, reorder, and reschedule each instruction every time it executes the instruction. Drastically reduce the speed of the microprocessor of the present invention.
In order to eliminate all these steps necessary for the execution of the target application by the prior art processor, the microprocessor of the present invention has the problem of making the operation of the present invention impossible at any reasonable speed in the prior art. Overcome. For example, some of the techniques of the present invention have been used in the aforementioned emulators that are used to port applications to other systems. However, some of these emulators have no way to run other than a short part of the application. This is because when processing translated instructions, exceptions that cause calls to various system exception handlers are not related to the state of the target processor that is processing the same host processor state. This is because it occurs at the time. For this reason, the state of the target processor at the time when such an exception occurs was not known. Therefore, the correct state of the target machine cannot be determined, operation must be stopped, restarted, and the correct state must be known before the exception can be handled (service) and execution can continue. There wasn't. For this reason, it was impossible to run the application program at the host speed.
The morph host hardware of the present invention includes a number of enhancements that overcome this problem. These enhancements are shown in FIGS. 3, 4 and 5, respectively. To determine the correct state of the registers at the time of the error, a set of official target registers is provided by the modified hardware to keep the state of the registers of the target processor for which the original application was designed . These target registers can be included in each of the floating point unit, any integer unit, and any other execution unit. By adding these official registers to the morph host of the present invention and increasing the number of normal working registers, a number of optimizations including register renaming can be implemented. One embodiment of the improved hardware includes 64 working registers in the integer unit and 32 working registers in the floating point unit. This embodiment also includes a reinforced set of target registers. It contains all the frequently changing registers of that processor that are needed to give the state of the target processor. These include condition control registers and other registers necessary for controlling the simulation target system.
Note that, depending on the type of improved processing hardware used by the morph host, the converted instruction sequence may contain primitive operations that make up multiple target instructions from the original application. For example, the VLIW microprocessor may be able to run multiple CISC or RISC instructions simultaneously, as shown in FIGS. 6 (a) through 6 (c). Whatever the morph host type, the target register state of the morph host hardware of the present invention does not change except for the integer target instruction boundary, and then all target registers are updated. Is done. Thus, if the microprocessor of the present invention is executing a target instruction or group of instructions that have been reordered and rescheduled for host translation, the target instruction or group of instructions is translated into the sequence of instructions When the first target instruction is addressed, the official target register holds the value held by the register of the target processor for which the application was designed. After the morph host begins executing the converted instruction, however, the working register holds a value determined by the original operation of the converted instruction executed up to that point. Thus, some of these working registers may hold the same value as in the official target register, while other working registers hold values that are meaningless to the target processor. . This is especially true for embodiments that provide much more registers than a particular target machine and that allow advanced acceleration technologies. Once converted host instructions have started, these converted host instructions determine the state of the working registers, and the values in these registers are one of the values determined by the converted host instructions. . When a set of converted host instructions is executed without causing an exception, the new working register value determined at the end of the set of instructions is transferred to the official target register together ( Possibly including the target instruction pointer register). In this embodiment of the present invention, this transfer is performed in an additional pipeline stage other than the execution of the host instruction, so it does not delay the operation of the morph host.
Similarly, a gate storage buffer such as the embodiment shown in FIG. 5 is utilized in the present invention to control the transfer of data to memory. The gate storage buffer includes a number of elements, each of which can act as a storage location for holding addresses and data for memory storage operations. These elements can be implemented in any of a number of different hardware configurations (eg, first-in first-out buffers), and the illustrated embodiment can be implemented using random access memory and three dedicated working registers. Each of the three registers stores a pointer to the head of the memory storage queue, a pointer to the gate, and a pointer to the end of the memory storage queue. The memory store at the storage location between the head and gate of the queue has already been committed to memory, while the memory store at the storage location between the gate and tail of the queue has not yet been committed to memory. Memory stores that occur during execution of host translation are placed in the storage buffer by the integer unit in the order in which they occurred during execution of the host instruction by the morph host, but until the commit operation is found in the host instruction, Writing is not allowed. Thus, when a conversion is performed, the store operation is placed in a queue. Assuming these are the first stores and no other stores are in the gate store buffer, the head pointer and the gate pointer indicate the same location. As each store is performed, it is placed at the next location in the queue and the tail pointer is incremented to the next location (upward in the figure). This continues until a commit command is executed. The commit command is typically executed when the conversion of a set of target instructions is completed without causing an exception or an error termination condition. If the conversion is performed by the morph host without error, the memory storage in the storage buffer that occurred during the execution will pass through the gate of the storage buffer (committed) together and subsequently written to the memory. In the illustrated embodiment, this is done by copying the value in the register holding the tail pointer to the register holding the gate pointer.
Thus, both the transfer of the register state from the working register to the official target register and the transfer of the working memory store to the official memory are performed together and in response to an explicit commit operation. It can be seen that this is done only on the boundary between integer target instructions.
This allows the microprocessor to recover from target exceptions that occurred during execution by the modified morph host without any significant delay. If a target exception occurs during the execution of either the translated instruction or group of instructions, this exception is detected by the morph host hardware or software. In response to detecting the target exception, the code morphing software returns the value held in the official register to the working register and erases all uncommitted memory storage in the gate store buffer. (Operation called "rollback"). The memory storage in the gate storage buffer in FIG. 5 can be erased by copying the value in the register holding the gate pointer to the register holding the tail pointer.
By moving the value from the target register to the working register, the address of the first of the target instructions that were running when the exception occurred can be placed in the working instruction pointer register.
Starting from this official state of the target processor in the working register, the target instructions that were running when the exception occurred are reconverted in sequential order, but without any reordering or other optimization. When each target instruction is newly decoded and converted into a new host conversion, when the converted host instruction representing the target instruction is executed by the morph host, an exception may or may not occur. (If the morph host is other than a VLIW processor, each of the host conversion primitive operations is executed sequentially. If no exception occurs when running host transformation, the next primitive function is run.) This continues until an exception occurs again or a single target instruction is translated and executed. In one embodiment, if the target instruction conversion is performed without an exception, the working register state is transferred to the target register, and any data in the gate storage buffer is committed, so the memory Can be transferred. However, if an exception occurs again during the execution of the conversion, the state of the target register and memory does not change and is identical to the state that occurred in the target computer when the exception occurred. As a result, if a target exception occurs, this exception is handled correctly by the target operating system.
Similarly, if the first target instruction in the series of instructions in which an exception has occurred due to conversion is executed once and no exception has occurred, the target instruction pointer indicates the next target instruction. As in the first case, the second target instruction is decoded and reconverted without optimization or rearrangement. As each single target instruction host translation is processed by the morph host, an exception occurs if the state of the target register and memory is the same as that occurring in the target computer. As a result, exceptions can be handled immediately and correctly. These new translations are stored in the translation buffer as the correct translations for the sequence of instructions in the target application and can be invoked whenever the instructions are run again.
Another embodiment of the present invention that achieves the same result as the gate store buffer of FIG. 5 is that the target is transferred when an exception or error occurs that requires a rollback as a result of a conversion exception while transferring the storage directly to memory. It could include a configuration that records sufficient data to restore the state of the computer. In such a case, any memory storage that occurred during the conversion and execution must be reversed and the memory state that existed at the start of the conversion must be restored. On the other hand, the working register must receive the data held in the official target register, as discussed above. One embodiment for doing this maintains a separate target memory to preserve the original memory state and uses this to replace the overwritten memory if a rollback occurs. Other embodiments that perform memory rollback record each storage, replace it as memory data occurs, and then reverse the storage process if a rollback is required.
The code morphing software of the present invention has additional operations that greatly increase the speed with which the program being converted is processed. Simply translate, optimize, reorder, reschedule, cache, and execute each transformation so that you can run it again whenever you need to execute a set of instructions In addition, the conversion unit links the different conversions and in most cases eliminates the need to return to the main loop of the conversion process. FIG. 8 shows the steps performed by the code morphing software converter in performing this linking process. Those skilled in the art will appreciate that this linking operation essentially eliminates the need for a return to the main loop and eliminates this overhead for most instruction conversions.
For illustrative purposes, assume that the target program to be run consists of X86 instructions. If the target instruction sequence is converted and the source host instructions are rearranged and rescheduled, two primitive instructions may occur at the end of each host conversion. The first is a primitive instruction that updates the value of the instruction pointer for the target processor (or equivalent). This instruction is used to place the correct address of the next target instruction in the target instruction pointer register. Following this primitive instruction is a branch instruction, which contains the address of each of the two possible targets for that branch. The method in which the original instruction prior to the branch instruction updates the value of the instruction pointer for the target processor is to test the condition code for the branch in the condition code register and to determine if one of the two branch addresses indicated by the condition controlling the branch is It is to determine whether or not the data is stored in the conversion buffer. When initially converting a sequence of target instructions, the two branch targets of the host instruction both have the same host processor address for the main loop of the converter software.
When the host translation is complete, stored in the translation buffer, and executed for the first time, the instruction pointer is updated in the target instruction pointer register (similar to the rest of the target register), and the operation branches to the main loop Return. In the main loop, the conversion software refers to the instruction pointer to the next target instruction in the target instruction pointer register. The next target instruction sequence is then addressed. Assuming that this sequence of target instructions has not yet been converted, and therefore the conversion is not in the conversion buffer, the next set of target instructions is taken from memory, decoded, converted, optimized, reordered, reordered. Schedule, cache in translation buffer and execute. Since the second set of target instructions follows the first set of target instructions, the last primitive branch instruction of the host translation of the first set of target instructions is automatically updated and the host translation address of the second set of target instructions Is replaced as a branch address for a specific condition that controls the branch.
Then, if the second translated host instruction loops back to the first translated host instruction, the branch operation at the end of the second translation is the address of the main loop and X86 of the first translation. The address is included as two possible targets for the branch. The update-instruction-pointer primitive operation prior to the branch tests the condition, decides to loop back to the first translation, and updates the target instruction pointer to the X86 address of the first translation. This causes the translation unit to check the translation buffer to see if the X86 address being searched is there. If the address of the first translation is found, replace its value in the host memory space with the X86 address in the last branch of the second host translation instruction. Next, the second host conversion instruction is cached and executed. As a result, this loop is run until the condition for branching from the first transformation to the second transformation is not satisfied, and a branch is taken that takes a path back to the main loop. If this is done, the first translated host instruction branches back to the main loop, searches the translation buffer for the next set of target instructions specified by the target instruction pointer, and translates the host from the cache. Capture. Alternatively, if the search in the conversion buffer fails, the target instruction is fetched from the memory and converted. When this translated host instruction is cached in the translation buffer, its address replaces the main loop address in the branch instruction that terminated the loop.
Thus, since the various translated host instructions are chained together, it is only necessary to follow a long path through the translation main loop when there is no link. Finally, the main loop reference in the host instruction branch instruction is almost completely useless. When this condition is reached, even before any host instruction is run, the target instruction is fetched, the target instruction is decoded, the primitive instructions that make up the target instruction are fetched, and these primitive operations are optimized, The time required to rearrange the primitive actions and reschedule these primitive actions is not required. Therefore, in contrast to all prior art microprocessors that must execute each of these steps each time the instruction sequence of any application is run, the present invention allows the first conversion to be performed. After doing so, the work required to run any set of target instructions is drastically reduced. This work is further reduced by linking each set of translated host instructions to another set of translated host instructions. In fact, while the application is running, it is estimated that it will need to be exchanged less than once during 1 million instruction executions.
Those skilled in the art will recognize that this implementation of the present invention requires a large translation buffer so that each set of instructions to translate is cached in turn and eliminates the need to translate again. The need for converter support buffer memory designed to work with applications programmed for different systems varies. However, one embodiment of the present invention designed to run X86 programs utilizes 2 megabytes of random access memory as a translation buffer.
Two additional hardware enhancements help increase the speed at which the macroprocessor of the present invention can process applications. The first of these is an anomaly / normal (A / N) protection bit, each of which is in the translation look-aside buffer (TLB) (see FIG. 3) that first referenced the physical address of the target instruction. Stored with address translation. There are two types of operation of the target memory inside the conversion, one operating on the memory (normal) and the other operating on the memory mapped I / O device (abnormal).
A normal access that affects the memory completes normally. When instructions operate on memory, it is appropriate to optimize and reorder these instructions, which is very helpful in increasing the speed of any system using the microprocessor of the present invention. On the other hand, abnormal access operations that affect I / O devices often have to be performed in the exact programmed order without removing any steps. Otherwise, there may be some adverse effects on the I / O device. For example, certain I / O operations may result in clearing I / O registers, and if the original operation is performed out of order, the result of the operation is different from the operation commanded by the target instruction There is a case. Without a means of distinguishing memory from memory mapped I / O, all memory must be handled using the traditional assumptions used in translating instructions that affect memory mapped I / O. This significantly limits the achievable optimality. Since prior art emulators lacked both a means of detecting a guess failure for the characteristics of the addressed memory and a means of recovering from such a failure, its processing power was limited.
In one embodiment of the present invention, the A / N bit is initially set in the conversion look-aside buffer to indicate a memory page. Converting an operation that affects the memory as if it were a memory operation is actually a speculation that this operation affects the memory. After the conversion is done and executed, the target memory reference is checked by comparing the access type (normal or abnormal) with the LTB A / N protection bit. An exception occurs if the access type does not match A / N protection. If the operation actually affects the memory, then the optimization, reordering, and rescheduling techniques described above have been correctly applied. However, if the comparison of the A / N bit in the TLB indicates that the operation affects the I / O device, an exception will occur due to execution, and the conversion unit will do any kind of optimization, reordering, There is no scheduling, and a new conversion is performed one target instruction at a time. Similarly, if a conversion incorrectly assumes an I / O operation that actually affects the memory, an exception will be generated by the execution and the optimization, reordering and rescheduling techniques can be used to Reconvert the instruction. Thus, the present invention can provide improvements over previously possible performance.
One of the guesses that the present invention makes most often relates to the absence of target exceptions during conversion. Thereby, each stage can be optimized with respect to the prior art. First, the target state does not need to be updated for each target instruction boundary, but only needs to be updated on the target instruction boundary that occurs on the conversion boundary. This eliminates the need for instructions required to save the target state for each target instruction boundary. Optimization that was not possible in the past to eliminate scheduling and redundant operations is also possible.
Surprisingly, the present invention is configured to select an appropriate conversion process. According to the conversion method described above, a set of instructions can first be converted as if it affected the memory. Next, when host instruction optimization, reordering, and rescheduling are performed, an address that refers to the I / O device is obtained according to the state of the A / N bit provided in the conversion look-aside buffer. Can do. A comparison of the A / N bit with the translated instruction address indicating that an operation is an I / O operation results in an error exception, which causes a software-initiated rollback procedure to be performed. The memory store is erased and the value in the target register is returned in the working register. Next, conversion is started one target instruction at a time, and no optimization, reordering, or rescheduling is performed. This reconversion is a host conversion suitable for an I / O device.
Similarly, the memory operation may be erroneously converted as an I / O operation. Using the error that occurs, let it do the correct retransformation, optimize, reorder, and reschedule to give faster operation.
Prior art emulators have also struggled with what is commonly referred to as self modifying code. When the target program writes to the memory that contains the target instructions, the translations that exist for those target instructions become “stale” and are no longer valid. As these stores occur, they need to be detected dynamically. In the prior art, such detection must be performed using an extra instruction for each store. This problem is broader than a program changing itself. Any agent that can write to memory, such as a second processor or DMA device, can also cause this problem.
The present invention addresses this problem with another enhancement to the morph host. Similarly, a conversion bit (T bit) that can be stored in the conversion look-aside buffer is used to indicate the target memory page that is causing the conversion to exist. Thus, the T bit can indicate that a particular page of target memory contains a target instruction that is responsible for the presence of a host translation. If these target instructions are overwritten, the conversion will become stale. If you try to write to a page protected in memory, an exception will be generated due to the presence of the conversion bit, and when this is processed by the code morphing software, the corresponding conversion (multiple conversions) will be invalidated, It can be removed from the conversion buffer. The T bit can also be used to mark a target page that has not been written and can be converted based on this.
This can be understood by referring to FIG. 3, which shows in block diagram form the overall functional elements of the microprocessor of the present invention. When the morph host executes the target program, it actually runs the conversion part of the code morphing software that contains only the original host instructions that have not been converted. The original host instruction that has not been translated effectively runs on the morph host. On the right side of the figure, the memory is shown divided into a host portion that essentially includes a translator and a translation buffer, and a target portion that includes a target operating system and includes target instructions and data. When the morph host hardware starts executing the converter, it takes host instructions from memory and places these instructions in the instruction cache. The instruction of the conversion unit generates a fetch of the first target instruction stored in the target portion of the memory. By performing the target fetch, the integer unit looks up the official target instruction pointer register for the first address of the target instruction. It then accesses the first address in the translation lookaside buffer of the memory management unit. The memory management unit includes paging hardware and provides memory mapping facilities to the TLB. Assuming the TLB is correctly mapped and holds reference data for the correct page in the target memory, the target instruction pointer value is translated to the physical address of the target instruction. At this point, the state of a bit (T bit) indicating whether or not conversion has been performed on the target instruction is detected, but the access is a read operation and no T bit exception occurs. The state of the A / N bit that indicates whether the access is for memory or memory mapped I / O is also detected. Assuming that the last mentioned bit indicates a memory location, since there is no translation, the target instruction in the target memory is accessed. This target instruction and subsequent target instructions are transferred as data to the morph host computer unit and converted under the control of conversion instructions stored in the instruction cache. The conversion instruction uses a reordering technique, an optimization technique, and a rescheduling technique as if the target instruction affects the memory. Next, a translation containing a sequence of host instructions is obtained and stored in a translation buffer in the host memory. The conversion is transferred directly to the conversion buffer in the host memory via the gate storage buffer. Once the conversion is stored in the host memory, the conversion unit branches to the conversion and then executes it. This execution (and subsequent executions) makes a determination as to whether the conversion has made the correct assumptions regarding exceptions and memory. Prior to performing the conversion, set the T bit for the target page (s) containing the converted target instructions. This indication warns that the instruction has been translated and that this attempt will cause an exception if the write to the target address is attempted and that the translation may be invalidated or removed.
One additional hardware enhancement to the morph host is to replicate (ie, “alias”) data that is normally stored in memory but frequently used in performing operations into execution unit registers. This circuit is used to eliminate the time required for retrieving the data from the memory for each use. To do this in one embodiment, working within the execution unit 110 shown in FIG. Designed to respond to a “load and protect” command that copies memory data to register 111 and places its memory address in register 112 in that unit. It is the comparator 113 that works in conjunction with the address register. The comparator receives the load and store addresses to the gate store buffer that are directed to the memory being translated. An exception can occur if the memory address for either load or store is compared to the address in register 112 (or additional register in some embodiments). Code morphing software responds to this exception by verifying that the memory address and register hold the same correct data. In one embodiment, this is done by rolling back the translation and re-executing with no "alias" data in the execution register. Other possible ways to correct this problem include updating the registers with the latest memory data or updating the memory with the latest load data.
Those skilled in the art will appreciate that the host processor of the present invention can form a computer as shown in FIG. 9 when connected to circuitry having typical computer elements. As can be seen, when used in a modern X86 computer, the host processor is coupled to the memory and bus control circuitry via the processor bus. The memory and bus control circuitry is configured to provide access to main memory and cache memory available with the microprocessor. The memory and bus control circuitry also provides access to a bus, such as a PCI or other local bus, through which I / O devices can be accessed. The individual computer system relies on circuitry used with the microprocessor of the present invention that is replaced by the processor of the present invention.
To illustrate the operation of the processor of the present invention and the manner in which execution is accelerated, the conversion of a small sample of X86 target code into host source instructions is presented here. This sample demonstrates the conversion of X86 target instructions to morph host instructions and includes various examples of optimization, reordering, and rescheduling steps by the microprocessor of the present invention. By following the illustrated process, there is a significant difference between the operations required to execute the original instruction using the target processor and the operations required to perform the conversion on the host processor. Will be apparent to those skilled in the art.
The original instruction illustrated in C language source code describes a very short loop process. Essentially, while the variable “n” decremented after each loop is greater than “0”, the value “c” is stored at the address indicated by the pointer “* s”. The pointer “* s” is incremented after each loop.
Figure 0003776132
Notation: [...] indicates the address expression for the memory operand. In the previous example, the address for the memory operand is formed by adding the contents of the register to the hexadecimal constant indicated by the Ox prefix. The target register is indicated with a% prefix. For example,% ecx indicates an exc register. The destination of the operation is the left side.
Figure 0003776132
In the first part of this sample, each X86 assembly language instruction to perform an action defined by a C language statement is tabulated by an assembly language mnemonic for that action. This is followed by the parameters that are included in the primitive action. An explanation of the operation is also given in the comment for each instruction. The order of execution may differ from that shown in the target processor, but each of these assembly language instructions must be executed each time a loop is executed when executing the target C language instruction. Don't be. Therefore, if the loop is performed 100 times, each instruction shown above must be executed 100 times.
Figure 0003776132
Figure 0003776132
The next sample shows the same target primitive instruction executing a C language instruction. However, after each primitive target instruction, the primitive host instructions necessary to perform the same operation in one particular embodiment of the microprocessor of the present invention are summarized. In this microprocessor, the morph host is a VLIW processor designed as described herein. The host register shadowed by the official target register is indicated by “R” followed by the X86 register name. For example, Reax is a working register that works with the EAX official target register. Note that.
Figure 0003776132
Figure 0003776132
Figure 0003776132
The next sample shows the addition of a host source instruction for each of the source target instructions so that the address required for the target operation can be generated by the code morphing software. Note that host address generation instructions are only required in microprocessor embodiments that use code morphing software for address generation instead of address generation hardware. In a target processor such as an X86 microprocessor, these addresses are generated using address generation hardware. Whenever an address occurs in such an embodiment of the present invention, a calculation is performed and a host source instruction is added to check the address value so that the calculated address is the appropriate X86 segment limit. Is determined to be within.
Figure 0003776132
Figure 0003776132
Figure 0003776132
Figure 0003776132
This sample adds two steps to each set of primitive host instructions to execute each primitive target instruction after executing the host instructions necessary to commit the uncommitted value in the gate storage buffer to memory, Illustrates updating the official target register. As seen in the sample, in each case, the length of the target instruction is added to the value in the working instruction pointer register (Reip). Next, a commit instruction is executed. In one embodiment, the commit instruction copies the current value of each working register shadowed to the associated official target register, stores a pointer value that specifies the gate location of the gate storage buffer, and stores the uncommitted Move them from immediately before and immediately after storing them, placing them in memory.
It will be appreciated that the list of instructions given at the end above is all of the instructions necessary to form a host translation of the original target assembly language instruction. If the conversion stops at this point, the number of primitive host instructions will be much more than the number of target instructions (perhaps six times more), and its execution will take longer than execution on the target processor there is a possibility. However, at this point, rearrangement, optimization, and rescheduling have not yet been performed.
If an instruction is run only once, the time required to perform further reordering and other optimizations may be longer than the time required to perform the conversion that exists at this point. In that case, in one embodiment of the present invention, the conversion is stopped at this point, the conversion is stored, and then it is executed to determine whether an exception or error occurs. In this embodiment, reordering and other optimization steps are performed only if it is determined that a particular transformation should be run or optimized a certain number of times. This is done, for example, by placing a host instruction in each conversion, counting the number of times the conversion has been performed, and generating an exception (or branch) when a certain value is reached. The exception (or branch) transfers the action to the code morphing software, which then performs some or all of the following optimizations and any additional that has been determined to be useful for the conversion Realize optimization. The second way to determine the number of times a transformation has been run and request optimization is to suspend the execution of the transformation at a certain frequency or based on certain statistical criteria, and any transformation running at that point is optimal It is to become. This ultimately seeks to optimize the most frequently run instructions. Another solution would be to optimize each particular type of host instruction, such as those that form loops and others that might run most frequently.
Figure 0003776132
Figure 0003776132
Figure 0003776132
Figure 0003776132
This sample illustrates the first stage of optimization that can be performed using the present invention. This optimization stage assumes optimal results, as do many other operations of the code morphing software. A particular optimization assumes that a target application program started as a 32-bit program written against the flat memory model provided by the X86 processor family will continue as such a program. Note that such assumptions are specific to the X86 family and do not necessarily apply to other processor families being emulated.
When this assumption is made, in the X86 application, all segments are mapped to the same address space. This makes it possible to remove the primitive host instructions required by the X86 segmentation process. As seen in the sample, first set the segment value to zero. Next, the base of the data is set to zero and the limit is set to the maximum available memory. Then, in each set of primitive host instructions for executing the target primitive instruction, both the segment base value check and the segment base address calculation necessary for segmentation become unnecessary. This reduces the loop that two host source instructions should execute for each target source instruction that requires an addressing function. At this point, there is still a host instruction check for the memory limit.
It should be noted that this optimization requires an inference that states that the application utilizes the 32-bit flat memory model. If this is not true, an error is found when the main loop resolves the control transfer destination and detects that the source assumption does not match the destination assumption. Then, a new conversion is required. This technique is very general and applies when the "mode" changes frequently, such as debug, system management mode, or "real" mode, in the case of various segmentation and other "moderation" Is possible.
Figure 0003776132
Figure 0003776132
Figure 0003776132
This sample illustrates the next stage of optimization. In this case, speculative translation eliminates the upper memory boundary check, which is only required for unaligned pages that intersect the memory reference at the top of the memory address space. This assumption failure is detected by a hardware or software fix up. This reduces the translation by one host source instruction for each target source instruction that requires addressing. This optimization requires both the assumptions made above that the application utilizes the 32-bit flat memory model and the assumption that the instructions are consistent. If these are not true, the conversion will fail and a new conversion will be required.
Figure 0003776132
Figure 0003776132
Figure 0003776132
This sample illustrates the following optimization. In this case, the common host representation is removed. That is, when converting the second target source instruction, the value in the working register Rebp (the working register representing the stack pace point register of the X86 processor) is added to the offset value 0x8, and the host working Place in register R2. Note that the same operation was performed when converting the target source instruction 5 in the previous sample, but the result of the addition was placed in the working register R5. As a result, the value placed in working register R5 already exists in working register R2 when host source instruction 5 is about to occur. Thus, the host add instruction can be removed from the conversion of the target source instruction 5 and the value in the working register R2 need only be copied to the working register R5. Similarly, the host instruction that adds the value in the working register Rebp to the offset value 0x10 can also be removed in the conversion of the target source instruction 8. This is because this step has already been done in the conversion of the target source instruction 6 and the result is in register R7. Note that this optimization does not depend on thought and therefore does not fail or retransform.
Figure 0003776132
Figure 0003776132
This example illustrates an optimization that assumes that the conversion of the primitive target instructions that make up the entire conversion can be done without generating an exception. If true, there is no need to update the official target register or commit the uncommitted storage in the storage buffer at the end of each sequence of host primitive instructions that execute individual target primitive instructions. If the guess is true, only the official target register needs to be updated at the end of the sequence of target source instructions, and the store need only be committed once. This makes it possible to remove two primitive host instructions for executing each primitive target instruction. They replace the official target register with a single host primitive instruction that commits the uncommitted store to memory.
It will be appreciated that this is another speculative action, which is also very likely to include a correct guess. This step provides a tremendous advantage over all prior art emulation techniques if the guess is true. This allows all of the primitive host instructions that execute the entire sequence of target primitive instructions to be aggregated into a single sequence in which all of the individual host primitive instructions can be optimized together. This has the advantage that many operations can be run in parallel on a morph host using ultra-long instruction word technology. This also allows for a larger number of other optimizations. This is because there are more options for such optimization. Furthermore, however, if the guess is found to be not true and an exception occurs during the execution of the loop, the official target register and memory retain the state of the official target that existed at the beginning of the sequence of target source instructions. is doing. This is because no commit occurs until the host instruction sequence is actually executed. All that is needed to recover from the exception is to clear the uncommitted store, roll back the official register to the working register, and start the conversion of the target source instruction again at the start of the sequence. In this reconversion, the conversion is performed one target instruction at a time, the host sequence representing each target source instruction is converted, and then the official state is updated. Next, this conversion is performed. If an exception occurs during this reconversion, the correct target state can be immediately obtained in the official target register and memory to execute the exception.
Figure 0003776132
This summary illustrates the sequence of host primitive instructions remaining at this point in the optimization process. Although this example shows maintaining the target instruction pointer (EIP) inline, it is possible to keep the pointer EIP for branching off-line during translation. In this case, the pointer EIP update sequence can be removed from this step and the subsequent steps of this example.
Figure 0003776132
This sample shows the next step of optimization, usually called register renaming. Here, operations that require a working register that is used for one or more operations in a sequence of host primitive instructions have been modified to use different unused working registers, and two host instructions can use the same hardware Eliminate the possibility of needing Thus, for example, in the previous two samples, the second host primitive instruction uses a working register Recx that represents the official target register ECX. The tenth host primitive instruction also uses the working register Recx. By changing the operation in the second host source instruction and storing the value indicated by the address in R0 in the working register R1, not in the register Recx, the previous two host instructions both use the same register The situation to do is avoided. Similarly, the fourth, fifth, and sixth primitive instructions all use the working register Reax in the previous sample. Change the fourth host source instruction to use the previously unused working register R3 instead of the working register Reax, and change the sixth host source instruction to replace the register Reax. By utilizing the previously unused working register R4, these hardware dependencies are eliminated.
Figure 0003776132
This sample demonstrates host primitive instruction scheduling for execution on a morph host. In this example, the morph host is assumed to be a VLIW processor and, in addition to the hardware enhancements provided for cooperating with the code morphing software, among other processing units, two arithmetic and logic (ALU) The unit is included. The first line shows two separate add instructions scheduled to run together on the morph host. As seen in the sample, these are the 3rd and 8th primitive host instructions in the sample just before the previous summary. The second row contains a NOP (no action but proceed to next instruction) instruction and another add instruction. The NOP instruction indicates that there are not always two instructions that can be run together even after some scheduling optimization. In any case, this sample shows that at this point, only 9 sets of primitive host instructions are left to execute the original 10 target instructions.
Figure 0003776132
This sample essentially illustrates the same set of host primitive instructions, except that the instructions are now stored in the translation buffer and executed one or more times. This is because the last jump (jp) instruction here shows the jump address given by chaining to another sequence of translated instructions. If the sequence conversion has been completed, the chain process takes out a sequence of instructions from the main loop of the conversion unit.
Figure 0003776132
This example illustrates an advanced optimization step that is mostly used only in sequences that are repeated many times. This process first detects the transformations that form the loop and examines each original host instruction to determine the instructions that produce a constant result within the loop body. These instructions are removed from the loop body and executed only once to place a value in the register. From that point on, the value stored in this register is used and the instruction is not run again.
Figure 0003776132
When these non-repeating instructions are removed from the loop and the sequence is scheduled for execution, the scheduled instruction looks like this last sample. The first instruction is executed, but only once during the first iteration of the loop, after which only the host primitive instructions remaining in the seven clock intervals shown are executed during the loop. I understand that. Therefore, the execution time has been reduced from 10 instructions required to execute the primitive target instruction to 7 instruction intervals.
As can be seen from the sample, the step removed from the loop is the address generation step. Therefore, in the present invention, address generation need only be performed once per loop call. That is, the address generation needs to be performed only once. On the other hand, the address generation hardware of the X86 target processor must generate these addresses each time the loop is executed. If the loop is executed 100 times, the present invention generates an address only once, whereas the target processor will generate each address 100 times.
Figure 0003776132
This allows variables to be safely moved from memory to registers. Demonstrates the use of morph host register alias detection hardware. The starting point is the code after “reverse code movement”. This represents an optimization that can remove the load.
Perform a load first. The address is protected by the alias hardware, and an "alias" exception occurs when a store is made to this address. Next, the load in the loop body is replaced with a copy. Release the alias hardware after the body of the loop.
Figure 0003776132
Figure 0003776132
This sample illustrates further optimization and can be performed by the microprocessor of the present invention. Referring back to the sample two samples prior to this sample, you will notice that the first three add instructions involved the calculation of addresses on the stack. These addresses do not change during the sequence of host operations. That is, the values stored at these addresses may be loaded into registers that can be retrieved from memory and obtained immediately for execution. As seen in the sample, this is done in host primitive instructions 6, 8, and 10. In instructions 7, 9 and 11, each of the memory addresses is marked as protected by special host alias hardware, and the registers are shown as aliases for these memory addresses. Any attempt to modify that data will cause an exception. In this regard, each of the load operations involving data movement from these stack memory addresses results in a simple register-to-register copy operation that progresses much faster than a load from a memory address. Note that once the loop has been executed until n = 0, the protection must be removed from each of the memory addresses so that the alias register is available for others.
Figure 0003776132
Figure 0003776132
This sample shows the next stage of optimization. Here, it is recognized that most of the copy instructions replacing the load instructions in the optimization shown in the last sample are unnecessary and may be excluded. That is, when an inter-register copy operation is performed, data before the operation exists in the original register from which data was copied. In this case, the data can access the first register, not the register to which it was copied, and the copy operation can be eliminated. As can be seen, the first, second, fifth and ninth primitive host instructions shown in the last sample loop are removed. In addition, the registers used for other host source instructions are also changed to reflect the correct registers for the data. Thus, for example, if the first and second copy instructions are removed, the third store instruction copies the data from the working register Rc (not register R1) where the data is present, and the working register Rs (register R3). The data must be placed at the address indicated in The working register Rs has its address.
Figure 0003776132
The upper sample shows the host instruction after scheduling. Note that this sequence requires fewer clocks to execute the loop than to execute the original target instruction originally decoded from the source code. Thus, apart from all the other accelerations that have taken place, the total number of times that the combined operation is run is simply less than that required to execute the original target code.
Figure 0003776132
The final optimization shown in this sample is the removal of storage by using alias hardware. This removes the storage from within the loop body and performs them only at the loop knot. This reduces the number of host instructions in the loop body to 3 compared to the original 10 target instructions.
Although the present invention has been described with reference to preferred embodiments, it will be appreciated by those skilled in the art that various changes and modifications can be made without departing from the spirit and scope of the invention. For example, although the present invention has been described with reference to emulation of an X86 processor, the present invention is similarly implemented on programs designed for other processor architectures and virtual machines such as P-code, Postscript, or Java programs. It will be understood that this also applies to programs that Accordingly, the present invention should be construed in accordance with the following claims.

Claims (26)

換ソフトウエアを直接実行するホスト・ハードウエアからなるマイクロプロセッサであって、
前記ホスト・ハードウエアがモーフ・ホスト・ハードウエアであり、
前記変換ソフトウエアが、
第1命令セットを有するプロセッサのために書かれたプログラムの複数のターゲット命令を、前記モーフ・ホスト・ハードウエア上で実行可能な複数の原始命令に変換する処理手順と、
前記複数の原始命令を複数のホスト変換として変換バッファに格納し、
前記モーフ・ホスト・ハードウエアによって前記変換バッファから呼び出し、何回でも実行可能とする処理手順と、
を含むコード・モーフィング・ソフトウエアであることを特徴とするマイクロプロセッサ。
A host Hadoue A or Ranaru microprocessor for executing the conversion software directly,
The host hardware is morph host hardware;
The conversion software is
A procedure for converting a plurality of target instructions of a program written for a processor having a first instruction set into a plurality of primitive instructions executable on the morph host hardware;
Storing the plurality of primitive instructions in a conversion buffer as a plurality of host conversions;
A procedure that is called from the conversion buffer by the morph host hardware and can be executed any number of times.
A microprocessor characterized by being code morphing software including:
請求項記載のマイクロプロセッサにおいて、前記コード・モーフィング・ソフトウエアが、更に、前記複数の原始命令の再順序付け、再スケジュールおよび最適化を行う処理手順を含むことを特徴とするマイクロプロセッサ。2. The microprocessor according to claim 1 , wherein the code morphing software further includes a processing procedure for reordering, rescheduling and optimizing the plurality of primitive instructions. 請求項記載のマイクロプロセッサにおいて、前記モーフ・ホスト・ハードウエアが、
メモリに転送されるデータのための格納バッファであって、
前記ホスト変換の例外のない実行に応答して、前記格納バッファに格納されているデータをメモリにコミットする手段と、
前記ホスト変換の実行中の例外またはエラーの発生に応答し、メモリにコミットすることなく、前記格納バッファ内のデータをダンプする手段と、
を含む格納バッファと、
実行ユニットであって、
ターゲット・プロセッサの実行ユニットにおいてターゲット・プロセッサが必要とする1組のレジスタよりも大きな、前記実行ユニット内の1組のワーク・レジスタと、
ターゲット・プログラムを処理する際に発生するターゲット・プロセッサのオフィシャル・レジスタ状態を保持する1組のターゲット・レジスタと、
を備える実行ユニットと
を備え、
前記コード・モーフィング・ソフトウエアが、
前記ホスト変換の実行中、例外またはエラーのない前記ホスト変換の実行に応答し、前記1組のワーク・レジスタから前記1組のターゲット・レジスタに状態を転送するステップと、
前記ホスト変換の実行中、例外またはエラーの発生に応答し、前記1組のターゲット・レジスタから前記1組のワーク・レジスタに状態を転送するステップと、
を備えることを特徴とするマイクロプロセッサ。
The microprocessor of claim 1 , wherein the morph host hardware is
A storage buffer for data transferred to memory,
Means for committing data stored in the storage buffer to memory in response to execution without exception of the host conversion;
Means for dumping data in the storage buffer without committing to memory in response to the occurrence of an exception or error during execution of the host translation;
A storage buffer containing
An execution unit,
A set of work registers in the execution unit that are larger than the set of registers required by the target processor in the execution unit of the target processor;
A set of target registers that hold the target processor's official register state that is generated when processing the target program;
An execution unit comprising
The code morphing software
Transferring status from the set of work registers to the set of target registers in response to executing the host conversion without exceptions or errors during execution of the host conversion;
Transferring a state from the set of target registers to the set of work registers in response to the occurrence of an exception or error during execution of the host translation;
A microprocessor comprising:
請求項記載のマイクロプロセッサにおいて、
前記ホスト変換の実行中、例外またはエラーのない前記ホスト変換の実行に応答し、前記1組のワーク・レジスタから前記1組のターゲット・レジスタに状態を転送する前記ステップが、コミット命令から成り、
前記ホスト変換の実行中、例外またはエラーの発生に応答し、前記1組のターゲット・レジスタから前記1組のワーク・レジスタに状態を転送する前記ステップが、ロールバック命令から成り、
前記ホスト変換の例外のない実行に応答して、前記格納バッファに格納されているデータをメモリにコミットする前記手段が前記コミット命令に、および前記ホスト変換の実行中の例外またはエラーの発生に応答し、メモリにコミットすることなく、前記格納バッファ内のデータをダンプする前記手段が前記ロールバック命令に応答して機能する、
ことを特徴とするマイクロプロセッサ。
The microprocessor of claim 3 , wherein
During the execution of the host conversion, the step of transferring state from the set of work registers to the set of target registers in response to execution of the host conversion without exceptions or errors comprises a commit instruction;
In response to the occurrence of an exception or error during execution of the host translation, the step of transferring state from the set of target registers to the set of work registers comprises a rollback instruction;
In response to execution without exception of the host conversion, the means for committing data stored in the storage buffer to memory is responsive to the commit instruction and to the occurrence of an exception or error during execution of the host conversion. And the means for dumping data in the storage buffer functions in response to the rollback instruction without committing to memory.
A microprocessor characterized by that.
請求項記載のマイクロプロセッサにおいて、前記モーフ・ホスト・ハードウエアが、ターゲット命令を変換し終えたことを示す手段を備えることを特徴とするマイクロプロセッサ。4. The microprocessor of claim 3 , wherein said morph host hardware comprises means for indicating that the target instruction has been translated. 請求項記載のマイクロプロセッサにおいて、ターゲット命令を変換し終えたことを示す前記手段が、ターゲット命令を変換し終えた事を示す指示を格納するアドレス変換キャッシュを含むことを特徴とするマイクロプロセッサ。4. A microprocessor according to claim 3, wherein said means for indicating completion of conversion of the target instruction includes an address conversion cache for storing an instruction indicating that conversion of the target instruction has been completed. 請求項記載のマイクロプロセッサにおいて、前記モーフ・ホスト・ハードウエアが、命令が正常かまたは異常かを示す手段を備えることを特徴とするマイクロプロセッサ。4. A microprocessor according to claim 3 , wherein the morph host hardware comprises means for indicating whether the instruction is normal or abnormal. 請求項記載のマイクロプロセッサにおいて、命令が正常かまたは異常かを示す前記手段が、ターゲット命令を変換し終えたことを示す指示を格納するアドレス変換キャッシュを含むことを特徴とするマイクロプロセッサ。7. The microprocessor according to claim 6, wherein said means for indicating whether the instruction is normal or abnormal includes an address translation cache for storing an instruction indicating that the target instruction has been translated. 請求項記載のマイクロプロセッサにおいて、前記モーフ・ホスト・ハードウエアが、あるメモリ・アドレスにおけるデータをレジスタに移動したことを示す手段を備えることを特徴とするマイクロプロセッサ。4. The microprocessor of claim 3 , comprising means for indicating that the morph host hardware has moved data at a memory address to a register. 請求項記載のマイクロプロセッサにおいて、あるメモリ・アドレスにおけるデータをレジスタに移動したことを示す前記手段が、前記アドレスにおけるデータをレジスタに移動したことの指示を格納する手段を含み、かつ実行するアドレスを、レジスタに移動したデータのアドレスと比較する手段を備えることを特徴とするマイクロプロセッサ。10. The microprocessor of claim 9 , wherein said means for indicating that data at a memory address has been moved to a register includes means for storing an indication that data at said address has been moved to a register, and an address to execute A microprocessor comprising means for comparing the address with the address of the data moved to the register. 請求項記載のマイクロプロセッサにおいて、前記モーフ・ホスト・ハードウエアが、超長命令ワード・マイクロプロセッサを備えることを特徴とするマイクロプロセッサ。The microprocessor of claim 1 , wherein the morph host hardware comprises a very long instruction word microprocessor. ターゲット命令セットを有するターゲット・コンピュータのためのターゲット・アプリケーション・プログラムを実行するように設計されたホスト・コンピュータ用マイクロプロセッサであって
始命令セットの命令を実行するように設計され、コード・モーフィング・ソフトウエアを直接実行するモーフ・ホスト処理ハードウエアから成り、
前記コード・モーフィング・ソフトウエアと前記モーフ・ホスト処理ハードウエアが、
ある条件の発生を推測して、1組のターゲット命令を原始命令セットの複数の命令に変換する手段と、
前記マイクロプロセッサによる前記ターゲット・プログラムの実行中に、1組のターゲット命令の変換開始時に存在した、前記ターゲット・コンピュータのオフィシャル状態を、前記コード・モーフィング・ソフトウエアの制御の下で判定する手段と、
前記推測に応じて1組の原始命令を実行するとき、前記ターゲット・コンピュータの状態を前記ホスト・コンピュータの状態から更新する手段と、
前記1組の原始命令の実行中、前記条件が満たされなかったことを検出する手段と、
1組の原始命令が前記推測に応じて実行し損ねた場合、前記ホスト・コンピュータの状態を前記ターゲット・コンピュータの状態から更新する手段と、
1組の原始命令が前記推測に応じて実行し損ねた場合、前記推測を用いずに、新たな1組の原始命令を変換する手段と、
を備えることを特徴とするマイクロプロセッサ。
A microprocessor for a host computer designed to execute a target application program for a target computer having a target instruction set ,
Is designed to execute the instructions of the Hajime Hara instruction set, made morph host processing Hadoue A or et al. To run the code-morphing software directly,
The code morphing software and the morph host processing hardware are:
Means for inferring the occurrence of a condition and converting a set of target instructions into a plurality of instructions in a source instruction set;
Means for determining, under the control of the code morphing software, an official state of the target computer that was present at the start of conversion of a set of target instructions during execution of the target program by the microprocessor; ,
Means for updating the state of the target computer from the state of the host computer when executing a set of primitive instructions in response to the guess;
Means for detecting that the condition was not satisfied during execution of the set of primitive instructions;
Means for updating the state of the host computer from the state of the target computer if a set of primitive instructions fails to execute in response to the guess;
Means for converting a new set of primitive instructions without using the guess if a set of primitive instructions fails to execute in response to the guess;
A microprocessor comprising:
請求項12記載のホスト・コンピュータ用マイクロプロセッサであって、更に、ある条件の発生を推測して、前記ターゲット・プログラムから変換される前記原始命令セットの複数の命令を最適化する手段を備えることを特徴とするホスト・コンピュータ用マイクロプロセッサ。13. The microprocessor for a host computer according to claim 12 , further comprising means for inferring occurrence of a certain condition and optimizing a plurality of instructions of the source instruction set converted from the target program. A microprocessor for host computers. 請求項12記載のホスト・コンピュータ用マイクロプロセッサにおいて、ある条件の発生を推測して、1組のターゲット命令を、原始命令セットの複数の命令に変換する前記手段が、前記1組の命令の変換中に例外やエラーが発生しないと推測することを特徴とするホスト・コンピュータ用マイクロプロセッサ。13. The microprocessor for a host computer according to claim 12 , wherein said means for inferring occurrence of a condition and converting a set of target instructions into a plurality of instructions of a source instruction set converts the set of instructions. A microprocessor for a host computer that is presumed that no exceptions or errors will occur in it. 請求項12記載のホスト・コンピュータ用マイクロプロセッサにおいて、1組のターゲット命令の変換開始時に存在した、前記ターゲット・コンピュータのオフィシャル状態を、前記コード・モーフィング・ソフトウエアの制御の下で判定する前記手段が、1組のターゲット命令の変換開始時に存在していた、前記ターゲット・コンピュータのオフィシャル状態を格納する手段を備えることを特徴とするホスト・コンピュータ用マイクロプロセッサ。13. The microprocessor for a host computer according to claim 12 , wherein said means for determining an official state of said target computer existing under the start of conversion of a set of target instructions under the control of said code morphing software. A host computer microprocessor comprising: means for storing an official state of the target computer that existed at the start of conversion of a set of target instructions. 請求項15記載のホスト・コンピュータ用マイクロプロセッサにおいて、1組のターゲット命令の変換開始時に存在していた、前記ターゲット・コンピュータのオフィシャル状態を格納する前記手段が、1組のターゲット・レジスタを備えることを特徴とするホスト・コンピュータ用マイクロプロセッサ。 16. The microprocessor for a host computer according to claim 15 , wherein said means for storing an official state of said target computer that existed at the start of conversion of a set of target instructions comprises a set of target registers. A microprocessor for a host computer. 請求項15記載のホスト・コンピュータ用マイクロプロセッサにおいて、前記推測に応じて1組の原始命令を実行するとき、前記ターゲット・コンピュータの状態を前記ホスト・コンピュータの状態から更新する手段が、1組の原始命令がエラーまたは例外なく実行した場合、前記ターゲット・コンピュータのオフィシャル状態を格納する前記手段にホスト状態を転送する手段を備えることを特徴とするホスト・コンピュータ用マイクロプロセッサ。 16. The microprocessor for a host computer according to claim 15 , wherein means for updating the state of the target computer from the state of the host computer when executing a set of primitive instructions in response to the guess. A host computer microprocessor comprising: means for transferring a host state to said means for storing an official state of said target computer when a primitive instruction is executed without error or exception. 請求項12記載のホスト・コンピュータ用マイクロプロセッサにおいて、前記1組の原始命令の実行中、前記条件が満たされなかったことを検出する前記手段が、例外を発生する手段を備えることを特徴とするホスト・コンピュータ用マイクロプロセッサ。13. The microprocessor for a host computer according to claim 12 , wherein said means for detecting that said condition is not satisfied during execution of said set of primitive instructions comprises means for generating an exception. Microprocessor for host computer. 請求項18記載のホスト・コンピュータ用マイクロプロセッサにおいて、前記例外を発生する手段が、ハードウエア手段であることを特徴とするホスト・コンピュータ用マイクロプロセッサ。19. A microprocessor for a host computer according to claim 18 , wherein said means for generating an exception is a hardware means. 請求項18記載のホスト・コンピュータ用マイクロプロセッサにおいて、前記例外を発生する手段が、ソフトウエア手段であることを特徴とするホスト・コンピュータ用マイクロプロセッサ。19. A microprocessor for a host computer according to claim 18 , wherein said means for generating an exception is a software means. 請求項12記載のホスト・コンピュータ用マイクロプロセッサにおいて、
1組の原始命令が前記推測に応じて実行し損ねた場合、前記ホスト・コンピュータの状態を前記ターゲット・コンピュータの状態から更新する手段が、1組のターゲット命令の変換開始時に存在していた前記ターゲット・コンピュータのオフィシャル状態を転送し、ホスト状態を更新する手段を備えることを特徴とするホスト・コンピュータ用マイクロプロセッサ。
A microprocessor for a host computer according to claim 12 ,
The means for updating the state of the host computer from the state of the target computer if a set of primitive instructions failed to execute according to the guess was present at the start of conversion of the set of target instructions A microprocessor for a host computer, comprising means for transferring an official state of a target computer and updating the host state.
請求項12記載のホスト・コンピュータ用マイクロプロセッサにおいて、
1組の原始命令が前記推測に応じて実行し損ねた場合、前記推測を用いずに、新たな1組の原始命令を変換する前記手段が、失敗した1組のターゲット命令の変換開始時に存在していたターゲット命令から始めて各ターゲット命令を順番に変換し、ホスト状態を前記ターゲット・コンピュータのオフィシャル状態としてセーブする手段を備えることを特徴とするホスト・コンピュータ用マイクロプロセッサ。
A microprocessor for a host computer according to claim 12 ,
If a set of primitive instructions fails to execute according to the guess, the means for converting a new set of primitive instructions without the guess is present at the start of conversion of the failed set of target instructions A microprocessor for a host computer, comprising means for converting each target instruction in order starting from the target instruction that has been executed and saving the host state as the official state of the target computer.
ターゲット命令セットとは異なる原始命令セットからの命令を実行可能なホスト・プロセッサを有するホスト・コンピュータ上で、前記ターゲット命令セットを有するターゲット・コンピュータによって実行するように設計されたターゲット・プログラムを実行する方法であって、
前記ターゲット・コンピュータの状態を、ターゲット命令の変換開始時に存在するものとして格納するステップと、
ある動作を命令する複数のターゲット命令を、前記ターゲット命令によって命令される前記動作を前記ホスト・プロセッサ上において実行するための1組の複数の原始命令に変換するステップと、
前記複数の原始命令をホスト変換として変換バッファに記憶するステップと、
前記ホスト変換を前記ホスト・プロセッサ上で実行するステップと、
前記ホスト変換の実行が例外またはエラーを発生しない場合、前記ターゲット・コンピュータに対して格納した状態を前記ホスト・コンピュータの状態から更新するステップと、
前記ホスト変換の実行が例外またはエラーを発生した場合、前記ホスト・コンピュータの状態を前記ターゲット・コンピュータの格納した状態から更新するステップと、
から成ることを特徴とするターゲット・プログラム実行方法。
A target program designed to be executed by a target computer having the target instruction set is executed on a host computer having a host processor capable of executing instructions from a source instruction set different from the target instruction set A method,
Storing the state of the target computer as existing at the start of conversion of the target instruction;
Converting a plurality of target instructions that command an operation into a set of primitive instructions for executing the operation commanded by the target instruction on the host processor;
Storing the plurality of primitive instructions in a conversion buffer as host conversion;
Performing the host conversion on the host processor;
Updating the stored state for the target computer from the state of the host computer if execution of the host conversion does not cause an exception or error; and
Updating the state of the host computer from the stored state of the target computer if execution of the host conversion generates an exception or error; and
A target program execution method comprising:
請求項23記載のターゲット・アプリケーション・プログラム実行方法であって、前記1組の複数の原始命令をホスト変換として格納する前に、該複数の原始命令の最適化および再スケジューリングを行う追加ステップを含むことを特徴とするターゲット・アプリケーション・プログラム実行方法。24. The target application program execution method according to claim 23 , comprising the additional step of optimizing and rescheduling the plurality of primitive instructions before storing the set of primitive instructions as a host translation. A method for executing a target application program. 請求項23記載のターゲット・アプリケーション・プログラム実行方法であって、
原始命令を発生するための前記原始命令の並び替え、最適化、または再スケジューリングを行わずに、ある動作を命令する各ターゲット命令を、前記ターゲット命令によって命令される前記動作の各ターゲット命令を前記ホスト・プロセッサ上で実行するための1組の原始命令に変換する追加ステップと、
各1組の原始命令の変換を完了した際に、該1組をホスト変換として前記変換バッファに格納する追加ステップと、
各ターゲット命令を1組の原始命令に変換した後、前記ホスト・コンピュータの状態を格納し更新する追加ステップと、
前記ホスト・プロセッサ上において各原始命令を実行するステップと、
前記ホスト変換の実行が例外またはエラーを発生しない場合、前記ターゲット・コンピュータに対して格納した状態を、前記ホスト・コンピュータの状態から更新する追加ステップと、
前記原始命令の実行によって例外またはエラーが発生した場合、発生したあらゆる例外またはエラーも取り込む追加ステップと、
を含むことを特徴とするターゲット・アプリケーション・プログラム実行方法。
A target application program execution method according to claim 23 , comprising:
Without reordering, optimizing, or rescheduling the primitive instructions to generate a primitive instruction, each target instruction that commands a certain action is replaced by each target instruction of the action that is commanded by the target instruction. An additional step of converting to a set of primitive instructions for execution on the host processor;
An additional step of storing each set of primitive instructions as a host conversion in the conversion buffer upon completion of conversion of each set of primitive instructions;
An additional step of storing and updating the state of the host computer after converting each target instruction into a set of primitive instructions;
Executing each primitive instruction on the host processor;
An additional step of updating the state stored for the target computer from the state of the host computer if execution of the host conversion does not cause an exception or error;
If an exception or error occurs due to execution of the primitive instruction, an additional step of capturing any exception or error that occurred,
A method for executing a target application program, comprising:
請求項23記載のターゲット・アプリケーション・プログラム実行方法であって、前記1組の原始命令が頻繁に再実行すべきものである場合、前記1組の原始命令をホスト変換として格納した後、複数の原始命令の最適化および再スケジューリングを行う追加ステップを含むことを特徴とするターゲット・アプリケーション・プログラム実行方法。24. The target application program execution method according to claim 23 , wherein when the set of primitive instructions is to be re-executed frequently, a plurality of primitives are stored after storing the set of primitive instructions as host translation. A method of executing a target application program comprising the additional steps of optimizing and rescheduling instructions.
JP50436199A 1997-06-25 1997-06-25 Microprocessor improvements Expired - Fee Related JP3776132B2 (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/US1997/011616 WO1998059292A1 (en) 1997-06-25 1997-06-25 Improved microprocessor

Publications (2)

Publication Number Publication Date
JP2001519953A JP2001519953A (en) 2001-10-23
JP3776132B2 true JP3776132B2 (en) 2006-05-17

Family

ID=22261203

Family Applications (1)

Application Number Title Priority Date Filing Date
JP50436199A Expired - Fee Related JP3776132B2 (en) 1997-06-25 1997-06-25 Microprocessor improvements

Country Status (5)

Country Link
EP (1) EP0991994A4 (en)
JP (1) JP3776132B2 (en)
KR (1) KR100443759B1 (en)
CA (1) CA2283776C (en)
WO (1) WO1998059292A1 (en)

Families Citing this family (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE69942011D1 (en) 1998-10-10 2010-03-25 Ibm Program code conversion with reduced translation
US7111290B1 (en) 1999-01-28 2006-09-19 Ati International Srl Profiling program execution to identify frequently-executed portions and to assist binary translation
JP5520326B2 (en) * 1999-01-28 2014-06-11 エーティーアイ・テクノロジーズ・ユーエルシー Method and computer for referencing computer memory
US6954923B1 (en) 1999-01-28 2005-10-11 Ati International Srl Recording classification of instructions executed by a computer
US7353163B2 (en) 1999-04-27 2008-04-01 Transitive Limited Exception handling method and apparatus for use in program code conversion
AU4580300A (en) * 1999-04-27 2000-11-10 Transitive Technologies Limited Exception handling method and apparatus for use in program code conversion
US6549959B1 (en) 1999-08-30 2003-04-15 Ati International Srl Detecting modification to computer memory by a DMA device
US6751583B1 (en) 1999-10-29 2004-06-15 Vast Systems Technology Corporation Hardware and software co-simulation including simulating a target processor using binary translation
US6627564B1 (en) * 2000-08-31 2003-09-30 Kimberly-Clark Worldwide, Inc. Composite elastic in one direction and extensible in another direction
FR2814257B1 (en) * 2000-09-20 2002-12-06 Palmware MULTI-PLATFORM VIRTUAL MICROPROCESSOR ARCHITECTURE AND ITS COMPLEMENTARY OPERATING SYSTEM, PARTICULARLY FOR THE EMBEDDED AND MOBILE COMPUTER AREA
GB2384089B (en) * 2000-11-13 2005-07-13 Sun Microsystems Inc Method and apparatus for increasing performance of an interpreter
EP1313012A1 (en) 2001-11-15 2003-05-21 Texas Instruments France Java DSP acceleration by byte-code optimization
US7805710B2 (en) * 2003-07-15 2010-09-28 International Business Machines Corporation Shared code caching for program code conversion
US7363620B2 (en) 2003-09-25 2008-04-22 Sun Microsystems, Inc. Non-linear execution of application program instructions for application program obfuscation
US7415618B2 (en) 2003-09-25 2008-08-19 Sun Microsystems, Inc. Permutation of opcode values for application program obfuscation
US7424620B2 (en) 2003-09-25 2008-09-09 Sun Microsystems, Inc. Interleaved data and instruction streams for application program obfuscation
US8220058B2 (en) 2003-09-25 2012-07-10 Oracle America, Inc. Rendering and encryption engine for application program obfuscation
US7353499B2 (en) 2003-09-25 2008-04-01 Sun Microsystems, Inc. Multiple instruction dispatch tables for application program obfuscation
US8020152B2 (en) * 2005-02-24 2011-09-13 Microsoft Corporation Code morphing
US7882336B2 (en) * 2007-02-01 2011-02-01 International Business Machines Corporation Employing a buffer to facilitate instruction execution
KR100968376B1 (en) * 2009-01-13 2010-07-09 주식회사 코아로직 Device and method for processing application between different processor, and application processor(ap) communication system comprising the same device
US9525586B2 (en) * 2013-03-15 2016-12-20 Intel Corporation QoS based binary translation and application streaming
US9703562B2 (en) * 2013-03-16 2017-07-11 Intel Corporation Instruction emulation processors, methods, and systems

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5574927A (en) * 1994-03-25 1996-11-12 International Meta Systems, Inc. RISC architecture computer configured for emulation of the instruction set of a target computer
US5751982A (en) * 1995-03-31 1998-05-12 Apple Computer, Inc. Software emulation system with dynamic translation of emulated instructions for increased processing speed
US5625835A (en) * 1995-05-10 1997-04-29 International Business Machines Corporation Method and apparatus for reordering memory operations in a superscalar or very long instruction word processor

Also Published As

Publication number Publication date
CA2283776A1 (en) 1998-12-30
KR100443759B1 (en) 2004-08-09
KR20010014094A (en) 2001-02-26
JP2001519953A (en) 2001-10-23
CA2283776C (en) 2003-11-11
EP0991994A4 (en) 2001-11-28
EP0991994A1 (en) 2000-04-12
WO1998059292A1 (en) 1998-12-30

Similar Documents

Publication Publication Date Title
JP3615770B2 (en) Memory controller that detects failure to think of addressed components
JP3753743B2 (en) Method and apparatus for memory data aliasing in advanced processors
US5958061A (en) Host microprocessor with apparatus for temporarily holding target processor state
US6031992A (en) Combining hardware and software to provide an improved microprocessor
US6199152B1 (en) Translated memory protection apparatus for an advanced microprocessor
JP3776132B2 (en) Microprocessor improvements
JP2001507151A (en) Gate storage buffers for advanced microprocessors.
JP3621116B2 (en) Conversion memory protector for advanced processors
JP3654913B2 (en) Host microprocessor with a device that temporarily holds the state of the target processor

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20041116

A601 Written request for extension of time

Free format text: JAPANESE INTERMEDIATE CODE: A601

Effective date: 20050215

A602 Written permission of extension of time

Free format text: JAPANESE INTERMEDIATE CODE: A602

Effective date: 20050404

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050516

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050628

A601 Written request for extension of time

Free format text: JAPANESE INTERMEDIATE CODE: A601

Effective date: 20050927

A602 Written permission of extension of time

Free format text: JAPANESE INTERMEDIATE CODE: A602

Effective date: 20051114

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20051129

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20060124

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20060222

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090303

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100303

Year of fee payment: 4

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313113

Free format text: JAPANESE INTERMEDIATE CODE: R313111

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100303

Year of fee payment: 4

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100303

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110303

Year of fee payment: 5

LAPS Cancellation because of no payment of annual fees