[lworld] RFR: 8366093: [lworld] Add preview mode to C++ classloader
Paul Hübner
phubner at openjdk.org
Fri Oct 10 09:03:39 UTC 2025
On Tue, 23 Sep 2025 19:11:41 GMT, David Beaumont <duke 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).
Disclaimer: I can only speak for the runtime portions of the code.
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?)
src/hotspot/share/classfile/classLoader.cpp line 291:
> 289: // the preview mode to be manually specified, so must not be accessible outside this
> 290: // class. ClassPathImageEntry manages all calls for resources after startup is complete.
> 291: static JImageLocationRef jimage_find_resource(const char* module_name,
This function makes the rest of the code more legible. Thanks!
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?
-------------
Marked as reviewed by phubner (Author).
PR Review: https://git.openjdk.org/valhalla/pull/1618#pullrequestreview-3322083982
PR Review Comment: https://git.openjdk.org/valhalla/pull/1618#discussion_r2418991622
PR Review Comment: https://git.openjdk.org/valhalla/pull/1618#discussion_r2418995309
PR Review Comment: https://git.openjdk.org/valhalla/pull/1618#discussion_r2418997876
More information about the valhalla-dev
mailing list