Method and apparatus for performing native binding
First Claim
Patent Images
1. A method of translating subject program code executable by a subject processor into target program code executable by a target processor, said method comprising the steps of:
- (a) dividing the subject code into a plurality of subject code units;
(b) translating one or more of the subject code units into one or more target code units via an intermediate representation; and
(c) executing the target code units on the target processor;
wherein the step (b) comprises (b1) identifying at least one of the subject code units as having a corresponding native code unit, wherein the native code unit is executable natively by the target processor, and (b2) identifying the native code unit which corresponds to the identified subject code unit;
wherein the steps (b1) and (b2) are performed by encountering an external call command as a translator-specific instruction interpreted as an illegal instruction by the subject processor during translation of the subject code, decoding the external call command, and adding to the intermediate representation based on the external call command; and
wherein the step (c) comprises executing the corresponding native code unit instead of executing a translated version of the identified subject code unit.
4 Assignments
0 Petitions
Accused Products
Abstract
A native binding technique is provided for inserting calls to native functions during translation of subject code to target code, such that function calls in the subject program to subject code functions are replaced in target code with calls to native equivalents of the same functions. Parameters of native function calls are transformed from target code representations to be consistent with native code representations, native code calling conventions, and native function prototypes.
18 Citations
14 Claims
-
1. A method of translating subject program code executable by a subject processor into target program code executable by a target processor, said method comprising the steps of:
-
(a) dividing the subject code into a plurality of subject code units; (b) translating one or more of the subject code units into one or more target code units via an intermediate representation; and (c) executing the target code units on the target processor; wherein the step (b) comprises (b1) identifying at least one of the subject code units as having a corresponding native code unit, wherein the native code unit is executable natively by the target processor, and (b2) identifying the native code unit which corresponds to the identified subject code unit; wherein the steps (b1) and (b2) are performed by encountering an external call command as a translator-specific instruction interpreted as an illegal instruction by the subject processor during translation of the subject code, decoding the external call command, and adding to the intermediate representation based on the external call command; and wherein the step (c) comprises executing the corresponding native code unit instead of executing a translated version of the identified subject code unit. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
-
-
12. A computer-readable storage medium having software resident thereon in the form of computer-readable code executable by a computer to perform a method of translating subject program code executable by a subject processor into target program code executable by a target processor, said method comprising the steps of:
-
(a) dividing the subject code into a plurality of subject code units; (b) translating one or more of the subject code units into one or more target code units via an intermediate representation; and (c) executing the target code units on the target processor; wherein the step (b) comprises (b1) identifying at least one of the subject code units as having a corresponding native code unit, wherein the native code unit is executable natively by the target processor, and (b2) identifying the native code unit which corresponds to the identified subject code unit; wherein the steps (b1) and (b2) are performed by encountering an external call command as a translator-specific instruction interpreted as an illegal instruction by the subject processor during translation of the subject code, decoding the external call command, and adding to the intermediate representation based on the external call command; and wherein the step (c) comprises executing the corresponding native code unit instead of executing a translated version of the identified subject code unit.
-
-
13. A computer apparatus, comprising:
-
a target processor; and a memory arranged to store subject program code executable by a subject processor, and translator code to translate the subject program code into a target program code that is executed by the target processor, wherein the translator code when executed by the processor performs the steps of; (a) dividing the subject code into a plurality of subject code units; (b) translating one or more of the subject code units into one or more target code units via an intermediate representation; and (c) executing the target code units on the target processor; wherein the step (b) comprises (b1) identifying at least one of the subject code units as having a corresponding native code unit, wherein the native code unit is executable natively by the target processor, and (b2) identifying the native code unit which corresponds to the identified subject code unit; wherein the steps (b1) and (b2) are performed by encountering an external call command as a translator-specific instruction interpreted as an illegal instruction by the subject processor during translation of the subject code, decoding the external call command, and adding to the intermediate representation based on the external call command; and wherein the step (c) comprises executing the corresponding native code unit instead of executing a translated version of the identified subject code unit.
-
-
14. A method of translating subject program code executable by a subject processor into target program code executable by a target processor, said method comprising the steps of:
-
(a) dividing the subject code into a plurality of subject code units; (b) translating one or more of the subject code units into one or more target code units via an intermediate representation; and (c) executing the target code units on the target processor; wherein the step (b) comprises (b1) identifying at least one of the subject code units as having a corresponding native code unit, wherein the native code unit is executable natively by the target processor, and (b2) identifying the native code unit which corresponds to the identified subject code unit; wherein the steps (b1) and (b2) are performed by encountering an external call command as a translator-specific instruction during translation of the subject code, decoding the external call command, and adding to the intermediate representation based on the external call command; wherein the external call commands are variable length instructions including multiple sub-component instructions, and wherein the multiple sub-component instructions include an Escape sub-component instruction that identifies a type of external call command represented by the other sub-component instructions of the external call command, and the step (b) further comprises detecting the Escape sub-component instruction; and wherein the step (c) comprises executing the corresponding native code unit instead of executing a translated version of the identified subject code unit.
-
Specification