[lworld] RFR: 8366093: [lworld] Add preview mode to C++ classloader

Roger Riggs rriggs at openjdk.org
Thu Oct 9 20:08:32 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).

src/java.base/share/native/libjimage/jimage.cpp line 114:

> 112:     size_t preview_infix_len = strlen(preview_infix);
> 113: 
> 114:     // TBD:   assert(module_name_len > 0 && "module name must be non-empty");

TBD: is obsolete?

src/java.base/share/native/libjimage/jimage.cpp line 157:

> 155:     // No preview flags means "a normal resource, without a preview version".
> 156:     // This is the overwhelmingly common case, with or without preview mode.
> 157:     if (flags == 0) {

Should test for defined flags, ignoring bits outside of the defined bits.

src/java.base/share/native/libjimage/jimage.cpp line 164:

> 162:     if ((flags & ImageLocation::FLAGS_IS_PREVIEW_VERSION) != 0) {
> 163:         return 0L;
> 164:     }

How can this occur?
classloader is the only client and does not pass arbitrary paths.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1618#discussion_r2417788703
PR Review Comment: https://git.openjdk.org/valhalla/pull/1618#discussion_r2417795963
PR Review Comment: https://git.openjdk.org/valhalla/pull/1618#discussion_r2417791849


More information about the valhalla-dev mailing list