RFR: 8361842: Validate input in both Java and C++ for java.lang.StringCoding intrinsics
Volkan Yazici
vyazici at openjdk.org
Thu Jul 10 12:58:56 UTC 2025
On Fri, 27 Jun 2025 20:21:31 GMT, ExE Boss <duke at openjdk.org> wrote:
>> 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);
@ExE-Boss, I consulted this internally and decided to stick to using public APIs, unless there is a reason not to do so. In short, given `Objects::checkFromIndexSize` directly delegates to `Preconditions::checkFromIndexSize`, I expect that C2 will do its magic. Note my remark above that, prior to promoting this draft to a PR, a comprehensive benchmark suite run will be performed when all intrinsics of concern are addressed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25998#discussion_r2185587428
More information about the core-libs-dev
mailing list