[lworld] RFR: 8349945: Implement strict static fields (proposed JVM feature) [v2]

Matias Saavedra Silva matsaave at openjdk.org
Fri May 23 19:59:04 UTC 2025


On Wed, 21 May 2025 18:52:41 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Matias Saavedra Silva has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Copyrights
>>  - Added reflective tests and problem listed test
>
> test/hotspot/jtreg/runtime/valhalla/inlinetypes/verifier/Brbefore_BAD.jasm line 24:
> 
>> 22:  */
>> 23: 
>> 24: identity class Brbefore_BAD version 69:65535
> 
> Can't this be compiled with javac? I don't think we are going to add any checks for strict initialization on the javac side as pre-write reads cannot be detected because they can easily happen in nested method calls.
> 
> Even if we decide to use jasm, I think the best practice seems to leave the source to generate the jasm in a .test file, and comment in the jasm what was changed.

Javac can catch this because the static field hasn't been initialized yet:
`error: variable F2__STRICT might not have been initialized
        int x = F2__STRICT; //FAIL`
It may be possible to write a java program with nested calls that does this but I think it's best to keep the test cases simple.

I agree with the last comment, I'll add the equivalent java code to the jasm files.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1465#discussion_r2105330628


More information about the valhalla-dev mailing list