The observer effect of profiling on dynamic Java optimizations
Java differs from many common programming languages in that Java programs are first compiled to platform-independent bytecode. Java bytecode is run by a program called the Java Virtual Machine (JVM). Because of this approach, Java programs are often optimized dynamically (i.e. at run-time) by the JVM. A just-in-time compiler (JIT) is a part of the JVM that performs dynamic optimizations. Our research goal is to be able to detect and study dynamic optimizations performed by a JIT using a profiler. A profiler is a programming tool that can track the performance of another program. A challenge for use of profilers for Java is a possible interaction between the profiler and the JVM, since the two programs are running at the same time. We show that profiling a Java program may disable some dynamic optimizations as a side effect in order to record information about those methods. In this paper we examine interactions between a profiler and dynamic optimizations by studying the information collected by the profiler and program run-time measurements without and without profiling. We use Java HotSpotTMJVM by SunMicrosystems as a JVM with an embedded JIT and HPROF profiling tool. The paper details the testing methodology and presents the results and the conclusions.