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

Doug Simon doug.simon at oracle.com
Thu Jan 10 15:09:36 UTC 2019

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.



More information about the hotspot-compiler-dev mailing list