[Vector] RFR: reshape, resize, rebracket, cast

Kharbas, Kishor kishor.kharbas at intel.com
Wed Jan 16 08:20:27 UTC 2019


Hi,
I have a patch which refactors the above methods as discussed in this thread - https://mail.openjdk.java.net/pipermail/panama-dev/2018-December/003365.html.

Please review the changes at - http://cr.openjdk.java.net/~kkharbas/vector-api/webrev-reshape_etc
Generation of intrinsics and correct vector boxing elimination have been verified. In the next patch I will add changes to jtreg tests.

I wanted to bring forth one small issue(possibly) which programmers might face with this change -

We provide specialized types like IntVector, FloatVector, etc for users to define their vectors and they would be able to write code like this with previous methods,
    FloatVector float256 = SPECIES_FLOAT256.cast(int256);
Here FloatSpecies would always return FloatVector.

However with this change, since cast() is defined on a vector and takes species of a generic type, it cannot return a specialized Vector like IntVector or FloatVector. User has to explicitly cast the return vector from Vector<T> to specialized Vector or use a generic vector of corresponding element type. For example,
    FloatVector float256 = (FloatVector)int256.cast(SPECIES_FLOAT256);
  or
    Vector<Float> float256 = int256.cast(SPECIES_FLOAT256);

I am not sure if this is even a problem, but I thought its worth mentioning.

Thanks
Kishor


More information about the panama-dev mailing list