Integrated: 8271732: Regression in StringBuilder.charAt bounds checking
Claes Redestad
redestad at openjdk.java.net
Thu Aug 12 07:05:33 UTC 2021
On Wed, 11 Aug 2021 14:26:32 GMT, Claes Redestad <redestad at openjdk.org> wrote:
> In #4738 we removed the `checkIndex(value, count)` call in `ASB.charAt` to avoid potentially getting two bounds checks in the UTF-16 case. Problem is this optimization cause a regression since `StringUTF16.charAt(..)` checks `index` against the length of the `value` array and not `count`.
>
> A correct fix that still maintain the possible performance advantage reported by #4738 is to reinstate the `checkIndex(value, count)` and call `StringUTF16.getChar` instead of `charAt`.
This pull request has now been integrated.
Changeset: a15b6592
Author: Claes Redestad <redestad at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/a15b659278741337aefc15ce8002df66ce6323c0
Stats: 108 lines in 3 files changed: 106 ins; 0 del; 2 mod
8271732: Regression in StringBuilder.charAt bounds checking
Reviewed-by: alanb, naoto
-------------
PR: https://git.openjdk.java.net/jdk/pull/5086
More information about the core-libs-dev
mailing list