Method and apparatus for native method calls
AssigneeInternational Business Machines Corporation
InventorsQiming Teng, Feng Wang, Haichuan Wang, Xiao Zhong
Life of this patent
Estimating the term…
Abstract
A method and apparatus for a native method call. The method comprises: generating, in response to a native method call-associated event, a template copy from a generic template for processing the native method call; filling information required for processing the native method call in corresponding locations in the template copy; and changing a code execution flow to execute the template copy. When a native method is called, the native method is processed by dynamically inserting the template copy in the execution path at the assembly level.
Claims18
A method, implemented in an electronic data processing system, for profiling a native method call, comprising the steps of:
- generating a profiling template copy from a generic profiling template for profiling the native method call, in response to a native method call-associated event, the profiling template copy comprises an epilog template copy for profiling after the native method call is completed;
- filling information required for profiling the native method call in corresponding locations in the profiling template copy;
- and
- changing a code execution flow to execute the profiling template copy
- replacing a return address of the native method call with an address of the epilog template copy before executing the native method call, so that the epilog template copy is executed after the native method call is completed;
- and
- using the epilog template copy for performing the steps of (i) executing an epilog profiling for the native method call and (ii) restoring the return address of the native method call to return to the calling method which calls the native method after executing the epilog template copy.
A computer program product embodied in a non-transitory computer readable storage medium comprising:
- computer readable program codes coupled to the non-transitory computer readable storage medium for profiling a native method call, the computer readable program codes configured to cause the program to:
- generate a profiling template copy from a generic profiling template for profiling the native method call, in response to a native method call-associated event, the profiling template copy including an epilog template copy for profiling after the native method call is completed;
- fill information required for profiling the native method call in corresponding locations in the profiling template copy;
- and
- change a code execution flow to execute the profiling template copy
- replace a return address of the native method call with an address of the epilog template copy before executing the native method call, so that the epilog template copy is executed after the native method call is completed;
- and
- use the epilog template copy for performing the steps of (i) executing an epilog profiling for the native method call and (ii) restoring the return address of the native method call to return to the calling method which calls the native method after executing the epilog template copy.
Dependencies are inferred from the claim text.