On Tue, 6 Apr 2021 10:05:08 GMT, Robbin Ehn <r...@openjdk.org> wrote:

>> src/hotspot/share/prims/jvmtiRawMonitor.cpp line 364:
>> 
>>> 362:     for (;;) {
>>> 363:       simple_enter(jt);
>>> 364:       if (!SafepointMechanism::should_process(jt)) {
>> 
>> It seems to be likely that the condition is false in the first loop 
>> iteration and the thread has to do another iteration even if not suspended. 
>> Wouldn't it be ok to break from the loop if `!jt->is_suspended()`?
>> I'm asking because in ObjectMonitor::enter() L414 there is similar code and 
>> the condition there is `SafepointMechanism::should_process(current) && 
>> current->suspend_request_pending()`
>
> I didn't add that optimization here because I don't think it is needed, but I 
> can add it.

Your version is good.

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

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

Reply via email to