RFR: 8318650: Optimized subword gather for x86 targets. [v11]

Sandhya Viswanathan sviswanathan at openjdk.org
Wed Jan 31 23:56:04 UTC 2024


On Wed, 31 Jan 2024 21:31:21 GMT, Sandhya Viswanathan <sviswanathan at openjdk.org> wrote:

>> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review comments resolutions.
>
> src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 1613:
> 
>> 1611:   vpand(xtmp, idx_vec, xtmp, vlen_enc);
>> 1612:   // Load double words from normalized indices.
>> 1613:   evpgatherdd(dst, gmask, Address(base, xtmp, scale), vlen_enc);
> 
> Another question, looks to me that we could read beyond the allocated memory for the array here. e.g. consider the following case:
> * It is a byte gather
> * The byte source array is of size 41, i.e. only indices 0-40 are valid
> * The gather index is 40
> 
> Then as part of evpgatherdd we would be reading bytes at 40-43 offset from source array.

I guess the fact that the Java objects are 8 byte alignment padded and the alignment being done at lines 1609-1611 and 1616-1621 somehow takes care of this.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16354#discussion_r1473627981


More information about the core-libs-dev mailing list