Static and Dynamic analysis of the call Chains in Java
- Abstract
This work present a parameterized the framework for static and dynamic analysis of the call chain in Java components.
- Introduction
- The designers of a call chain analysis has to address several important issues;
- How to ensure this analysis reports few infeasible chains?
- The results should represent the set of call chains in a compact manner;
- The analysis should employ mechanisms for controlling the number of reported chains;
- Different levels of call edge granularity should is supported (an edge may either represent a relationship "invokes", Or a finer-grain relationship call site inside invokes);
- A dynamic call chain analysis takes as input a set of call chains computed by some static call chain analysis;
- It should instrument only the component of interest, and is not other components of this interact with it;
- It should identify and ignore run-time events that is not relevant to the given static call chains;
- It should handle correctly the potential interactions between the instrumented and the non-instrumented parts of the Progr Am.
- Analysis Framework
- This are designed based on a data structure which is generalized form of a calling context tree;
- 1) Call graph construction algorithm; 2) Granularity of call graph edges; 3) mechanism for choosing "interesting" chains, and (4) handling of recursion.
- This parameterization allows various uses of the approach in software tools;
- This empirical study addresses the key questions:
- What exactly are the imprecision in the chains computed using popular class analyses such as Rapid Type analysis A nd andersen-style points-to analysis?
- What's the limits of call chain precision for all class analyses-that's, how much call chain infeasibility wo Uld remain even if the "most powerful" class analysis were available.
- Static Analysis
- Each Non-abstract method in the component was represented by a graph node.
- Call graphs represent different kinds of relationships:
- Method invokes method;
- Call site inside invokes;
- Call site inside invokes in an instance of.
- Our static and dynamic analyses is designed for the last choice from the list; Therefore, we assume that each call graph edge was labeled with a pair of a call site and a receiver class.
- Artificial node caller is a abstraction of all external callers of the component, and Artificial node callee is a abstraction of any external code, called by the component.
- Calling Context Trees
- The root of the tree represents the starting point of the program, and each tree node n represents a particular C All chain containing n , and all of it ancestors in the tree.
- We associate a separate calling context tree with each entry method in the component. In the Component-level call graph, a entry method has a incoming artificial edge which shows that the method Ma Y is called by non-component code.
- Tree Construction
- label (e) is used to denote the pair of a call site and a receiver class associated with call graph edge.
- createnewchild (t, M ', label (e)): Creates a new tree node attached to, and the link is tagged as. <//build the link between to T, M was entry method which is associated with t>
- To avoid infeasible chain, this approach use a simple test:for any call through this, the receiver class associated with E should match the receiver class associated with the last edge in chain.
- use-backedges: Creating a Back-edge from a tree node to some ancestor of this node. In addition, if use-backedges is true, we have an analysis uses the same approach (lines). the call to Createnewbackedge on line 8 traverses the ancestors of T, finds the ancestor node T ' that Correspo NDS to M ', and creates a Backedge from T-T ' labeled with label (e). If the flag is false, recursion are unrolled until the stopping criterion indicates that no further unrolling is necessary.
- Dynamic Analysis
- Instrumentation
- (1) We need instrumentation at the beginning and at the returns for each entry method. This instrumentation creates Run-time events of the form entered (m) and exited (m), W Here M was an entry method.
- (2) We need instrumentation immediately before and immediately after certain call sites. <!--for a call site C, the generated Run-time events is before(c, x) and after (c, X), wher E Xis the class of the receiver object .>
- (3) If C is a call to a static method, we use X = none. Call site instrumentation are needed only for call sites this correspond to edges on the input forest, and for call sites T Hat has outgoing call edges to Non-component code.
- (4)