Skip to content
Manu Sridharan edited this page Oct 7, 2021 · 3 revisions

The CallGraph class represents potentially context-sensitive call graphs, via a logical cloning of methods. Each call graph node (CGNode) represents a method IMethod in a Context.

So what's a Context? Basically, a Context is just a name for a clone of an IMethod. For context-insensitive call graphs, note the special Context Everywhere.EVERYWHERE. This will be used as a default context in context-insensitive algorithms.

Note that for a given IMethod, a context-sensitive call graph may have many nodes (contexts) representing the method. You can get all these nodes using the method CallGraph.getNodes(MethodReference m)

WALA supports a family of on-the-fly call graph construction algorithms, integrated with flow-insensitive pointer analysis. See Pointer Analysis for more details. WALA also has an implementation of call-graph construction via rapid type analysis (see Util.makeRTABuilder()), but its use is strongly discouraged. The included 0-CFA analysis (see Pointer Analysis) is almost always faster and more precise. Furthermore, RTA operates on bytecodes, some of which may be proved dead during SSA construction and hence not represented in the SSA IR. This can lead to undesirable behaviors like call sites returned by the RTA call graph that do not appear in the SSA IR. Finally, note that models of native methods like Object.clone() in the RTA call graph are "sound enough" to ensure that the call graph includes all reachable code but may be unsound otherwise.