On Mon, 10 Aug 2026 20:42:23 GMT, Chen Liang <[email protected]> wrote:

>> We should allow unset fields when `uninitializedThis` is in the stack, in 
>> addition to only checking locals, as a result of 
>> https://bugs.openjdk.org/browse/JDK-8375481.
>> 
>> Noticed that hotspot's verifier is not up-to-date with this spec; this patch 
>> therefore only fixes classfile API and javap and leaves classfile API's 
>> verifier and hotspot in place.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Chen Liang 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 three additional commits since 
> the last revision:
> 
>  - Add 8389843
>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
> fix/cf-unset-restriction
>  - unset field allowed for uninitThis on stack

Mixed-purpose PRs are difficult to review and maintain. 
I would strongly recommend splitting this into separate PRs.

> This patch currently has these contents:
> 
> 1. Fix `StackMapFrameInfo` and stack maps parsing/generation to correctly 
> accept a `flagThisUninit` frame with `uninitializedThis` in the stack only.

The Class-File API should perform only critical structural validation while 
parsing a class file. I recommend removing:

            uninitializedThisCheck:
            if (!unsetFields.isEmpty()) {
                for (var local : locals) {
                    if (local == SimpleVerificationTypeInfo.UNINITIALIZED_THIS) 
{
                        break uninitializedThisCheck;
                    }
                }
                throw new IllegalArgumentException("unset fields requires 
uninitializedThis in locals");
            }

from the `StackMapDecoder.StackMapFrameImpl` constructor, as this condition is 
not a structural class file validation.

> 2. Incorporate the ClassFile API port of verifier changes in [8389840: 
> Verifier is not setting flagThisUninit when uninitializedThis is on the stackĀ 
> #32242](https://github.com/openjdk/jdk/pull/32242)

This is an important synchronization with the native verifier. It should have 
its own bug and PR, with all relevant references.

> 3. Fix typo in `StackMapGenerator.Type.UNITIALIZED_THIS_TYPE`

This could be treated as a small, unrelated implementation change.

> 4. Validate the u2 checks for the list arguments to `StackMapFrameInfo.of` 
> with unset fields overload

This could be treated as a small, independent change.

> 5. Fix javap to print unset fields when it encounters a `flagThisUninit` 
> frame with `uninitializedThis` in the stack only.

This belongs to a different JDK module and is unrelated to the other changes.

> 6. Clean ups to StrictStackMapsTest, use constant for EARLY_LARVAL frame 
> type, clean up other IDE warnings.

These could be treated as minor test and cleanup changes.

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

PR Comment: https://git.openjdk.org/jdk/pull/32224#issuecomment-5254176779

Reply via email to