RFR: 8266170: -Wnonnull happens in classLoaderData.inline.hpp

Coleen Phillimore coleenp at openjdk.java.net
Wed Apr 28 13:27:51 UTC 2021


On Wed, 28 Apr 2021 07:31:26 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:

> We can see compiler warnings in dictionary.cpp as following on GCC 11. Conditions in `guarantee` should be changed.
> 
> 
> In file included from /home/ysuenaga/git-forked/jdk/src/hotspot/share/utilities/globalDefinitions.hpp:29,
>                  from /home/ysuenaga/git-forked/jdk/src/hotspot/share/memory/allocation.hpp:29,
>                  from /home/ysuenaga/git-forked/jdk/src/hotspot/share/classfile/classLoaderData.hpp:28,
>                  from /home/ysuenaga/git-forked/jdk/src/hotspot/share/precompiled/precompiled.hpp:34:
> In member function 'oop ClassLoaderData::class_loader() const',
>     inlined from 'void Dictionary::verify()' at /home/ysuenaga/git-forked/jdk/src/hotspot/share/classfile/dictionary.cpp:635:3:

Thank you for fixing this!

src/hotspot/share/classfile/dictionary.cpp line 636:

> 634:   // boostrap loader
> 635:   guarantee(cld != NULL &&
> 636:             (cld->the_null_class_loader_data() || cld->class_loader()->is_instance()),

This is right.  The CLD can never be null here because we create a dictionary for each CLD and link back the CLD.

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

Marked as reviewed by coleenp (Reviewer).

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


More information about the hotspot-runtime-dev mailing list