Runtime Data Analysis for Java Programs Andrew Cain, Jean-Guy Schneider, Doug Grant and Tsong Yueh Chen Swinburne University of Technology School of Information Technology P.O. Box 218, Hawthorn, Victoria 3122, Australia {acain,jschneider,dgrant,tychen}@it.swin.edu.au Abstract Program analysis plays a key role in many areas of software development, such as per- formance tuning, testing, debugging, and maintenance. Program analysis can be carried out statically or dynamically, and these two approaches are generally seen as being complementary to each other. In this paper, we will focus on runtime data analysis for object oriented systems in general and the Java 2 platform in particular. More specifically, we are investigating various runtime approaches to monitor the access and modification of variables in a Java program in order to keep track of the their usage history, being of particular interest for dynamic data flow analysis. Our results indicate that the Java 2 platform does not provide sufficient tools to enable comprehensive runtime data analysis in this context, especially when the complete source code of an application under investigation is unavailable. 1 Introduction Data flow analysis is a technique traditionally used by compilers for code optimization [1], but it has also shown to be a useful technique in other areas, such as performance tuning, testing, debugging, and maintenance. Data flow analysis can be performed either statically or dynamically, and these two approaches are generally seen to be complementary. Static analysis can ensure that all paths within the code are examined, though it is difficult to analyze the use of individual array elements, pointers, and, in the case of object oriented systems, objects. A dynamic approach can only examine program paths covered by the respective input data, but can provide more exact information on the use of objects, individual array elements, and pointers. In order to perform a comprehensive runtime data flow analysis, it is, amongst others, necessary to obtain accurate runtime information about the access and modification of each program variable under investigation. This can in general not be completely done in a generic way as languages may support different data interaction models. In this paper, we will focus on technical aspects related to retrieving runtime information required to perform dynamic data flow analysis in the context of the Java 2 platform [10]. As discussed in Section 6, our results are not only applicable to dynamic data flow analysis, but to also other areas where runtime data analysis is required. The remainder of this paper is organized as follows: in Section 2, we briefly introduce the concepts of dynamic data flow analysis, followed by a discussion of previous approaches to per- forming data flow analysis for object oriented programs (Section 3). In Section 4, we present a set of requirements for performing comprehensive dynamic data flow analysis for Java. Section 5 presents different approaches that can be taken to retrieve runtime data flow information for Java programs. We conclude in Section 6 with our main observations and outline future directions. 1