Instrumentation of standard libraries in object-oriented languages: the twin class hierarchy approach

Code instrumentation is widely used for a range of purposes that include profiling, debugging, visualization, logging, and distributed computing. Due to their special status within the language infrastructure, the <i>standard class libraries</i>, also known as <i>system classes</i> provided by most contemporary object-oriented languages are difficult and sometimes impossible to instrument. If instrumented, the use of their rewritten versions within the instrumentation code is usually unavoidable. However, this is equivalent to `instrumenting the instrumentation', and thus may lead to erroneous results. Consequently, most systems avoid rewriting system classes. We present a novel instrumentation strategy that alleviates the above problems by renaming the instrumented classes. The proposed approach does not require any modifications to the language, compiler or runtime. It allows system classes to be instrumented both statically and dynamically. In fact, this is the first technique that enables dynamic instrumentation of Java system classes without modification of any runtime components. We demonstrate our approach by implementing two instrumentation-based systems: a memory profiler and a distributed runtime for Java.

[1]  Urs Hölzle,et al.  Load-Time Adaptation: Efficient and Non-Intrusive Language Extension for Virtual Machines , 1999 .

[2]  Shigeru Chiba,et al.  A Bytecode Translator for Distributed Execution of "Legacy" Java Software , 2001, ECOOP.

[3]  Urs Hölzle,et al.  Binary Component Adaptation , 1997, ECOOP.

[4]  Markus Dahm,et al.  Byte Code Engineering , 1999, Java-Informations-Tage.

[5]  Yannis Smaragdakis,et al.  J-Orchestra: Automatic Java Application Partitioning , 2002, ECOOP.

[6]  Günter Kniesel,et al.  JMangler - a framework for load-time transformation of Java class files , 2001, Proceedings First IEEE International Workshop on Source Code Analysis and Manipulation.

[7]  Shigeru Chiba,et al.  Load-Time Structural Reflection in Java , 2000, ECOOP.

[8]  Assaf Schuster,et al.  JavaSplit: a runtime for execution of monolithic Java programs on heterogenous collections of commodity workstations , 2003, 2003 Proceedings IEEE International Conference on Cluster Computing.

[9]  Geoff A. Cohen,et al.  Automatic Program Transformation with JOIE , 1998, USENIX Annual Technical Conference.

[10]  Martin D. Westhead,et al.  A benchmark suite for high performance Java , 2000, Concurr. Pract. Exp..