JP2003515203A - Optimization of N-base type arithmetic expression - Google Patents

Optimization of N-base type arithmetic expression

Info

Publication number
JP2003515203A
JP2003515203A JP2001536669A JP2001536669A JP2003515203A JP 2003515203 A JP2003515203 A JP 2003515203A JP 2001536669 A JP2001536669 A JP 2001536669A JP 2001536669 A JP2001536669 A JP 2001536669A JP 2003515203 A JP2003515203 A JP 2003515203A
Authority
JP
Japan
Prior art keywords
instruction
base
processor
overflow
operand
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.)
Granted
Application number
JP2001536669A
Other languages
Japanese (ja)
Other versions
JP4786101B2 (en
JP2003515203A5 (en
Inventor
ジクン チェン
ジュディー シュワーブ
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sun Microsystems Inc
Original Assignee
Sun Microsystems Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sun Microsystems Inc filed Critical Sun Microsystems Inc
Publication of JP2003515203A publication Critical patent/JP2003515203A/en
Publication of JP2003515203A5 publication Critical patent/JP2003515203A5/ja
Application granted granted Critical
Publication of JP4786101B2 publication Critical patent/JP4786101B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • G06F8/4434Reducing the memory space required by the 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

Abstract

(57)【要約】 演算式最適化の方法は、第1のベースを有する第1のプロセッサのために形成された、演算子と少なくとも1つのオペランドとを含む第1の命令(80)を受け取る段階、全てのオペランドが潜在的な桁あふれ(82)を伴っていないか、又は、演算子が桁あふれに対して敏感でない場合、第1のベースよりも小さい第2のベースを有する第2のプロセッサのために最適化された第2の命令(88)に第1の命令(80)を変換する段階、及び、少なくとも1つのオペランドが桁あふれの可能性になっており、かつ、演算子が桁あふれに対して敏感な場合、桁あふれの源である第3の命令(86)をより広いベースに変換する段階を含む。演算式最適化の装置は、プログラム命令を有する少なくとも1つのメモリ、及び、第1のベースを有する第1のプロセッサに対して形成された第1の命令(80)を受信し、少なくとも1つのオペランドのいずれもが潜在的な桁あふれ(82)を伴っていないか、又は、演算子が桁あふれに敏感でない場合には、その第1の命令を第1のベースよりも小さい第2のベースを有する第2のプロセッサに対して最適化された第2の命令(88)に変換し、少なくとも1つのオペランドが桁あふれ(84)の可能性になっており、かつ、演算子が桁あふれに対して敏感な場合には、桁あふれの源である第3の命令(86)をより広いベースに変換するために、プログラム命令を使用するように形成された少なくとも1つのプロセッサを含む。 (57) Abstract A method for arithmetic expression optimization receives a first instruction (80) formed for a first processor having a first base and including an operator and at least one operand. Stage, if all operands have no potential overflow (82) or if the operator is not sensitive to overflow, a second with a second base smaller than the first base Converting the first instruction (80) into a second instruction (88) optimized for the processor, and wherein at least one of the operands is subject to overflow, and the operator is If overflow sensitive, the method includes converting the third instruction (86), which is the source of the overflow, to a wider base. An apparatus for arithmetic expression optimization receives at least one memory having program instructions and a first instruction (80) formed for a first processor having a first base, and at least one operand Are not accompanied by a potential overflow (82), or if the operator is not sensitive to overflow, the first instruction is passed to a second base that is smaller than the first base. A second instruction (88) optimized for the second processor, wherein at least one of the operands is subject to overflow (84) and the operator is When sensitive, it includes at least one processor configured to use program instructions to convert the overflow instruction, third instruction (86), to a wider base.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】 (技術分野) 関連出願への相互参照 本出願は、以下の特許に関連する: スッサー及びシュウェーブによる「リソース限定型装置のためのオブジェクト
志向命令セット」という名称の1999年2月2日出願の米国特許出願、及び レビ及びシュウェーブによる「確実に配分されたバイトコード照合を有する仮
想計算機」という名称の1997年4月15日出願の米国特許出願。 本発明は、コンピュータシステムに関する。より具体的には、本発明は、nベ
ースタイプの演算式の最適化に関する。
[0001] CROSS-REFERENCE This application to (art) related application is related to the following patents: entitled "Object-oriented instruction set for resource-limited device" Sussa and by Gerhard Wave 1999 February 2 U.S. patent application filed on April 15, 1997 by Levi and Schwabe, entitled "Virtual Machine with Reliably Distributed Bytecode Matching". The present invention relates to computer systems. More specifically, the present invention relates to optimization of n-base type arithmetic expressions.

【0002】 (背景技術) コンピュータプログラムの準備が図1に示されている。ユーザは、プログラム
を高級プログラム言語10で書く。高級プログラム言語10で書かれたプログラ
ムは、目標とする計算機によって実行することができる低級機械言語12にコン
パイルされる。例えば、高級Java(登録商標)プログラム言語で書かれたプ
ログラムは、低級バイトコード命令にコンパイルされる。バイトコード命令とは
、「Java(登録商標)仮想計算機」のための機械言語である。「Java(
登録商標)機械言語仕様」は、アジソン・ウェスレーから1999年に出版のリ
ンドホルム他著「Java(登録商標)機械言語仕様」第2版に説明されている
BACKGROUND ART The preparation of a computer program is shown in FIG. The user writes the program in the high level programming language 10. A program written in the high-level programming language 10 is compiled into a low-level machine language 12 that can be executed by a target computer. For example, a program written in the high-level Java (registered trademark) programming language is compiled into low-order bytecode instructions. A bytecode instruction is a machine language for “Java (registered trademark) virtual computer”. "Java (
"Registered Trademark) Machine Language Specification" is described in Second Edition "Java Machine Language Specification" by Lindholm et al., Published by Addison Wesley in 1999.

【0003】 一般的な高級プログラム言語は、演算式をサポートする。演算式は、1つ又は
それ以上のオペランドに作用する算術演算子によって形成される。一般的にサポ
ートされる演算子は、加算、引き算、乗算、割り算、剰余、ネゲート、桁送り、
ビット式論理和、ビット式論理積、及び、ビット式排他的論理和を含む。中間的
な値は、1つ又はそれ以上の算術演算の結果である。高級言語はまた、一般的に
多重又はnベースの整数タイプをサポートし、算術演算がオーバ・ロードされる
。オーバ・ロードは、演算子が混合タイプを有するオペランドを受け入れること
を可能にする。例えば、Java(登録商標)プログラム言語は、4つのベース
の整数タイプ、すなわち、byte、short、int、及び、longをサ
ポートする。これらのタイプは、各々、8、16、32、及び、64ビット値を
サポートする。「+」演算子のような演算子は、これらの整数タイプのいずれの
オペランドも受け入れるであろう。以下の3つの例は、混合ベースタイプを有す
るオペランドの演算のための「+」演算子のオーバ・ロードを示している。 int a、b; a+b; short a、b; a+b; byte a、b; a+b;
Common high-level programming languages support arithmetic expressions. Arithmetic expressions are formed by arithmetic operators that operate on one or more operands. Commonly supported operators are addition, subtraction, multiplication, division, remainder, negate, shift,
Bit-type logical sum, bit-type logical product, and bit-type exclusive logical sum are included. Intermediate values are the result of one or more arithmetic operations. Higher level languages also generally support multiple or n-based integer types, with arithmetic operations overloaded. Overloading allows operators to accept operands with mixed types. For example, the Java programming language supports four base integer types: byte, short, int, and long. These types support 8, 16, 32, and 64-bit values, respectively. Operators such as the "+" operator will accept any operand of these integer types. The following three examples show overloading of the "+" operator for operations on operands with mixed base types. int a, b; a + b; short a, b; a + b; byte a, b; a + b;

【0004】 このオーバ・ロードは、一般的に、値をより広いベースタイプに広げ、次に、
算術演算を実行することによって行われる。例えば、「C」及びJava(登録
商標)コンパイラは、通常、タイプbyte及びshortの値をタイプint
に広げる。Java(登録商標)言語において、タイプintは、いつも32ビ
ットである。すなわち、タイプshortの16ビット値とタイプbyteの8
ビット値とは、算術演算を実行する前に、32ビットのタイプintまで広げら
れる。Java(登録商標)言語においては、上記で列挙した3つの例の各々に
対して、以下のバイトコードが発生される。 iload a iload b iadd
This overload generally spreads the values to a wider base type, then
It is done by performing arithmetic operations. For example, "C" and Java compilers typically assign values of type byte and short to type int.
Spread to. In the Java language, the type int is always 32 bits. That is, a 16-bit value of type short and 8 of type byte
A bit value is expanded to a 32-bit type int before performing an arithmetic operation. In the Java language, the following bytecodes are generated for each of the three examples listed above. iload a iload b iadd

【0005】 iload命令は、8、16、又は、32ビット変数のいずれかをロードし、
そのスタック上に32ビットオペランドを置く。iadd命令は、スタックから
2つの32ビットオペランドを取り出し、それらを加え合わせ、32ビットの結
果をスタック上に戻して置く。 Java(登録商標)と違って、いくつかの高級言語は、整数タイプ間の関係
のみを規定し、各タイプのサイズは規定しない。例えば、「C」コンパイラの販
売業者の1つは、byte、short、及び、intのタイプのビットサイズ
を、各々、8、16、及び、32ビットであると規定してもよい。しかし、別の
「C」コンパイラの販売業者は、同じタイプのサイズを、各々、16、32、及
び、64ビットであると規定するであろう。更に別のコンパイラは、そのビット
サイズを、各々、16、32、及び、32ビットであると規定してもよい。全て
の場合において、各タイプのサイズ間の関係は維持されるが(タイプbyteで
表される値の数<タイプshortで表される値の数、タイプshortで表さ
れる値の数<タイプintで表される値の数)、各タイプを表すのに使用される
実際のビット数は異なってもよい。しかし、Java(登録商標)のように、「
C」は、特定の各コンパイラによって規定されるintタイプのサイズで算術演
算を実行する。これには、より小さいベースタイプを有する値をタイプintま
で広げることが必要である。
The iload instruction loads either an 8, 16 or 32-bit variable,
Put a 32-bit operand on the stack. The iadd instruction takes two 32-bit operands from the stack, adds them together, and places the 32-bit result back on the stack. Unlike Java, some high-level languages only specify the relationship between integer types, not the size of each type. For example, one of the "C" compiler vendors may specify the bit sizes of the byte, short, and int types to be 8, 16, and 32 bits, respectively. However, other "C" compiler vendors will specify the same type sizes as 16, 32, and 64 bits, respectively. Yet another compiler may define its bit size to be 16, 32, and 32 bits, respectively. In all cases, the relationship between the sizes of each type is maintained (number of values represented by type byte <number of values represented by type short, number of values represented by type short <type int , The actual number of bits used to represent each type may vary. However, like Java (registered trademark),
C "performs arithmetic operations on int-type sizes defined by each particular compiler. This requires extending values with smaller base types to type int.

【0006】 このタイプ拡大手法は、機械命令の数を減らし、従って、目標とする計算機の
複雑さを低減する。しかし、このタイプ拡大は、一般的により大きな計算スタッ
ク空間を必要とする。例えば、タイプshortの2つの16ビット値をそれら
が32ビットタイプに拡大された後で加え合わせることは、図2A及び図2Bに
示す通り、タイプintの2つの32ビット値を加え合わせるスタック空間と同
じ量を使用する。
This type expansion technique reduces the number of machine instructions and thus the target computer complexity. However, this type extension generally requires more computational stack space. For example, adding two 16-bit values of type short after they have been expanded to a 32-bit type is a stack space that adds two 32-bit values of type int, as shown in FIGS. 2A and 2B. Use the same amount.

【0007】 ここで図2Aを参照すると、Java(登録商標)言語のタイプshortの
2つの16ビット値を加え合わせる時のスタック使用法を示す流れ図が示されて
いる。参照番号20において、第1の16ビットオペランドがロードされ、オペ
ランドスタック上に押し付けられる。この時点のオペランドスタックは、参照番
号30で示されている。参照番号22において、第1の16ビットオペランドは
、32ビットに拡大される。参照番号24において、第2の16ビットオペラン
ドがロードされ、オペランドスタック上に押し付けられる。参照番号26におい
て、第2の16ビットオペランドが32ビットに拡大される。この時点で、オペ
ランドスタックは、4x16=64ビットを占有する。参照番号28において、
この2つの32ビットオペランドは、32ビットadd演算子を使用して加え合
わされる。
Referring now to FIG. 2A, there is shown a flow diagram illustrating stack usage when adding two 16-bit values of type short in the Java language. At reference numeral 20, the first 16-bit operand is loaded and pushed onto the operand stack. The operand stack at this point is indicated by reference numeral 30. At reference numeral 22, the first 16-bit operand is expanded to 32 bits. At reference numeral 24, a second 16-bit operand is loaded and pushed onto the operand stack. At reference numeral 26, the second 16-bit operand is expanded to 32 bits. At this point, the operand stack occupies 4x16 = 64 bits. At reference numeral 28,
The two 32-bit operands are added using the 32-bit add operator.

【0008】 ここで図3Aを参照すると、タイプintの2つの32ビット値を加え合わせ
る時のスタック使用法を示す流れ図が表されている。参照番号40において、第
1の32ビットオペランドがロードされ、オペランドスタック上に押し付けられ
る。このオペランドスタックは、図3Bで示されている。参照番号42において
、第2の32ビットオペランドがロードされ、オペランドスタック上に押し付け
られる。参照番号44において、この2つの32ビットオペランドは、32ビッ
トadd演算子を使用して加え合わされる。すなわち、上述の16ビット加算及
び32ビット加算例の両方において、2つの32ビットオペランドは、スタック
から取り出されて32ビットの加算演算を使用して加え合わされる前に、スタッ
ク上に押し付けられる。
Referring now to FIG. 3A, there is shown a flow diagram illustrating stack usage when adding two 32-bit values of type int. At reference numeral 40, the first 32-bit operand is loaded and pushed onto the operand stack. This operand stack is shown in Figure 3B. At reference numeral 42, a second 32-bit operand is loaded and pushed onto the operand stack. At reference numeral 44, the two 32-bit operands are added using the 32-bit add operator. That is, in both the 16-bit add and 32-bit add examples above, the two 32-bit operands are pushed onto the stack before they are popped from the stack and added using the 32-bit add operation.

【0009】 プログラム実行が進行する間、スタックの大きさは、入れ子プロシージャの呼
び出しのレベル、計算された式の複雑さ、及び、局所的に表された変数の数など
の要素のためにサイズが変動する場合がある。スマートカードなどのリソース限
定型装置においては、一般的に、タイプ拡大が行われるような計算を実行するの
に利用できるメモリが不十分である。 リソース限定型装置は、一般的なデスクトップコンピュータなどと比べた場合
、一般的に、メモリ、及び/又は、計算能力又は速度が比較的制限されているも
のであると考えられている。一例として、他のリソース限定型装置には、セルラ
ー電話機、境界用走査装置、野外用プログラム可能装置、携帯情報端末(PDA
)、及び、ポケットベル(登録商標)や他の小型又は小さな衛星電波使用装置が
含まれる。
During the course of program execution, the size of the stack is sized due to factors such as the level of nesting procedure invocation, the complexity of the calculated expression, and the number of locally represented variables. It may fluctuate. In resource limited devices such as smart cards, there is generally insufficient memory available to perform calculations such that type expansion is performed. Resource limited devices are generally considered to have relatively limited memory and / or computational power or speed when compared to typical desktop computers and the like. By way of example, other resource limited devices include cellular telephones, border scanning devices, outdoor programmable devices, personal digital assistants (PDAs).
), And pagers and other small or small satellite radio equipment.

【0010】 賢い携帯用データ携行カードとしても知られるスマートカードは、一般的に、
プラスチック又は金属から作られ、プログラムを実行するための内蔵マイクロプ
ロセッサ又はマイクロコントローラとプログラム及びデータを記憶するメモリと
を含む電子集積回路を有する。ほぼクレジットカードのサイズが可能なその様な
装置は、8ビット又は16ビットのアーキテクチャを備えたコンピュータ集積回
路を有する。更に、これらの装置は、一般的に制限された記憶容量を有する。例
えば、スマートカードのいくつかは、1キロバイト(1K)未満のランダムアク
セスメモリ(RAM)のほか、限られたロム(ROM)、及び/又は、電気的消
去可能ロム(EEPROM)のような不揮発性メモリを有する。
Smart cards, also known as clever portable data carrying cards, generally
It is made of plastic or metal and has an electronic integrated circuit including an embedded microprocessor or microcontroller for executing programs and a memory for storing programs and data. Such devices, which can be approximately credit card sized, have computer integrated circuits with 8-bit or 16-bit architectures. Furthermore, these devices generally have a limited storage capacity. For example, some smart cards have less than 1 kilobyte (1K) of random access memory (RAM) as well as limited ROM (ROM) and / or non-volatile such as electrically erasable ROM (EEPROM). It has a memory.

【0011】 更に、8ビット又は16ビットアーキテクチャを有するスマートカードは、一
般的に、内蔵8ビット又は16ビット算術演算を各々有する。従って、スマート
カードは、通常、32ビット演算よりも効率的に8ビット又は16ビット演算を
実行することができる。32ビットに拡大されたデータに対して32ビット演算
を実行することは、特に非効率的である。すなわち、スマートカードなどのリソ
ース限定型装置の限られたアーキテクチャ及びメモリは、値がより大きな整数タ
イプに拡大されたプログラムを実行することを非実用的又は不可能にする。
Moreover, smart cards with 8-bit or 16-bit architectures typically have built-in 8-bit or 16-bit arithmetic operations, respectively. Therefore, smart cards are typically able to perform 8-bit or 16-bit operations more efficiently than 32-bit operations. Performing 32-bit operations on data expanded to 32 bits is particularly inefficient. That is, the limited architecture and memory of resource limited devices such as smart cards make it impractical or impossible to execute programs whose values have been extended to larger integer types.

【0012】 「Java(登録商標)機械言語」命令セットは、byte、short、及
び、intの整数タイプの値を処理するための算術命令セットを形成する。タイ
プbyte及びshortの変数は、編集中に整数タイプintまで拡大される
。反対に、「Java Card(登録商標)(Java(登録商標)プログラ
ム言語をサポートするスマートカード)仮想計算機」は、整数タイプintの変
数を処理する命令セットに加えて、タイプbyte及びshortの変数を処理
する別の命令セットを形成する。ほとんどの「Java Card(登録商標)
」アプリケーションは、タイプshort又はbyteのデータ値に対して演算
する。
The “Java Machine Language” instruction set forms the arithmetic instruction set for processing integer type values of byte, short, and int. Variables of type byte and short are expanded to the integer type int during editing. Conversely, "Java Card (registered trademark) (a smart card supporting the Java (registered trademark) programming language) virtual machine" adds a variable of types byte and short in addition to an instruction set that handles variables of integer type int. Form another set of instructions to process. Most of the "Java Card (R)"
The application operates on data values of type short or byte.

【0013】 コンピュータ産業においては、同じプログラムをリソース限定型装置で実行す
ることができ、従って縦のプラットフォームに亘る相互運用性が達成されるよう
に、比較的メモリが豊富なデスクトップコンピュータ上で実行するように意図さ
れた高級コンピュータ言語をサポートする傾向が増加している。この縦のプラッ
トフォームに亘る相互運用性には、高級プログラム言語で書かれたプログラムが
リソース限定型装置で実行された時、それらが仮に比較的メモリが豊富な装置で
実行された場合にもたらすであろう同じ結果を示すことが必要である。例えば、
Java(登録商標)プログラム言語で書かれたプログラムの実行を、スマート
カードプラットフォーム、手持式装置、消費者電気器具、デスクトップコンピュ
ータ、及び、スーパーコンピュータを含む、様々なプラットフォーム上でサポー
トすることが必要である。 従って、意味論的に同等な数学的表現をより少ない計算スタック空間を使用し
て実行することができるように、プログラム表現を変える必要性が存在する。更
に、実行速度が増加するようにそのような変形を行う必要性が従来技術において
存在する。
In the computer industry, the same program can be run on a resource limited device, thus running on a relatively memory rich desktop computer so that interoperability across vertical platforms is achieved. There is an increasing tendency to support high-level computer languages intended to be. This interoperability across vertical platforms comes into play when programs written in high-level programming languages are executed on resource-limited devices, if they were executed on relatively memory-rich devices. It is necessary to show the same results as the wax. For example,
It is necessary to support the execution of programs written in the Java programming language on various platforms, including smart card platforms, handheld devices, consumer appliances, desktop computers, and supercomputers. is there. Therefore, there is a need to change program representations so that semantically equivalent mathematical representations can be performed using less computational stack space. Moreover, there is a need in the prior art to make such modifications to increase execution speed.

【0014】 (発明の開示) 演算式最適化の方法は、第1のベースを有する第1のプロセッサのために形成
された、演算子と少なくとも1つのオペランドとを含む第1の命令を受け取る段
階、全てのオペランドが潜在的な桁あふれを伴っていないか、又は、演算子が桁
あふれに対して敏感でない場合、第1のベースよりも小さい第2のベースを有す
る第2のプロセッサのために最適化された第2の命令に第1の命令を変換する段
階、及び、少なくとも1つのオペランドが桁あふれの可能性になっており、かつ
、演算子が桁あふれに対して敏感な場合、桁あふれの源である第3の命令をより
広いベースに変換する段階を含む。演算式最適化の装置は、プログラム命令を有
する少なくとも1つのメモリ、及び、第1のベースを有する第1のプロセッサに
対して形成された第1の命令を受信し、少なくとも1つのオペランドのいずれも
が潜在的な桁あふれを伴っていないか、又は、演算子が桁あふれに敏感でない場
合には、その第1の命令を第1のベースよりも小さい第2のベースを有する第2
のプロセッサに対して最適化された第2の命令に変換し、少なくとも1つのオペ
ランドが桁あふれの可能性になっており、かつ、演算子が桁あふれに対して敏感
な場合には、桁あふれの源である第3の命令をより広いベースに変換するために
、プログラム命令を使用するように形成された少なくとも1つのプロセッサを含
む。
DISCLOSURE OF THE INVENTION A method of arithmetic expression optimization includes receiving a first instruction formed for a first processor having a first base and including an operator and at least one operand. , For all processors with no potential overflow, or if the operator is not sensitive to overflow, for a second processor with a second base smaller than the first base. Converting the first instruction to an optimized second instruction, and if at least one operand is potential overflow and the operator is sensitive to overflow It includes converting the third source of overflow to a wider base. An arithmetic optimization device receives at least one memory having a program instruction and a first instruction formed to a first processor having a first base, and at least one of the at least one operand. Is not associated with a potential overflow, or if the operator is not sensitive to overflow, then the first instruction has a second base with a second base smaller than the first base.
To a second instruction optimized for other processors, if at least one operand is potentially overflow and the operator is sensitive to overflow. At least one processor configured to use the program instructions to translate the third instruction, which is the source of

【0015】 (発明を実施するための最良の形態) 当業者は、本発明の以下の記述が単に例示的であることを理解するであろうし
、本発明の開示の恩恵を受けるような当業者に対しては、本発明の他の実施形態
が容易に示唆されるであろう。 本発明は、コンピュータシステムに関する。より具体的には、本発明は、nベ
ースタイプの演算式の最適化に関する。本発明は、更に、(1)本発明のレイア
ウトパラメータ、及び/又は、(2)コンピュータ上で演算を実行する際に本発
明を使用するためのプログラム命令、を記憶した機械読取可能媒体に関する。そ
のような媒体には、例として挙げると、磁気テープ、磁気ディスク、CD・RO
Mのような光学的読取可能媒体、及び、PCMCIAカードのような半導体メモ
リが含まれる。この媒体はまた、小さなディスク、ディスケット、又は、カセッ
トのような携帯用品目の形態を取ってもよい。この媒体はまた、ハードディスク
ドライブやコンピュータRAMのようなより大きな又は固定式品目の形態を取っ
てもよい。
BEST MODE FOR CARRYING OUT THE INVENTION Those skilled in the art will appreciate that the following description of the invention is merely exemplary, and would benefit from the disclosure of the invention. For, other embodiments of the invention will be readily suggested. The present invention relates to computer systems. More specifically, the present invention relates to optimization of n-base type arithmetic expressions. The invention further relates to a machine-readable medium having (1) the layout parameters of the invention and / or (2) program instructions for using the invention in performing an operation on a computer. Such media include, by way of example, magnetic tape, magnetic disk, CD / RO.
Optically readable media such as M, and semiconductor memories such as PCMCIA cards are included. The medium may also take the form of a portable item such as a small disk, diskette, or cassette. This medium may also take the form of larger or stationary items such as a hard disk drive or computer RAM.

【0016】 リソース限定型装置は、通常のデスクトップコンピュータなどと比べた場合、
一般的に、メモリ、及び/又は、計算能力又は速度が比較的制限されているもの
であると考えられている。以下で検討する特定の実施例はスマートカードに関し
て説明されるが、本発明は、他のリソース限定型装置と共に使用することができ
、それらには、以下に限定されないが、セルラー電話機、境界用走査装置、野外
用プログラム可能装置、携帯情報端末(PDA)、及び、ポケットベルのほか、
他の小型又は小さな衛星電波使用装置が含まれる。本発明はまた、非リソース限
定型装置上でも使用することができる。 本発明を開示する目的上、「プロセッサ」という用語は、物理的なコンピュー
タ又は仮想計算機を意味するように用いられる場合がある。
Resource-limited devices, when compared to ordinary desktop computers,
It is generally considered to be a relatively limited memory and / or computing power or speed. Although the particular embodiments discussed below are described with respect to smart cards, the present invention can be used with other resource-limited devices, including, but not limited to, cellular telephones, border scanning. Devices, outdoor programmable devices, personal digital assistants (PDAs), and pagers,
Other small or small satellite radio devices are included. The present invention can also be used on non-resource limited devices. For the purposes of disclosing the present invention, the term "processor" may be used to mean a physical computer or virtual machine.

【0017】 ここで図4Aを参照すると、本発明の一実施形態に従ってリソース限定型計算
機上で実行するための演算式を変換する段階を説明するブロック図が示されてい
る。コンパイラは、高級言語62で書かれた演算式60を取り、そのオペランド
をより大きな整数タイプに拡大し、一般的なデスクトップ計算機66上で実行す
るためのより大きなベースタイプの命令64を作り出す。このより大きなベース
タイプ命令64は、リソース限定型計算機70上で実行するための意味論的に同
等なより小さなベースタイプ命令68に最適化される。例えば、shortタイ
プの加算命令は、shortタイプのオペランドに対して演算するのに使用され
、その結果は、タイプshortである。
Referring now to FIG. 4A, there is shown a block diagram illustrating the steps of transforming an arithmetic expression for execution on a resource limited computer according to one embodiment of the invention. The compiler takes an arithmetic expression 60 written in a high level language 62, expands its operands into larger integer types, and produces larger base type instructions 64 for execution on a typical desktop computer 66. This larger base type instruction 64 is optimized into a semantically equivalent smaller base type instruction 68 for execution on resource limited computer 70. For example, a short type add instruction is used to operate on a short type operand and the result is of type short.

【0018】 本発明の別の実施形態によると、意味論的に同等なより小さなベースタイプ命
令への最適化は、ジャスト・イン・タイム・コード発生装置の一部である。命令
セットが初めて実行される少し前に、最適化されていない命令は、リソース限定
型計算機上で実行するための意味論的に同等なより小さなベースタイプ命令に最
適化される。同じ命令セットのその後の実行は、その最適化された命令セットを
使用する。 本発明の別の実施形態によると、算術命令の意味を保存するためにより大きな
タイプ命令64が必要であり、かつ、より大きなタイプ命令が目標とするプロセ
ッサによってサポートされていない場合、その演算式は、サポートされていない
として拒絶される。
According to another embodiment of the invention, optimization to semantically equivalent smaller base type instructions is part of the just-in-time code generator. Shortly before the instruction set is first executed, the non-optimized instructions are optimized into smaller, semantically equivalent base type instructions for execution on a resource limited computer. Subsequent executions of the same instruction set will use that optimized instruction set. According to another embodiment of the invention, if a larger typed instruction 64 is needed to preserve the meaning of an arithmetic instruction, and the larger typed instruction is not supported by the targeted processor, the expression is , Rejected as unsupported.

【0019】 ここで図4Bを参照すると、本発明の一実施形態による命令を変換する段階を
説明するブロック図が示されている。32ビットオペランドを有する命令を含む
Java(登録商標)の部類のファイル72は、「Java Card(登録商
標)」の部類のファイル変換器74によって受け取られる。この変換器74は、
リソース限定型装置上で実行するために最適化された命令76を発生する。この
最適化は、例として挙げると、より少ないスタック使用量、より小さなプログラ
ムサイズ、及び、より高速の実行を準備する段階を含む。
Referring now to FIG. 4B, there is shown a block diagram illustrating the steps of translating instructions in accordance with one embodiment of the present invention. A Java class file 72 containing instructions with 32-bit operands is received by a "Java Card" class file converter 74. This converter 74
Generate instructions 76 optimized for execution on a resource limited device. This optimization includes, by way of example, preparing for less stack usage, smaller program size, and faster execution.

【0020】 目標とする計算機は、nタイプの算術演算をサポートするであろう。「Jav
a(登録商標)仮想計算機」は、タイプint演算子をサポートするが、「Ja
va Card(登録商標)仮想計算機」は、タイプshort演算子をサポー
トし、オプションでタイプint演算子をサポートする。他の装置は、byte
タイプの算術演算子のみ、又は、byte、short、及び、intタイプの
演算の全てをサポートしてもよい。一般的に、8ビット又は16ビットプロセッ
サ上で16ビットの算術を実行するために比較的少ない時間を要し、同じプロセ
ッサ上で32ビットの算術を実行するためには、比較的多くの時間が必要である
The target calculator will support n types of arithmetic operations. "Jav
"a (registered trademark) virtual machine" supports the type int operator, but "Ja
The "va Card virtual machine" supports a type short operator and optionally a type int operator. Other devices are byte
Only type arithmetic operators may be supported, or all byte, short, and int type operations may be supported. Generally, it takes a relatively small amount of time to perform 16-bit arithmetic on an 8-bit or 16-bit processor, and a relatively large amount of time to perform 32-bit arithmetic on the same processor. is necessary.

【0021】 算術演算に使用される実際の値は最適化時には未知であるから、最適化は、各
オペランドに対して最悪の場合の値を仮定する必要がある。オペランドに対する
最悪の場合の値は、入力オペランドタイプに基づいて判断される。小さいタイプ
の演算は、大きいタイプの表示又はより大きなタイプへの桁あふれを必要とする
結果を有する可能性がある。すなわち、本発明によると、算術演算子は、桁あふ
れによって影響される演算子と桁あふれを引き起こす可能性を有する演算子とに
分類される。本発明を開示する目的上、桁あふれは、負の値の下位桁あふれを含
む。小さいタイプの演算の結果は、その結果を作り出すのに用いられた演算子が
大きいタイプの表示への桁あふれを引き起こす可能性を有する演算子のグループ
に属する場合、潜在的桁あふれを伴うと言われる。中間的な値は、その中間的な
値が桁あふれに影響される演算子のグループに属する演算子のためのオペランド
として使用されない限り、潜在的桁あふれを伴うことを許される。
Since the actual values used for arithmetic operations are unknown during optimization, the optimization must assume the worst case value for each operand. The worst case value for the operand is determined based on the input operand type. Small type operations may have consequences that require large type representations or overflows to larger types. That is, according to the present invention, arithmetic operators are classified into operators that are affected by overflow and operators that can cause overflow. For purposes of disclosing the present invention, overflow includes negative value sub-overflow. It is said that the result of a small type operation involves a potential overflow if the operator used to produce the result belongs to a group of operators that can cause overflow to the large type display. Be seen. Intermediate values are allowed to carry a potential overflow, unless the intermediate value is used as an operand for an operator belonging to a group of operators affected by overflow.

【0022】 桁あふれを引き起こす可能性を有する演算子は、加算、引き算、乗算、割り算
、ネゲート、及び、左側桁送りを含む。これらの演算子に対するJava(登録
商標)バイトコードは、表1に示されている。
Operators that can cause overflow include add, subtract, multiply, divide, negate, and left shift. The Java bytecodes for these operators are shown in Table 1.

【0023】 (表1)潜在的桁あふれを伴う演算 (Table 1) Operations involving potential overflow

【0024】 桁あふれに影響される演算子は、表2に示されている。桁あふれに影響される
算術演算子は、割り算、剰余、ネゲート、右側桁送り、及び、符号なしの右側桁
送りを含む。また、桁あふれに影響される非算術演算子は、アレー演算、スイッ
チ演算、及び、比較演算を含む。
The operators that are affected by overflow are shown in Table 2. The arithmetic operators affected by carry over include divide, remainder, negate, right shift, and unsigned right shift. The non-arithmetic operators affected by the overflow include array operation, switch operation, and comparison operation.

【0025】 (表2)桁あふれに影響される演算 (Table 2) Operations affected by overflow

【0026】 表1の演算をより小さなタイプに最適化する時、結果は、より大きなタイプの
中に桁あふれする場合がある。表2の演算子のうちの1つを用いる表現の結果は
、表現中のオペランドのうちの1つが中間的な値であり、潜在的な桁あふれデー
タを含む場合、精度を失うであろう。最適化を可能にし、高級ソースコードの意
味を保存するために、潜在的桁あふれは、結果が表2の演算のうちの1つに入力
される場合、その結果のタイプに対する明白なソースレベルの型を用いて是正す
る必要がある。
When optimizing the operations in Table 1 for smaller types, the results may overflow into larger types. The result of an expression using one of the operators in Table 2 will lose precision if one of the operands in the expression is an intermediate value and contains potential overflow data. In order to enable optimization and preserve the meaning of the high-level source code, potential overflow causes an explicit source-level effect on the type of result when it is entered into one of the operations in Table 2. It is necessary to correct it using the pattern.

【0027】 表2の演算のいずれかに対する入力オペランドが表1の演算の結果であり、明
白な高級ソースコードの型がない場合、最適化は起こることができない。そのよ
うな誤った最適化は、意味論的に同等な結果を保証しないであろう。換言すれば
、リソース限定型装置上で実行するために発生された最適化コードは、結果をデ
スクトップコンピュータ用に発生された最適化なしのコードとは異なるようにす
ることができるであろう。例えば、桁あふれデータは、オペランドのJava(
登録商標)32ビット表示で与えることができるが、「Java Card(登
録商標)」16ビット表示ではできないであろう。
If the input operand to any of the operations in Table 2 is the result of the operation in Table 1 and there is no explicit high-level source code type, then optimization cannot occur. Such a false optimization would not guarantee semantically equivalent results. In other words, the optimized code generated to run on a resource limited device could have different results than the non-optimized code generated for a desktop computer. For example, overflow data can be stored in the operand Java (
It can be provided in a registered trademark) 32-bit representation, but not in a "Java Card (R)" 16-bit representation.

【0028】 表1に列挙された演算子を用いる演算の結果は、より小さなタイプを有する演
算子が適用された場合、桁あふれを生じる場合がある。デスクトップコンピュー
タ・プラットフォームを目標とする命令をリソース限定型コンピュータ・プラッ
トフォームを目標とする命令に最適化する段階に付随するこれらの問題の例は、
図5A〜図8Bに与えられている。これらの例は、デスクトップコンピュータが
32ビットアーキテクチャに基づいており、比較的メモリが豊富であることを仮
定している。リソース限定型コンピュータは、比較的少ないメモリを有する16
ビットアーキテクチャに基づくと仮定されている。当業者は、本発明が様々なア
ーキテクチャを有する演算プラットフォームに適用されることを認めるであろう
。 図5A〜図8Bはまた、符号を有する値を使用する。当業者はまた、値の符号
の有無に関わらず桁あふれが起こり得ることを認めるであろう。
The results of operations using the operators listed in Table 1 may result in overflow when operators with smaller types are applied. Examples of these problems associated with optimizing instructions targeted for desktop computer platforms to those targeted for resource limited computer platforms are:
Given in FIGS. 5A-8B. These examples assume that the desktop computer is based on a 32-bit architecture and is relatively memory rich. Resource limited computers have relatively little memory 16
It is assumed to be based on bit architecture. Those skilled in the art will recognize that the present invention applies to computing platforms with various architectures. 5A-8B also use values with signs. Those skilled in the art will also recognize that overflow can occur with or without the sign of the value.

【0029】 ここで図5Aを参照すると、デスクトップコンピュータ上での2つのタイプs
hortの値の加算を説明するコード見本が示されている。値「a」は、16ビ
ットの符号付きshortタイプで表すことができる最大値を含む。上記の通り
、たとえ値が16ビットshortの値であっても、intタイプの加算が用い
られる。すなわち、16ビット範囲から32ビット範囲への桁あふれが結果の値
の中に存在し、桁あふれの効果は、より大きな正の32ビット数を作り出すこと
である。
Referring now to FIG. 5A, two types s on a desktop computer
A code sample illustrating the addition of the value of hort is shown. The value "a" contains the maximum value that can be represented in a 16-bit signed short type. As described above, int type addition is used even if the value is a 16-bit short value. That is, there is an overflow in the resulting value from the 16-bit range to the 32-bit range, and the effect of the overflow is to produce a larger positive 32-bit number.

【0030】 ここで図5Bを参照すると、リソース限定型コンピュータ上で図5Aにおける
のと同じ値を加算する段階を説明するコード見本が示されている。実行は、リソ
ース限定型コンピュータ上で行われており、両方の値が16ビットshortタ
イプであるから、命令はshortタイプの加算を用いて最適化され、従ってよ
り少ないスタック空間を使用する。しかし、32ビット加算の代わりに16ビッ
ト加算が用いられるために、加算は符号ビットに桁あふれを引き起こす。デスク
トップコンピュータは、32、768という値を計算したのに対し、リソース限
定型コンピュータの例で計算された結果は、−32、768という負の数である
。この結果は、それがデスクトップコンピュータの結果と異なり、多様なコンピ
ュータ・プラットフォームに亘る相互運用性を妨げる理由から、受け入れられな
いものである。
Referring now to FIG. 5B, a code sample illustrating the steps of adding the same values as in FIG. 5A on a resource limited computer is shown. Since the execution is on a resource limited computer and both values are 16-bit short type, the instructions are optimized with short type additions and thus use less stack space. However, because 16-bit addition is used instead of 32-bit addition, the addition causes a sign bit overflow. The desktop computer calculated the value 32,768, while the result calculated on the resource limited computer example is a negative number -32,768. This result is unacceptable because, unlike the results for desktop computers, it interferes with interoperability across diverse computer platforms.

【0031】 ここで図6Aを参照すると、2つのタイプshortの値の加算とその結果を
直ちに型に入れる段階とを説明するコード見本が示されている。この例は、加算
結果がタイプshortに型入れされる点を除いて、図5Aのものと同じである
。タイプをshortに型入れする段階は、最も有意な16ビットをshort
値に切り落とし、符号が32ビット値に広がる。潜在的に桁あふれを伴う演算(
add演算)の結果は、タイプshortに型入れされ、それによっていかなる
潜在的桁あふれの問題も排除する。図6Bは、リソース限定型コンピュータ上で
16ビット値として表された、図6Aにおけるのと同じ値を加算する段階を示す
。デスクトップコンピュータ及びリソース限定型コンピュータの両方に対する結
果の値は同じである。
Referring now to FIG. 6A, a code sample illustrating the addition of the values of two type shorts and the step of immediately putting the result into the type is shown. This example is similar to that of FIG. 5A, except that the result of the addition is typed into type short. Type the type into short, the most significant 16 bits are short
Rounded down to a value and the code spreads to a 32-bit value. Operations (potentially overflow)
The result of the add operation) is typed into type short, thereby eliminating any potential overflow problem. FIG. 6B illustrates adding the same values as in FIG. 6A, represented as 16-bit values on a resource limited computer. The resulting values for both desktop and resource limited computers are the same.

【0032】 ここで図7Aを参照すると、デスクトップコンピュータ上での3つのタイプs
hortの値の加算を説明するコード見本が示されている。この例においては、
intタイプの加算が、16ビットshort値「a」及び「b」を加え、その
結果を「c」に加えるために用いられている。最終結果は、shortタイプに
型入れされる。 ここで図7Bを参照すると、リソース限定型コンピュータ上に潜在的に桁あふ
れを伴う演算によって引き起こされたオペランドの桁あふれに影響されない演算
を実行する段階を説明するコード見本が示されている。この例の全ての値は16
ビットのshortタイプであるから、全ての中間的な加算に対してshort
タイプの加算が用いられる。表1に示す通り、加算演算子は、潜在的に桁あふれ
を引き起こすが、桁あふれに影響されない。すなわち、「a」と「b」を加える
ことは、潜在的に桁あふれを伴う値を作り出す。この値が「c」に加えられ、潜
在的に桁あふれを伴う別の値を作り出す。第2のadd演算は、潜在的に桁あふ
れ(a+bの結果)を伴う1つのオペランドを含むが、add演算は、桁あふれ
を伴うオペランドに影響されない。最終結果は、タイプshortに型入れされ
、加算演算から潜在的な桁あふれを取り除く。すなわち、デスクトップコンピュ
ータ及びリソース限定型コンピュータの両方に対する結果の値は同じである。
Referring now to FIG. 7A, three types s on a desktop computer
A code sample illustrating the addition of the value of hort is shown. In this example,
An int type addition is used to add the 16-bit short values “a” and “b” and the result to “c”. The final result is typed into the short type. Referring now to FIG. 7B, a code sample illustrating the steps for performing an operand overflow-insensitive operation caused by a potentially overflow operation on a resource limited computer is shown. All values in this example are 16
Since it is a bit short type, it is short for all intermediate additions.
Type of addition is used. As shown in Table 1, the addition operator potentially causes overflow, but is not affected by overflow. That is, adding "a" and "b" creates a value with potentially overflow. This value is added to "c" to create another value, potentially with overflow. The second add operation potentially contains one operand with overflow (the result of a + b), but the add operation is unaffected by the operand with overflow. The final result is typed into type short to remove potential overflow from the add operation. That is, the resulting values for both the desktop computer and the resource limited computer are the same.

【0033】 ここで図8Aを参照すると、デスクトップコンピュータ上での2つのタイプs
hortの値の加算とその結果をタイプshortの値で割り算する段階とを説
明するコード見本が示されている。実行はデスクトップコンピュータ上で行われ
ているので、intタイプの演算が用いられる。「a」及び「b」の値がint
タイプのaddを用いて互いに加えられ、この中間的な値は、「c]で割り算さ
れる。 ここで図8Bを参照すると、リソース限定型コンピュータ上で潜在的に桁あふ
れを伴う演算によって引き起こされたオペランドの桁あふれに影響される演算を
実行する段階を説明するコード見本が示されている。実行はリソース限定型コン
ピュータ上で行われているので、shortタイプの演算が用いられる。「a」
及び「b」の値は、shortタイプのaddを用いて互いに加えられる。この
加算は、16ビット範囲から桁あふれする中間的な値を作り出す。この中間的な
値は、「c」で割り算される。図7Bで用いられた加算演算子と異なり、割り算
演算子は、表2に示す通り桁あふれに影響される。高いビットに値が入っている
ので、この16ビット値は、負であると見なされる。すなわち、デスクトップコ
ンピュータ及びリソース限定型コンピュータの例は、図6A〜図7Bにおけるよ
うなプログラムで表されたタイプ変換で訂正されていない、異なる結果をもたら
す。
Referring now to FIG. 8A, two types s on a desktop computer
A code sample is shown that illustrates the addition of the value of hort and the division of the result by the value of type short. Since the execution is performed on the desktop computer, the int type operation is used. The values of "a" and "b" are int
These intermediate values are added together using type add and are divided by "c]. Referring now to Figure 8B, caused by a potentially overflowing operation on a resource limited computer. A code sample illustrating the steps of performing an operation that is sensitive to operand overflow is shown.Since execution is on a resource limited computer, a short type operation is used.
And the values of "b" are added to each other using a short type add. This addition produces an intermediate value that overflows the 16-bit range. This intermediate value is divided by "c". Unlike the addition operator used in FIG. 7B, the division operator is sensitive to overflow, as shown in Table 2. This 16-bit value is considered negative because the high bits contain the value. That is, the desktop and resource limited computer examples give different results, uncorrected by the type conversions represented by the programs as in FIGS. 6A-7B.

【0034】 本発明によると、演算式は、オペランドのタイプに応じて最適であるタイプの
命令を用いて最適化される。最適化処理は、潜在的桁あふれの問題に遭遇するま
で進行される。その時点で、演算式の入力オペランドに立ち戻り、それを次のよ
り大きなタイプ命令に変換する。この処理は、演算式が最適化された命令セット
を用いてデスクトップコンピュータとリソース限定型装置とで同じ結果を示すよ
うな、命令の適切なタイプが選択されるまで繰り返される。
According to the present invention, the arithmetic expression is optimized using the type of instruction that is optimal depending on the type of operand. The optimization process proceeds until a potential overflow problem is encountered. At that point, we return to the input operand of the arithmetic expression and convert it to the next larger typed instruction. This process is repeated until the appropriate type of instruction is selected such that the arithmetic expression uses the optimized instruction set to produce the same result on the desktop computer and the resource limited device.

【0035】 変換処理の間は、いくつかの関係が維持される。これらの関係は、命令と、そ
の命令を目標とする計算機上で実行する時に生じることになる値とに関する。関
係データには、値に対する実際のタイプ及びターゲットタイプが含まれる。関係
データはまた、命令が目標とする計算機上で一旦実行されると目標とする計算機
上で値を生み出すことになるソース命令を含む。各命令はまた、そのオペランド
関係データにリンクされる。更に、結果に関する関係データは、その結果を消費
する命令にリンクされる。各関係データはまた、命令が目標とする計算機上で実
行された場合に潜在的桁あふれを生じることになる命令(もしあれば)にリンク
される。この命令は、ロールバックポイントと呼ばれる。潜在的桁あふれを伴う
値が桁あふれに敏感な演算子によって消費された場合、誤った最終結果が生み出
されることがあるので、生み出されることになる値の各々を桁あふれを引き起こ
した命令とリンクさせることは、変換処理を先に進めることができない時に桁あ
ふれ問題を引き起こした命令にロールバックする方法を与える。
Some relationships are maintained during the conversion process. These relationships relate to instructions and the values that will occur when the instructions execute on the targeted computer. The relational data includes the actual type and target type for the value. Relational data also includes source instructions that, once executed on the target computer, will produce a value on the target computer. Each instruction is also linked to its operand-related data. Furthermore, the relevant data about the result is linked to the instruction that consumes the result. Each relational data is also linked to the instruction (if any) that would result in a potential overflow if the instruction were executed on the target computer. This instruction is called the rollback point. Linking each of the values that is to be produced with the instruction that caused the overflow, as erroneous end results can be produced if a value with a potential overflow is consumed by an overflow-sensitive operator. This gives a way to roll back to the instruction that caused the overflow problem when the conversion process cannot proceed.

【0036】 中間的な値は、後続の命令においてオペランドとして更に消費することができ
る。中間的な値が潜在的に桁あふれを伴う場合、ロールバック命令もまた、結果
内を伝達される。これは、表現を変換する過程で繰り返される。このロールバッ
ク作用は、常に中間的な値(又は、オペランド)に作用し、再変換が必要とされ
る命令までロールバックする。ロールバック命令を判断する方法及び最適化の他
の詳細は、以下で検討される。
Intermediate values can be further consumed as operands in subsequent instructions. Rollback instructions are also propagated in the result if the intermediate value potentially carries overflow. This is repeated in the process of transforming the representation. This rollback action always works on intermediate values (or operands) and rolls back to the instruction at which retranslation is required. Other details of how to determine the rollback instruction and optimization are discussed below.

【0037】 ここで図9を参照すると、本発明の一実施形態によるnベースタイプの演算式
最適化を説明する流れ図が示されている。参照番号80で、変換される命令が受
け取られる。参照番号82で、入力オペランドのいずれかが潜在的桁あふれを伴
うか否かに関して判断が為される。少なくとも1つのオペランドが潜在的桁あふ
れを伴う場合、変換される命令が桁あふれに敏感であるか否かに関する判断が参
照番号84で為される。これらに関するJava(登録商標)バイトコードが表
2に列挙されている。当業者は、桁あふれに影響される演算子のリストが異なる
高級言語に関して変動し得ること、及び、本発明がこれらの他の言語にも同様に
適用し得ることを認めるであろう。
Referring now to FIG. 9, there is shown a flow diagram illustrating n-base type arithmetic expression optimization according to one embodiment of the present invention. At reference numeral 80, an instruction to be translated is received. At reference numeral 82, a determination is made as to whether any of the input operands carry a potential overflow. If at least one operand has a potential overflow, then a determination is made at reference numeral 84 as to whether the instruction being translated is sensitive to overflow. The Java bytecodes for these are listed in Table 2. Those skilled in the art will appreciate that the list of operators affected by overflow can vary for different high level languages, and the invention can be applied to these other languages as well.

【0038】 変換される命令が桁あふれに敏感である場合、変換処理は、参照番号86にお
いて問題の源である命令にロールバックされ、その命令は、より広いベースを有
するタイプを用いて変換される。例えば、8ビットのバイトタイプは、16ビッ
トのワードタイプに拡大され、16ビットのワードタイプは、32ビットのワー
ドタイプに拡大されるであろう。オペランドをより大きなタイプに拡大すること
により、オペランドのその後の命令変換がより大きなタイプに結合された命令を
使用することが必要になる。
If the instruction to be converted is overflow sensitive, the conversion process is rolled back to the instruction that is the source of the problem at reference numeral 86, and the instruction is converted using the type with the wider base. It For example, an 8-bit byte type would be expanded to a 16-bit word type, and a 16-bit word type would be expanded to a 32-bit word type. Extending an operand to a larger type requires subsequent instruction conversion of the operand to use an instruction that is bound to the larger type.

【0039】 変換される命令が桁あふれに敏感でない場合、又は、どの入力オペランドも潜
在的桁あふれを伴わない場合、その命令は、参照番号88で、リソース限定型装
置上での実行に対して最も最適なタイプに変換される。参照番号90で、変換さ
れる命令がまだ残っているか否かに関する判断が為される。更なる命令が残って
いる場合、参照番号80で次の命令の変換が始まる。最後の命令が変換されると
、参照番号92で変換処理が終了する。
If the instruction to be translated is not overflow sensitive, or if no input operand has a potential overflow, the instruction is referenced 88 for execution on the resource limited device. Converted to the most optimal type. At reference numeral 90, a determination is made as to whether there are more instructions to be translated. If more instructions remain, the conversion of the next instruction begins at reference numeral 80. When the last instruction is converted, the conversion process ends at reference numeral 92.

【0040】 ここで図10を参照すると、本発明の一実施形態によるnベースタイプの演算
式最適化を説明する詳細な流れ図が示されている。参照番号100で、変換が完
了していないという指示が作られる。参照番号102で、第1の命令の変換を実
行すべきであるという指示が作られる。参照番号104で、命令変換が完了した
か否かが判断される。命令変換が完了した場合、実行は参照番号106で終了す
る。変換が完了していない場合、変換が完了したという指示が参照番号108で
作られる。参照番号110で、第1の命令が得られる。参照番号112で、その
命令が変換されるべきか否かの判断が為される。
Referring now to FIG. 10, there is shown a detailed flow chart illustrating n-base type arithmetic expression optimization according to one embodiment of the present invention. At reference numeral 100, an indication is made that the conversion is not complete. At reference numeral 102, an indication is made that a translation of the first instruction should be performed. At reference numeral 104, it is determined whether the instruction conversion is complete. If the instruction conversion is complete, execution ends at reference numeral 106. If the conversion is not complete, an indication that the conversion is complete is made at reference numeral 108. At reference numeral 110, a first instruction is obtained. At reference numeral 112, a determination is made whether the instruction should be translated.

【0041】 命令を変換する必要がある場合、変換が未完了であるという指示、及び、現在
の命令を再度変換すべきではないという指示が、参照番号114及び116で各
々作られる。参照番号118で、命令は、より小さなベースタイプを有する、目
標とする計算機のために最適化された別の命令に変換される。参照番号120で
、ロールバックが参照番号118における変換によってトリガされたか否かに関
する判断が為される。ロールバックがトリガされていた場合、ロールバックポイ
ントでの命令が参照番号122で得られ、ロールバックポイントでの命令の変換
が参照番号104で再度開始される。ロールバックがトリガされない場合、結果
のタイプ及びターゲットタイプが参照番号124で照合される。参照番号126
で、変換情報は、各制御経路の後続命令に伝達される。 参照番号128で、更なる命令が残っているか否かに関する判断が為される。
更なる命令が残っている場合、次の命令が参照番号130で取得され、参照番号
112で実行が継続される。変換処理は、最後の命令が変換されると終了する。
If the instruction needs to be translated, an indication that the translation is incomplete and an indication that the current instruction should not be translated is made at reference numerals 114 and 116, respectively. At reference numeral 118, the instruction is translated into another instruction having a smaller base type and optimized for the target computer. At reference numeral 120, a determination is made as to whether rollback was triggered by the conversion at reference numeral 118. If a rollback has been triggered, the instruction at the rollback point is obtained at reference numeral 122 and the translation of the instruction at the rollback point is restarted at reference numeral 104. If no rollback is triggered, the result type and target type are matched at reference numeral 124. Reference number 126
Then, the conversion information is transmitted to the subsequent instruction of each control path. At reference numeral 128, a determination is made as to whether more instructions remain.
If there are more instructions remaining, the next instruction is obtained at reference numeral 130 and execution continues at reference numeral 112. The conversion process ends when the last instruction is converted.

【0042】 ここで図11を参照すると、本発明の一実施形態による命令を変換する段階を
説明する流れ図が示されている。参照番号140で、現在の命令が算術命令か否
かが判断される。命令が算術命令である場合、それは、参照番号142で変換さ
れる。同様に、スタック操作命令、ターゲット命令、タイプ変換命令、及び、初
期値変換命令は、参照番号146、150、154、及び、158で各々変換さ
れる。命令が図11の算術命令、スタック操作命令、タイプ変換命令、又は、初
期値命令か否かによる命令の分類は、単に例示的な目的で示されている。当業者
は、本発明が他の多くの命令の種類又は分類に対しても同様に適用し得ることを
認めるであろう。
Referring now to FIG. 11, a flowchart illustrating the steps of translating instructions according to one embodiment of the present invention is shown. At reference numeral 140, it is determined whether the current instruction is an arithmetic instruction. If the instruction is an arithmetic instruction, it is translated at reference numeral 142. Similarly, the stack manipulation instruction, the target instruction, the type conversion instruction, and the initial value conversion instruction are converted by reference numerals 146, 150, 154, and 158, respectively. Classification of instructions depending on whether the instruction is an arithmetic instruction, a stack manipulation instruction, a type conversion instruction, or an initial value instruction in FIG. 11 is shown for illustrative purposes only. Those skilled in the art will appreciate that the present invention is applicable to many other instruction types or classifications as well.

【0043】 ここで図12Aを参照すると、本発明の一実施形態によるターゲット命令を変
換する方法を説明する流れ図が示されている。「Java(登録商標)仮想計算
機」命令セットにおいては、ターゲット命令は、分岐、スイッチ、アレーアクセ
ス、アレー作成、及び、様々な記憶/保管命令(store/put命令)を含
むほか、スタック操作命令、タイプ変換命令、初期値命令、又は、演算式ではな
い、コンピュータ言語におけるタイプに敏感な他のいかなる非算術命令をも含む
Referring now to FIG. 12A, there is shown a flow chart illustrating a method of translating a target instruction according to one embodiment of the present invention. In the “Java (registered trademark) virtual machine” instruction set, the target instructions include branch, switch, array access, array creation, and various storage / save instructions (store / put instructions), stack operation instructions, It includes type conversion instructions, initial value instructions, or any other type-sensitive non-arithmetic instructions in computer languages that are not arithmetic expressions.

【0044】 参照番号160で、命令オペランドに対するターゲットタイプが判断される。
参照番号162で、ターゲット命令が消費するオペランドがそのターゲット命令
のターゲットタイプよりも小さいタイプを有するか否かに関する判断が為される
。そのオペランドが目標とするものよりも小さなタイプを有する場合、変換処理
は、参照番号164で、その小さなタイプのオペランドを用いてロールバックさ
れる。オペランドが目標とするものよりも小さなタイプを持たない場合、そのオ
ペランドが潜在的桁あふれを伴うか否かに関する判断が参照番号166で為され
る。オペランドは、それが表1に記載されたオペランドのうちの1つで作り出さ
れたか、又は、オペランド内で桁あふれを伝達する演算子によって作り出された
場合、潜在的桁あふれを伴うことがある。桁あふれを伝達する演算子には、例と
して挙げると、「and」、「or」、及び、排他的「or」(xor)演算子
が含まれる。どのオペランドも潜在的桁あふれを伴わない場合、命令は、参照番
号167で最適化される。オペランドの少なくとも1つが潜在的に桁あふれを伴
っている場合、変換処理は、参照番号164で、より小さなオペランドを用いて
ロールバックされる。
At reference numeral 160, the target type for the instruction operand is determined.
At reference numeral 162, a determination is made as to whether the operand consumed by the target instruction has a type less than the target type of the target instruction. If the operand has a smaller type than the target, the conversion process is rolled back at reference numeral 164 with the smaller type operand. If the operand does not have a smaller type than the target, then a determination is made at reference numeral 166 as to whether the operand has a potential overflow. An operand may have a potential overflow if it was created by one of the operands listed in Table 1 or by an operator that propagates the overflow within the operand. Operators that propagate overflow include, by way of example, "and", "or", and exclusive "or" (xor) operators. If none of the operands have a potential overflow, the instruction is optimized at reference numeral 167. If at least one of the operands is potentially overflowed, the conversion process is rolled back at 164 with the smaller operand.

【0045】 ここで図12Bを参照すると、本発明の一実施形態による初期値命令を変換す
る方法を説明する流れ図が示されている。初期値命令の例には、獲得/ロード命
令(get/load命令)、及び、変数をロードする他の命令が含まれる。初
期値命令はまた、方法の結果を戻す、方法呼出し命令を含む。更に、初期値命令
は、ロード定数命令を含む。これらの命令は、命令が生み出す値が中間的な計算
の結果ではないことから、「初期値」命令と呼ばれる。参照番号168で、変数
、戻り値、又は、定数のタイプが受け取られる。参照番号169で、初期値命令
は、変数又は定数のタイプに従って最適化される。例えば、shortタイプの
ローカル変数をロードするために、iload命令はsloadに最適化される
Referring now to FIG. 12B, there is shown a flow chart illustrating a method of converting an initial value instruction according to one embodiment of the present invention. Examples of initial value instructions include get / load instructions (get / load instructions) and other instructions that load variables. Initial value instructions also include method call instructions that return the results of the method. Further, the initial value instruction includes a load constant instruction. These instructions are called "initial value" instructions because the values they produce are not the result of intermediate calculations. At reference numeral 168, a variable, return value, or constant type is received. At reference numeral 169, the initial value instruction is optimized according to the type of variable or constant. For example, to load a short type local variable, the iload instruction is optimized for sload.

【0046】 ここで図13を参照すると、本発明の一実施形態によるタイプ変換命令を変換
する方法を説明する流れ図が示されている。タイプ変換命令は、オペランドをよ
り大きなタイプ又はより小さなタイプに変換してもよい。例えば、32ビットの
intタイプを16ビットのshortタイプに型入れする段階は、オペランド
をより小さなタイプに変換する。同様に、8ビットのbyteタイプを32ビッ
トのintタイプに型入れする段階は、オペランドをより大きなタイプに変換す
る。後者の場合、byteタイプは、オペランドタイプと呼ばれ、intタイプ
は、ターゲットタイプと呼ばれる。
Referring now to FIG. 13, a flowchart illustrating a method of converting type conversion instructions according to one embodiment of the present invention is shown. A type conversion instruction may convert an operand to a larger type or a smaller type. For example, casting a 32-bit int type into a 16-bit short type converts the operand to a smaller type. Similarly, casting an 8-bit byte type into a 32-bit int type converts the operand to a larger type. In the latter case, the byte type is called the operand type and the int type is called the target type.

【0047】 参照番号170で、命令が受け取られる。オペランドタイプ及びターゲットタ
イプは、各々、参照番号172及び174において決められる。オペランドタイ
プがターゲットタイプよりも大きい場合、オペランドタイプは、参照番号178
でターゲットタイプまで狭められる。オペランドタイプがターゲットタイプより
も小さい場合、オペランドが潜在的に桁あふれを伴っているか否かに関する判断
が参照番号180で為される。オペランドが潜在的に桁あふれを伴う場合、変換
処理は、タイプを訂正するために参照番号182でロールバックされる。オペラ
ンドタイプが潜在的桁あふれを伴わない場合、オペランドは、参照番号184で
ターゲットタイプまで広げられる。
At reference numeral 170, an instruction is received. The operand type and target type are determined at reference numerals 172 and 174, respectively. If the operand type is greater than the target type, the operand type is reference number 178.
You can narrow down to the target type. If the operand type is less than the target type, a determination is made at reference numeral 180 as to whether the operand potentially has overflow. If the operand potentially carries overflow, the conversion process is rolled back at reference numeral 182 to correct the type. If the operand type does not involve a potential overflow, the operand is extended to the target type at reference numeral 184.

【0048】 ここで図14を参照すると、本発明の一実施形態によるスタック操作命令を変
換する方法を説明する流れ図が示されている。「Java(登録商標)仮想計算
機」命令セットにおいては、スタック操作命令は、「dup(複製する)」、「
swap(交換する)」、及び、「pop(ポップする)」命令を含む。参照番
号190で、命令が受け取られる。参照番号192で、その命令がdup命令か
否かに関する判断が為される。命令がdup命令である場合、参照番号194で
、元のスタックエントリに対するロールバックポイントが存在するか否かに関す
る判断が為される。元のスタックエントリがロールバックポイントを有する場合
、複製されたスタックエントリのロールバックポイントは、参照番号196で、
元のスタックエントリのロールバックポイントに設定される。元のスタックエン
トリがロールバックポイントを持たない場合、複製されたスタックエントリのロ
ールバックポイントは、参照番号198で、元のスタックエントリのソース命令
に設定される。参照番号200で、命令が変換される。
Referring now to FIG. 14, a flow chart illustrating a method of translating stack manipulation instructions according to one embodiment of the invention is shown. In the “Java (registered trademark) virtual machine” instruction set, the stack operation instructions are “dup (copy)”, “
Includes "swap" and "pop" instructions. At reference numeral 190, an instruction is received. At reference numeral 192, a determination is made as to whether the instruction is a dup instruction. If the instruction is a dup instruction, then at reference numeral 194, a determination is made as to whether there is a rollback point for the original stack entry. If the original stack entry has a rollback point, the rollback point of the duplicated stack entry is at reference numeral 196,
Set to the rollback point of the original stack entry. If the original stack entry has no rollback point, the rollback point of the duplicated stack entry is set at reference numeral 198 to the source instruction of the original stack entry. At reference numeral 200, the instruction is translated.

【0049】 ここで図15を参照すると、本発明の一実施形態による演算式を変換する方法
を説明する流れ図が示されている。参照番号210で、オペランドが潜在的桁あ
ふれを伴っているか否かに関する判断が為される。オペランドが潜在的桁あふれ
を伴わない場合、参照番号212で、オペランドが潜在的桁あふれを持たないと
いう指示が作られる。オペランドが潜在的桁あふれを伴う場合、参照番号214
で、命令が桁あふれに影響されるか否かに関する判断が為される。命令が桁あふ
れに影響されない場合、参照番号216で、オペランドが潜在的桁あふれを有す
るという指示が作られる。命令が桁あふれに影響される場合、この変換は、参照
番号218で、桁あふれを有する第1のオペランドにロールバックされる。変換
がロールバックされない場合、最適化された命令タイプが参照番号220で決め
られ、命令が参照番号222で最適化され、結果のタイプと結果の桁あふれが参
照番号224で判断される。
Referring now to FIG. 15, a flow chart illustrating a method of transforming an arithmetic expression according to one embodiment of the present invention is shown. At reference numeral 210, a determination is made as to whether the operand has a potential overflow. If the operand does not have a potential overflow, reference numeral 212 makes an indication that the operand does not have a potential overflow. Reference number 214 if the operand involves a potential overflow
Then, a decision is made as to whether the instruction is affected by overflow. If the instruction is not affected by overflow, reference numeral 216 makes an indication that the operand has a potential overflow. If the instruction is overflow sensitive, this conversion is rolled back at reference numeral 218 to the first operand with overflow. If the translation is not rolled back, the optimized instruction type is determined at reference numeral 220, the instruction is optimized at reference numeral 222, and the result type and result overflow are determined at reference numeral 224.

【0050】 ここで図16を参照すると、本発明の一実施形態による最適化された命令タイ
プを判断する方法を説明する流れ図が示されている。参照番号230で、少なく
とも1つのオペランドが受け取られる。参照番号232で、目標とする命令タイ
プは、そのオペランドに付随する最も大きいタイプに設定される。参照番号23
4で、オペランドのいずれかが目標とする命令タイプよりも小さいタイプを有す
るか否かに関する判断が為される。少なくとも1つのオペランドが目標とするタ
イプよりも小さいタイプを有する場合、その小さいオペランドは、タイプを訂正
するために参照番号236でロールバックされる。
Referring now to FIG. 16, there is shown a flow chart illustrating a method of determining an optimized instruction type according to one embodiment of the present invention. At reference numeral 230, at least one operand is received. At reference numeral 232, the target instruction type is set to the largest type associated with that operand. Reference number 23
At 4, a determination is made as to whether any of the operands have a type that is less than the target instruction type. If at least one operand has a smaller type than the target type, the smaller operand is rolled back at 236 to correct the type.

【0051】 ここで図17を参照すると、本発明の一実施形態による結果のタイプ及び結果
の桁あふれを判断する方法を説明する流れ図が示されている。参照番号240で
、結果のタイプは、命令タイプに設定される。「Java Card(登録商標
)」の戻された結果タイプ及び桁あふれ指示は、以下の表3から表10にまとめ
られている。これらの表は、命令のタイプによって構成されている。各表は、1
つ又は2つのオペランドのタイプに基づいて、結果タイプと桁あふれ指示とを示
している
Referring now to FIG. 17, there is shown a flow chart illustrating a method of determining result type and result overflow according to one embodiment of the invention. At reference numeral 240, the result type is set to the instruction type. The "Java Card (R)" returned result types and overflow indications are summarized in Tables 3-10 below. These tables are organized by instruction type. Each table has 1
Shows the result type and the overflow indicator based on the type of one or two operands

【0052】 (表3)加算、乗算、及び、引き算 (Table 3) Addition, multiplication and subtraction

【0053】 (表4)割り算 (Table 4) Division

【0054】 (表5)左側桁送り (Table 5) Left shift

【0055】 (表6)右側桁送り (Table 6) Right shift

【0056】 (表7)ネゲート (Table 7) Negate

【0057】 (表8)符号なしの右側桁送り (Table 8) Right shift without code

【0058】 (表9)剰余 (Table 9) Remainder

【0059】 (表10)and、or、及び、xor (Table 10) and, or, and xor

【0060】 図17における「Java Card(登録商標)」の結果タイプ及び桁あふ
れ指示の使用は、単に例証目的のためである。当業者は、本発明が他のタイプを
有する他の高級言語に対しても適用可能であることを認めるであろう。 参照番号244で、結果がより最適化された命令を用いることで生じた桁あふ
れを潜在的に伴うか否かに関する判断が為される。結果が潜在的桁あふれを伴わ
ない場合、参照番号246で、オペランドのいずれかが桁あふれを伝達するか否
かに関する判断が為される。少なくとも1つのオペランドが桁あふれを伝達する
か、又は、結果が潜在的に桁あふれを伴う場合、その結果のロールバックポイン
トが参照番号248で記録され、結果が潜在的桁あふれを有するという指示が参
照番号250で作られる。
The use of “Java Card®” result types and overflow indicators in FIG. 17 is for illustration purposes only. Those skilled in the art will recognize that the present invention is applicable to other high level languages having other types. At reference numeral 244, a determination is made as to whether the result potentially involves overflow due to the use of more optimized instructions. If the result does not involve a potential overflow, then at reference numeral 246, a determination is made as to whether any of the operands convey an overflow. If at least one operand conveys a carry, or if the result is potentially carry, a rollback point for the result is recorded at reference numeral 248, with an indication that the result has a potential carry. Made with reference numeral 250.

【0061】 ここで図18を参照すると、本発明の一実施形態によるロールバックポイント
を記録する方法を説明する流れ図が示されている。参照番号260で、第1のオ
ペランドがそれに付随するロールバックポイントを有するか否かに関する判断が
為される。第1のオペランドがそれに付随するロールバックポイントを有する場
合、現在の命令のロールバックポイントは、参照番号262で、第1のオペラン
ドのロールバックポイントに設定される。第1のオペランドがそれに付随する桁
あふれを持たない場合、参照番号264で、第2のオペランドがそれに付随する
桁あふれを有するか否かに関する判断が為される。第2のオペランドがそれに付
随するロールバックポイントを有する場合、命令のロールバックポイントは、参
照番号266で、第2のオペランドのロールバックポイントに設定される。どち
らのオペランドもそれに付随するロールバックポイントを持たない場合、命令の
ロールバックポイントは、参照番号268で、第1のオペランドに対するソース
命令に設定される。
Referring now to FIG. 18, a flowchart illustrating a method of recording rollback points according to one embodiment of the present invention is shown. At reference numeral 260, a determination is made as to whether the first operand has a rollback point associated with it. If the first operand has a rollback point associated with it, then the rollback point of the current instruction is set at reference numeral 262 to the rollback point of the first operand. If the first operand does not have an overflow associated with it, then at reference numeral 264, a determination is made as to whether the second operand has an overflow associated with it. If the second operand has a rollback point associated with it, the rollback point of the instruction is set at reference numeral 266 to the rollback point of the second operand. If neither operand has a rollback point associated with it, the rollback point of the instruction is set at 268 to the source instruction for the first operand.

【0062】 本発明の特定の実施形態によると、図18に示す通り、「第1のオペランド」
は、第1に作り出されたオペランドを意味する。ロールバックポイントをより古
いオペランドに対するソース命令に設定することは、より古いオペランドに付随
するタイプを訂正することによって、より新しいオペランドがその後に使用する
タイプを訂正し得るので、より新しいオペランドに対する追加のロールバック演
算を実行する必要性を除外するであろう。
According to a particular embodiment of the invention, as shown in FIG. 18, a “first operand”
Means the first created operand. Setting the rollback point on the source instruction for the older operand can correct the type associated with the older operand, thereby correcting the type that the newer operand will subsequently use, thus adding additional space to the newer operand. It would eliminate the need to perform rollback operations.

【0063】 ここで図19を参照すると、本発明の一実施形態による変換処理をロールバッ
クする方法を設定する流れ図が示されている。参照番号270で、現在の命令の
変換が割り込まれる。参照番号272で、オペランドがロールバックポイントを
有するか否かに関する判断が為される。オペランドがロールバックポイントを持
たない場合、ロールバック命令は、参照番号276で、そのオペランドを作り出
したソース命令に設定される。オペランドがロールバックポイントを有する場合
、ロールバック命令は、参照番号274で、その同じロールバックポイントに設
定される。参照番号278で、ロールバック命令の目標とするタイプが広げられ
る。参照番号280で、ロールバック命令を変換すべきであるという指示が作ら
れる。変換処理は、参照番号282において、ロールバック命令で再開される。
参照番号284で、ロールバック命令は、新しい目標とするタイプに従って変換
される。
Referring now to FIG. 19, there is shown a flow chart setting up a method for rolling back a conversion process in accordance with one embodiment of the present invention. At reference numeral 270, the translation of the current instruction is interrupted. At reference numeral 272, a determination is made as to whether the operand has a rollback point. If the operand does not have a rollback point, the rollback instruction is set at 276 to the source instruction that produced the operand. If the operand has a rollback point, the rollback instruction is set to that same rollback point at reference numeral 274. At reference numeral 278, the target type of the rollback instruction is widened. At reference numeral 280, an indication is made that the rollback instruction should be translated. The conversion process is restarted with a rollback instruction at reference numeral 282.
At reference numeral 284, the rollback instruction is translated according to the new target type.

【0064】 ここで図20を参照すると、本発明の一実施形態による命令最適化の結果を伝
達する段階を説明する流れ図が示されている。参照番号290で、後続命令が取
得される。後続命令とは、現在の命令と同じ制御経路にあって、現在の命令の直
ぐ後に発生する命令である。当業者は、1つの命令が多くの制御経路の一部であ
ってもよいことを認めるであろう。 参照番号292で、後続命令が変換処理において以前に訪問されたか否かに関
する判断が為される。後続命令が以前に訪問されていない場合、後続命令に関す
る変換情報は、参照番号294で現在の命令に関する変換情報と等しいように設
定され、参照番号296で後続命令を変換すべきであるという指示が作られる。
変換情報は、現在の変換点におけるランタイム状態を含んでもよい。例えば、ま
だ消費されていない現在又は以前の命令によって、それらの値が作り出される。
これらの値は、制御経路の後続命令に対してオペランドとして使用されることに
なる。各値に対して、タイプ、ソース命令、及び、ロールバックポイントが記録
される。後続命令が以前に訪問されていた場合、後続命令において以前に記録さ
れた変換情報は、参照番号298で現在の変換情報と結合される。参照番号30
0で、結合された情報の中の値が変更されたか否かに関する判断が為される。値
が変更されていた場合、後続命令を変換すべきであるという指示が参照番号29
6で作られる。この処理は、各後続命令に対して繰り返される。
Referring now to FIG. 20, a flowchart illustrating the steps of communicating the results of instruction optimization according to one embodiment of the invention is shown. At reference numeral 290, a subsequent instruction is obtained. A subsequent instruction is an instruction that is in the same control path as the current instruction and that occurs immediately after the current instruction. One of ordinary skill in the art will recognize that a single instruction may be part of many control paths. At reference numeral 292, a determination is made as to whether a subsequent instruction was previously visited in the conversion process. If the subsequent instruction has not been previously visited, the conversion information for the subsequent instruction is set equal to the conversion information for the current instruction at reference numeral 294, and an indication that the subsequent instruction should be converted at reference numeral 296. Made
The conversion information may include run-time state at the current conversion point. For example, current or previous instructions that have not yet been consumed produce their values.
These values will be used as operands for subsequent instructions in the control path. For each value, the type, source instruction, and rollback point are recorded. If the subsequent instruction has been previously visited, the conversion information previously recorded in the subsequent instruction is combined with the current conversion information at reference numeral 298. Reference number 30
At 0, a determination is made as to whether the values in the combined information have changed. If the value has changed, the reference number 29 indicates that the subsequent instruction should be converted.
Made in 6. This process is repeated for each subsequent instruction.

【0065】 ここで図21を参照すると、本発明の一実施形態による異なる制御経路からの
変換情報を結合する段階を説明する流れ図が示されている。参照番号310で、
両方の制御経路の対応する入力が比較される。参照番号312で、対応する入力
のタイプが異なっているか否かに関する判断が為される。タイプが異なる場合、
より小さなタイプを有する入力は、参照番号314でロールバックされる。この
処理は、各オペランドに対して繰り返される。
Referring now to FIG. 21, there is shown a flow diagram illustrating the steps of combining translation information from different control paths according to one embodiment of the present invention. At reference numeral 310,
The corresponding inputs of both control paths are compared. At reference numeral 312, a determination is made as to whether the corresponding input types are different. If the types are different,
Inputs with smaller types are rolled back at reference numeral 314. This process is repeated for each operand.

【0066】 ここで図22Aを参照すると、本発明の一実施形態による命令変換を説明する
ブロック図が示されている。これは、最適化が可能な演算式への本発明の応用法
を示している。図22Aは、値a、b、及び、cをタイプshortとする時の
以下のJava(登録商標)表現に対する変換処理を説明している。 short c=(short)((short)(a+b)/c) この式のJava(登録商標)バイトコードシーケンスは、参照番号316で
示されている。
Referring now to FIG. 22A, a block diagram illustrating instruction conversion according to one embodiment of the present invention is shown. This shows an application method of the present invention to an arithmetic expression that can be optimized. FIG. 22A explains the conversion process for the following Java (registered trademark) representation when the values a, b, and c are of type short. short c = (short) ((short) (a + b) / c) The Java bytecode sequence for this equation is designated by reference numeral 316.

【0067】 命令変換は、iload-a命令で始まる。第1のより小さなタイプに付随す
る命令が、load及びadd命令に対して用いられる。表1に明記した通り、
add命令は潜在的桁あふれを引き起こすが、ソースレベルにおけるタイプsh
ortへの明確な型入れが、桁あふれの可能性を取り除く。div330の命令
は、表2に示す通り、桁あふれに影響される。しかし、明確な型入れのために、
潜在的桁あふれは何も存在しない。従って、より大きなタイプを作り出すために
加算演算に「ロールバック」する必要性は起こらない。 本発明の理解を更に助けるために、上記で検討した例は、図10から図21に
関連して以下で更に詳細に説明される。
Instruction conversion begins with the iload - a instruction. The instructions associated with the first, smaller type are used for load and add instructions. As specified in Table 1,
The add instruction causes a potential overflow, but type sh at the source level
Clear typing in the ort removes the possibility of overflow. Div 330 instructions are sensitive to overflow, as shown in Table 2. However, for clear typing,
There is no potential overflow. Therefore, the need to "roll back" to the add operation to create a larger type does not occur. To further aid the understanding of the present invention, the examples discussed above are described in further detail below in connection with FIGS. 10-21.

【0068】 iload命令は、ソース命令である。参照番号160において、「a」オペ
ランドに対する目標とするタイプはタイプshortである。参照番号162に
おいて、オペランド「a」はタイプshortである。オペランドは、それらが
直接ロードされ、従って、桁あふれを引き起こす演算によって作り出されたので
はないために、参照番号166で潜在的桁あふれを伴わない。従って、参照番号
167でiload命令をsload-a命令に変換するのに、shortの気
味のある命令が使用される。同様に、iload-b命令は、sload-b命令
に変換される。
The iload instruction is a source instruction. At reference numeral 160, the target type for the “a” operand is type short. At reference numeral 162, the operand “a” is of type short. The operands do not carry a potential overflow at reference numeral 166 because they were loaded directly and were therefore not created by the operation that caused the overflow. Therefore, the short instruction is used to convert the iload instruction to the sload - a instruction at reference numeral 167. Similarly, the iload - b instruction is converted into a sload - b instruction.

【0069】 次に、iadd命令が処理される。iaddは桁あふれを引き起こすことがあ
る命令であるから、そのオペランドが潜在的桁あふれを伴うか否かを判断する検
査が参照番号210で行われる。両方のオペランドは、それらが潜在的桁あふれ
を伴わないように、直接ロードされる。従って、最適化された結果タイプは、参
照番号220で判断される。参照番号232で、命令タイプは、最大のオペラン
ドタイプに設定される。この例では、この最大オペランドタイプは、オペランド
「a」及びオペランド「b」の両方がタイプshortであるために、タイプs
hortである。両方のオペランドが命令タイプと同じタイプであるから、参照
番号238で、タイプshortが、命令タイプとして戻される。
Next, the iadd instruction is processed. Because iadd is an instruction that can cause overflow, a check is made at reference numeral 210 to determine if its operands have a potential overflow. Both operands are loaded directly so that they do not have a potential overflow. Therefore, the optimized result type is determined at reference numeral 220. At reference numeral 232, the instruction type is set to the maximum operand type. In this example, this maximum operand type is of type s because both operand "a" and operand "b" are of type short.
It is a hort. At both reference numbers 238, type short is returned as the instruction type because both operands are the same type as the instruction type.

【0070】 次に、参照番号222で、命令が最適化される。命令タイプがタイプshor
tであるから、最適化された命令は、「sadd」である。次に、結果タイプ及
び桁あふれ指示が、参照番号224で判断される。参照番号240で、結果タイ
プは、命令タイプであるタイプshortに設定される。更に、結果が潜在的桁
あふれを有するという指示が表3に従って作られる。結果が潜在的桁あふれを含
むので、(a+b)の結果に対するロールバックポイントは、参照番号248で
記録される。いずれのオペランドもロールバックポイントを持たないので、結果
に対するロールバックポイントは、参照番号268で、オペランド「a」(第1
のオペランド)に対するソース命令に設定される。参照番号250で、結果が潜
在的桁あふれを有するという指示が作られる。
Next, at reference numeral 222, the instruction is optimized. Instruction type is type short
Since it is t, the optimized instruction is "sadd". The result type and overflow indication are then determined at reference numeral 224. At reference numeral 240, the result type is set to the instruction type type short. In addition, an indication that the result has a potential overflow is made according to Table 3. The rollback point for the (a + b) result is recorded at reference numeral 248 because the result contains a potential overflow. Since neither operand has a rollback point, the rollback point for the result is reference numeral 268 and is the operand "a" (first
Operand) of the source instruction. At reference numeral 250, an indication is made that the result has a potential overflow.

【0071】 次に、i2s命令が処理される。このi2s命令は、タイプ変換命令である。
参照番号176で、オペランドタイプ(short)は、ターゲットタイプ(s
hort)と比較される。両方のタイプは同じであるから、参照番号178でタ
イプがタイプshortまで狭められ、潜在的桁あふれを取り除く。 次に、iload-c命令が処理される。値a及びbのように、cはタイプs
hortであり、iload-c命令は、sload-c命令に変換される。次に
、idiv命令が処理される。表2に明記した通り、idivは、桁あふれに影
響されてもよい命令である。「a+b」オペランドは、shortへの明確なソ
ースレベルの型入れのために潜在的桁あふれを伴わず、従って、最適化された割
り算命令タイプは、参照番号232でタイプshortであると判断され、結果
タイプは、参照番号240でタイプshortに設定される。
Next, the i2s instruction is processed. This i2s instruction is a type conversion instruction.
At reference numeral 176, the operand type (short) is the target type (s
hort). Since both types are the same, at 178 the type is narrowed to type short, eliminating potential overflow. Next, the iload - c instruction is processed. Like values a and b, c is of type s
a hort, iload - c instruction, sload - is converted into c instruction. Next, the idiv instruction is processed. As specified in Table 2, idiv is an instruction that may be subject to overflow. The "a + b" operand does not involve a potential overflow due to explicit source level typing into short, so the optimized divide instruction type is determined at reference numeral 232 to be of type short, The result type is set to type short at reference numeral 240.

【0072】 次に、i2s命令が処理される。参照番号176で、オペランドタイプ(sh
ort)は、ターゲットタイプ(short)と比較される。両方のタイプは同
じであるから、このタイプは、参照番号178でタイプshortまで狭められ
、潜在的桁あふれを取り除く。 最後に、istore-c命令が処理される。目標とするタイプがタイプsh
ortであり、オペランドが桁あふれを伴わないから、istore-c命令は
、参照番号167で、sstore-c命令に最適化される。変換されたバイト
コードは、参照番号318で示されている。
Next, the i2s instruction is processed. At reference numeral 176, the operand type (sh
ort) is compared to the target type (short). Since both types are the same, this type is narrowed down to type short at reference numeral 178, eliminating potential overflow. Finally, the store - c instruction is processed. The target type is type sh
an ort, since operands without overflow, istore - c instruction, at reference numeral 167, sstore - are optimized c instruction. The converted bytecode is indicated by reference numeral 318.

【0073】 ここで図22Bを参照すると、本発明の一実施形態による命令変換を説明する
ブロック図が示されている。これは、最適化不可能な演算式への本発明の応用法
を示している。それにもかかわらず、変換されたコードは、未変換コードとの意
味論的同等性を維持している。図22Bは、値a、b、及び、cをタイプsho
rtとする時の以下のJava(登録商標)表現に対する変換処理を説明してい
る。 short c=(short)((a+b)/c) この式に対するJava(登録商標)バイトコードシーケンスは、参照番号3
20で示されている。
Referring now to FIG. 22B, a block diagram illustrating instruction conversion according to one embodiment of the invention is shown. This shows the application of the present invention to non-optimizable arithmetic expressions. Nevertheless, the translated code retains its semantic equivalent to the untranslated code. FIG. 22B shows that values a, b, and c are of type sho
A conversion process for the following Java (registered trademark) expression when rt is described. short c = (short) ((a + b) / c) The Java bytecode sequence for this expression is reference numeral 3.
It is shown at 20.

【0074】 命令変換は、参照番号322で表されたiload-a命令で始まる。第1の
より小さなタイプに付随する命令が、load322及び324とadd326
との命令に対して使用される。表1で明記した通り、add命令326は、桁あ
ふれの可能性を引き起こすが、第2のより大きなタイプの使用を必要としない。
しかし、div330の命令は、桁あふれに影響される。これは、表2で示され
ている。すなわち、桁あふれの問題を引き起こす命令は、訂正されなければなら
ない。この問題は、参照番号322まで「ロールバック」して、オペランド「a
」に対して第2の大きなタイプの命令を使用することによって訂正される。
The instruction conversion begins with the iload - a instruction represented by reference numeral 322. The instructions associated with the first, smaller type are load322 and 324 and add326.
And used for instructions. As specified in Table 1, the add instruction 326 causes a potential overflow, but does not require the use of the second, larger type.
However, the div330 instructions are sensitive to overflow. This is shown in Table 2. That is, the instruction causing the overflow problem must be corrected. This problem is "rolled back" to reference numeral 322 and the operand "a
Is corrected by using a second large type instruction for ".

【0075】 命令変換がオペランド「b」もまたより大きなタイプに変換されるべきである
と判断され、2度目のロールバックを必要とするまで、命令変換は、参照番号3
32で2度目を続行する。命令変換は、次に、オペランド「c」に対する命令が
より大きなタイプの使用を必要とすると命令変換が判断されるまで、参照番号3
34で3度目を続行する。3度目のロールバックが実行され、オペランド「c」
のタイプが訂正されて、変換処理は、参照番号336で4度目の変換処理が続行
された後で完了する。 本発明の理解を更に助けるために、上記で検討した図22Bの例は、図10か
ら図21を参照して以下で更に詳細に説明される。
Until the instruction conversion determines that operand “b” should also be converted to a larger type and requires a second rollback, the instruction conversion is referred to by reference numeral 3.
Continue the second time at 32. The instruction conversion then proceeds to reference numeral 3 until the instruction conversion determines that the instruction for operand "c" requires the use of a larger type.
At 34, continue for the third time. The third rollback is executed and the operand "c"
Is corrected and the conversion process is complete after the fourth conversion process continues at reference numeral 336. To further aid in understanding the invention, the example of FIG. 22B discussed above is described in further detail below with reference to FIGS. 10-21.

【0076】 iload-a命令、iload-b命令、及び、iadd命令の最初の変換は
、前記の例で説明したように進行する。次に、iload-c命令は、参照番号
167で、sload-c命令に変換される。次に、idiv命令が処理される
。表2で明記した通り、idivは、桁あふれに影響され得る命令である。「a
+b」オペランドは、それが「+」演算子によって作り出され、その演算子が表
1で示したように桁あふれを引き起こすことがあるので、桁あふれの可能性とな
る。少なくとも1つのオペランドが桁あふれの可能性となっているので、桁あふ
れを有する第1のオペランドへのロールバックが参照番号218で実行される。
The initial conversion of the iload - a, iload - b, and iadd instructions proceeds as described in the previous example. The iload - c instruction is then converted to a sload - c instruction at reference numeral 167. Next, the idiv instruction is processed. As specified in Table 2, idiv is an instruction that can be affected by overflow. "A
The "+ b" operand is a potential overflow because it is created by the "+" operator, which can cause overflow as shown in Table 1. Since at least one operand has a potential overflow, a rollback to the first operand with an overflow is performed at reference numeral 218.

【0077】 参照番号270で、現在の命令の変換が割り込まれる。参照番号274で、桁
あふれがa+bオペランドと結び付けられ、そのために、ロールバックポイント
は、a+bオペランドに対するロールバックポイントに設定される。参照番号2
78で、ロールバック命令の目標とするタイプは、タイプshortからタイプ
intに広げられる。参照番号280で、ロールバックされる行き先の命令を変
換する指示が作られる。参照番号282で、変換処理は、以前にsload-
命令に変換されたiload-a命令において再開される。このiload-a命
令は、参照番号284で変換される。
At reference numeral 270, the translation of the current instruction is interrupted. At reference numeral 274, a rollover is associated with the a + b operand, so the rollback point is set to the rollback point for the a + b operand. Reference number 2
At 78, the target type of the rollback instruction is expanded from type short to type int. At reference numeral 280, an instruction is made to translate the destination instruction to be rolled back. At reference numeral 282, the conversion process was previously sload - a.
It is restarted at the iload - a instruction converted into an instruction. This iload - a instruction is translated at reference numeral 284.

【0078】 ロールバックの結果として、iload-a命令は、参照番号338で処理さ
れる。参照番号124で、結果のタイプと目標とするタイプとが照合される。結
果のタイプがshortで、目標とするタイプがintであるから、そのタイプ
は一致しない。すなわち、shortをintに上げるために、S2I命令が作
り出される。処理は、iload-b命令及びiadd命令を用いて続行される
。iadd命令に対するオペランドは、参照番号210において潜在的桁あふれ
を伴わず、従って、最適化された結果タイプが参照番号220で判断される。参
照番号234で、オペランドのタイプが比較される。「a」オペランドが今はタ
イプintであり、「b」オペランドがまだタイプshortであるから、「b
」オペランドに対してロールバックが実行される。参照番号276で、ロールバ
ック命令は、iload-b命令340に設定される。また、参照番号278で
、目標とするタイプはintに設定される。参照番号280で、現在の命令を変
換する指示が作られる。参照番号282及び284で、変換がiload-b命
令において再開され、命令が変換される。 参照番号124で、結果のタイプと目標とするタイプとが照合される。結果の
タイプがshortで、目標とするタイプがintであるから、そのタイプは一
致しない。すなわち、shortをintに上げるために、S2I命令が作り出
される。
As a result of the rollback, the iload - a instruction is processed at reference numeral 338. At reference numeral 124, the result type and the target type are matched. Since the result type is short and the target type is int, the types do not match. That is, an S2I instruction is created to raise short to int. Processing continues with the iload - b and iadd instructions. The operand for the iadd instruction does not involve a potential overflow at 210, so the optimized result type is determined at 220. At reference numeral 234, the types of operands are compared. Since the "a" operand is now of type int and the "b" operand is still of type short, "b"
A rollback is performed on the operand. At reference numeral 276, the rollback instruction is set to the iload - b instruction 340. Also, at reference numeral 278, the target type is set to int. At reference numeral 280, an instruction to translate the current instruction is made. At reference numbers 282 and 284, conversion resumes at the iload - b instruction and the instruction is converted. At reference numeral 124, the result type and the target type are matched. Since the result type is short and the target type is int, the types do not match. That is, an S2I instruction is created to raise short to int.

【0079】 次に、iadd命令が処理される。2度ロールバックした後では、いずれのオ
ペランドも桁あふれの可能性を持っていない。従って、参照番号210で、オペ
ランドが潜在的桁あふれを伴わないという指示が作られ、最適化された命令タイ
プが参照番号220で決められる。参照番号232で、命令タイプは、最大のオ
ペランドタイプに設定される。「a+b」オペランドがタイプintであり、「
c」オペランドがタイプshortであるから、命令タイプはintに設定され
る。「c」オペランドのタイプが命令タイプと異なるので、参照番号236で、
「c」オペランドに対してロールバックが実行される。参照番号276で、ロー
ルバック命令は、iload-c命令に設定される。参照番号278で、ロール
バック命令の目標とするタイプは、タイプshortからタイプintに広げら
れる。変換処理は、iload-c命令342において再開される。
Next, the iadd instruction is processed. After rolling back twice, neither operand has the possibility of overflow. Therefore, at reference numeral 210, an indication is made that the operand does not carry a potential overflow, and the optimized instruction type is determined at reference numeral 220. At reference numeral 232, the instruction type is set to the maximum operand type. The “a + b” operand is of type int,
The instruction type is set to int because the "c" operand is of type short. Since the type of the "c" operand is different from the instruction type, reference numeral 236
Rollback is performed on the "c" operand. At reference numeral 276, the rollback instruction is set to the iload - c instruction. At reference numeral 278, the target type of the rollback instruction is expanded from type short to type int. The conversion process is restarted at the iload - c instruction 342.

【0080】 参照番号124で、結果のタイプと目標とするタイプとが照合される。結果の
タイプがshortで、目標とするタイプがintであるから、そのタイプは一
致しない。すなわち、shortをintに上げるために、S2I命令が作り出
される。 次に、idiv命令が処理される。参照番号238において、両方のオペラン
ドがタイプintであるから、最適化された命令タイプはintに設定される。
参照番号222で、intの気味のある命令(idiv)が選択される。最後の
命令シーケンスは、図22の参照番号344で表されている。
At reference numeral 124, the result type and the target type are matched. Since the result type is short and the target type is int, the types do not match. That is, an S2I instruction is created to raise short to int. Next, the idiv instruction is processed. At reference numeral 238, the optimized instruction type is set to int because both operands are of type int.
At reference numeral 222, a daunting int instruction (idiv) is selected. The final instruction sequence is represented by reference numeral 344 in FIG.

【0081】 本発明は、整数タイプに関して説明されたが、当業者は、本発明が浮動小数点
演算式に対しても同様に適用し得ることを認めるであろう。更に、本発明は、「
Java Card(登録商標)」技術に関して説明されたが、当業者は、本発
明が他の多くのプラットフォームに対しても同様に適用可能であることを認める
であろう。これらのプラットフォームには、例として挙げると、K仮想計算機(
KVM)技術が含まれる。KVM技術は、1999年6月8日にサン・マイクロ
システムズ・インコーポレーテッドから出版された「K仮想計算機(KVM)・
白書」で説明されている。 本発明は、ソフトウエア又はハードウエアにおいて実施されるであろう。本発
明は、他のプロセッサにおいて実施されてもよく、同様に、プログラム可能ゲー
トアレー装置、「特定用途向け集積回路(ASIC)」、及び、他のハードウエ
アにおいて実施されてもよい。
Although the present invention has been described in terms of integer types, those skilled in the art will appreciate that the present invention is equally applicable to floating point arithmetic expressions. Furthermore, the present invention provides
Although described with respect to "Java Card (R)" technology, those skilled in the art will recognize that the present invention is equally applicable to many other platforms. These platforms include, for example, the K virtual machine (
KVM) technology is included. KVM technology was published by Sun Microsystems, Inc. on June 8, 1999 in the "K Virtual Machine (KVM).
White Paper ”. The present invention may be implemented in software or hardware. The present invention may be implemented in other processors, as well as programmable gate array devices, "application specific integrated circuits (ASICs)", and other hardware.

【0082】 演算式の適応最適化に関する新しい方法が以上のように説明された。同一タイ
プの命令は、リソース限定型計算機上で実行するために、第2のより小さな(よ
り小さなビット数を有する)整数タイプのための意味論的同等タイプの命令に変
換され、従って、比較的効率的なスタック利用と実行速度の増加とをもたらす。
本発明の実施形態及び応用例が示され説明されたが、本発明の開示の恩恵を受け
る当業者には、本明細書の革新的概念から逸脱することなく、上述のもの以外に
更に多くの変更が可能であることが明らかであろう。従って、本発明は、特許請
求の範囲の精神において限定されるが、それ以外では限定されないものとする。
A new method for adaptive optimization of arithmetic expressions has been described above. Instructions of the same type are converted to a semantically equivalent type instruction for a second, smaller (with a smaller number of bits) integer type instruction for execution on a resource limited computer, and thus relatively This results in efficient stack utilization and increased execution speed.
While embodiments and applications of the present invention have been shown and described, one of ordinary skill in the art having the benefit of the present disclosure will recognize many more than those described above without departing from the innovative concepts herein. It will be apparent that changes are possible. Accordingly, the invention is intended to be limited in the spirit of the claims, but not otherwise limited.

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

【図1】 高級言語で書かれたプログラムをコンパイルする方法を示すブロック図である
FIG. 1 is a block diagram showing a method of compiling a program written in a high level language.

【図2A】 32ビットに拡大された2つの16ビットオペランドを加え合わせるためのス
タックの使用法を示す流れ図である。
FIG. 2A is a flow chart illustrating the use of a stack to add two 16-bit operands expanded to 32 bits.

【図2B】 32ビットに拡大された2つの16ビットオペランドを加え合わせるためのス
タックの使用法を示すブロック図である。
FIG. 2B is a block diagram illustrating the use of a stack to add two 16-bit operands extended to 32 bits.

【図3A】 2つの32ビットオペランドを加え合わせるためのスタックの使用法を示す流
れ図である。
FIG. 3A is a flow diagram illustrating the use of a stack to add two 32-bit operands together.

【図3B】 2つの32ビットオペランドを加え合わせるためのスタックの使用法を示すブ
ロック図である。
FIG. 3B is a block diagram illustrating the use of a stack to add two 32-bit operands together.

【図4A】 本発明の一実施形態に従って、リソース限定型計算機上での実行のために演算
式を変換する方法を示すブロック図である。
FIG. 4A is a block diagram illustrating a method of transforming an arithmetic expression for execution on a resource limited computer according to an embodiment of the present invention.

【図4B】 本発明の一実施形態に従って、Java(登録商標)の部類に属するファイル
を変換する段階を示すブロック図である。
FIG. 4B is a block diagram illustrating the steps of converting a file belonging to the Java® class, according to one embodiment of the invention.

【図5A】 デスクトップコンピュータ上での2つのタイプshortの値の加算を説明す
るコード見本を示す図である。
FIG. 5A is a code sample illustrating the addition of values of two types short on a desktop computer.

【図5B】 リソース限定型コンピュータ上での2つのタイプshortの値の加算を説明
するコード見本を示す図である。
FIG. 5B is a code sample illustrating the addition of values of two type shorts on a resource limited computer.

【図6A】 2つのタイプshortの値の加算、及び、その結果を直ちにデスクトップコ
ンピュータ上で型に入れることを説明するコード見本を示す図である。
FIG. 6A is a code sample illustrating the addition of the values of two type shorts and the immediate entry of the result into a type on a desktop computer.

【図6B】 リソース限定型コンピュータ上に桁あふれを持ち込む可能性のある、演算の結
果の直ぐの型入れを説明するコード見本を示す図である。
FIG. 6B is a code sample illustrating immediate typing of the result of an operation that may introduce an overflow on a resource limited computer.

【図7A】 3つのタイプshortの値の加算、及び、その結果を直ちにデスクトップコ
ンピュータ上で型に入れることを説明するコード見本を示す図である。
FIG. 7A is a code sample illustrating the addition of the values of three type shorts and the immediate entry of the result into a type on a desktop computer.

【図7B】 リソース限定型コンピュータ上に桁あふれをもたらす可能性がある演算による
オペランド上の桁あふれによって影響されない演算の実行を説明するコード見本
を示す図である。
FIG. 7B is a code sample illustrating the execution of an operation that is unaffected by overflow on an operand due to an operation that can result in overflow on a resource limited computer.

【図8A】 2つのタイプshortの値の加算、及び、その結果をデスクトップコンピュ
ータ上のタイプshortの値で割り算することを説明するコード見本を示す図
である。
FIG. 8A is a code sample illustrating the addition of two type short values and the division of the result by the type short value on the desktop computer.

【図8B】 リソース限定型コンピュータ上に桁あふれをもたらす可能性がある演算によっ
て作り出されたオペランド上の桁あふれによって影響された演算の実行を説明す
るコード見本を示す図である。
FIG. 8B is a code sample illustrating the execution of an overflow-affected operation on an operand created by an operation that may result in a overflow on a resource-limited computer.

【図9】 本発明の一実施形態によるnベースタイプの演算式最適化の方法を示す流れ図
である。
FIG. 9 is a flowchart illustrating a method of optimizing an n-base type arithmetic expression according to an embodiment of the present invention.

【図10】 本発明の一実施形態によるnベースタイプの演算式最適化の方法を示す詳細な
流れ図である。
FIG. 10 is a detailed flowchart illustrating an n-base type arithmetic expression optimization method according to an embodiment of the present invention.

【図11】 本発明の一実施形態による命令を変換する段階を示す流れ図である。FIG. 11   6 is a flow chart illustrating steps of converting instructions according to an embodiment of the present invention.

【図12A】 本発明の一実施形態によるターゲット命令を変換する方法を示す流れ図である
FIG. 12A is a flow chart illustrating a method of converting a target instruction according to an embodiment of the present invention.

【図12B】 本発明の一実施形態による初期値命令を変換する方法を示す流れ図である。FIG. 12B   6 is a flowchart illustrating a method of converting an initial value instruction according to an exemplary embodiment of the present invention.

【図13】 本発明の一実施形態によるタイプ変換命令を変換する方法を示す流れ図である
FIG. 13 is a flowchart illustrating a method for converting a type conversion instruction according to an exemplary embodiment of the present invention.

【図14】 本発明の一実施形態によるスタック操作命令を変換する方法を示す流れ図であ
る。
FIG. 14 is a flow diagram illustrating a method of converting stack manipulation instructions according to one embodiment of the invention.

【図15】 本発明の一実施形態による演算式を変換する方法を示す流れ図である。FIG. 15   6 is a flowchart illustrating a method for converting an arithmetic expression according to an exemplary embodiment of the present invention.

【図16】 本発明の一実施形態による最適化された命令のタイプを判断する方法を示す流
れ図である。
FIG. 16 is a flow chart illustrating a method of determining an optimized instruction type according to one embodiment of the invention.

【図17】 本発明の一実施形態による、結果のタイプ及び結果の桁あふれを判断する方法
を示す流れ図である。
FIG. 17 is a flow chart illustrating a method of determining result type and result overflow, according to one embodiment of the invention.

【図18】 本発明の一実施形態によるロールバックポイントを記録する方法を示す流れ図
である。
FIG. 18 is a flow chart illustrating a method of recording a rollback point according to an embodiment of the present invention.

【図19】 本発明の一実施形態による変換処理をロールバックする方法を示す流れ図であ
る。
FIG. 19 is a flow chart illustrating a method of rolling back a conversion process according to an embodiment of the present invention.

【図20】 本発明の一実施形態による命令最適化の結果を伝達する段階を示す流れ図であ
る。
FIG. 20 is a flowchart showing a step of transmitting a result of instruction optimization according to an exemplary embodiment of the present invention.

【図21】 本発明の一実施形態による異なる制御経路からの変換情報を結合する段階を示
す流れ図である。
FIG. 21 is a flow chart illustrating steps of combining conversion information from different control paths according to an embodiment of the present invention.

【図22A】 本発明の一実施形態による命令変換を示すブロック図である。FIG. 22A   FIG. 6 is a block diagram illustrating instruction conversion according to an exemplary embodiment of the present invention.

【図22B】 本発明の一実施形態による命令変換を示すブロック図である。FIG. 22B   FIG. 6 is a block diagram illustrating instruction conversion according to an exemplary embodiment of the present invention.

───────────────────────────────────────────────────── フロントページの続き (81)指定国 EP(AT,BE,CH,CY, DE,DK,ES,FI,FR,GB,GR,IE,I T,LU,MC,NL,PT,SE,TR),OA(BF ,BJ,CF,CG,CI,CM,GA,GN,GW, ML,MR,NE,SN,TD,TG),AP(GH,G M,KE,LS,MW,MZ,SD,SL,SZ,TZ ,UG,ZW),EA(AM,AZ,BY,KG,KZ, MD,RU,TJ,TM),AE,AG,AL,AM, AT,AU,AZ,BA,BB,BG,BR,BY,B Z,CA,CH,CN,CR,CU,CZ,DE,DK ,DM,DZ,EE,ES,FI,GB,GD,GE, GH,GM,HR,HU,ID,IL,IN,IS,J P,KE,KG,KP,KR,KZ,LC,LK,LR ,LS,LT,LU,LV,MA,MD,MG,MK, MN,MW,MX,MZ,NO,NZ,PL,PT,R O,RU,SD,SE,SG,SI,SK,SL,TJ ,TM,TR,TT,TZ,UA,UG,UZ,VN, YU,ZA,ZW (72)発明者 シュワーブ ジュディー アメリカ合衆国 カリフォルニア州 94303‐4900 パロ アルト エムエス パル 01‐521 サン アントニオ ロー ド 901 Fターム(参考) 5B035 BB09 BC00 CA11 5B081 AA09 DD01 【要約の続き】 第2の命令(88)に変換し、少なくとも1つのオペラ ンドが桁あふれ(84)の可能性になっており、かつ、 演算子が桁あふれに対して敏感な場合には、桁あふれの 源である第3の命令(86)をより広いベースに変換す るために、プログラム命令を使用するように形成された 少なくとも1つのプロセッサを含む。─────────────────────────────────────────────────── ─── Continued front page    (81) Designated countries EP (AT, BE, CH, CY, DE, DK, ES, FI, FR, GB, GR, IE, I T, LU, MC, NL, PT, SE, TR), OA (BF , BJ, CF, CG, CI, CM, GA, GN, GW, ML, MR, NE, SN, TD, TG), AP (GH, G M, KE, LS, MW, MZ, SD, SL, SZ, TZ , UG, ZW), EA (AM, AZ, BY, KG, KZ, MD, RU, TJ, TM), AE, AG, AL, AM, AT, AU, AZ, BA, BB, BG, BR, BY, B Z, CA, CH, CN, CR, CU, CZ, DE, DK , DM, DZ, EE, ES, FI, GB, GD, GE, GH, GM, HR, HU, ID, IL, IN, IS, J P, KE, KG, KP, KR, KZ, LC, LK, LR , LS, LT, LU, LV, MA, MD, MG, MK, MN, MW, MX, MZ, NO, NZ, PL, PT, R O, RU, SD, SE, SG, SI, SK, SL, TJ , TM, TR, TT, TZ, UA, UG, UZ, VN, YU, ZA, ZW (72) Inventor Schwab Judy             United States California             94303-4900 Palo Alto MS             Pal 01-521 San Antonio Law             Do 901 F-term (reference) 5B035 BB09 BC00 CA11                 5B081 AA09 DD01 [Continued summary] At least one opera converted into a second command (88) And there is a possibility of overflow (84), and If the operator is sensitive to overflow, the overflow Convert source third instruction (86) to a wider base Formed to use program instructions in order to It includes at least one processor.

Claims (35)

【特許請求の範囲】[Claims] 【請求項1】 第1のベースを有する第1のプロセッサのために形成され、
演算子と少なくとも1つのオペランドとを含む第1の命令を受け取る段階と、 前記少なくとも1つのオペランドが前記第1のベースよりも小さい第2のベー
スを超える潜在的桁あふれを伴わない時、又は、前記演算子が桁あふれに敏感で
ない時、前記第1の命令を、前記第2のベースを有する第2のプロセッサに対し
て最適化された第2の命令に変換する段階と、 前記少なくとも1つのオペランドが前記第2のベースを超える桁あふれの可能
性を伴う時、及び、前記演算子が桁あふれに敏感である時、前記少なくとも1つ
のオペランドに付随する潜在的桁あふれの源であり、以前に最適化されている第
3の命令を、前記第2のベースよりも大きく前記第1のベースよりも小さいか又
は等しいより広いベースに変換する段階と、 を含むことを特徴とする、演算式最適化の方法。
1. Formed for a first processor having a first base,
Receiving a first instruction that includes an operator and at least one operand, when the at least one operand does not involve a potential overflow beyond a second base that is less than the first base, or Converting the first instruction to a second instruction optimized for a second processor having the second base when the operator is not sensitive to overflow; and the at least one A source of potential overflow associated with the at least one operand when the operand is associated with a possibility of overflow beyond the second base, and when the operator is sensitive to overflow. Converting a third instruction that is optimized to a wider base that is greater than the second base and less than or equal to the first base. The symptom, the method of arithmetic expression optimization.
【請求項2】 より広いベースへの前記変換段階は、前記第3の命令の以前
の変換結果を、より広いベースへの前記変換段階の前に廃棄する段階を更に含む
ことを特徴とする請求項1に記載の方法。
2. The step of converting to a wider base further comprises the step of discarding a previous conversion result of the third instruction before the step of converting to a wider base. The method according to Item 1.
【請求項3】 前記第2のプロセッサ上でより小さなベースに最適化するこ
とができない表現を拒否する段階を更に含むことを特徴とする請求項1に記載の
方法。
3. The method of claim 1, further comprising rejecting expressions that cannot be optimized to a smaller base on the second processor.
【請求項4】 より広いベースへの前記変換段階は、より広い前記ベースが
前記第2のプロセッサによってサポートされない時は前記第1の命令を拒否する
段階を更に含むことを特徴とする請求項1に記載の方法。
4. The step of converting to a wider base further comprises rejecting the first instruction when the wider base is not supported by the second processor. The method described in.
【請求項5】 前記第1の命令は、算術であることを特徴とする請求項1に
記載の方法。
5. The method of claim 1, wherein the first instruction is arithmetic.
【請求項6】 前記第1の命令は、タイプに敏感な非算術命令を含むことを
特徴とする請求項1に記載の方法。
6. The method of claim 1, wherein the first instruction comprises a type sensitive non-arithmetic instruction.
【請求項7】 前記第1の命令の前記変換段階の後で、前記第1のプロセッ
サのために形成された全ての命令が変換されるまで、前記第1の命令を受け取る
段階に戻る段階を更に含むことを特徴とする請求項5に記載の方法。
7. A step of returning to the step of receiving the first instruction after the step of converting the first instruction until all the instructions formed for the first processor have been converted. The method of claim 5, further comprising:
【請求項8】 全ての制御経路において、各命令を後続命令にリンクする段
階を更に含むことを特徴とする請求項7に記載の方法。
8. The method of claim 7, further comprising linking each instruction with a subsequent instruction in every control path.
【請求項9】 前記第1の命令の前記変換段階は、 命令の結果の各々を、前記結果を消費する全ての命令にリンクする段階と、 前記変換段階が値を作り出す段階を含む場合、前記値を生み出した命令に前記
値をリンクする段階と、 前記値が桁あふれの可能性を伴う場合、前記桁あふれを最初に引き起こした命
令に前記値をリンクする段階と、 を更に含む、ことを特徴とする請求項8に記載の方法。
9. The converting step of the first instruction comprises: linking each of the results of the instruction with all the instructions that consume the result; and, if the converting step produces a value, Linking the value to the instruction that produced the value, and linking the value to the instruction that first caused the overflow, if the value is associated with a possible overflow. The method of claim 8 characterized.
【請求項10】 前記第1のプロセッサは、「Java(登録商標)仮想計
算機」を含み、 前記第2のプロセッサは、「Java Card(登録商標)仮想計算機」を
含む、 ことを特徴とする請求項1に記載の方法。
10. The first processor includes a “Java (registered trademark) virtual computer”, and the second processor includes a “Java Card (registered trademark) virtual computer”. The method according to Item 1.
【請求項11】 前記第1のベースは、前記第1のベースのサイズよりも小
さいサイズを有する少なくとも1つのデータタイプ上で算術演算を実行するため
に、前記第1のプロセッサによって使用され、 前記少なくとも1つのデータタイプのサイズに等しいサイズを有する前記第2
のベースは、前記少なくとも1つのデータタイプ上で算術演算を実行するために
、前記第2のプロセッサによって使用される、 ことを特徴とする請求項1に記載の方法。
11. The first base is used by the first processor to perform arithmetic operations on at least one data type having a size less than the size of the first base, Said second having a size equal to the size of at least one data type
The method of claim 1, wherein the base of is used by the second processor to perform arithmetic operations on the at least one data type.
【請求項12】 前記第1のプロセッサは、32ビットのプロセッサを含み
、 前記第2のプロセッサは、リソース限定型16ビットのプロセッサを含む、 ことを特徴とする請求項1に記載の方法。
12. The method of claim 1, wherein the first processor comprises a 32-bit processor and the second processor comprises a resource limited 16-bit processor.
【請求項13】 前記第1のベースは、前記第1のベースのサイズよりも小
さいサイズを有する少なくとも1つのデータタイプ上で算術演算を実行するため
に、前記第1のプロセッサによって使用され、 前記少なくとも1つのデータタイプのサイズよりも大きいサイズを有する前記
第2のベースは、前記少なくとも1つのデータタイプ上で算術演算を実行するた
めに、前記第2のプロセッサによって使用される、 ことを特徴とする請求項9に記載の方法。
13. The first base is used by the first processor to perform arithmetic operations on at least one data type having a size less than the size of the first base, The second base having a size greater than the size of at least one data type is used by the second processor to perform arithmetic operations on the at least one data type. The method according to claim 9, wherein
【請求項14】 前記第1のプロセッサは、32ビットのプロセッサを含み
、 前記第2のプロセッサは、リソース限定型16ビットのプロセッサを含む、 ことを特徴とする請求項13に記載の方法。
14. The method of claim 13, wherein the first processor comprises a 32-bit processor and the second processor comprises a resource limited 16-bit processor.
【請求項15】 第1のベースを有する第1のプロセッサのために形成され
、演算子と少なくとも1つのオペランドとを含む第1の命令を受け取る段階と、 前記少なくとも1つのオペランドが前記第1のベースよりも小さい第2のベー
スを超える潜在的桁あふれを伴わない時、又は、前記演算子が桁あふれに敏感で
ない時、前記第1の命令を、前記第2のベースを有する第2のプロセッサに対し
て最適化された第2の命令に変換する段階と、 前記少なくとも1つのオペランドが前記第2のベースを超える桁あふれの可能
性を伴う時、及び、前記演算子が桁あふれに敏感である時、前記少なくとも1つ
のオペランドに付随する潜在的桁あふれの源であり、以前に最適化されている第
3の命令を、前記第2のベースよりも大きく前記第1のベースよりも小さいか又
は等しいより広いベースに変換する段階と、 を含む演算式最適化を実行する、計算機が実行可能な命令プログラムを包含す
ることを特徴とする、計算機が読取可能なプログラム記憶装置。
15. Receiving a first instruction formed for a first processor having a first base and including an operator and at least one operand, said at least one operand comprising said first instruction. A second processor having the second base when the first instruction is not sensitive to overflow, or when the operator is not sensitive to overflow. To a second instruction optimized for, when the at least one operand involves a possibility of overflow beyond the second base, and the operator is sensitive to overflow. At a certain time, a third instruction, which is a source of potential overflow associated with the at least one operand, has been previously optimized and is larger than the second base in the first base. And converting a wide base smaller than or equal to remote, executes arithmetic expression optimization including, characterized in that it comprises computer executable program of instructions, computer-readable program storage device.
【請求項16】 より広いベースへの前記変換段階は、前記第3の命令の以
前の変換結果を、より広いベースへの前記変換段階の前に破棄する段階を更に含
むことを特徴とする請求項15に記載のプログラム記憶装置。
16. The step of converting to a wider base further comprises the step of discarding a previous conversion result of the third instruction before the step of converting to a wider base. Item 16. The program storage device according to item 15.
【請求項17】 前記第2のプロセッサ上でより小さなベースに最適化する
ことができない表現を拒否する段階を更に含むことを特徴とする請求項15に記
載のプログラム記憶装置。
17. The program storage device of claim 15, further comprising rejecting expressions that cannot be optimized to a smaller base on the second processor.
【請求項18】 より広いベースへの前記変換段階は、より広い前記ベース
が前記第2のプロセッサによってサポートされない時は前記第1の命令を拒否す
る段階を更に含むことを特徴とする請求項15に記載のプログラム記憶装置。
18. The step of converting to a wider base further comprises rejecting the first instruction when the wider base is not supported by the second processor. The program storage device according to 1.
【請求項19】 前記第1の命令は、算術であることを特徴とする請求項1
5に記載のプログラム記憶装置。
19. The first instruction is an arithmetic operation.
5. The program storage device according to item 5.
【請求項20】 前記第1の命令は、タイプに敏感な非算術命令を含むこと
を特徴とする請求項15に記載のプログラム記憶装置。
20. The program storage device of claim 15, wherein the first instruction comprises a type-sensitive non-arithmetic instruction.
【請求項21】 前記第1の命令の前記変換段階の後で、前記第1のプロセ
ッサのために形成された全ての命令が変換されるまで、前記第1の命令を受け取
る段階に戻る段階を更に含むことを特徴とする請求項19に記載のプログラム記
憶装置。
21. After the converting step of the first instruction, returning to receiving the first instruction until all instructions formed for the first processor have been converted. 20. The program storage device according to claim 19, further comprising:
【請求項22】 全ての制御経路において、各命令を後続命令にリンクする
段階を更に含むことを特徴とする請求項21に記載のプログラム記憶装置。
22. The program storage device of claim 21, further comprising linking each instruction with a subsequent instruction in all control paths.
【請求項23】 前記第1の命令の前記変換段階は、 命令の結果の各々を、前記結果を消費する全ての命令にリンクする段階と、 前記変換段階が値を作り出す段階を含む場合、前記値を生み出した命令に前記
値をリンクする段階と、 前記値が桁あふれの可能性を伴う場合、前記桁あふれを最初に引き起こした命
令に前記値をリンクする段階と、 を更に含む、ことを特徴とする請求項22に記載のプログラム記憶装置。
23. The step of converting the first instruction comprises: linking each of the results of the instruction with all the instructions that consume the result; and, if the converting step produces a value, Linking the value to the instruction that produced the value, and linking the value to the instruction that first caused the overflow, if the value is associated with a possible overflow. The program storage device according to claim 22, wherein the program storage device is a storage device.
【請求項24】 前記第1のプロセッサは、「Java(登録商標)仮想計
算機」を含み、 前記第2のプロセッサは、「Java Card(登録商標)仮想計算機」を
含む、 ことを特徴とする請求項15に記載のプログラム記憶装置。
24. The first processor includes a “Java (registered trademark) virtual computer”, and the second processor includes a “Java Card (registered trademark) virtual computer”. Item 16. The program storage device according to item 15.
【請求項25】 前記第1のベースは、前記第1のベースのサイズよりも小
さいサイズを有する少なくとも1つのデータタイプ上で算術演算を実行するため
に、前記第1のプロセッサによって使用され、 前記少なくとも1つのデータタイプのサイズに等しいサイズを有する前記第2
のベースは、前記少なくとも1つのデータタイプ上で算術演算を実行するために
、前記第2のプロセッサによって使用される、 ことを特徴とする請求項15に記載のプログラム記憶装置。
25. The first base is used by the first processor to perform arithmetic operations on at least one data type having a size less than the size of the first base, Said second having a size equal to the size of at least one data type
16. The program storage device of claim 15, wherein the base of is used by the second processor to perform arithmetic operations on the at least one data type.
【請求項26】 前記第1のプロセッサは、32ビットのプロセッサを含み
、 前記第2のプロセッサは、リソース限定型16ビットのプロセッサを含む、 ことを特徴とする請求項15に記載のプログラム記憶装置。
26. The program storage device according to claim 15, wherein the first processor includes a 32-bit processor, and the second processor includes a resource-limited 16-bit processor. .
【請求項27】 前記第1のベースは、前記第1のベースのサイズよりも小
さいサイズを有する少なくとも1つのデータタイプ上で算術演算を実行するため
に、前記第1のプロセッサによって使用され、 前記少なくとも1つのデータタイプのサイズよりも大きいサイズを有する前記
第2のベースは、前記少なくとも1つのデータタイプ上で算術演算を実行するた
めに、前記第2のプロセッサによって使用される、 ことを特徴とする請求項23に記載のプログラム記憶装置。
27. The first base is used by the first processor to perform arithmetic operations on at least one data type having a size less than the size of the first base, The second base having a size greater than the size of at least one data type is used by the second processor to perform arithmetic operations on the at least one data type. 24. The program storage device according to claim 23.
【請求項28】 プログラム命令を有する少なくとも1つのメモリと、 第1のベースを有する第1のプロセッサのために形成され、演算子と少なくと
も1つのオペランドとを含む第1の命令を受け取り、 前記少なくとも1つのオペランドが前記第1のベースよりも小さい第2のベー
スを超える潜在的桁あふれを伴わない時、又は、前記演算子が桁あふれに敏感で
ない時、前記第1の命令を、前記第2のベースを有する第2のプロセッサに対し
て最適化された第2の命令に変換し、 前記少なくとも1つのオペランドが前記第2のベースを超える桁あふれの可能
性を伴う時、及び、前記演算子が桁あふれに敏感である時、前記少なくとも1つ
のオペランドに付随する潜在的桁あふれの源であり、以前に最適化されている第
3の命令を、前記第2のベースよりも大きく前記第1のベースよりも小さいか又
は等しいより広いベースに変換する、 ために前記プログラム命令を使用するように形成された少なくとも1つのプロ
セッサと、 を含むことを特徴とする、演算式最適化のための装置。
28. Receiving a first instruction formed for at least one memory having a program instruction and a first processor having a first base, the first instruction including an operator and at least one operand; When the one operand does not involve a potential overflow beyond a second base that is less than the first base, or when the operator is not sensitive to overflow, the first instruction is replaced by the second instruction. Converting to a second instruction optimized for a second processor having a base of at least one operand with a possibility of overflow beyond the second base, and the operator Is sensitive to overflow, the third instruction that was the source of potential overflow associated with the at least one operand and was previously optimized is At least one processor configured to use the program instructions to convert to a wider base that is greater than a base and less than or equal to the first base; Equipment for expression optimization.
【請求項29】 前記少なくとも1つのプロセッサは、より広いベースに変
換する段階の前に、前記プログラム命令を使用して前記第3の命令の以前の変換
結果を破棄するように更に形成されることを特徴とする請求項28に記載の装置
29. The at least one processor is further configured to use the program instruction to discard a previous conversion result of the third instruction prior to the step of converting to a wider base. 29. The device of claim 28, characterized by:
【請求項30】 第1のベースを有する第1のプロセッサのために形成され
、演算子と少なくとも1つのオペランドとを含む第1の命令を受け取る手段と、 前記少なくとも1つのオペランドが前記第1のベースよりも小さい第2のベー
スを超える潜在的桁あふれを伴わない時、又は、前記演算子が桁あふれに敏感で
ない時、前記第1の命令を、前記第2のベースを有する第2のプロセッサに対し
て最適化された第2の命令に変換する手段と、 前記少なくとも1つのオペランドが前記第2のベースを超える桁あふれの可能
性を伴う時、及び、前記演算子が桁あふれに敏感である時、前記少なくとも1つ
のオペランドに付随する潜在的桁あふれの源であり、以前に最適化されている第
3の命令を、前記第2のベースよりも大きく前記第1のベースよりも小さいか又
は等しいより広いベースに変換する手段と、 を含むことを特徴とする、演算式最適化のための装置。
30. Means for receiving a first instruction formed for a first processor having a first base and including an operator and at least one operand; said at least one operand being said first A second processor having the second base when the first instruction is not sensitive to overflow, or when the operator is not sensitive to overflow. Means for converting to a second instruction optimized for, when the at least one operand involves a possibility of overflow beyond the second base, and the operator is sensitive to overflow. At a certain time, a third instruction, which is a source of potential overflow associated with the at least one operand, has been previously optimized and is larger than the second base in the first base. Characterized in that it comprises means for converting remote smaller or wider base equal to, apparatus for arithmetic expression optimization.
【請求項31】 より広いベースに変換する前記手段は、より広いベースに
変換する前記段階の前に、前記第3の命令の以前の変換結果を破棄する手段を更
に含むことを特徴とする請求項30に記載の装置。
31. The means for converting to a wider base further comprises means for discarding a previous conversion result of the third instruction prior to the step of converting to a wider base. Item 31. The device according to item 30.
【請求項32】 全ての制御経路において、各命令を後続命令にリンクする
手段を更に含むことを特徴とする請求項30に記載の装置。
32. The apparatus of claim 30, further comprising means for linking each instruction with a subsequent instruction in every control path.
【請求項33】 第1のベースを有するプロセッサを目標とする少なくとも
1つの命令の演算式最適化を含むアプリケーションソフトウエアプログラムを使
用する方法であって、 ソフトウエアプログラムをプロセッサ上に受け取る段階と、 命令のシーケンスを前記プロセッサ上で実行する段階と、 を含むことを特徴とする方法。
33. A method of using an application software program including at least one instruction optimization targeting a processor having a first base, the method comprising receiving the software program on a processor. Executing a sequence of instructions on the processor.
【請求項34】 前記少なくとも1つの命令をリソース限定型装置上に記憶
する段階を更に含むことを特徴とする請求項33に記載の方法。
34. The method of claim 33, further comprising storing the at least one instruction on a resource limited device.
【請求項35】 マイクロ制御装置によって実行される仮想計算機、 を含み、 前記仮想計算機は、複数の予め最適化された命令から成るソフトウエアアプリ
ケーションを実行し、 前記仮想計算機は、リソース限定型装置上で実行するために予め最適化されて
いる最適化された命令を受け取る手段と前記命令を実行する手段とを含む、 ことを特徴とする、マイクロ制御装置が組み込まれたスマートカード。
35. A virtual machine executed by a micro controller, the virtual machine executing a software application comprising a plurality of pre-optimized instructions, the virtual machine on a resource limited device. A smart card incorporating a microcontroller, comprising: means for receiving optimized instructions that have been pre-optimized for execution at: and means for executing said instructions.
JP2001536669A 1999-11-12 2000-11-10 Optimization of N-base type arithmetic expressions Expired - Lifetime JP4786101B2 (en)

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
US09/439,113 1999-11-12
US09/439,113 US6363523B1 (en) 1999-11-12 1999-11-12 Optimization of N-base typed arithmetic expressions
PCT/US2000/031029 WO2001035201A1 (en) 1999-11-12 2000-11-10 Optimization of n-base typed arithmetic expressions

Related Child Applications (1)

Application Number Title Priority Date Filing Date
JP2011092259A Division JP5325925B2 (en) 1999-11-12 2011-04-18 Optimization of N-base type arithmetic expressions

Publications (3)

Publication Number Publication Date
JP2003515203A true JP2003515203A (en) 2003-04-22
JP2003515203A5 JP2003515203A5 (en) 2008-01-10
JP4786101B2 JP4786101B2 (en) 2011-10-05

Family

ID=23743348

Family Applications (2)

Application Number Title Priority Date Filing Date
JP2001536669A Expired - Lifetime JP4786101B2 (en) 1999-11-12 2000-11-10 Optimization of N-base type arithmetic expressions
JP2011092259A Expired - Lifetime JP5325925B2 (en) 1999-11-12 2011-04-18 Optimization of N-base type arithmetic expressions

Family Applications After (1)

Application Number Title Priority Date Filing Date
JP2011092259A Expired - Lifetime JP5325925B2 (en) 1999-11-12 2011-04-18 Optimization of N-base type arithmetic expressions

Country Status (8)

Country Link
US (3) US6363523B1 (en)
EP (1) EP1232430B1 (en)
JP (2) JP4786101B2 (en)
KR (1) KR20020087384A (en)
CN (1) CN1287257C (en)
AU (1) AU1484901A (en)
DE (1) DE1232430T1 (en)
WO (1) WO2001035201A1 (en)

Families Citing this family (38)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8631066B2 (en) * 1998-09-10 2014-01-14 Vmware, Inc. Mechanism for providing virtual machines for use by multiple users
US7200842B1 (en) 1999-02-02 2007-04-03 Sun Microsystems, Inc. Object-oriented instruction set for resource-constrained devices
JP2001005675A (en) * 1999-06-21 2001-01-12 Matsushita Electric Ind Co Ltd Program converter and processor
US8453133B2 (en) * 1999-11-12 2013-05-28 Oracle America, Inc. Optimization of N-base typed arithmetic instructions via rework
US7207037B2 (en) * 1999-11-12 2007-04-17 Sun Microsystems, Inc. Overflow sensitive arithmetic instruction optimization using chaining
US7010786B2 (en) * 1999-11-12 2006-03-07 Sun Microsystems, Inc. Predictive arithmetic overflow detection
US7107581B2 (en) * 1999-11-12 2006-09-12 Sun Microsystems, Inc. Overflow predictive arithmetic instruction optimization using chaining
US6363523B1 (en) * 1999-11-12 2002-03-26 Sun Microsystems, Inc. Optimization of N-base typed arithmetic expressions
US20010007146A1 (en) * 1999-12-23 2001-07-05 Uwe Hansmann Method for providing a set of software components
US20100174717A1 (en) * 2002-02-28 2010-07-08 Olivier Fambon Interative serialisation procedure for structured software objects
US7171438B2 (en) * 2002-11-12 2007-01-30 Sandbridge Technologies, Inc. Method for recognition of full-word saturating addition and subtraction
US7661096B2 (en) * 2004-02-13 2010-02-09 Microsoft Corporation Interaction with nested and non-nested streams
TW200622904A (en) * 2004-08-12 2006-07-01 Sandbridge Technologies Inc Method for recognition of acyclic instruction patterns
JP2006227939A (en) * 2005-02-17 2006-08-31 Matsushita Electric Ind Co Ltd Arithmetic unit
CN100410873C (en) * 2005-04-12 2008-08-13 威盛电子股份有限公司 Separate saturation add-minus function to improve key-performming moment of processor pipe
US8375247B2 (en) 2005-08-29 2013-02-12 The Invention Science Fund I, Llc Handling processor computational errors
US7647487B2 (en) 2005-08-29 2010-01-12 Searete, Llc Instruction-associated processor resource optimization
US8209524B2 (en) * 2005-08-29 2012-06-26 The Invention Science Fund I, Llc Cross-architecture optimization
US20070050605A1 (en) * 2005-08-29 2007-03-01 Bran Ferren Freeze-dried ghost pages
US20070050606A1 (en) * 2005-08-29 2007-03-01 Searete Llc, A Limited Liability Corporation Of The State Of Delaware Runtime-based optimization profile
US7877584B2 (en) * 2005-08-29 2011-01-25 The Invention Science Fund I, Llc Predictive processor resource management
US7653834B2 (en) 2005-08-29 2010-01-26 Searete, Llc Power sparing synchronous apparatus
US7739524B2 (en) * 2005-08-29 2010-06-15 The Invention Science Fund I, Inc Power consumption management
US7779213B2 (en) * 2005-08-29 2010-08-17 The Invention Science Fund I, Inc Optimization of instruction group execution through hardware resource management policies
US8516300B2 (en) * 2005-08-29 2013-08-20 The Invention Science Fund I, Llc Multi-votage synchronous systems
US8423824B2 (en) 2005-08-29 2013-04-16 The Invention Science Fund I, Llc Power sparing synchronous apparatus
US8214191B2 (en) * 2005-08-29 2012-07-03 The Invention Science Fund I, Llc Cross-architecture execution optimization
US7725693B2 (en) 2005-08-29 2010-05-25 Searete, Llc Execution optimization using a processor resource management policy saved in an association with an instruction group
US8255745B2 (en) * 2005-08-29 2012-08-28 The Invention Science Fund I, Llc Hardware-error tolerant computing
US7627739B2 (en) * 2005-08-29 2009-12-01 Searete, Llc Optimization of a hardware resource shared by a multiprocessor
US8181004B2 (en) * 2005-08-29 2012-05-15 The Invention Science Fund I, Llc Selecting a resource management policy for a resource available to a processor
US7774558B2 (en) * 2005-08-29 2010-08-10 The Invention Science Fund I, Inc Multiprocessor resource optimization
US8689194B1 (en) * 2007-08-20 2014-04-01 The Mathworks, Inc. Optimization identification
CN101814009B (en) * 2009-02-25 2011-12-21 慧国(上海)软件科技有限公司 Flash device, data storage system and method for transmitting special command to flash device
US9003377B2 (en) * 2010-01-07 2015-04-07 Microsoft Technology Licensing, Llc Efficient resumption of co-routines on a linear stack
US8572594B2 (en) 2010-12-22 2013-10-29 Microsoft Corporation Invasion analysis to identify open types
US9652358B1 (en) 2016-04-14 2017-05-16 Semmle Limited Type widening for source code analysis
JP7163697B2 (en) * 2018-09-28 2022-11-01 富士通株式会社 Generation program, information processing device and generation method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05505692A (en) * 1991-03-07 1993-08-19 ディジタル イクイプメント コーポレイション Effective error reporting for executing conversion code
JPH06337792A (en) * 1993-05-27 1994-12-06 Matsushita Electric Ind Co Ltd Program converting device and processor

Family Cites Families (58)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US574041A (en) * 1896-12-29 Mcolure
US3805045A (en) 1972-10-30 1974-04-16 Amdahl Corp Binary carry lookahead adder using redundancy terms
US3993891A (en) 1975-07-03 1976-11-23 Burroughs Corporation High speed parallel digital adder employing conditional and look-ahead approaches
JPS55112651A (en) 1979-02-21 1980-08-30 Fujitsu Ltd Virtual computer system
US4429370A (en) * 1981-04-23 1984-01-31 Data General Corporation Arithmetic unit for use in a data processing system for computing exponent results and detecting overflow and underflow conditions thereof
US4504924A (en) 1982-06-28 1985-03-12 International Business Machines Corporation Carry lookahead logical mechanism using affirmatively referenced transfer gates
US4941119A (en) * 1988-11-30 1990-07-10 Control Data Corporation Method and apparatus for predicting an overflow in an integer multiply
US5617574A (en) 1989-05-04 1997-04-01 Texas Instruments Incorporated Devices, systems and methods for conditional instructions
JPH03100827A (en) 1989-09-14 1991-04-25 Mitsubishi Electric Corp Overflow detecting circuit
US5107451A (en) 1990-01-30 1992-04-21 The Boeing Company Method and apparatus for pipelined detection of overflow in residue arithmetic multiplication
US5058048A (en) * 1990-04-02 1991-10-15 Advanced Micro Devices, Inc. Normalizing pipelined floating point processing unit
US5301341A (en) 1990-11-28 1994-04-05 International Business Machines Corporation Overflow determination for three-operand alus in a scalable compound instruction set machine which compounds two arithmetic instructions
US5102645A (en) * 1990-06-21 1992-04-07 Liquid Carbonic Corporation Method for manufacture of high purity carbon monoxide
IL100986A (en) * 1991-02-27 1997-01-10 Digital Equipment Corp Method for compiling code
IL100987A (en) * 1991-02-27 1995-10-31 Digital Equipment Corp Method and apparatus for compiling code
US5305456A (en) 1991-10-11 1994-04-19 Security Integration, Inc. Apparatus and method for computer system integrated security
US5606677A (en) 1992-11-30 1997-02-25 Texas Instruments Incorporated Packed word pair multiply operation forming output including most significant bits of product and other bits of one input
US5418959A (en) * 1992-11-30 1995-05-23 Intel Corporation Instruction operation size optimization
US5408670A (en) 1992-12-18 1995-04-18 Xerox Corporation Performing arithmetic in parallel on composite operands with packed multi-bit components
DE69432445T2 (en) * 1993-05-27 2003-10-23 Matsushita Electric Ind Co Ltd Improved processor for addressing
US5446901A (en) 1993-06-30 1995-08-29 Digital Equipment Corporation Fault tolerant distributed garbage collection system and method for collecting network objects
US5825407A (en) 1993-09-13 1998-10-20 Albrit Technologies Ltd. Cable television audio messaging systems
US5668999A (en) 1994-12-20 1997-09-16 Sun Microsystems, Inc. System and method for pre-verification of stack usage in bytecode program loops
US5630066A (en) 1994-12-20 1997-05-13 Sun Microsystems, Inc. System and method for locating object view and platform independent object
US5748964A (en) 1994-12-20 1998-05-05 Sun Microsystems, Inc. Bytecode program interpreter apparatus and method with pre-verification of data type restrictions
US5659754A (en) 1995-03-31 1997-08-19 Sun Microsystems, Inc. Method and apparatus for an improved optimizing compiler
CA2173695A1 (en) 1995-04-14 1996-10-15 Panagiotis Kougiouris Method and system for providing interoperability among processes written to execute on different operating systems
US5724279A (en) 1995-08-25 1998-03-03 Microsoft Corporation Computer-implemented method and computer for performing modular reduction
US5878266A (en) 1995-09-26 1999-03-02 Advanced Micro Devices, Inc. Reservation station for a floating point processing unit
US5732263A (en) 1995-10-03 1998-03-24 International Business Machines Corporation Systems, methods and computer program products for generating and validating user defined object classes in an object oriented programming environment after build time
US6151618A (en) 1995-12-04 2000-11-21 Microsoft Corporation Safe general purpose virtual machine computing system
US6067575A (en) 1995-12-08 2000-05-23 Sun Microsystems, Inc. System and method for generating trusted, architecture specific, compiled versions of architecture neutral programs
US5790859A (en) 1995-12-21 1998-08-04 International Business Machines Corporation Method of, system for, and computer program product for efficient identification of private variables in program loops by an optimizing compiler
US5784553A (en) 1996-01-16 1998-07-21 Parasoft Corporation Method and system for generating a computer program test suite using dynamic symbolic execution of JAVA programs
US6014723A (en) * 1996-01-24 2000-01-11 Sun Microsystems, Inc. Processor with accelerated array access bounds checking
US6091897A (en) * 1996-01-29 2000-07-18 Digital Equipment Corporation Fast translation and execution of a computer program on a non-native architecture by use of background translator
US5802373A (en) * 1996-01-29 1998-09-01 Digital Equipment Corporation Method for providing a pipeline interpreter for a variable length instruction set
US6075863A (en) 1996-02-28 2000-06-13 Encanto Networks Intelligent communication device
US5794049A (en) 1996-06-05 1998-08-11 Sun Microsystems, Inc. Computer system and method for executing architecture specific code with reduced run-time memory space requirements
US5844218A (en) * 1996-07-16 1998-12-01 Transaction Technology, Inc. Method and system for using an application programmable smart card for financial transactions in multiple countries
EP0932865B1 (en) * 1996-10-25 2002-08-14 SCHLUMBERGER Systèmes Using a high level programming language with a microcontroller
US5884316A (en) 1996-11-19 1999-03-16 Microsoft Corporation Implicit session context system with object state cache
US5920720A (en) 1997-02-25 1999-07-06 Microsoft Corporation Efficient computer based virtual machine object structure
CA2288824A1 (en) * 1997-03-24 1998-10-01 Marc B. Kekicheff A system and method for a multi-application smart card which can facilitate a post-issuance download of an application onto the smart card
US6003038A (en) 1997-03-31 1999-12-14 Sun Microsystems, Inc. Object-oriented processor architecture and operating method
US6092147A (en) * 1997-04-15 2000-07-18 Sun Microsystems, Inc. Virtual machine with securely distributed bytecode verification
US6202143B1 (en) * 1997-08-21 2001-03-13 Samsung Electronics Co., Ltd. System for fetching unit instructions and multi instructions from memories of different bit widths and converting unit instructions to multi instructions by adding NOP instructions
US6026237A (en) 1997-11-03 2000-02-15 International Business Machines Corporation System and method for dynamic modification of class files
US5978825A (en) * 1997-11-14 1999-11-02 Crystal Semiconductor Corp. Zero detection circuitry and methods
US6247174B1 (en) 1998-01-02 2001-06-12 Hewlett-Packard Company Optimization of source code with embedded machine instructions
US6247116B1 (en) * 1998-04-30 2001-06-12 Intel Corporation Conversion from packed floating point data to packed 16-bit integer data in different architectural registers
US6292935B1 (en) * 1998-05-29 2001-09-18 Intel Corporation Method for fast translation of java byte codes into efficient native processor code
US6093216A (en) 1998-05-29 2000-07-25 Intel Corporation Method of run-time tracking of object references in Java programs
US6212633B1 (en) 1998-06-26 2001-04-03 Vlsi Technology, Inc. Secure data communication over a memory-mapped serial communications interface utilizing a distributed firewall
FR2797963B1 (en) 1999-08-23 2002-11-29 Trusted Logic MANAGEMENT PROTOCOL, METHOD FOR VERIFICATION AND TRANSFORMATION OF A DOWNLOADED PROGRAM FRAGMENT AND CORRESPONDING SYSTEMS
US6363523B1 (en) * 1999-11-12 2002-03-26 Sun Microsystems, Inc. Optimization of N-base typed arithmetic expressions
GB2365610A (en) 2000-08-02 2002-02-20 Ncr Int Inc Self-service terminal
US6988119B2 (en) 2001-06-29 2006-01-17 Intel Corporation Fast single precision floating point accumulator using base 32 system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05505692A (en) * 1991-03-07 1993-08-19 ディジタル イクイプメント コーポレイション Effective error reporting for executing conversion code
JPH06337792A (en) * 1993-05-27 1994-12-06 Matsushita Electric Ind Co Ltd Program converting device and processor

Also Published As

Publication number Publication date
US7316007B2 (en) 2008-01-01
JP4786101B2 (en) 2011-10-05
CN1287257C (en) 2006-11-29
US20040073894A1 (en) 2004-04-15
US6687898B2 (en) 2004-02-03
EP1232430A4 (en) 2007-01-10
JP5325925B2 (en) 2013-10-23
EP1232430B1 (en) 2020-05-20
JP2011150727A (en) 2011-08-04
EP1232430A1 (en) 2002-08-21
KR20020087384A (en) 2002-11-22
DE1232430T1 (en) 2003-02-06
CN1421001A (en) 2003-05-28
WO2001035201A1 (en) 2001-05-17
US6363523B1 (en) 2002-03-26
AU1484901A (en) 2001-06-06
US20020129344A1 (en) 2002-09-12

Similar Documents

Publication Publication Date Title
JP5325925B2 (en) Optimization of N-base type arithmetic expressions
JP3377419B2 (en) Instruction string generation method and apparatus, conversion method, and computer
US6721944B2 (en) Marking memory elements based upon usage of accessed information during speculative execution
KR101642556B1 (en) Methods and systems for performing a binary translation
US7366880B2 (en) Facilitating value prediction to support speculative program execution
US6353881B1 (en) Supporting space-time dimensional program execution by selectively versioning memory updates
JPWO2003025743A1 (en) Processor system with Java accelerator
JP2000507015A (en) Real-time programming language accelerator
US20030192035A1 (en) Systems and methods for implementing efficient execution transfers between successive translations of stack-based program code in a virtual machine environment
US6463526B1 (en) Supporting multi-dimensional space-time computing through object versioning
US7168076B2 (en) Facilitating efficient join operations between a head thread and a speculative thread
US20230084523A1 (en) Data Processing Method and Device, and Storage Medium
US6453463B1 (en) Method and apparatus for providing finer marking granularity for fields within objects
CN116204232A (en) Method and device for expanding data operation bit width
US20130262910A1 (en) Time keeping in unknown and unstable clock architecture
US7010786B2 (en) Predictive arithmetic overflow detection
US7107581B2 (en) Overflow predictive arithmetic instruction optimization using chaining
US8453133B2 (en) Optimization of N-base typed arithmetic instructions via rework
US7207037B2 (en) Overflow sensitive arithmetic instruction optimization using chaining
JPH07191845A (en) Immediate data transfer device
Shamir Dynamic reuse of subroutine results
JPH05173780A (en) Method and device for executing instruction
JP2001117759A (en) Technology for implementing virtual machine allowed to be plugged

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20071112

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20071112

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100826

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20101126

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20101216

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110418

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110420

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110527

A911 Transfer to examiner for re-examination before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20110601

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: 20110623

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20110713

R150 Certificate of patent or registration of utility model

Ref document number: 4786101

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20140722

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20140722

Year of fee payment: 3

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: R3D02

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

EXPY Cancellation because of completion of term