RFR: 8331196: vector api: Remove unnecessary index check in Byte/ShortVector.fromArray/fromArray0Template

Hamlin Li mli at openjdk.org
Wed May 22 17:03:03 UTC 2024


On Fri, 26 Apr 2024 14:06:02 GMT, Hamlin Li <mli 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

In one side, yes, there is a gap in the tests.

In another side, I wonder if the check here is necessary (i.e. `VectorIntrinsics.checkIndex(vix, a.length)`). 
* For default java implementation, it's not necessary, as java code will check it anyway; 
* for intrinsic implementation, I saw relative information (array, offset, index map, offset in the map) are wrapped in LoadVectorGatherNode, I wonder it will also check IOOBE?

As I totally removed `VectorIntrinsics.checkIndex(vix, a.length);`, and in either conditions it still throws IOOBE when it should throw IOOBE.

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

PR Comment: https://git.openjdk.org/jdk/pull/18977#issuecomment-2125320559


More information about the core-libs-dev mailing list