[lworld] RFR: 8366093: [lworld] Add preview mode to C++ classloader
David Beaumont
duke at openjdk.org
Fri Oct 10 10:20:22 UTC 2025
On Fri, 10 Oct 2025 08:56:59 GMT, Paul Hübner <phubner at openjdk.org> wrote:
>> C++ changes for supporting preview mode when preview mode resources (with new location flags) are available.
>>
>> At the moment, this code will operate on non-preview jimage files (1.0) and act as if no preview resources are available by virtue of the default value for missing attributes being zero (which matches location flags for "normal" entries).
>
> src/hotspot/share/classfile/classLoader.cpp line 251:
>
>> 249: // Closes and clears the JImage file reference (this will only be called during shutdown).
>> 250: static void jimage_close() {
>> 251: if (JImage_file != nullptr) {
>
> I'm not familiar with jimage at all, is there as reason we could close a non-open jimage? And following from that, can we guarantee to not call jimage_open on an open jimage? (Maybe an assert should guard it?)
I honestly don't know, so this is the old behaviour, so I'm keeping it for now.
Alan might know more.
> src/java.base/share/native/libjimage/imageFile.cpp line 326:
>
>> 324: // for preview mode. Preview mode changes do not modify any structure,
>> 325: // so a 1.0 file will look like a jimage without any preview resources.
>> 326: // TODO: Restore equality check for MINOR_VERSION.
>
> Is this something you still have to address in this PR?
I need to address it later, when the image writing code is changed.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1618#discussion_r2419241260
PR Review Comment: https://git.openjdk.org/valhalla/pull/1618#discussion_r2419235251
More information about the valhalla-dev
mailing list