On Wed, 27 Aug 2025 06:37:44 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> (I realize this is a tangent, but maybe there is a separate bug here...)
>> 
>>> To have a Class object it must have already undergone the "preparation" 
>>> part of linking (it is done at the end of loading when we create the class 
>>> mirror).
>> 
>> If that's what "preparation" means, and Class.forName(name, false, loader) 
>> does not link the class, then posting the event here in 
>> InstanceKlass::link_class_impl() instead of earlier seems misplaced:
>> 
>> https://github.com/openjdk/jdk/blob/c75534517729b903b63263cf64dc2ff841e3dcb1/src/hotspot/share/oops/instanceKlass.cpp#L1064
>> 
>> Class.forName(name, false, loader) would result in a prepared class but 
>> without the event being sent.
>
>> If that's what "preparation" means, and Class.forName(name, false, loader) 
>> does not link the class, then posting the event here in 
>> InstanceKlass::link_class_impl() instead of earlier seems misplaced
> 
> @dean-long it seems the JVM TI "prepare" event is somewhat misnamed. It 
> states "At this point, class fields, methods, and implemented interfaces are 
> available, and no code from the class has been executed." but that neither 
> describes preparation, nor the rest of linking. You can only access fields 
> and methods after a class has been initialized! But lets take this elsewhere 
> if needed.

Does it fail with the patch?  Sorry for the delay.  @dholmes-ora and I have 
been discussing how all this works offline, but with time-zone differences, we 
won't have any agreement until next week.  I wrote a more limited version of 
the patch I sent and am testing it now.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26863#issuecomment-3236952904

Reply via email to