[vectorIntrinsics] RFR: Refactor JVM Interface

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Tue Mar 24 22:34:39 UTC 2020


> Java side looks good.

Thanks, Paul.

> I browsed the HS side.  It looks like you greatly simplified some code, namely that which was gated by the old flag VectorAPIAggressiveReboxing.  Is that related to "don't remove unused VectorBoxAllocate nodes, but replace them with safepoints”?

Not really, most of the code are still there. In particular, vector box 
elimination pass is moved into src/hotspot/share/opto/vector.cpp [1].

The size is significantly reduced since JVM doesn't need to enumerate 
all typed vector variants anymore.

And VBA-related change is a 1-liner in 
PhaseVector::eliminate_vbox_alloc_node():

  471 void PhaseVector::eliminate_vbox_alloc_node(VectorBoxAllocateNode* 
vbox_alloc) {
  472   JVMState* jvms = clone_jvms(C, vbox_alloc);
  473   GraphKit kit(jvms);
  474   // Remove VBA, but leave a safepoint behind.
  475   // Otherwise, it may end up with a loop without any safepoint polls.
  476   kit.replace_call(vbox_alloc, kit.map(), true);
  477   C->remove_macro_node(vbox_alloc);
  478 }

Best regards,
Vladimir Ivanov

[1] 
http://cr.openjdk.java.net/~vlivanov/panama/vector/new_jvm_interface/webrev.00/src/hotspot/share/opto/vector.cpp.html

> 
> Paul.
> 
>> On Mar 24, 2020, at 2:07 PM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com> wrote:
>>
>> http://cr.openjdk.java.net/~vlivanov/panama/vector/new_jvm_interface/webrev.00/
>>
>> (First cleanup pass over the JVM implementation.
>> The focus is on JVM-JDK interface.)
>>
>> New JVM interface is minimal and contains intrinsics, well-known classes, and opcode declarations. It resides in java.base (jdk.internal.vm.vector.VectorSupport) and exports the interface to jdk.incubator.vector module.
>>
>> JVM doesn't need to know about typed vectors anymore: VectorPayload, VectorMask, and VectorShuffle are enough to represent all interesting cases and provide enough information to the JVM how to handle vector classes:
>>
>>   - VectorPayload class represents vector values which are amenable to aggressive box elimination transformation
>>      * vector on-heap representation remains primitive array-backed;
>>      * classes which extend VectorPayload should declare 2 static fields (VLENGTH and ETYPE) which describe vector on-heap representation to the JVM (array length and its element type);
>>
>>   - VectorShuffle and VectorMask mark vector shuffles and masks for the JVM;
>>
>>   - VectorSpecies and Vector are there to enhance type checking of JVM intrinsic usages;
>>
>>
>> Also, additional refactorings/fixes:
>>
>>   * merged reinterpret and cast intrinsics into one (convert)
>>
>>   * refactored rematerialization support
>>
>>   * don't remove unused VectorBoxAllocate nodes, but replace them with safepoints
>>
>>   * VM vector support is turned off by default, but automatically enabled when user adds jdk.incubator.vector incubator module to the graph
>>
>>   * multiple minor fixes and cleanups along the way
>>
>> Testing: jdk/incubator/vector tests
>>
>> Best regards,
>> Vladimir Ivanov
> 


More information about the panama-dev mailing list