RFR: 8362394: C2: Repeated stacked string concatenation fails with "Hit MemLimit" and other resourcing errors [v3]
Daniel Skantz
dskantz at openjdk.org
Mon Aug 18 13:34:14 UTC 2025
On Tue, 12 Aug 2025 06:40:53 GMT, Daniel Skantz <dskantz at openjdk.org> wrote:
>> 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.
I think the default node limit, memory limit and timeout for product runs may be enough to test the fix.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26685#discussion_r2282402493
More information about the hotspot-compiler-dev
mailing list