RFR: 8271459: C2: Missing NegativeArraySizeException when creating StringBuilder with negative capacity [v2]
Christian Hagedorn
chagedorn at openjdk.java.net
Mon Sep 27 07:37:34 UTC 2021
> Stringopts does not take into account that a negative `int` argument for `StringBuilder(int)` results in a `NegativeArraySizeException` when optimizing away `StringBuilder` usages into single strings.
>
> The suggested fix does the following:
> - Bailout of Stringopts if C2 knows that an `int` argument is always negative.
> - Apply stringopts but insert an additional runtime check with an UCT if C2 cannot tell if an `int` argument is positive or negative.
>
> I added some IR tests to verify the fix and also ran some standard benchmarks.
>
> I also updated `TestIRMatching` to test the new and updated default regexes.
>
> Thanks,
> Christian
Christian Hagedorn has updated the pull request incrementally with one additional commit since the last revision:
Update UCT to Action_maybe_recompile
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/5652/files
- new: https://git.openjdk.java.net/jdk/pull/5652/files/ab8b6f8a..4e4f5222
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5652&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5652&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/5652.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/5652/head:pull/5652
PR: https://git.openjdk.java.net/jdk/pull/5652
More information about the hotspot-compiler-dev
mailing list