RFR: 8361842: Move input validation checks to Java for String-related intrinsics [v2]
Roger Riggs
rriggs at openjdk.org
Tue Jul 15 20:32:43 UTC 2025
On Tue, 15 Jul 2025 20:24:22 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:
>> src/java.base/share/classes/sun/nio/cs/ISO_8859_1.java line 201:
>>
>>> 199: int len = (dlen < slen) ? dlen : slen;
>>> 200: try {
>>> 201: int ret = len <= 0 ? 0 : encodeISOArray(sa, sp, da, dp, len);
>>
>> Moving the length correction into `encodeISOArray` would help other callers too. (There's only 1 at the moment).
>
> I've tried to make the code such that wrapper functions contain nothing but argument checks. Moving `if (len <= 0) { return 0; }` logic to the wrapper function will introduce a behavior different than the one implemented by the intrinsic. @RogerRiggs, do you still prefer me to carry out this change?
The wrapper is the method actually called, the intrinsic `encodeISOArray0` intrinsic would be inlined into it.
I don't have a compelling reason to change it, given the solitary caller.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25998#discussion_r2208599130
More information about the graal-dev
mailing list