[lworld] RFR: 8373261: [lworld] VerifyError: Strict fields not a subset of initial strict instance fields [v2]
Vicente Romero
vromero at openjdk.org
Wed Dec 17 16:37:34 UTC 2025
> The verifier is failing due to an incorrect EarlyLarvalFrame generated by javac. The issue can be reproduced by compiling this test case:
>
>
> public class Test {
> static value class Val1 {
> int i1;
> int i2;
> int i3;
> int i4;
>
> public Val1() {
> this.i1 = 0;
> this.i2 = 0;
> this.i3 = 0;
> this.i4 = 0;
> }
> }
>
> static value class Val2 {
> int i1;
> Val1 val1;
>
> public Val2(boolean b) {
> this.i1 = 0;
> this.val1 = b ? null : new Val1(); // this statement will trigger the generation of an EarlyLarvalFrame
> }
> }
>
> public static void main(String[] args) {
> Val2 val = new Val2(true);
> }
> }
>
> so from the example above, for `Val2`'s constructor, javac is generating an `EarlyLarvalFrame` that included `Val1`'s `i4` field as an uninitialized strict field. The reason is that method `findUninitStrictFields` in `Flow` was not stopping at the max valid local variable for the current method. There are some data structures that are reused during flow analysis without being cleared from method to method to save time. So basically this method was reading "logically erased" info left during the analysis of the previous constructor.
>
> TIA for the review
Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
addressing review comments
-------------
Changes:
- all: https://git.openjdk.org/valhalla/pull/1809/files
- new: https://git.openjdk.org/valhalla/pull/1809/files/a317c78a..75e460af
Webrevs:
- full: https://webrevs.openjdk.org/?repo=valhalla&pr=1809&range=01
- incr: https://webrevs.openjdk.org/?repo=valhalla&pr=1809&range=00-01
Stats: 3 lines in 1 file changed: 0 ins; 1 del; 2 mod
Patch: https://git.openjdk.org/valhalla/pull/1809.diff
Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1809/head:pull/1809
PR: https://git.openjdk.org/valhalla/pull/1809
More information about the valhalla-dev
mailing list