[lworld] RFR: 8368467: [lworld] Add new flag generation for jimage to support preview mode [v3]
David Beaumont
duke at openjdk.org
Tue Sep 23 19:12:27 UTC 2025
> Adds support for writing preview related flags into jimage files.
>
> Preview mode is complex. It's not nearly as simple as "does something in /modules/xxx/... have an entry in /modules/xxx/META-INF/preview/...".
>
> Specific issues include:
> 1. Supporting preview-only resources without forcing a double lookup on everything.
> 2. Changing the set of entries in /packages/xxx directories to account for preview only packages in some modules.
> 3. Minimising the work done during image reader initialization to only need to process the small number of preview resources (rather than scanning the whole file to look for them).
>
> The new flags added by this code address these issues, but calculating them correctly with only minor adjustments to the existing code was not feasible, it just became a lot larger and very complex.
>
> To address this, a new type (ModuleReference) is introduced to track and then merge information about packages seen in each module. This allows a much simpler inner loop for processing resource paths when building the node tree, combined with a subsequent merging stage to produce the final package information for each module.
>
> Not that since ModuleReference is needed during jimage reading, that class is already present in the previous PR on which this is based, but it starts to be used to calculate the module flags in this PR.
>
> This PR can also adds the ImageReader unit tests for preview mode, which rely on being able to generate jimage files with preview mode flags in.
>
> Compare and review this against https://github.com/openjdk/valhalla/pull/1613.
>
> https://github.com/openjdk/valhalla/pull/1615/commits/28eae40aa9a3f8520519d79d7749b5a4b3511609
David Beaumont has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains seven new commits since the last revision:
- add system property guard to preview mode
- jimage writer changes to support preview mode.
* Remove TODOs now jimage version is bumped
* jimage writer changes to support preview mode.
- 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
- C++ preparation for preview mode
-------------
Changes:
- all: https://git.openjdk.org/valhalla/pull/1615/files
- new: https://git.openjdk.org/valhalla/pull/1615/files/82f4e671..2d56562f
Webrevs:
- full: https://webrevs.openjdk.org/?repo=valhalla&pr=1615&range=02
- incr: https://webrevs.openjdk.org/?repo=valhalla&pr=1615&range=01-02
Stats: 197 lines in 10 files changed: 108 ins; 2 del; 87 mod
Patch: https://git.openjdk.org/valhalla/pull/1615.diff
Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1615/head:pull/1615
PR: https://git.openjdk.org/valhalla/pull/1615
More information about the valhalla-dev
mailing list