On Thu, 26 Sep 2024 13:04:57 GMT, Roberto Castañeda Lozano 
<rcastaned...@openjdk.org> wrote:

>> This comes from an assert in `LibraryCallKit::inline_string_indexOfI` and I 
>> believe we can perhaps remove that assert and the !UCOH clause. I checked a 
>> couple of tests that tripped that assert, and they seem to work fine, and I 
>> also checked the code in `LibraryCallKit::inline_string_indexOfI` and 
>> `generate_string_indexof_stubs()` and could not find anything obvious that 
>> requires the base offset to be >=16. I am not sure why that assert is there. 
>> I am now running tier1-4 with that change: 
>> https://github.com/rkennke/jdk/commit/7001783e8c11718226506f42b7c1f1fda1af3ad0
>> 
>> If you know (or find) any reason why we need that assert, please let me 
>> know. Otherwise I'd remove it, if you don't have objections.
>
> I am not familiar with the `indexOf` implementation, but here is a relevant 
> comment that motivates the assertion: 
> https://github.com/openjdk/jdk/pull/16753#discussion_r1592774634.

Ok, this is indeed relevant and helpful. This could segfault if we happen to 
read from the very first object on the heap. I can solve this by allowing to 
copy only 8 bytes onto the stack: 
https://github.com/rkennke/jdk/commit/097c2afa04397773e514552dfb942aa889bfa2c1

Does this look correct to you? Or better to do it as a follow-up?
(It passes a couple of indexOf tests, will run tier1-4 on it).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20677#discussion_r1777134871

Reply via email to