Optimizing type-specific instrumentation on the JVM with reflective supertype information. (December 2018) - Rosà, Andrea; Binder, Walter
Abstract : highlights: We allow inspecting reflective supertype information during instrumentation. We allow reification of classloader namespaces in an instrumentation process. We enable speedups up a factor of 6.24x for dynamic analyses with full code coverage. Abstract: Reflective supertype information (RSI) is useful for many instrumentation-based type-specific analyses on the Java Virtual Machine (JVM). On the one hand, while such information can be obtained when performing the instrumentation within the same JVM process executing the instrumented program, in-process instrumentation severely limits the bytecode coverage of the analysis. On the other hand, performing the instrumentation in a separate process can achieve full bytecode coverage, but complete RSI is generally not available, often requiring the insertion of expensive runtime type checks in the instrumented program. In this article, we present a novel technique to accurately reify complete RSI in a separate instrumentation process. This is challenging, because the observed application may make use of custom classloaders and the loaded classes in one application execution are generally only known upon termination of the application. We implement our technique in an extension of the dynamic analysis framework DiSL. The resulting framework guarantees full bytecode coverage, while providing RSI. Evaluation results on a task profiler demonstrate that our technique can achieve speedups up to a factor of 6.24× wrt. resorting to runtime type checks in the instrumentation code for an analysis with full bytecode coverage.