When running very small Java programs in the AOT training mode, the 3 lambda expressions in ModuleBootstrap.java are evaluated. However, when running without the AOT training mode, these lambda expressions are not evaluated.
As a result, the AOT training mode captures a much large profile (due to the complex implementation of the lambda framework). This causes the AOT cache of very small Java programs to be much larger than necessary. The fix is to rewrite these 3 lambda expressions (streams) back to tradition iterative code (contributed by @AlanBateman) Changes in ModuleBootstrap.java revealed a bug in `AOTArtifactFinder::find_artifacts()`: some AOT-initialized classes may be incorrectly excluded. --------- - [x] I confirm that I make this contribution in accordance with the [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). ------------- Commit messages: - clean up - Removed debug code - ioi debugging - patch from @AlanBateman Changes: https://git.openjdk.org/jdk/pull/31142/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=31142&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8381710 Stats: 36 lines in 2 files changed: 19 ins; 0 del; 17 mod Patch: https://git.openjdk.org/jdk/pull/31142.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/31142/head:pull/31142 PR: https://git.openjdk.org/jdk/pull/31142
