On Fri, 5 Feb 2021 02:25:15 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:

>> src/hotspot/share/classfile/dictionary.cpp line 145:
>> 
>>> 143: #ifdef ASSERT
>>> 144:   if (protection_domain == instance_klass()->protection_domain()) {
>>> 145:     MutexLocker ml(ProtectionDomainSet_lock, 
>>> Mutex::_no_safepoint_check_flag);
>> 
>> By splitting the lock scope into two blocks you have lost the atomicity of 
>> the entire action in a debug build, and now you check a potentially 
>> different pd_set().
>
> If the dictionary entry's class matches the protection domain, then it should 
> never be added to the pd_set list.  So it doesn't need to be locked to check 
> that.  It doesn't need atomicity.

I missed the re-check at line 163 means we are going to return immediately 
after we execute the debug code.

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

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

Reply via email to