RFR: 8298853: JvmtiVTMSTransitionDisabler should support disabling one virtual thread transitions [v2]

David Holmes dholmes at openjdk.org
Tue Dec 20 04:54:51 UTC 2022


On Mon, 19 Dec 2022 11:32:40 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>> src/hotspot/share/classfile/javaClasses.cpp line 1745:
>> 
>>> 1743:   int val = VTMS_transition_disable_count(java_thread);
>>> 1744:   java_thread->int_field_put(_jvmti_VTMS_transition_disable_count_offset, val - 1);
>>> 1745: }
>> 
>> These are not thread-safe functions. What constraints exist for using these methods safely?
>> Update: looks like they must be called with the lock held so we should assert that.
>> Should also assert the count never goes negative (which I assume would be an error?).
>
> Each of these two functions is called just once with the lock held.
> I feel that asserting this would be an overkill but I can add it if you still think it is important.
> I've added assert for negative count.

asserts would be good please else someone may use them somewhere else without locking.

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

PR: https://git.openjdk.org/jdk/pull/11690


More information about the hotspot-dev mailing list