On Tue, 14 Oct 2025 12:34:14 GMT, David Beaumont <[email protected]> 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).
>
> David Beaumont has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Reorganising to catch preview-only cases

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

> 143:     }
> 144: 
> 145:     // find_location_index() returns the data "offset", not an index.

I reworked this code slightly and added more comments explaining why the "do 
two lookups if the resource doesn't exist" should not risk performance issues 
(we should only be being asked for things that are expected to exist). Of 
course if anyone reviewing this thinks this is not a correct statement, please 
speak up!!

Right now, the flags are definitely zero (the new attribute is never written 
and defaults to zero) so the preview specific code is unreachable code until 
the jimage creation is modified (even if `is_preview_mode` were true, which it 
isn't).

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1618#discussion_r2429322847

Reply via email to