On Tue, 28 May 2024 21:17:07 GMT, Scott Gibbons <sgibb...@openjdk.org> wrote:

>> src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp line 488:
>> 
>>> 486:   __ cmpq(r11, nMinusK);
>>> 487:   __ ja_b(L_return);
>>> 488:   __ movq(rax, r11);
>> 
>> At places where we know that return value in r11 is correct, we dont need to 
>> checkRange so this could have its own label.
>
> Disabling causes the test to succeed, so we're not finding matches beyond the 
> end of the string, correct?  Are we confident that this test passing can 
> warrant removing the range check? @sviswa7 ?

Removed.

>> src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp line 621:
>> 
>>> 619:     __ addq(hsPtrRet, index);
>>> 620:     __ movq(r11, hsPtrRet);
>>> 621:     __ jmp(L_checkRangeAndReturn);
>> 
>> Why do we have to checkRange here, would it not be always correct? It so we 
>> could return r11 directly (by moving into rax).
>
> There are cases where r11 could have a value that, when added to (k - 1) 
> would go past the end of the haystack.  I did all in my power to ensure that 
> it doesn't but there's no test I know of to ensure that condition.  I would 
> recommend leaving this in for now.

Removed checkRangeAndReturn

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16753#discussion_r1617956870
PR Review Comment: https://git.openjdk.org/jdk/pull/16753#discussion_r1617956635

Reply via email to