Abstract
The goal of points-to analysis for Java is to determine the set of objects pointed to by a reference variable or a reference object field. Improving the precision of practical points-to analysis is important because points-to information has a wide variety of client applications in optimizing compilers and software engineering tools. In this paper we present object sensitivity, a new approach to context-sensitive flow insensitive points-to analysis for Java. The key idea of our approach is to analyze a method separately for each of the objects on which this method is invoked. To ensure flexibility and practicality, we propose a parameterization framework which allows analysis designers to control the cost precision tradeoffs of the object-sensitive analysis. Side-effect analysis determines the memory locations that can be modified by the execution of a program statement. This information is needed for various compiler optimizations and software engineering tools. We present a new form of side-effect analysis for Java which is based on object sensitive points-to analysis. We have implemented one instantiation of our parameterized object-sensitive points-to analysis. We compare this instantiation with a context-insensitive points-to analysis for Java which is based on Andersen’s analysis for C [4]. On a set of 23 realistic Java programs, our experiments show that the two analyses have comparable cost. In some cases the object-sensitive analysis is actually faster than the context sensitive analysis. Our results also show that object sensitivity significantly improves the precision of side-effect analysis, call graph construction, and virtual call resolution. Our empirical results demonstrate that object-sensitive analyses are capable of achieving significantly better precision than context-insensitive ones, while at the same time remaining efficient and practical. Thus, object-sensitive analysis is a better candidate for a relatively precise, practical, general-purpose points-to analysis for Java.