On Wed, 22 Oct 2025 03:28:59 GMT, Leonid Mesnik <[email protected]> wrote:
>> src/hotspot/share/prims/jvmtiExport.cpp line 2283:
>>
>>> 2281: // In this case the frame is only marked for deoptimization but
>>> still remains compiled.
>>> 2282: // Also, the last frame might be compiled if events were not
>>> enabled for
>>> 2283: // this thread. The thread filtering is done later.
>>
>> Q: The following part of comment is confusing: `" ... if events were not
>> enabled for this thread."
>> How do we post the events if they were not enabled? Do I miss anything?
>
> Yes
> The
> jni_GetField_probe
> is called on every field if any of fields access event is envabled.
>
> /* Keep JVMTI addition small and only check enabled flag here. */ \
> if (JvmtiExport::should_post_field_access()) { \
> o = JvmtiExport::jni_GetField_probe(thread, obj, o, k, fieldID, false); \
> } \
>
> The jni_GetField_probe checks if the events are enabled for this specific
> field on any thread for any jvmtiEnv and call
>
> post_field_access_by_jni
>
> which prepare all the data and call
>
> post_field_access
>
> Only on this level it is check which threads and environments should post
> events. I suspect that it is done for unification of jni/non-jni check.
>
> So ```post_field_access_by_jni``` is executed for threads where events is
> not enabled.
I see now, thanks! But then it means the comments are not easy to understand
correctly. :)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27584#discussion_r2450445678