Browse Prior Art Database

Introducing Aspects to Java Programs without a Custom JVM or Application Source Modification

IP.com Disclosure Number: IPCOM000015958D
Original Publication Date: 2002-Oct-16
Included in the Prior Art Database: 2003-Jun-21
Document File: 2 page(s) / 45K

Publishing Venue

IBM

Abstract

The main idea of this invention is to provide for aspect orientated alteration of running java programs via their manipulation by the use of the 'standard' Java** Virtual Machine Profiler Interface (JVMPI) interface. This allows dynamic, selective injection of performance instrumentation without a prior off-line preparation of object code.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 52% of the total text.

Page 1 of 2

  Introducing Aspects to Java Programs without a Custom JVM or Application Source Modification

The main idea of this invention is to provide for aspect orientated alteration of running java programs via their manipulation by the use of the 'standard' Java** Virtual Machine Profiler Interface (JVMPI) interface. This allows dynamic, selective injection of performance instrumentation without a prior off-line preparation of object code.

    The JVMPI class load hook is present and supported in 1.2-onwards JVMs** derived from the Sun Classic and Hotspot reference codebases. As such it is available in most current JVMs. The class load hook is designed to allow load time modification of class files, but to date this has only been used to inject performance profiling code rather than aspect oriented instrumentation.

    To create a JVM based profiter which introduces aspect oriented instrumentation the profiler would enable the JVMPI_EVENT_CLASS_LOAD_HOOK after obtaining the JVMPTI interface. Code may then be added to a function for handling event notification as follows:

..

case JVMPI_EVENT_CLASS_LOAD_HOOK:

aspectifyClass( aspects, &(event->u.class_load_hook));

break;

A sample profiling agent is available from Sun Microsystems Inc., see the JVMPTI specification (http://java.sun.com/j2se/1.3/docs/guide/jvmpi.html).

aspectifyClass( ){

.. Here there would be (typically C/C++ - note ) code to modify the loaded class file data in unsigned char *class_data and return the new data and size in *new_class_data and new_class_data_len of the class_load_hook data structure. To successfully apply modifications, the programmer will need to be familiar with structure (documented in the Java Virtual Machine Specification, Lindholm, Yellin ) and manipulation of Java class files. A discussion of byte...