opalj/opal

May-alias analysis/domain for Fields and Arrays to improve the escape analysis

errt opened this issue · 0 comments

errt commented

Taken from Bitbucket#176:

In the current escape analysis, more than 90% of all entities are flagged with AtMost(...) (which is currently equivalent to GlobalEscape), because they were stored into arrays or fields.

Consider the following example:

static Object global = null;
void foo() {
Object o = new Object(); // may be local, iff the array arr is local and no read from the array escapes
Object[] arr = new Object[] { o }; // the array is local
Object o2 = arr[0]; // here the three-address code provides no information that o2 might be an alias of o
// global = o2; // would let o escape. if the stmt is omitted, o would not escape.
}
As a first step we would need such a field/array may alias analysis. Afterwards we would need to modify the escape analysis.