On Wed, 11 Aug 2021 14:26:32 GMT, Claes Redestad <redes...@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 looks okay but surprised there wasn't a jtreg test that would have caught this before integration, maybe we should add a test as part of this change. ------------- Marked as reviewed by alanb (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/5086