RFR: 8374043: C2: assert(_base >= VectorMask && _base <= VectorZ) failed: Not a Vector [v2]

Xiaohong Gong xgong at openjdk.org
Wed Jan 21 01:42:01 UTC 2026


On Tue, 20 Jan 2026 19:28:56 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> Vector intrinsics looks safer to me now. The APIs are inlined in an even earlier optimization stage, and the nodes are almost new created ones. Regarding to `unbox_vector()`, it either returns a new created `VectorUnboxNode` or a GVN transformed node of `VectorUnbox`. Currently there is not `TOP` input check for `VectorUnboxNode` itself during GVN.
>> It might be an issue that we need to revisit once we add such checks for vector nodes. 
>> 
>> I agree with that additional input validation should be better. We can abort the API inlining as early as possible. Code may look like:
>> 
>> Node* mask_vec = unbox_vector(mask, mask_box_type, elem_bt, num_elem);
>> if (mask_vec == nullptr || gvn().type(mask_vec) == Type::TOP) {
>>     log_if_needed("  ** unbox failed mask=%s",
>>                       NodeClassNames[argument(4)->Opcode()]);
>>     return false;
>> }
>> 
>> That looks a common issue for all APIs that we'd better fix for all code after `unbox_vector` ? I'm unsure whether I have to do this regarding to the issue this PR reported. Or maybe we could revisit the whole file in future. Any suggestions?
>
> I'd suggest to shape it as follows:
> 
> Node* GraphKit::unbox_vector(Node* v, const TypeInstPtr* vbox_type, BasicType elem_bt, int num_elem) {
>   ...
>   Node* unbox = gvn().transform(new VectorUnboxNode(C, vt, v, merged_memory()));
>   if (!gvn().type(unbox)->isa_vect()) {
>     assert(gvn().type(unbox) == Type::TOP, "sanity");
>     return nullptr; // not a vector
>   }
>   return unbox;
> }

Sounds reasonable. I will fix it with next commit. Thanks for your suggestion!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29057#discussion_r2710648393


More information about the hotspot-compiler-dev mailing list