On Thu, 30 Apr 2026 17:27:05 GMT, Frederic Parain <[email protected]> wrote:

>> This patch adds a simple policy to put a limit on field flattening to 
>> prevent instances from becoming too large. It is easy to generate very huge 
>> instances with nested flat values, so huge that the JVM struggles to 
>> allocate its internal data structure to handle such classes. The new policy 
>> allocates a flattening budget to each class, and field flattening in this 
>> class stops when the budget is exhausted. The limit can be tuned with a VM 
>> parameter.
>> 
>> Tested on Mach5 tier1-4
>> 
>> ---------
>> - [X] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> 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.

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

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

Reply via email to