[lworld] RFR: 8304168: [lworld] CDS tests fail with --enable-preview patched value classes

Frederic Parain fparain at openjdk.org
Wed Mar 27 15:49:39 UTC 2024


On Tue, 26 Mar 2024 15:51:48 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> [1] Allow `--enable-preview -XX:+EnableValhalla` to be specified when dumping a CDS archive. This allows only the patch modules that are used for the value classes. The user is still forbidden from specifying --patch-module when dumping the CDS archive.
> 
> [2] If a CDS archive was created with `--enable-preview -XX:+EnableValhalla`, then it must also be specified at run time, or else the CDS archive will be ignored.
> 
> [3] Fixed a few bugs with value types. E.g., some metadata objects need to be placed in R/W region.
> 
> [4] Tests with all CDS tests and tiers 1-4.
> 
> [5] Modify Image.gmk to be able to generate default CDS archives for `--enable-preview -XX:+EnableValhalla`, but this is not yet enabled as some non-CDS tests will fail. See [JDK-8329108](https://bugs.openjdk.org/browse/JDK-8329108)

src/hotspot/share/cds/cdsConfig.cpp line 51:

> 49: bool CDSConfig::is_dumping_heap() {
> 50:   if (is_valhalla_preview()) {
> 51:     // Not working yet -- e.g., HeapShared::ooo_hash() needs to be implemented for value oops

HeapShared::ooo_hash() -> HeapShared::oop_hash()

src/hotspot/share/cds/filemap.cpp line 2474:

> 2472:     }
> 2473:   }
> 2474: 

Another VM option, `InlineFieldMaxFlatSize`, can influence the field layout, and by consequence, the validity of the `InstanceKlass` from the archive. It is probably needed to encode the value of `InlineFieldMaxFlatSize` in the archive to be able to check against the current VM options. We can decide to completely reject the archive if `InlineFieldMaxFlatSize` options don't match, or we can have a per class approach, as most classes won't have flat fields, and only reject them with a field layout not compliant with the current flag value.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1063#discussion_r1541375017
PR Review Comment: https://git.openjdk.org/valhalla/pull/1063#discussion_r1541374564



More information about the valhalla-dev mailing list