RFR: 8341784: Refactor TypeVect to use a BasicType instead of a const Type* [v2]

Jasmine Karthikeyan jkarthikeyan at openjdk.org
Wed Oct 9 19:29:18 UTC 2024


On Wed, 9 Oct 2024 17:12:33 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> Hi,
>> 
>> This patch refactors `TypeVect` to use a `BasicType` instead of a `const Type*` as our current implementation. This conveys the element information in a clearer and safer manner.
>> 
>> Please take a look and leave your reviews,
>> Thanks a lot.
>
> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
> 
>   style changes

I think this is a really nice cleanup, it makes working with vectors more clear. I've added some minor stylistic fixes you could do since you're already changing these lines.

src/hotspot/share/opto/type.cpp line 2532:

> 2530: //------------------------------meet-------------------------------------------
> 2531: // Compute the MEET of two types. Since each TypeVect is the only instance of
> 2532: // its species, meetting often returns itself

Suggestion:

// its species, meeting often returns itself.

src/hotspot/share/opto/vectorIntrinsics.cpp line 602:

> 600:   }
> 601: 
> 602:   const TypeVect * vt  = TypeVect::make(elem_bt, num_elem);

Suggestion:

  const TypeVect* vt  = TypeVect::make(elem_bt, num_elem);

src/hotspot/share/opto/vectorIntrinsics.cpp line 624:

> 622: 
> 623:   Node * mod_val = gvn().makecon(TypeInt::make(num_elem-1));
> 624:   Node * bcast_mod  = gvn().transform(VectorNode::scalar2vector(mod_val, num_elem, elem_bt));

Suggestion:

  Node* bcast_mod  = gvn().transform(VectorNode::scalar2vector(mod_val, num_elem, elem_bt));

src/hotspot/share/opto/vectorIntrinsics.cpp line 2202:

> 2200: 
> 2201:   // cast index vector from elem_bt vector to byte vector
> 2202:   const TypeVect * byte_vt  = TypeVect::make(T_BYTE, num_elem);

Suggestion:

  const TypeVect* byte_vt  = TypeVect::make(T_BYTE, num_elem);

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

Marked as reviewed by jkarthikeyan (Committer).

PR Review: https://git.openjdk.org/jdk/pull/21414#pullrequestreview-2358047181
PR Review Comment: https://git.openjdk.org/jdk/pull/21414#discussion_r1794077620
PR Review Comment: https://git.openjdk.org/jdk/pull/21414#discussion_r1794068522
PR Review Comment: https://git.openjdk.org/jdk/pull/21414#discussion_r1794070557
PR Review Comment: https://git.openjdk.org/jdk/pull/21414#discussion_r1794069515


More information about the hotspot-compiler-dev mailing list