RFR: 8368333: [lworld] Add preview mode to ImageReader and JRT file-system [v7]

David Beaumont duke at openjdk.org
Wed Oct 22 19:45:10 UTC 2025


On Tue, 21 Oct 2025 19:53:29 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> David Beaumont has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 12 additional commits since the last revision:
>> 
>>  - Rolled up changes after rebase.
>>    
>>    * Removing package root flag based on feedback.
>>    * Changing existing package flags during writing to match altered flag values.
>>    * Feedback changes, and fixing some comments.
>>    * Renaming slightly confusing "testEncoder" method.
>>    * Fixing unit tests to use new constructor.
>>    * Word smithing flags definitions.
>>    * Add workaround until new image writing code is in
>>    * Clarifying flag docs for /packages/xxx case
>>    * Java ImageReader changes for preview mode
>>  - Merge branch 'jdk_8366093_cpp/squashed' into jdk_8368333_java/squashed
>>  - [[RESET BRANCH FOR MERGE]]
>>  - Removing package root flag based on feedback.
>>  - Changing existing package flags during writing to match altered flag values.
>>  - Feedback changes, and fixing some comments.
>>  - Test fixes and feedback changes.
>>    
>>    * Renaming slightly confusing "testEncoder" method.
>>    * Fixing unit tests to use new constructor.
>>  - Manually deleting ImageReaderFactory (it returned somehow)
>>  - Word smithing flags definitions.
>>  - Add workaround until new image writing code is in
>>  - ... and 2 more: https://git.openjdk.org/valhalla/compare/4a672f4e...9bbc26c1
>
> src/java.base/share/classes/jdk/internal/jimage/ImageReader.java line 525:
> 
>> 523:             }
>> 524:             ImageLocation loc = findLocation(moduleName, resourcePath);
>> 525:             return loc != null && loc.getType() == RESOURCE;
> 
> Would there be any benefit to caching the resource here, since it has been found and will likely be opened again.

Very unlikely to be worth it, and outside the scope of this work (since nothing I'm doing changes this behaviour).

ImageReader deals with small nodes and has a surprisingly low footprint. Caching content would require managing a size bounded cache, since it's well over 100MB of content.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1619#discussion_r2453173787


More information about the valhalla-dev mailing list