[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:04:12 UTC 2019


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