Integrated: 8299721: [Vector API] assert in switch-default of LibraryCallKit::arch_supports_vector_rotate is too weak to catch bugs
Jie Fu
jiefu at openjdk.org
Fri Jan 6 13:00:55 UTC 2023
On Fri, 6 Jan 2023 07:53:27 GMT, Jie Fu <jiefu at openjdk.org> wrote:
> Hi all,
>
> The switch-default path of LibraryCallKit::arch_supports_vector_rotate means runtime error.
> This is because `lshiftopc`@Line136 and `rshiftopc`@Line137 would be undefined if the switch-default path is taken.
>
>
> 115 int lshiftopc, rshiftopc;
> 116 switch(elem_bt) {
> 117 case T_BYTE:
> 118 lshiftopc = Op_LShiftI;
> 119 rshiftopc = Op_URShiftB;
> 120 break;
> 121 case T_SHORT:
> 122 lshiftopc = Op_LShiftI;
> 123 rshiftopc = Op_URShiftS;
> 124 break;
> 125 case T_INT:
> 126 lshiftopc = Op_LShiftI;
> 127 rshiftopc = Op_URShiftI;
> 128 break;
> 129 case T_LONG:
> 130 lshiftopc = Op_LShiftL;
> 131 rshiftopc = Op_URShiftL;
> 132 break;
> 133 default:
> 134 assert(false, "Unexpected type");
> 135 }
> 136 int lshiftvopc = VectorNode::opcode(lshiftopc, elem_bt); <--- lshiftopc is undefine with the default path
> 137 int rshiftvopc = VectorNode::opcode(rshiftopc, elem_bt); <--- rshiftopc is undefine with the default path
>
>
> So to prevent potential bugs, it would be better to stop and print an error msg even with release VMs, which is done by other switch-default statements in the file.
>
> Thanks.
> Best regards,
> Jie
This pull request has now been integrated.
Changeset: 8cc1669f
Author: Jie Fu <jiefu at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/8cc1669ffd22c8cabc98585ca6df6fc5fed5fb10
Stats: 3 lines in 1 file changed: 0 ins; 1 del; 2 mod
8299721: [Vector API] assert in switch-default of LibraryCallKit::arch_supports_vector_rotate is too weak to catch bugs
Reviewed-by: jbhateja
-------------
PR: https://git.openjdk.org/jdk/pull/11877
More information about the hotspot-compiler-dev
mailing list