On Tue, 16 Dec 2025 20:06:08 GMT, Vicente Romero <[email protected]> wrote:
> 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
This pull request has now been integrated.
Changeset: 9bc2649c
Author: Vicente Romero <[email protected]>
URL:
https://git.openjdk.org/valhalla/commit/9bc2649cc4c3a620e8cc04f869c8cd41e2055b09
Stats: 63 lines in 2 files changed: 59 ins; 1 del; 3 mod
8373261: [lworld] VerifyError: Strict fields not a subset of initial strict
instance fields
Reviewed-by: mcimadamore
-------------
PR: https://git.openjdk.org/valhalla/pull/1809