On Tue, 29 Jun 2021 07:51:52 GMT, Leonid Mesnik <lmes...@openjdk.org> wrote:

>> src/hotspot/share/prims/jvmtiImpl.cpp line 968:
>> 
>>> 966:   for (QueueNode* node = _queue_head; node != NULL; node = 
>>> node->next()) {
>>> 967:     node->event().post_compiled_method_load_event(env);
>>> 968:   }
>> 
>> Can't you dequeue() immediately after calling 
>> post_compiled_method_load_event()?
>
> Seems that dequeue in for-loop deletes the node which posted. It is possible 
> to update the loop to have update dequeue in the same iteration however, I 
> don't think it is a good idea to mix iterator/deletion in the same loop. What 
> is the reason for this change?

Just to save iterating the queue twice. And that is what the original loop did 
- you just have to switch the order of processing and deleting.

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

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

Reply via email to