RFR: 8368467: [lworld] Add new flag generation for jimage to support preview mode [v12]
David Beaumont
duke at openjdk.org
Fri Oct 31 14:48:22 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:
>
> Supporting preview-only resources without forcing a double lookup on everything.
> Changing the set of entries in /packages/xxx directories to account for preview only packages in some modules.
> 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/1619.
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 129 additional commits since the last revision:
- Merge branch 'lworld' into jdk_8368467_reader/squashed
- 8370217: [lworld] Crash in add_migrated_value_classes after merging JDK-8350550
Reviewed-by: coleenp, fparain
- 8367711: [lworld] JDI test updates
Reviewed-by: cjplummer
- 8369530: [lworld] Improve execution time of compiler tests
Reviewed-by: mhaessig, thartmann, chagedorn
- 8370687: Improve before constructor has been called error message
Reviewed-by: vromero
- Problem list compiler/valhalla/inlinetypes/TestNullableArrays.java
Reviewed-by: dsimms
- 8370509: [lworld] EnableValhalla is not needed for sync
Reviewed-by: phubner, fparain
- 8314996: [lworld] java/lang/Thread/virtual/stress/PingPong.java fails since jdk-22+8
Reviewed-by: phubner, fparain
- Merge jdk
Merge jdk-26+21
- 8370156: Fix jpackage IconTest
Reviewed-by: almatvee
- ... and 119 more: https://git.openjdk.org/valhalla/compare/55731a5d...897de83b
-------------
Changes:
- all: https://git.openjdk.org/valhalla/pull/1621/files
- new: https://git.openjdk.org/valhalla/pull/1621/files/67e07af2..897de83b
Webrevs:
- full: https://webrevs.openjdk.org/?repo=valhalla&pr=1621&range=11
- incr: https://webrevs.openjdk.org/?repo=valhalla&pr=1621&range=10-11
Stats: 50282 lines in 1314 files changed: 31285 ins; 12185 del; 6812 mod
Patch: https://git.openjdk.org/valhalla/pull/1621.diff
Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1621/head:pull/1621
PR: https://git.openjdk.org/valhalla/pull/1621
More information about the valhalla-dev
mailing list