RFR: 8320448: Accelerate IndexOf using AVX2 [v43]
Sandhya Viswanathan
sviswanathan at openjdk.org
Tue May 28 20:32:16 UTC 2024
On Tue, 28 May 2024 17:30:24 GMT, Scott Gibbons <sgibbons at openjdk.org> wrote:
>> src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp line 278:
>>
>>> 276: __ bind(L_nextCheck);
>>> 277: __ testq(haystack_len_p, haystack_len_p);
>>> 278: __ je(L_zeroCheckFailed);
>>
>> This check could be removed as the next check covers this one.
>
> No. This is checking for a zero length haystack. The following compare checks for needle length longer than haystack, regardless of the value in each. The comparison is signed, so a haystack length of 0 with a needle length of -1 will pass the following test and assume validity.
But we have already checked for needle length to be greater than 0 in the following lines:
__ cmpq(needle_len_p, 0);
__ jg_b(L_nextCheck);
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16753#discussion_r1617857240
More information about the hotspot-compiler-dev
mailing list