[vector] refactoring api for mask, shuffle creation

Brian Goetz brian.goetz at oracle.com
Fri Apr 12 17:17:46 UTC 2019

Moving the classes to top-level is a slam-dunk.  There's no need for 
nesting in this API.  We might ask ourselves later if we should rename 
some of these (Shape -> VectorShape) but that's easy if we decide to do so.

I like the idea of moving the mask/shuffle creation methods to 
Mask/Shuffle, since they will be easier for developers to find (and 
secondarily it reduces the surface area of the API.)  Now, the Mask and 
Shuffle abstractions effectively stand on their own; they are their own 
top-level entity, and they take control of their own creation.  This 
results in a simpler API.

I hope that the generated code remains good with this shift.

On 4/11/2019 8:07 PM, Kharbas, Kishor wrote:
> Hi,
> I am experimenting with few changes to improve the API. Specifically,
> 1.mask and shuffle creation methods (example, maskFromArray()) right 
> now are defined in XxxVector. From user’s perspective it seems more 
> intuitive for Mask/Shuffle to define these methods. This patch moves 
> them out of XxxVector to their respective classes.
> 2.Moved classes – Species, Shape, Shuffle and Mask, at the top-level 
> instead of being nested inside vector.
> Please help me evaluate the changes. Apart from moving methods around 
> and changing signatures, there are changes in Species class -- 
> addition of factory methods to create masks and shuffles.
> I am in the process of testing the patch.
> Webrev : 
> http://cr.openjdk.java.net/~kkharbas/vector-api/species_refactoring-phase2/webrev-phase2.02/
> Javadoc : 
> http://cr.openjdk.java.net/~kkharbas/vector-api/species_refactoring-phase2/webrev_phase-2.JavaDoc.02/jdk.incubator.vector/jdk/incubator/vector/package-summary.html
> Thanks
> Kishor

More information about the panama-dev mailing list