On Mon, 27 Apr 2026 19:58:18 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 two > additional commits since the last revision: > > - Silently skip the test when flattening conditions are not satisfied > - Add argument and CDS validation of the new VM option Once you have a flattening budget, doesn't this bring up issues similar to method inlining on how to spend that budget? For example, should it be spent eagerly on the first fields (depth first), or should top-level fields be flattened before nested fields (breadth first)? ------------- PR Comment: https://git.openjdk.org/valhalla/pull/2372#issuecomment-4331994114
