RFR: 8321033: Avoid casting Array to GrowableArray

Kim Barrett kbarrett at openjdk.org
Wed Jun 5 04:17:58 UTC 2024


On Wed, 5 Jun 2024 04:09:26 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> src/hotspot/share/classfile/moduleEntry.hpp line 73:
>> 
>>> 71:   void* _reads; // list of modules that are readable by this module
>>> 72:   DEBUG_ONLY(bool _reads_is_growable);
>>> 73:   DEBUG_ONLY(bool _reads_is_archived);
>> 
>> These new members should be initialized in the constructor.
>
> Do we really need two bool members?  I've not delved deeply, but it looks like one bool flag would
> be sufficient, so long as one is okay with initializing as having a null GA to start with.  This would
> also avoid any questions about what it means for both to be true (shouldn't be possible, but bugs
> happen, and the new state checks don't catch that) or both false.

Is making this state information debug-only the best choice?  There were a couple of places where
I wondered if things might be simpler if we could test the state, rather than only asserting it.  If worried
about the additional space, there is some unused alignment padding after `_is_patched`.  Of course,
this would require managing the state in product builds, so it's not entirely free.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19549#discussion_r1626903245


More information about the hotspot-runtime-dev mailing list