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

Josef Haider josef.haider at khg.jku.at
Thu Jan 10 21:52:53 UTC 2019

Agreed, cmpw/cmpb would make more sense here, i just wanted
to keep the changeset minimal, since the entire method may soon be
changed again, anyway.

- Josef

> 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 <https://mail.openjdk.java.net/mailman/listinfo/hotspot-compiler-dev> 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 />//

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20190110/0f5d683b/attachment.html>

More information about the hotspot-compiler-dev mailing list