RFR: 8331196: vector api: Remove unnecessary index check in Byte/ShortVector.fromArray/fromArray0Template
Paul Sandoz
psandoz at openjdk.org
Tue May 21 15:44:04 UTC 2024
On Mon, 20 May 2024 19:21:44 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
>> Hi,
>> Can you help to review this simple patch?
>> Some index check in Byte/ShortVector.fromArray/fromArray0Template seems not necessary, could be removed.
>> Thanks
>
> That does not look correct and will only check a prefix indexes. A `ByteVector` with a shape of 256 bits has 32 lanes, whereas an `IntVector` of the same shape has 8 lanes. The `mapOffset` array will hold 32 indexes that need checking, so we need to loop through `mapOffset` array four times.
> Thanks @PaulSandoz for comment. I just re-ran the vector api tests with this patch on x64 and riscv64, but seems no failures triggered. Let me check further, either I missed something or maybe there is some gap in test to be filled.
More likely a gap in the tests, not sufficiently checking for out of bounds access across the range in the mapOffset array.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18977#issuecomment-2122917109
More information about the core-libs-dev
mailing list