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

Jatin Bhateja jbhateja at openjdk.org
Mon May 29 07:34:27 UTC 2023


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

>> 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_inlinetyp...

> 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()` ?

Do not consider empty output list of the PhiNode, this dump was taken from debugger during a reverse debugging step, so it may appear its not getting used. 

All the signatures of top level VectorAPIs methods always deal in abstract types, its only due to aggressive in-lining boxes (concrete vector/mask/shuffle) gets exposed. 

We have currently disabled value scalarization for vectors, please also add mask/shuffle to [that list](https://github.com/openjdk/valhalla/blob/lworld%2Bvector/src/hotspot/share/prims/vectorSupport.cpp#L88)

https://github.com/openjdk/valhalla/blob/lworld%2Bvector/src/hotspot/share/oops/inlineKlass.cpp#L341
https://github.com/openjdk/valhalla/blob/lworld%2Bvector/src/hotspot/share/oops/inlineKlass.cpp#L336

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

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



More information about the valhalla-dev mailing list