[vector] Vector API -- alignment with value types

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Sat Feb 9 00:23:52 UTC 2019


> http://cr.openjdk.java.net/~sviswanathan/vectorIntrinsics/Brian/zero/webrev.00/

I have one comment on implementation:

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java:

+    public static ByteVector zero(ByteSpecies species) {
+        return VectorIntrinsics.broadcastCoerced((Class<ByteVector>) 
species.boxType(), byte.class, species.length(),
+                                                 0,
+                                                 (z -> species.zero()));
+    }

There's a slight change in behavior compared to "species.zero()" call 
and that's because not all arguments to 
VectorIntrinsics.broadcastCoerced() are guaranteed to be constant.

If JIT can't devirtualize & inline "species.boxType()", intrinsification 
fails and falls back to default implementation.

In case of species.zero(), a failure to inline callee leads to a virtual 
call, but callee contains intrinsified operation.

Overall, I believe it shouldn't matter from performance perspective 
right now, because a call breaks vector box elimination anyway, but in a 
longer term it may become important.

But I'd still prefer to see calls to VectorIntrinsics be fully 
specialized. In the particular case I referred to, IMO it's better to 
just call species.zero().

Best regards,
Vladimir Ivanov


More information about the panama-dev mailing list