RFR: 8357105: C2: compilation fails with "assert(false) failed: empty program detected during loop optimization" [v2]
Daniel Skantz
dskantz at openjdk.org
Mon May 26 06:08:55 UTC 2025
> This pull request contains a fix for JDK-8357105.
>
> The problem is performing stacked string concatenation optimization between a pair of StringBuilder.append().toString()-links SB1 and SB2, where the parameter of an append call in SB2 has a complex dependency on the result of SB1, which in turn is replaced by top() during stringopts -- similar to JDK-8271341, which had a diamond if-structure using the result of SB1, while in this case the use is an unstable If. In the attached regression test, a live part of the graph gets optimized away during later phases and ultimately the whole graph vanishes.
>
> The proposed solution is to simply exclude this specific case. This bug has existed for a long time and stacked concats is a niche optimization.
>
> Testing:
> Tier1-4.
>
> Extra testing:
> Ran Tier1-4 with an instrumented build and observed that we do not disable stacked concatenation in any previously known case after the fix.
Daniel Skantz has updated the pull request incrementally with two additional commits since the last revision:
- Apply suggestions from code review
Co-authored-by: Roberto Castañeda Lozano <robcasloz at users.noreply.github.com>
- Update src/hotspot/share/opto/stringopts.cpp
Co-authored-by: Roberto Castañeda Lozano <robcasloz at users.noreply.github.com>
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/25395/files
- new: https://git.openjdk.org/jdk/pull/25395/files/1ed6dde9..65c331fb
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=25395&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=25395&range=00-01
Stats: 7 lines in 1 file changed: 2 ins; 0 del; 5 mod
Patch: https://git.openjdk.org/jdk/pull/25395.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25395/head:pull/25395
PR: https://git.openjdk.org/jdk/pull/25395
More information about the hotspot-compiler-dev
mailing list