On Fri, 27 Jun 2025 13:24:52 GMT, Chen Liang <[email protected]> wrote:
>> But the original code already checks for `len >= 0`, right? See
>> `LibraryCallKit::inline_countPositives` -> `generate_string_range_check` ->
>> `// Offset and count must not be negative`
>>
>> This PR is about moving the range checks from the intrinsics into the Java
>> wrappers. Removing range checks is out of the scope and should be carefully
>> evaluated on a case-by-case basis separately.
>
> My point is this is a performance-sensitive API. We are using a known-slow
> check method `checkFromIndexSize` which may introduce a performance
> regression.
Maybe use `jdk.internal.util.Preconditions` directly instead?
Suggestion:
Preconditions.checkFromIndexSize(off, len, ba.length, null);
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25998#discussion_r2172823303