JVMTI and instrumentation

Michael Rasmussen michael.rasmussen at zeroturnaround.com
Tue Dec 1 22:08:26 UTC 2015


Are there any plans to support setting -Xpatch from JVMTI in OnLoad
phase, or even setting the "jdk.launcher.patchdirs" system property,
and have it take effect? (Also applies to the other module -X options)

Agent_OnLoad should is still so early in the process that it should
be possible to influence these things; but I assume agent support has
been a very low priority?


I'm trying to patch java.base, so trying to influence where classes are
loaded from before module system is initialized in System.initPhase2()

Tried setting "jdk.launcher.patchdirs", but got a JVMTI error that
it wasn't available to set at that time, also tried adding -Xpatch,
so the property was present, and then modifying it in OnLoad phase,
but still didn't take effect (java.base classes were still loaded from
original location, and not from patch location).


Also, the JVMTI function AddToBootstrapClassLoaderSearch seems to be
not functioning correctly at the moment. I'm currently using it to add
the java part of my agent to the bootclasspath, for it to be loaded,
but with current build of jigsaw, this doesn't seem to have the desired
effect, calling it, adding my jar file there, doesn't allow me to
find any classes present in the jar file using FindClass, even though
I can see that it is being used (-verbose:class shows jar is opened)


One further question; any plans of expanding java.lang.instrument.
ClassFileTransformer, so the transform method has a Module argument,
possibly via a default method, calling the existing transform method?


/Michael


More information about the jigsaw-dev mailing list