Method for accurately extracting library-based object-oriented applications
First Claim
1. A method for analyzing an object-oriented program implementing reflection comprising a plurality of components, the method comprising the steps of:
- providing data including at least one conditional directive, wherein the conditional directive specifies i) a condition associated with a first set of components, and ii) a second set of components that are to be classified as live if the condition is satisfied, wherein the plurality of components comprise classes, methods, and fields;
determining whether a given class is live when the given class may be instantiated by refection during any execution of the program;
determining whether a given method is live when the given method may be called by refection during any execution of the program;
determining whether a given field is live when the given field may be accessed by refection during any execution of the program; and
generating data identifying components that are live based upon the conditional directive.
1 Assignment
0 Petitions
Accused Products
Abstract
The present invention is capable of accurately extracting multiple applications with respect to a class library. The invention relies on a configuration file for an application program and/or library, which describes how program components in the program/library should be preserved under specified conditions. The invention may be used in application extraction tools, and in tools that aim at enhancing performance using whole-program optimizations. The invention may be used as an optimization to reduce application size by eliminating unreachable methods. In the alternative, the invention may be used as a basis for optimizations that reduce execution time (e.g., by means of call devirtualization), and as a basis for tools for program understanding and debugging.
68 Citations
20 Claims
-
1. A method for analyzing an object-oriented program implementing reflection comprising a plurality of components, the method comprising the steps of:
-
providing data including at least one conditional directive, wherein the conditional directive specifies i) a condition associated with a first set of components, and ii) a second set of components that are to be classified as live if the condition is satisfied, wherein the plurality of components comprise classes, methods, and fields;
determining whether a given class is live when the given class may be instantiated by refection during any execution of the program;
determining whether a given method is live when the given method may be called by refection during any execution of the program;
determining whether a given field is live when the given field may be accessed by refection during any execution of the program; and
generating data identifying components that are live based upon the conditional directive. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
(a) constructing an initial call graph of the program;
(b) extending the call graph using information about components that have been classified as live;
(c) extending the call graph using the conditional directive; and
(d) identifying in the program any component that is classified as live;
where steps (b), (c), and (d) are preferably performed repeatedly until no further components are added to the call graph.
-
-
3. The method of claim 2, wherein the condition associated with the first set of components is based upon usefulness of the first set of components during any execution of the program.
-
4. The method of claim 3, wherein the condition associated with the first set of components is satisfied if at least one component in the first set of components is used during any execution of the program.
-
5. The method of claim 1, further comprising the step of generating a representation of the program based upon the data.
-
6. The method of claim 5, wherein the representation of the program omits components that are determined not to be live.
-
7. The method of claim 1, further comprising the step of identifying at least one component of the program that is live, and reporting the at least one component to a user via a graphical user interface.
-
8. The method of claim 1, wherein the first set of components include components that are part of a library used by the program.
-
9. The method of claim 1, wherein the data including at least one conditional directive is derived from at least two distinct files, wherein one of the distinct files is associated with program, and wherein another of the distinct files is associated with the library.
-
10. The method of claim 1, wherein one of the distinct files includes an import directive that provides a mechanism to import directives from another file.
-
11. A program storage device readable by a machine, tangibly embodying a series of instructions executable by the machine to perform method steps for analyzing an object-oriented program implementing reflection comprising a plurality of components, the method steps comprising:
-
providing data including at least one conditional directive, wherein the conditional directive specifies i) a condition associated with a first set of components, and ii) a second set of components that are to be classified as live if the condition is satisfied, wherein the plurality of components comprise classes, methods, and fields;
determining whether a given class is live when the given class may be instantiated by refection during any execution of the program;
determining whether a given method is live when the given method may be called by refection during any execution of the program;
determining whether a given field is live when the given field may be accessed by refection during any execution of the program; and
generating data identifying components that are live based upon the conditional directive. - View Dependent Claims (12, 13, 14, 15, 16, 17, 18, 19, 20)
(a) constructing an initial call graph of the program;
(b) extending the call graph using information about components that have been classified as live;
(c) extending the call graph using the conditional directive; and
(d) identifying in the program any component that is classified as live;
where steps (b), (c), and (d) are preferably performed repeatedly until no further components are added to the call graph.
-
-
13. The program storage device of claim 12, wherein the condition associated with the first set of components is based upon usefulness of the first set of components during any execution of the program.
-
14. The program storage device of claim 13, wherein the condition associated with the first set of components is satisfied if at least one component in the first set of components is used during any execution of the program.
-
15. The program storage device of claim 11, further comprising the step of generating a representation of the program based upon the data.
-
16. The program storage device of claim 15, wherein the representation of the program omits components that are determined not to be live.
-
17. The program storage device of claim 11, further comprising the step of identifying at least one component of the program that is live, and reporting the at least one component to a user via a graphical user interface.
-
18. The program storage device of claim 11, wherein the first set of components include components that are part of a library used by the program.
-
19. The program storage device of claim 11, wherein the data including at least one conditional directive is derived from at least two distinct files, wherein one of the distinct files is associated with program, and wherein another of the distinct files is associated with the library.
-
20. The program storage device of claim 11, wherein one of the distinct files includes an import directive that provides a mechanism to import directives from another file.
Specification