RFR: 8321033: Avoid casting Array to GrowableArray [v5]

Ioi Lam iklam at openjdk.org
Fri Jun 14 17:24:13 UTC 2024


On Fri, 14 Jun 2024 17:17:23 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

>> `ModuleEntry::_reads` is declared as an GrowableArray<ModuleEntry*>*, but when stored in a CDS archive, it's assigned to an Array<ModuleEntry*>*. To ensure better type safety, `ModuleEntry::_reads` is changed to a generic pointer which uses two different getters and setters as well as two booleans to ensure the value is interpreted correctly. This was chosen to avoid introducing a new field to the ModuleEntry class, as another pointer and further alignment would increase the size of the ModuleEntry array. Verified with tier1-5 tests.
>
> Matias Saavedra Silva has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Added assert to ensure reads is empty

LGTM. Just one nit about using the initializer list.

src/hotspot/share/classfile/moduleEntry.cpp line 304:

> 302:     }
> 303:   }
> 304:   DEBUG_ONLY(_reads_is_archived = false);

It's better to move this to the initializer list above, like:


DEBUG_ONLY(_reads_is_archived(false) COMMA)

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

Marked as reviewed by iklam (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/19549#pullrequestreview-2118909345
PR Review Comment: https://git.openjdk.org/jdk/pull/19549#discussion_r1640140022


More information about the hotspot-runtime-dev mailing list