RFR: 8261921: ClassListParser::current should be used only by main thread

Calvin Cheung ccheung at openjdk.java.net
Fri Feb 19 01:20:41 UTC 2021


On Thu, 18 Feb 2021 02:25:38 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> During -Xshare:dump, ClassListParser::current() should be used only by the main thread, which has created the only ClassListParser instance. Accessing it from other threads could cause intermittent failures. We observed this only on certain hosts with -Xcomp.
> 
> The fix is to check for `ClassListParser::is_parsing_thread()` before calling `ClassListParser::current()`. After the fix, I can no longer reproduce the crash.
> 
> I also did some renaming and comment cleaning.

Looks good. Just couple of comments.

Thanks,
Calvin

src/hotspot/share/classfile/systemDictionary.cpp line 373:

> 371:     // Special processing for handling UNREGISTERED shared classes.
> 372:     InstanceKlass* k = SystemDictionaryShared::lookup_super_for_unregistered_class(class_name,
> 373:                            super_name, is_superclass);

Please align `super_name` with `class_name` in the previous line.

src/hotspot/share/classfile/classListParser.hpp line 86:

> 84:   };
> 85: 
> 86:   static Thread* _parsing_thread;    // the thread that created _instance

Should this be declared `volatile`?

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

Marked as reviewed by ccheung (Reviewer).

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


More information about the hotspot-runtime-dev mailing list