RFR: 8362394: C2: Repeated stacked string concatenation fails with "Hit MemLimit" and other resourcing errors [v2]

Daniel Skantz dskantz at openjdk.org
Tue Aug 12 06:43:13 UTC 2025


On Mon, 11 Aug 2025 10:30:42 GMT, Galder Zamarreño <galder at openjdk.org> wrote:

>> Daniel Skantz has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>    move check / tweak test
>
> test/hotspot/jtreg/compiler/stringopts/TestStackedConcatsMany.java line 28:
> 
>> 26:  * @bug 8357105
>> 27:  * @summary Test that repeated stacked string concatenations do not
>> 28:  *          consume too many compilation resources.
> 
> Is there a reasonable way to enhance the test to validate excessive resources? I'm not sure if the following example would work, but I'm wondering if there is something that can be measured deterministically. E.g. before with the given test there would be ~N IR nodes produced but now it would be a max of ~M, assuming that M is deterministically smaller than N.

There's a 80000 node limit by default and maybe the test could use a lower limit by specifying a value for the MaxNodeLimit flag. There is also the IR framework that can check for node counts for individual nodes.

Without the fix, the test currently gets a MemLimit assert in debug runs for consuming 1GB of memory as it is building up the _arguments arrays. The high number of IR nodes is created later in `replace_string_concat` if we get that far without timing out or reaching the memory limit.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26685#discussion_r2268756368


More information about the hotspot-compiler-dev mailing list