[lworld+vector] RFR: 8311080: [lworld+vector] Fix jdk build failures with different options

Xiaohong Gong xgong at openjdk.org
Mon Jul 3 08:53:55 UTC 2023


There are several issues exposed by building jdk image with following different options:
 - `--disable-precompiled-headers`
 - `--with-jvm-variants=client`
 - `--with-jvm-variants=minimal` or `--disable-cds`

1. With `--disable-precompiled-headers`, using `class MultiFieldInfo` in `oops/fieldInfo.hpp` and `oops/fieldInfo.inline.hpp` builds error with "invalid use of incomplete type".

The reason is that class `MultiFieldInfo` is used in `fieldInfo.hpp`, but the header declaring the class is not included in it. A direct
fixing is including its header file `oops/instanceKlass.hpp` before using it. But it cannot work here since `oops/instanceKlass.hpp` has included `oops/fieldInfo.hpp`.

To resolve the circle, we can move the definition of class `MultiFieldInfo` to `oops/fieldInfo.hpp`, which I think is also reasonable since `multifield` is a kind of `field`.

2. With `--with-jvm-variants=client`, calling `Deoptimization::reassign_fields_by_klass()` in `vectorsupport.cpp` builds error since `reassign_fields_by_klass()` is defined when C2 or JVMCI compiler is enabled (See [1]).

Consider the caller method in `vectorSupport.cpp` is used only for C2 compiler (See [2]), adding the same limitation for definition of all the relative methods in `vectorSupport.cpp` is better and can fix this issue.

3. With `--with-jvm-variants=minimal` or `--disable-cds`, calling several CDS specific methods ([3]) in `oops/inlineKlass.cpp` builds error. Those caller methods defined in `inlineKlass.hpp` are all CDS related as well. Hence, adding the same CDS condition for them sounds reasonable and can fix this issue.

This patch also fixed an return type mismatch issue exposed by building the jdk image on aarch64 windows system. The relative method is:


jint SharedRuntime::skip_value_scalarization(InlineKlass *)

The declaration type is `int` (see [4]).

[1] https://github.com/openjdk/valhalla/blob/lworld%2Bvector/src/hotspot/share/runtime/deoptimization.hpp#L195
[2] https://github.com/openjdk/valhalla/blob/lworld%2Bvector/src/hotspot/share/runtime/deoptimization.cpp#L1278
[3] https://github.com/openjdk/valhalla/blob/lworld%2Bvector/src/hotspot/share/oops/instanceKlass.hpp#L1236
[4] https://github.com/openjdk/valhalla/blob/lworld%2Bvector/src/hotspot/share/runtime/sharedRuntime.hpp#L186

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

Commit messages:
 - 8311080: [lworld+vector] Fix jdk build failures with different options

Changes: https://git.openjdk.org/valhalla/pull/881/files
 Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=881&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8311080
  Stats: 53 lines in 7 files changed: 28 ins; 18 del; 7 mod
  Patch: https://git.openjdk.org/valhalla/pull/881.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/881/head:pull/881

PR: https://git.openjdk.org/valhalla/pull/881



More information about the valhalla-dev mailing list