Dynamic 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:
- (a) dividing the subject program code into a plurality of subject program code units;
(b) translating one or more of the subject program code units into one or more target program code units using a translator executing on the target processor interleaved with execution of the target program code by the target processor; and
(c) executing the one or more target program code units on the target processor;
wherein the step (b) further comprises dynamically identifying, by the translator at run-time while the target program code is executing on the target processor, whether at least one of the subject program code units has a corresponding native code unit which is executable natively by the target processor, and, if so, identifying the native code unit which corresponds to the identified subject program code unit, wherein the identified subject program code unit corresponds to a subject function and the identified native code unit corresponds to a native function; and
wherein the step (c) further comprises executing the corresponding native code unit instead of executing a translated version of the identified subject program code unit comprising;
transforming in target code all subject register values from the target code representation to the native code representation;
invoking from target code a native code call stub function with the transformed subject register values according to a uniform call stub interface; and
invoking from the native code call stub function the native function with particular subject register values and/or parameter stack according to a prototype of the native function.
4 Assignments
0 Petitions
Accused Products
Abstract
A native binding technique is provided for insetting 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.
22 Citations
32 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:
-
(a) dividing the subject program code into a plurality of subject program code units; (b) translating one or more of the subject program code units into one or more target program code units using a translator executing on the target processor interleaved with execution of the target program code by the target processor; and (c) executing the one or more target program code units on the target processor; wherein the step (b) further comprises dynamically identifying, by the translator at run-time while the target program code is executing on the target processor, whether at least one of the subject program code units has a corresponding native code unit which is executable natively by the target processor, and, if so, identifying the native code unit which corresponds to the identified subject program code unit, wherein the identified subject program code unit corresponds to a subject function and the identified native code unit corresponds to a native function; and wherein the step (c) further comprises executing the corresponding native code unit instead of executing a translated version of the identified subject program code unit comprising; transforming in target code all subject register values from the target code representation to the native code representation; invoking from target code a native code call stub function with the transformed subject register values according to a uniform call stub interface; and invoking from the native code call stub function the native function with particular subject register values and/or parameter stack according to a prototype of the native function. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30)
-
-
31. A computer-readable storage medium having translator software resident thereon in the form of computer-readable code executable by a computer to translate subject program code executable by a subject processor into target program code executable by a target processor, wherein the translator software performs the steps of:
-
(a) dividing the subject program code into a plurality of subject program code units; (b) translating one or more of the subject program code units into one or more target program code units using a translator executing on the target processor interleaved with execution of the target program code by the target processor; and (c) executing the one or more target program code units on the target processor; wherein the step (b) further comprises dynamically identifying, by the translator at run-time while the target program code is executing on the target processor, whether at least one of the subject program code units has a corresponding native code unit which is executable natively by the target processor, and, if so, identifying the native code unit which corresponds to the identified subject program code unit, wherein the identified subject program code unit corresponds to a subject function and the identified native code unit corresponds to a native function; and wherein the step (c) further comprises executing the corresponding native code unit instead of executing a translated version of the identified subject program code unit comprising; transforming in target code all subject register values from the target code representation to the native code representation; invoking from target code a native code call stub function with the transformed subject register values according to a uniform call stub interface; and invoking from the native code call stub function the native function with particular subject register values and/or parameter stack according to a prototype of the native function.
-
-
32. A computer apparatus, comprising:
-
a target processor; and a memory arranged to store a subject program code executable by a subject processor, and a translator code to translate the subject program code into a target program code that is executed by the target processor, including performing the steps of; (a) dividing the subject program code into a plurality of subject program code units; (b) translating one or more of the subject program code units into one or more target program code units using a translator executing on the target processor interleaved with execution of the target program code by the target processor; and (c) executing the one or more target program code units on the target processor; wherein the step (b) further comprises dynamically identifying, by the translator at run-time while the target program code is executing on the target processor, whether at least one of the subject program code units as having a corresponding native code unit which is executable natively by the target processor, and identifying the native code unit which corresponds to the identified subject program code unit, wherein the identified subject program code unit corresponds to a subject function and the identified native code unit corresponds to a native function; and wherein the step (c) further comprises executing the corresponding native code unit instead of executing a translated version of the identified subject program code unit comprising; transforming in target code all subject register values from the target code representation to the native code representation; invoking from target code a native code call stub function with the transformed subject register values according to a uniform call stub interface; and invoking from the native code call stub function the native function with particular subject register values and/or parameter stack according to a prototype of the native function.
-
Specification