[12] RFR(S): 8215313: [AOT] java/lang/String/Split.java fails with AOTed java.base

dean.long at oracle.com dean.long at oracle.com
Thu Jan 10 18:53:51 UTC 2019


Taking another look, it seems like cmpl could be replaced with the 
size-appropriate cmpb, cmpw, or cmpl based on byteMode(kind) and 
findTwoCharPrefix, but I guess AMD64Assembler only supports cmpl and 
cmpq right now.

dl

On 1/10/19 10:04 AM, dean.long at oracle.com wrote:
> Is it OK to modify the values of searchValue[i]?  If the search value 
> is already sign-extended, how about sign-extending cmpResult instead 
> of zero-extending searchValue?
>
> dl
>
> On 1/10/19 7:09 AM, Doug Simon wrote:
>> Please review this fix supplied by Josef Haider for an incorrect 
>> compilation of String.split.
>>
>> When the String.indexOf intrinsic on AMD64 reaches the end of a 
>> string, it tries to vectorize the last compare operations by reading 
>> past the bounds of the character/byte array. This is not safe if the 
>> out-of-bounds read would cross a page boundary, so in that case 
>> characters are compared one-by-one. This is done with a 
>> `cmpl`-instruction, which only works as long as the bytes/chars are 
>> not sign extended.
>>
>> The fix is to simply `and` the characters we are searching for with 
>> `0xff`/`0xffff` in order to eliminate any erroneous sign extensions.
>>
>> http://cr.openjdk.java.net/~dnsimon/8215313
>> https://bugs.openjdk.java.net/browse/JDK-8215313
>>
>> -Doug
>



More information about the hotspot-compiler-dev mailing list