RFR: 8304738: UnregisteredClassesTable_lock never created

Justin King jcking at openjdk.org
Wed Apr 5 17:55:14 UTC 2023


On Wed, 5 Apr 2023 16:17:15 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

> UnregisteredClassesTable_lock is never created in mutex_init() and is always nullptr. This lock is referenced in a few places and all of those are effectively thread unsafe. Some of the places `unregistered_classes_table` is accessed are under other locks, so the rank of this lock has to be adjusted appropriately. The lock will be initialized to enable the intended behavior. Verified with tier 1-4 tests.

src/hotspot/share/classfile/systemDictionaryShared.cpp line 526:

> 524: 
> 525:   if (_unregistered_classes_table != nullptr) {
> 526:     // Remove the class from _unregistered_classes_table: keep the entry but

Pre-existing, but `_unregistered_classes_table` is set under the lock above, but here it is checked outside of the lock. Maybe MutexLocker should be move above the `if` and placed in a `{ ... }` so that it is unlocked before the `if (ClassListWriter:...)` statement?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13358#discussion_r1158836386


More information about the hotspot-runtime-dev mailing list