-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
5.0
-
generic
-
generic
Name: kbR10066 Date: 11/05/2003
JVMTI spec encourages developers to use the bytecode instrumentation
technique to implement custom events/features (Introduction/bytecode instrumentation):
This interface does not include some events that one might expect in an
interface with profiling support. Some examples include object allocation
events and full speed method enter and exit events. The interface instead
provides support for bytecode instrumentation, the ability to alter the Java
virtual machine bytecode instructions which comprise the target program.
Typically, these alterations are to add "events" to the code of a method - for
example, to add, at the beginning of a method, a call to
MyProfiler.methodEntered()
But inserting new instructions into existing bytecode generally requires some
not very trivial updates to the existing instructions which are always the same.
For example, branch target pc re-calculation. And every developer who uses
BCI will have to write the (same) code which will perform the "update".
It would be helpful to provide some general programmatic model of method's byte
code providing necessary data structures and implementations of most common
BCI-related tasks. Apparently, many JVMTI implementations themselves will
use BCI to implement some parts of the interface. So it seems that providing the
requested model would cost them minimal efforts.
If such model is too much to require support of from all JVM/JVMTI implementors,
this could be made an optional part of the spec.
Going further, complete C/C++ interface to the class file model would also be
welcome :)
======================================================================
JVMTI spec encourages developers to use the bytecode instrumentation
technique to implement custom events/features (Introduction/bytecode instrumentation):
This interface does not include some events that one might expect in an
interface with profiling support. Some examples include object allocation
events and full speed method enter and exit events. The interface instead
provides support for bytecode instrumentation, the ability to alter the Java
virtual machine bytecode instructions which comprise the target program.
Typically, these alterations are to add "events" to the code of a method - for
example, to add, at the beginning of a method, a call to
MyProfiler.methodEntered()
But inserting new instructions into existing bytecode generally requires some
not very trivial updates to the existing instructions which are always the same.
For example, branch target pc re-calculation. And every developer who uses
BCI will have to write the (same) code which will perform the "update".
It would be helpful to provide some general programmatic model of method's byte
code providing necessary data structures and implementations of most common
BCI-related tasks. Apparently, many JVMTI implementations themselves will
use BCI to implement some parts of the interface. So it seems that providing the
requested model would cost them minimal efforts.
If such model is too much to require support of from all JVM/JVMTI implementors,
this could be made an optional part of the spec.
Going further, complete C/C++ interface to the class file model would also be
welcome :)
======================================================================