On Mon, 4 May 2026 07:27:04 GMT, Paul Hübner <[email protected]> wrote:

>> Frederic Parain has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Fix VM flag v2
>
> src/hotspot/share/classfile/fieldLayoutBuilder.cpp line 806:
> 
>> 804:   _declared_nonstatic_fields_count(0),
>> 805:   _flattening_budget((int)FlatteningBudget),  // uint -> int convertion 
>> but FlatteningBudget value has
>> 806:                                               // been validated in 
>> arguments.cpp (range [0, 1024 * 1024]).
> 
> It's defined in `globals.hpp` and we don't do any ergonomics/validation in 
> `arguments.cpp`, the comment feels a bit misleading.

$ ./build/lworld/images/jdk/bin/java --enable-preview 
-XX:+UnlockExperimentalVMOptions -XX:FlatteningBudget=-1 Test2
Improperly specified VM option 'FlatteningBudget=-1'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

$ ./build/lworld/images/jdk/bin/java --enable-preview 
-XX:+UnlockExperimentalVMOptions -XX:FlatteningBudget=9999990 Test2
uint FlatteningBudget=9999990 is outside the allowed range [ 0 ... 1048576 ]
Improperly specified VM option 'FlatteningBudget=9999990'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

$ ./build/lworld/images/jdk/bin/java --enable-preview 
-XX:+UnlockExperimentalVMOptions -XX:FlatteningBudget=1024 Test2
Run test1
Run test2
Run test3
Done


There's  a validation that the value is within the range specified in 
`globals.hpp`.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2372#discussion_r3181881423

Reply via email to