Method and apparatus for transforming Java Native Interface function calls into simpler operations during just-in-time compilation
First Claim
1. A computer-implemented method in a data processing system for transforming native interface function calls into simpler operations during just-in-time (JIT) compilation, the computer-implemented method comprising:
- generating a list of shapes rendered in an intermediate language of a JIT compiler and representing a plurality of native interface function calls, wherein the generated list of shapes comprises intermediate representation of the plurality of native interface function calls and usage of a native interface environment variable and user arguments by the plurality of native function calls;
identifying a list of native interface function calls for possible transformation by matching the plurality of native interface function calls made in the native language program against the generated list of shapes;
determining, for each of the list of identified native interface function calls, if the native interface environment variable is used in a same manner as in a shape in the list of generated shapes;
responsive to the native interface environment variable being used in the same manner as a shape in the generated list of shapes, determining is a match exists between the shape and an intermediate representation of the native interface function call,wherein a match exists if the intermediate representation of the native interface function call has a same number of arguments and each argument in the native interface function call is compatible with a type of argument in the shape;
responsive to a match existing between the shape and the intermediate representation of the native interface function call, adding the native interface function call to the list of native interface function calls,wherein the list of native interface function calls is sorted in an order of appearance in the intermediate representation of the plurality of native interface function calls;
performing a definition and use analysis on each native interface function call in the list of identified native interface function calls by tracking a plurality of values passed as parameters to a plurality of arguments of native interface functions, wherein the definition and use analysis included tracking a plurality of objects passed to the list of native interface function calls to point where the plurality of objects are passed as arguments to a native interface function;
determining if the definition and use analysis returns a conclusive result; and
responsive to the definition and use analysis returning a conclusive result, determining a type of the native interface function call; and
transforming a portion of the list of native interface function calls into one of a constant value, an internal JIT compiler operation, and a simpler intermediate representation based on a result of the definition and use analysis.
1 Assignment
0 Petitions
Accused Products
Abstract
A method and apparatus for transforming JAVA Native Interface function calls to constants, internal just-in-time (JIT) compiler operations or simpler intermediate representation. A compiler generates a plurality of intermediate representations for a plurality of native interface function calls. During inlining of native code, matching is performed on each native function call (against this list) and a list of native interface function calls is generated. For each native interface function call, a (JIT) call transformer attempts to replace the native interface function call with a constant, internal JIT compiler operation or a simpler intermediate representation depending on the type of native interface function call.
-
Citations
3 Claims
-
1. A computer-implemented method in a data processing system for transforming native interface function calls into simpler operations during just-in-time (JIT) compilation, the computer-implemented method comprising:
-
generating a list of shapes rendered in an intermediate language of a JIT compiler and representing a plurality of native interface function calls, wherein the generated list of shapes comprises intermediate representation of the plurality of native interface function calls and usage of a native interface environment variable and user arguments by the plurality of native function calls; identifying a list of native interface function calls for possible transformation by matching the plurality of native interface function calls made in the native language program against the generated list of shapes; determining, for each of the list of identified native interface function calls, if the native interface environment variable is used in a same manner as in a shape in the list of generated shapes; responsive to the native interface environment variable being used in the same manner as a shape in the generated list of shapes, determining is a match exists between the shape and an intermediate representation of the native interface function call, wherein a match exists if the intermediate representation of the native interface function call has a same number of arguments and each argument in the native interface function call is compatible with a type of argument in the shape; responsive to a match existing between the shape and the intermediate representation of the native interface function call, adding the native interface function call to the list of native interface function calls, wherein the list of native interface function calls is sorted in an order of appearance in the intermediate representation of the plurality of native interface function calls; performing a definition and use analysis on each native interface function call in the list of identified native interface function calls by tracking a plurality of values passed as parameters to a plurality of arguments of native interface functions, wherein the definition and use analysis included tracking a plurality of objects passed to the list of native interface function calls to point where the plurality of objects are passed as arguments to a native interface function; determining if the definition and use analysis returns a conclusive result; and responsive to the definition and use analysis returning a conclusive result, determining a type of the native interface function call; and transforming a portion of the list of native interface function calls into one of a constant value, an internal JIT compiler operation, and a simpler intermediate representation based on a result of the definition and use analysis.
-
-
2. A data processing system for transforming native interface function calls into simpler operations during just-in-time (JIT) compilation, the data processing system comprising:
- a processor and a memory communicatively coupled to the processor, the memory storing instructions comprising;
a JIT compiler that generates a list of shapes rendered in an intermediate language of a JIT compiler for a plurality of native interface function calls, wherein the generated list of shapes comprises an intermediate representation of the plurality of native interface function calls and includes usage of a native interface environment variable and user arguments by the plurality of native function calls, a JIT compiler inliner that identifies, from the generated list of shapes, a list of native interface function calls for possible transformation and determines, for each native interface function call of the list of identified native function calls, if the native interface environment variable is used in a same manner as in a shape in the list of generated shapes; and responsive to the native interface environment variable being used in the same manner as in a shape in the generated list of shapes, the JIT compiler inliner determining if a match exists between the shape and an intermediate representation of the native function call, wherein a match exists if the intermediate representation of the native interface function call has a same number of arguments and each argument in the native interface function call is compatible with a type of argument in the shape; and responsive to a match existing between the shape and the intermediate representation of the native interface function call, the JIT compiler inliner adding the native interface function call to the list of native interface function calls, wherein the list of native interface function calls is sorted in an order of appearance in the intermediate representation of the plurality of native interface function calls; wherein the JIT compiler performs a definition and use analysis on the list of native interface function calls and a plurality of arguments passed to the native interface functions, the JIT compiler tracking a plurality of objects passed to the list of native interface function calls to point where the plurality of objects are passed as arguments to a native interface function after the list of native interface function calls is identified; and a JIT call transformer that transforms a portion of the list of native interface function calls into one of a constant value, an internal JIT compiler operation and a simpler intermediate representation based on a result of the definition and use analysis.
- a processor and a memory communicatively coupled to the processor, the memory storing instructions comprising;
-
3. A computer program product comprising a computer recordable medium including executable instructions that transform native interface function calls into simpler operations during just-in-time (JIT) compilation, the computer program product comprising:
-
first executable instructions generating a list of intermediate representation shapes representing a plurality of native interface function calls, wherein the generated list of shapes comprises an intermediate representation of the plurality of native interface function calls and includes usage of a native interface environment variable and user arguments by the plurality of native interface function calls; second executable instructions identifying a list of native interface function calls for possible transformation by matching the plurality of native interface function calls made in the native language program against the generated list of shapes, the second executable instructions further comprising; first executable sub-instructions determining, for each of the list of identified native interface function calls, if the native interface environment variable is used in a same manner as in a shape in the list of generated shapes; and
responsive to the native interface environment variable being used in the same manner as a shape in the generated list of shapes,second executable sub-instructions determining if a match exists between the shape and an intermediate representation of the native interface function call, wherein a match exists if the intermediate representation of the native interface function call has a same number of arguments and each argument in the native interface function call is compatible with a type of argument in the shape; and
responsive to a match existing between the shape and the intermediate representation of the native interface function call,third executable sub-instructions adding the native interface function call to the list of native interface function calls, wherein the list of native interface function calls is sorted in an order of appearance in the intermediate representation of the plurality of native interface function calls; third executable instructions performing a definition and use analysis on each of the list of identified native interface function calls by tracking a plurality of values passed as parameters to a plurality of arguments of native interface functions, the third executable instructions further comprising; fourth executable sub-instructions tracking a plurality of objects passed to the list of native interface function calls to point wherein the plurality of objects are passed as arguments to a native interface function after the list of native interface function calls is identified, wherein the definition and use analysis determines what variables are defined and where the defined variables are used; and fourth executable instructions transforming a portion of the list of native interface function calls into one of a constant value, an internal JIT compiler operations and a simpler intermediate representation based on a result of the definition and use analysis.
-
Specification