I am trying to understand static analysis of Java bytecode/source-code.
These terms frequently come up for which I am not able to find satisfactory definitions on the Internet:
- context (in)sensitive analysis
- calling context
- active call site
- points-to analysis
Can anyone please elaborate in layman terms what the above terms mean in the context of Java.
A search of "context" "programming" on Google brings up stuff about context sensitive grammar, language theory, etc., but not the definitions I need (unless they mean the same thing).
Points-to Analysis (or reference analysis in the context of Java) would try to infer at compile-time what all objects a pointer may be pointing to at run-time. This is sound, but approximate.
A context-sensitive (CS) points-to analysis takes into account the calling context of a function while analyzing a function. For the program below, a CS points-to analysis can infer that x and z have different points-to information, i.e., they point to different objects, if y and w point to different objects.
main() {
x = foo(y);
z = foo(w);
}
foo (a) {
return a;
}
In contrast, a context-insensitive (CI) analysis would not distinguish between the calling contexts and (imprecisely, but soundly) infer that x and z may alias (or may point to the same object).
Calling context is a sequence of call-sites in which the current (invocation of current) function appears. In the example, foo has two calling contexts, one at the first call-site from main and the second at line 2 of main. Active call-site is the one which you are analyzing.