mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8159129: TestStringIntrinsicRangeChecks fails w/ No exception thrown for compressByte/inflateByte
Need to convert char offsets to byte offsets before range check. Reviewed-by: vlivanov
This commit is contained in:
parent
9ab5f632b5
commit
b64a4110b3
2 changed files with 13 additions and 11 deletions
|
@ -1403,18 +1403,20 @@ bool LibraryCallKit::inline_string_copy(bool compress) {
|
|||
(!compress && src_elem == T_BYTE && (dst_elem == T_BYTE || dst_elem == T_CHAR)),
|
||||
"Unsupported array types for inline_string_copy");
|
||||
|
||||
// Range checks
|
||||
generate_string_range_check(src, src_offset, length, compress && src_elem == T_BYTE);
|
||||
generate_string_range_check(dst, dst_offset, length, !compress && dst_elem == T_BYTE);
|
||||
if (stopped()) {
|
||||
return true;
|
||||
// Convert char[] offsets to byte[] offsets
|
||||
bool convert_src = (compress && src_elem == T_BYTE);
|
||||
bool convert_dst = (!compress && dst_elem == T_BYTE);
|
||||
if (convert_src) {
|
||||
src_offset = _gvn.transform(new LShiftINode(src_offset, intcon(1)));
|
||||
} else if (convert_dst) {
|
||||
dst_offset = _gvn.transform(new LShiftINode(dst_offset, intcon(1)));
|
||||
}
|
||||
|
||||
// Convert char[] offsets to byte[] offsets
|
||||
if (compress && src_elem == T_BYTE) {
|
||||
src_offset = _gvn.transform(new LShiftINode(src_offset, intcon(1)));
|
||||
} else if (!compress && dst_elem == T_BYTE) {
|
||||
dst_offset = _gvn.transform(new LShiftINode(dst_offset, intcon(1)));
|
||||
// Range checks
|
||||
generate_string_range_check(src, src_offset, length, convert_src);
|
||||
generate_string_range_check(dst, dst_offset, length, convert_dst);
|
||||
if (stopped()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Node* src_start = array_element_address(src, src_offset, src_elem);
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
* @library /compiler/patches /testlibrary /test/lib /
|
||||
* @build java.base/java.lang.Helper
|
||||
* @build compiler.intrinsics.string.TestStringIntrinsicRangeChecks
|
||||
* @run main compiler.intrinsics.string.TestStringIntrinsicRangeChecks
|
||||
* @run main/othervm -Xbatch -XX:CompileThreshold=100 -XX:-TieredCompilation compiler.intrinsics.string.TestStringIntrinsicRangeChecks
|
||||
*/
|
||||
package compiler.intrinsics.string;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue