RFR: 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 08:00:44 UTC 2023
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
-------------
Commit messages:
- 8299721: [Vector API] assert in switch-default of LibraryCallKit::arch_supports_vector_rotate is too weak to catch bugs
Changes: https://git.openjdk.org/jdk/pull/11877/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11877&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8299721
Stats: 3 lines in 1 file changed: 0 ins; 1 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/11877.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/11877/head:pull/11877
PR: https://git.openjdk.org/jdk/pull/11877
More information about the hotspot-compiler-dev
mailing list