preview

Grade Hierarchy Analysis Call Graph

Decent Essays

According to Figure 2.8, node 7, node 8 and node 9 do not have any other predecessors except node 5 & node 6 and by removing non-instantiated methods they become head nodes. So, I should remove these heads from graph and this new graph can be considered as RTA result for the given CHA Call Graph (Figure 2.9).

Figure 2.9: The result of removing head nodes from graph

To clarify this approach, I will use the computed Class Hierarchy Analysis Call Graph from the first example (Figure 2.6) and convert it to RTA. Since set of instantiated classes contains Class B & Class C, according to the algorithm, I have to remove node A.m( ).
Moreover, if I check Call Graph again, I will find that node Interface.( ) has a reflexive edge and it’s indegree=1 . Therefore, this node should be deleted as well.

Figure 2.10 illustrates a conversion from CHA to RTA:

CHA retrieved call graph

Removing non-instantiated node Removing non-connected node

Figure 2.10: CHA to RTA conversion
2.3.3 Class Type Analysis (CTA)
CTA’s main idea is narrowing down the set of reachable methods of a call site b.n( ) inside method A.m( ) by keeping track of "available target types" within class A. Since CTA algorithm is refinement of CHA and RTA, I can reuse CHA or RTA Call Graph result in CTA and decrease the set of reachable methods of a call b.n( ) to make it more precise.
CTA algorithm implementation has three phases:
a) Class Graph Generation
b) Data flow
c) Call Graph Generation
a)

Get Access