<div dir="ltr"><div dir="ltr"><div>Hi,</div><div><br></div><div>I noticed that the following code doesn't get intrinsified:</div><div><br></div><div> VectorMask.fromLong(ByteVector.SPECIES_128, someInt)</div><div><br></div><div>Profiling with JFR reveals that this method falls back to fromArray and allocates a boolean[], which is undesirable.</div><div><br></div><div>It has to be this fallback code: <a href="https://github.com/openjdk/jdk/blob/41ee582df8c65f2f26b21e46784cf0bc4ece0585/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMask.java#L252">https://github.com/openjdk/jdk/blob/41ee582df8c65f2f26b21e46784cf0bc4ece0585/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMask.java#L252</a></div><div><br></div><div>With PrintIntrin, I'm seeing this message<br><br>** missing constant: vclass=DecodeN etype=ConP vlen=LoadI bitwise=ConI</div><div><br></div><div>I modified the logging and narrowed it down to vector_klass->const_oop() being a nullptr<br><br><a href="https://github.com/openjdk/jdk/blob/41ee582df8c65f2f26b21e46784cf0bc4ece0585/src/hotspot/share/opto/vectorIntrinsics.cpp#L833">https://github.com/openjdk/jdk/blob/41ee582df8c65f2f26b21e46784cf0bc4ece0585/src/hotspot/share/opto/vectorIntrinsics.cpp#L833</a></div><div><br></div><div>I then tried to cheat and hardcode the vector class and lane count in VectorMask.java so it knows the arguments statically, like so:</div><div><br></div><div> return VectorSupport.fromBitsCoerced((Class<? extends AbstractMask<E>>) (Class<?>) Byte128Vector.Byte128Mask.class, vsp.elementType(), 16, bits, ...<br><br></div><div>While this did make inlining happen (as reported by PrintIntrin at least), I couldn't get rid of the boolean[] allocations.</div><div><br></div><div>I'm testing on 41ee582df8c65f2f26b21e46784cf0bc4ece0585 amd64 Linux.<br></div><div><br></div><div>Regards,</div><div>Jakub<br></div></div>
</div>