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). ------------- Commit messages: - Fix tabs - Adjust budget policy - Merge remote-tracking branch 'upstream/lworld' into flattening_budget - Add unit test - Add flattening budget Changes: https://git.openjdk.org/valhalla/pull/2372/files Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2372&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8383417 Stats: 161 lines in 4 files changed: 159 ins; 0 del; 2 mod Patch: https://git.openjdk.org/valhalla/pull/2372.diff Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2372/head:pull/2372 PR: https://git.openjdk.org/valhalla/pull/2372
