[lworld+vector] RFR: 8307715: Integrate VectorMask/Shuffle with value/primitive classes [v7]

Xiaohong Gong xgong at openjdk.org
Mon May 29 07:13:27 UTC 2023


On Mon, 29 May 2023 07:01:40 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:

>> Phi is still carrying an abstract VectorMask type where as one of its input is concrete mask which is why C2 injects InlineTypeNode for it.
>
> Yes, so do you know how this PhiNode is generated and what it is used for? From the log, I can see the two inputs of Phi are all from `VectorBox`. I guess the abstract VectorMask is from the return type of `VectorMask.fromArray()` ?

I also met several issues due to the VectorAPI abstract classes and its concrete vector classes. As I see, in compiler, sometimes the argument/return type is calculated from the sigunature type of the method, but sometimes it is calculated based on the speculative type which use the profiling info as a reference.  Following is part of my fixing for such cases:

diff --git a/src/hotspot/share/opto/callGenerator.cpp b/src/hotspot/share/opto/callGenerator.cpp
index 985f7f1c8..b77aa11d9 100644
--- a/src/hotspot/share/opto/callGenerator.cpp
+++ b/src/hotspot/share/opto/callGenerator.cpp
@@ -1169,7 +1169,7 @@ static void cast_argument(int nargs, int arg_nb, ciType* t, GraphKit& kit, bool
     kit.set_argument(arg_nb, arg);
   }
   if (sig_type->is_inlinetypeptr()) {
-    arg = InlineTypeNode::make_from_oop(&kit, arg, t->as_inline_klass(), !kit.gvn().type(arg)->maybe_null());
+    arg = InlineTypeNode::make_from_oop(&kit, arg, sig_type->inline_klass(), !kit.gvn().type(arg)->maybe_null());
     kit.set_argument(arg_nb, arg);
   }
 }
diff --git a/src/hotspot/share/opto/graphKit.cpp b/src/hotspot/share/opto/graphKit.cpp
index bce8d7781..bab94b204 100644
--- a/src/hotspot/share/opto/graphKit.cpp
+++ b/src/hotspot/share/opto/graphKit.cpp
@@ -1914,20 +1914,25 @@ Node* GraphKit::set_results_for_java_call(CallJavaNode* call, bool separate_io_p
   }
 
   // Capture the return value, if any.
-  Node* ret;
   if (call->method() == NULL || call->method()->return_type()->basic_type() == T_VOID) {
-    ret = top();
+    return top();
   } else if (call->tf()->returns_inline_type_as_fields()) {
     // Return of multiple values (inline type fields): we create a
     // InlineType node, each field is a projection from the call.
     ciInlineKlass* vk = call->method()->return_type()->as_inline_klass();
     uint base_input = TypeFunc::Parms;
-    ret = InlineTypeNode::make_from_multi(this, call, vk, base_input, false, call->method()->signature()->returns_null_free_inline_type());
+    return InlineTypeNode::make_from_multi(this, call, vk, base_input, false, call->method()->signature()->returns_null_free_inline_type());
   } else {
-    ret = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
+    Node* ret = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
+    ciType* t = call->method()->return_type();
+    if (t->is_klass()) {
+      const Type* sig_type = TypeOopPtr::make_from_klass(t->as_klass());
+      if (sig_type->is_inlinetypeptr()) {
+        ret = InlineTypeNode::make_from_oop(this, ret, sig_type->inline_klass(), false);
+      }
+    }
+    return ret;
   }
-
-  return ret;
 }
 
 //--------------------set_predefined_input_for_runtime_call--------------------

-------------

PR Review Comment: https://git.openjdk.org/valhalla/pull/845#discussion_r1208993080



More information about the valhalla-dev mailing list