On Mon, 30 Nov 2020 12:57:36 GMT, Coleen Phillimore <[email protected]> wrote:

>> src/hotspot/share/prims/jvmtiTagMap.cpp line 1162:
>> 
>>> 1160:   if (_needs_cleaning) {
>>> 1161:     // Recheck whether to post object free events under the lock.
>>> 1162:     post_object_free = post_object_free && 
>>> env()->is_enabled(JVMTI_EVENT_OBJECT_FREE);
>> 
>> Where is `is_enabled` called without the lock being held in a caller of 
>> `remove_dead_entries()`?
>
> void JvmtiTagMap::flush_object_free_events() {
>   assert_not_at_safepoint();
>   if (env()->is_enabled(JVMTI_EVENT_OBJECT_FREE)) {
> 
> Called by JVMTI to disable events and called by the service thread.  And here 
> for get_objects_with_tags:
> 
>   if (collector.some_dead_found() && 
> env()->is_enabled(JVMTI_EVENT_OBJECT_FREE)) {
>     post_dead_objects_on_vm_thread();
>   }

That isn't quite what I asked. The claim is that `remove_dead_entries_locked` 
needs to recheck `is_enabled` if `post_object_free` is true in case the enabled 
state changed from true to false. But I can't see how such a situation can 
arise. In `flush_object_free_events` we only call `remove_dead_entries(false)` 
and that is when events were seen to be disabled.

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

PR: https://git.openjdk.java.net/jdk/pull/1439

Reply via email to