On Fri, 19 Dec 2025 15:36:35 GMT, David Beaumont <[email protected]> wrote:

> Hopefully a fix for preview mode with exploded images in classLoader.cpp.
> 
> I did a little renaming since now it's clear that "preview mode" isn't a 
> thing that's limited only to a jimage being present.

src/hotspot/share/classfile/classLoader.cpp line 102:

> 100: static JImageFile*                     JImage_file            = nullptr;
> 101: 
> 102: // PreviewMode status to control preview behaviour. JImage_file is 
> unusable

Totally automated search & replace.

src/hotspot/share/classfile/classLoader.cpp line 999:

> 997: }
> 998: 
> 999: // caller needs ResourceMark

Based on the code above. Both these should probably use stringStream and format 
specifiers according to several people. I don't want to do that in this PR 
though.

src/hotspot/share/classfile/classLoader.cpp line 1157:

> 1155:       assert(_exploded_entries != nullptr, "No exploded build entries 
> present");
> 1156:       assert(!CDSConfig::is_dumping_archive(), "CDS dumping doesn't 
> support exploded build");
> 1157:       const char* preview_file_name = is_preview_enabled() ? 
> create_preview_file_name(file_name) : nullptr;

Making this out here seems best, but I could also pass the flag in and make it 
in search_module_entries(), but that's called from two places, so the less 
complexity in there the better.

src/hotspot/share/classfile/classLoader.cpp line 1513:

> 1511: // Finishes initializing the JImageFile (if present) by setting the 
> access mode.
> 1512: void ClassLoader::set_preview_mode(bool enable_preview) {
> 1513:   assert(Preview_mode == PREVIEW_MODE_UNINITIALIZED, "set_preview_mode 
> must not be called twice");

Don't check for jimage now since it won't be there when using exploded image.

src/hotspot/share/classfile/classLoader.hpp line 252:

> 250:   static const char* file_name_for_class_name(const char* class_name,
> 251:                                               int class_name_len);
> 252:   // REVIEWER-NOTE: Where best to put this - it should be private!

I don't think this should be here, but several other "private looking" 
functions are in the public section so I'm not sure. Advice requested...

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1845#discussion_r2635489822
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1845#discussion_r2635493068
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1845#discussion_r2635497142
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1845#discussion_r2635498605
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1845#discussion_r2635500894

Reply via email to