On Tue, 28 May 2024 17:36:03 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.
>
> I don't want to change this because its reason for existence is to ensure we 
> don't return a value that's beyond the end of the haystack.  We don't yet 
> have a good enough test to validate whether we're reading past the end of the 
> haystack, so I like this as insurance.

I would recommend an experiment. Disable the range-check and run 
String/IndexOf.java test. Particularly run test4(), which is designed exactly 
to test the reads beyond the end. 

It wont find all the bad reads, but right now if there are any failures, they 
are 'hidden' by this range-check.

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

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

Reply via email to