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. In this paper we present a points-to analysis for Java based on Andersen’s points-to analysis for C [5]. Andersen’s analysis can be implemented efficiently by using systems of set-inclusion constraints and by employing several techniques for constraint representation and resolution. We extend these techniques to efficiently represent and solve systems of annotated inclusion constraints. The annotations play two roles in our analysis. Method annotations are used to model precisely and efficiently the semantics of virtual calls. Field annotations allow us to distinguish between different fields of an object. In addition, our analysis keeps track of all reachable methods and avoids analyzing irrelevant library code. We evaluate the performance of the analysis on a large set of realistic Java programs. Our experiments show that the analysis runs in practical time and space, and has significant impact on call graph construction, virtual call resolution, synchronization removal, stack-based object allocation, and object read-write information. The results show that our analysis is a realistic candidate for a relatively precise, practical, general-purpose points-to analysis for Java.