RFR: 8292202: modules_do is called without Module_lock [v2]

Calvin Cheung ccheung at openjdk.org
Wed Sep 21 18:50:17 UTC 2022


On Thu, 15 Sep 2022 21:43:51 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

>> Please review this fix which involves:
>> 
>> - acquire the `Module_lock` before calling `modules_do`;
>> - move the call to `ClassLoader::setup_module_search_path `out of `do_module`;
>> - save the module paths in a `GrowableArray` in `do_module` for calling `ClassLoader::setup_module_search_path`.
>> 
>> Passed tiers 1 - 3 testing.
>
> Calvin Cheung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   get rid of the _total_count field

Hi Coleen,

Thanks for your review.

I've added assert in moduleEntry.cpp as follows:


diff --git a/src/hotspot/share/classfile/moduleEntry.cpp b/src/hotspot/share/classfile/moduleEntry.cpp
index a85c8f41145..f12f63ba2e5 100644
--- a/src/hotspot/share/classfile/moduleEntry.cpp
+++ b/src/hotspot/share/classfile/moduleEntry.cpp
@@ -694,6 +694,7 @@ void ModuleEntryTable::modules_do(void f(ModuleEntry*)) {
   auto do_f = [&] (const SymbolHandle& key, ModuleEntry*& entry) {
     f(entry);
   };
+  assert_lock_strong(Module_lock);
   _table.iterate_all(do_f);
 }
 
@@ -701,6 +702,7 @@ void ModuleEntryTable::modules_do(ModuleClosure* closure) {
   auto do_f = [&] (const SymbolHandle& key, ModuleEntry*& entry) {
     closure->do_module(entry);
   };
+  assert_lock_strong(Module_lock);
   _table.iterate_all(do_f);
 }

I'll run some mach5 testing before integrating the fix.

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

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


More information about the hotspot-runtime-dev mailing list