On Tue, 28 May 2024 17:59:49 GMT, Scott Gibbons <sgibb...@openjdk.org> wrote:
>> src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp line 578: >> >>> 576: // helper jumps to L_checkRangeAndReturn with a (-1) return value. >>> 577: big_case_loop_helper(false, 0, L_checkRangeAndReturn, L_loopTop, >>> mask, hsPtrRet, needleLen, >>> 578: needle, haystack, hsLength, tmp1, tmp2, tmp3, >>> rScratch, ae, _masm); >> >> If we run out of haystack instead of jumping to L_checkRangeAndReturn, we >> could directly jump to L_retrunError. > > Again, I think we ought to leave this in. Although it executes ~3 > instructions that may not be necessary in some cases I think it's best to > perform the check. Once we have a good enough test to check reading past the > end of the haystack we can change it. In this particular case, we are returning -1 (NoMatch), so no need to do L_checkRangeAndReturn here, we could directly jump to L_returnError. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16753#discussion_r1617853337