mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 11:34:38 +02:00
8209684: Intrinsics that assume some input non null should use GraphKit::must_be_not_null()
Reviewed-by: kvn, thartmann
This commit is contained in:
parent
f3e518394b
commit
417149e74a
1 changed files with 63 additions and 3 deletions
|
@ -1100,6 +1100,9 @@ bool LibraryCallKit::inline_string_compareTo(StrIntrinsicNode::ArgEnc ae) {
|
||||||
Node* arg1 = argument(0);
|
Node* arg1 = argument(0);
|
||||||
Node* arg2 = argument(1);
|
Node* arg2 = argument(1);
|
||||||
|
|
||||||
|
arg1 = must_be_not_null(arg1, true);
|
||||||
|
arg2 = must_be_not_null(arg2, true);
|
||||||
|
|
||||||
// Get start addr and length of first argument
|
// Get start addr and length of first argument
|
||||||
Node* arg1_start = array_element_address(arg1, intcon(0), T_BYTE);
|
Node* arg1_start = array_element_address(arg1, intcon(0), T_BYTE);
|
||||||
Node* arg1_cnt = load_array_length(arg1);
|
Node* arg1_cnt = load_array_length(arg1);
|
||||||
|
@ -1123,6 +1126,10 @@ bool LibraryCallKit::inline_string_equals(StrIntrinsicNode::ArgEnc ae) {
|
||||||
Node* phi = new PhiNode(region, TypeInt::BOOL);
|
Node* phi = new PhiNode(region, TypeInt::BOOL);
|
||||||
|
|
||||||
if (!stopped()) {
|
if (!stopped()) {
|
||||||
|
|
||||||
|
arg1 = must_be_not_null(arg1, true);
|
||||||
|
arg2 = must_be_not_null(arg2, true);
|
||||||
|
|
||||||
// Get start addr and length of first argument
|
// Get start addr and length of first argument
|
||||||
Node* arg1_start = array_element_address(arg1, intcon(0), T_BYTE);
|
Node* arg1_start = array_element_address(arg1, intcon(0), T_BYTE);
|
||||||
Node* arg1_cnt = load_array_length(arg1);
|
Node* arg1_cnt = load_array_length(arg1);
|
||||||
|
@ -1182,6 +1189,8 @@ bool LibraryCallKit::inline_hasNegatives() {
|
||||||
Node* offset = argument(1);
|
Node* offset = argument(1);
|
||||||
Node* len = argument(2);
|
Node* len = argument(2);
|
||||||
|
|
||||||
|
ba = must_be_not_null(ba, true);
|
||||||
|
|
||||||
// Range checks
|
// Range checks
|
||||||
generate_string_range_check(ba, offset, len, false);
|
generate_string_range_check(ba, offset, len, false);
|
||||||
if (stopped()) {
|
if (stopped()) {
|
||||||
|
@ -1254,6 +1263,9 @@ bool LibraryCallKit::inline_string_indexOf(StrIntrinsicNode::ArgEnc ae) {
|
||||||
RegionNode* result_rgn = new RegionNode(4);
|
RegionNode* result_rgn = new RegionNode(4);
|
||||||
Node* result_phi = new PhiNode(result_rgn, TypeInt::INT);
|
Node* result_phi = new PhiNode(result_rgn, TypeInt::INT);
|
||||||
|
|
||||||
|
src = must_be_not_null(src, true);
|
||||||
|
tgt = must_be_not_null(tgt, true);
|
||||||
|
|
||||||
// Get start addr and length of source string
|
// Get start addr and length of source string
|
||||||
Node* src_start = array_element_address(src, intcon(0), T_BYTE);
|
Node* src_start = array_element_address(src, intcon(0), T_BYTE);
|
||||||
Node* src_count = load_array_length(src);
|
Node* src_count = load_array_length(src);
|
||||||
|
@ -1298,6 +1310,9 @@ bool LibraryCallKit::inline_string_indexOfI(StrIntrinsicNode::ArgEnc ae) {
|
||||||
Node* tgt_count = argument(3); // char count
|
Node* tgt_count = argument(3); // char count
|
||||||
Node* from_index = argument(4); // char index
|
Node* from_index = argument(4); // char index
|
||||||
|
|
||||||
|
src = must_be_not_null(src, true);
|
||||||
|
tgt = must_be_not_null(tgt, true);
|
||||||
|
|
||||||
// Multiply byte array index by 2 if String is UTF16 encoded
|
// Multiply byte array index by 2 if String is UTF16 encoded
|
||||||
Node* src_offset = (ae == StrIntrinsicNode::LL) ? from_index : _gvn.transform(new LShiftINode(from_index, intcon(1)));
|
Node* src_offset = (ae == StrIntrinsicNode::LL) ? from_index : _gvn.transform(new LShiftINode(from_index, intcon(1)));
|
||||||
src_count = _gvn.transform(new SubINode(src_count, from_index));
|
src_count = _gvn.transform(new SubINode(src_count, from_index));
|
||||||
|
@ -1383,6 +1398,8 @@ bool LibraryCallKit::inline_string_indexOfChar() {
|
||||||
Node* from_index = argument(2);
|
Node* from_index = argument(2);
|
||||||
Node* max = argument(3);
|
Node* max = argument(3);
|
||||||
|
|
||||||
|
src = must_be_not_null(src, true);
|
||||||
|
|
||||||
Node* src_offset = _gvn.transform(new LShiftINode(from_index, intcon(1)));
|
Node* src_offset = _gvn.transform(new LShiftINode(from_index, intcon(1)));
|
||||||
Node* src_start = array_element_address(src, src_offset, T_BYTE);
|
Node* src_start = array_element_address(src, src_offset, T_BYTE);
|
||||||
Node* src_count = _gvn.transform(new SubINode(max, from_index));
|
Node* src_count = _gvn.transform(new SubINode(max, from_index));
|
||||||
|
@ -1453,6 +1470,9 @@ bool LibraryCallKit::inline_string_copy(bool compress) {
|
||||||
(!compress && src_elem == T_BYTE && (dst_elem == T_BYTE || dst_elem == T_CHAR)),
|
(!compress && src_elem == T_BYTE && (dst_elem == T_BYTE || dst_elem == T_CHAR)),
|
||||||
"Unsupported array types for inline_string_copy");
|
"Unsupported array types for inline_string_copy");
|
||||||
|
|
||||||
|
src = must_be_not_null(src, true);
|
||||||
|
dst = must_be_not_null(dst, true);
|
||||||
|
|
||||||
// Convert char[] offsets to byte[] offsets
|
// Convert char[] offsets to byte[] offsets
|
||||||
bool convert_src = (compress && src_elem == T_BYTE);
|
bool convert_src = (compress && src_elem == T_BYTE);
|
||||||
bool convert_dst = (!compress && dst_elem == T_BYTE);
|
bool convert_dst = (!compress && dst_elem == T_BYTE);
|
||||||
|
@ -1709,6 +1729,8 @@ bool LibraryCallKit::inline_string_char_access(bool is_store) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
value = must_be_not_null(value, true);
|
||||||
|
|
||||||
Node* adr = array_element_address(value, index, T_CHAR);
|
Node* adr = array_element_address(value, index, T_CHAR);
|
||||||
if (adr->is_top()) {
|
if (adr->is_top()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -4866,6 +4888,9 @@ bool LibraryCallKit::inline_encodeISOArray() {
|
||||||
Node *dst_offset = argument(3);
|
Node *dst_offset = argument(3);
|
||||||
Node *length = argument(4);
|
Node *length = argument(4);
|
||||||
|
|
||||||
|
src = must_be_not_null(src, true);
|
||||||
|
dst = must_be_not_null(dst, true);
|
||||||
|
|
||||||
const Type* src_type = src->Value(&_gvn);
|
const Type* src_type = src->Value(&_gvn);
|
||||||
const Type* dst_type = dst->Value(&_gvn);
|
const Type* dst_type = dst->Value(&_gvn);
|
||||||
const TypeAryPtr* top_src = src_type->isa_aryptr();
|
const TypeAryPtr* top_src = src_type->isa_aryptr();
|
||||||
|
@ -4918,6 +4943,9 @@ bool LibraryCallKit::inline_multiplyToLen() {
|
||||||
Node* ylen = argument(3);
|
Node* ylen = argument(3);
|
||||||
Node* z = argument(4);
|
Node* z = argument(4);
|
||||||
|
|
||||||
|
x = must_be_not_null(x, true);
|
||||||
|
y = must_be_not_null(y, true);
|
||||||
|
|
||||||
const Type* x_type = x->Value(&_gvn);
|
const Type* x_type = x->Value(&_gvn);
|
||||||
const Type* y_type = y->Value(&_gvn);
|
const Type* y_type = y->Value(&_gvn);
|
||||||
const TypeAryPtr* top_x = x_type->isa_aryptr();
|
const TypeAryPtr* top_x = x_type->isa_aryptr();
|
||||||
|
@ -4963,7 +4991,12 @@ bool LibraryCallKit::inline_multiplyToLen() {
|
||||||
} __ else_(); {
|
} __ else_(); {
|
||||||
// Update graphKit memory and control from IdealKit.
|
// Update graphKit memory and control from IdealKit.
|
||||||
sync_kit(ideal);
|
sync_kit(ideal);
|
||||||
Node* zlen_arg = load_array_length(z);
|
Node *cast = new CastPPNode(z, TypePtr::NOTNULL);
|
||||||
|
cast->init_req(0, control());
|
||||||
|
_gvn.set_type(cast, cast->bottom_type());
|
||||||
|
C->record_for_igvn(cast);
|
||||||
|
|
||||||
|
Node* zlen_arg = load_array_length(cast);
|
||||||
// Update IdealKit memory and control from graphKit.
|
// Update IdealKit memory and control from graphKit.
|
||||||
__ sync_kit(this);
|
__ sync_kit(this);
|
||||||
__ if_then(zlen_arg, BoolTest::lt, zlen); {
|
__ if_then(zlen_arg, BoolTest::lt, zlen); {
|
||||||
|
@ -5018,6 +5051,9 @@ bool LibraryCallKit::inline_squareToLen() {
|
||||||
Node* z = argument(2);
|
Node* z = argument(2);
|
||||||
Node* zlen = argument(3);
|
Node* zlen = argument(3);
|
||||||
|
|
||||||
|
x = must_be_not_null(x, true);
|
||||||
|
z = must_be_not_null(z, true);
|
||||||
|
|
||||||
const Type* x_type = x->Value(&_gvn);
|
const Type* x_type = x->Value(&_gvn);
|
||||||
const Type* z_type = z->Value(&_gvn);
|
const Type* z_type = z->Value(&_gvn);
|
||||||
const TypeAryPtr* top_x = x_type->isa_aryptr();
|
const TypeAryPtr* top_x = x_type->isa_aryptr();
|
||||||
|
@ -5065,6 +5101,8 @@ bool LibraryCallKit::inline_mulAdd() {
|
||||||
Node* len = argument(3);
|
Node* len = argument(3);
|
||||||
Node* k = argument(4);
|
Node* k = argument(4);
|
||||||
|
|
||||||
|
out = must_be_not_null(out, true);
|
||||||
|
|
||||||
const Type* out_type = out->Value(&_gvn);
|
const Type* out_type = out->Value(&_gvn);
|
||||||
const Type* in_type = in->Value(&_gvn);
|
const Type* in_type = in->Value(&_gvn);
|
||||||
const TypeAryPtr* top_out = out_type->isa_aryptr();
|
const TypeAryPtr* top_out = out_type->isa_aryptr();
|
||||||
|
@ -5317,6 +5355,7 @@ bool LibraryCallKit::inline_updateBytesCRC32() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'src_start' points to src array + scaled offset
|
// 'src_start' points to src array + scaled offset
|
||||||
|
src = must_be_not_null(src, true);
|
||||||
Node* src_start = array_element_address(src, offset, src_elem);
|
Node* src_start = array_element_address(src, offset, src_elem);
|
||||||
|
|
||||||
// We assume that range check is done by caller.
|
// We assume that range check is done by caller.
|
||||||
|
@ -5405,10 +5444,12 @@ bool LibraryCallKit::inline_updateBytesCRC32C() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'src_start' points to src array + scaled offset
|
// 'src_start' points to src array + scaled offset
|
||||||
|
src = must_be_not_null(src, true);
|
||||||
Node* src_start = array_element_address(src, offset, src_elem);
|
Node* src_start = array_element_address(src, offset, src_elem);
|
||||||
|
|
||||||
// static final int[] byteTable in class CRC32C
|
// static final int[] byteTable in class CRC32C
|
||||||
Node* table = get_table_from_crc32c_class(callee()->holder());
|
Node* table = get_table_from_crc32c_class(callee()->holder());
|
||||||
|
table = must_be_not_null(table, true);
|
||||||
Node* table_start = array_element_address(table, intcon(0), T_INT);
|
Node* table_start = array_element_address(table, intcon(0), T_INT);
|
||||||
|
|
||||||
// We assume that range check is done by caller.
|
// We assume that range check is done by caller.
|
||||||
|
@ -5452,6 +5493,7 @@ bool LibraryCallKit::inline_updateDirectByteBufferCRC32C() {
|
||||||
|
|
||||||
// static final int[] byteTable in class CRC32C
|
// static final int[] byteTable in class CRC32C
|
||||||
Node* table = get_table_from_crc32c_class(callee()->holder());
|
Node* table = get_table_from_crc32c_class(callee()->holder());
|
||||||
|
table = must_be_not_null(table, true);
|
||||||
Node* table_start = array_element_address(table, intcon(0), T_INT);
|
Node* table_start = array_element_address(table, intcon(0), T_INT);
|
||||||
|
|
||||||
// Call the stub.
|
// Call the stub.
|
||||||
|
@ -5695,6 +5737,9 @@ bool LibraryCallKit::inline_aescrypt_Block(vmIntrinsics::ID id) {
|
||||||
Node* dest = argument(3);
|
Node* dest = argument(3);
|
||||||
Node* dest_offset = argument(4);
|
Node* dest_offset = argument(4);
|
||||||
|
|
||||||
|
src = must_be_not_null(src, true);
|
||||||
|
dest = must_be_not_null(dest, true);
|
||||||
|
|
||||||
// (1) src and dest are arrays.
|
// (1) src and dest are arrays.
|
||||||
const Type* src_type = src->Value(&_gvn);
|
const Type* src_type = src->Value(&_gvn);
|
||||||
const Type* dest_type = dest->Value(&_gvn);
|
const Type* dest_type = dest->Value(&_gvn);
|
||||||
|
@ -5765,6 +5810,9 @@ bool LibraryCallKit::inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id) {
|
||||||
Node* dest = argument(4);
|
Node* dest = argument(4);
|
||||||
Node* dest_offset = argument(5);
|
Node* dest_offset = argument(5);
|
||||||
|
|
||||||
|
src = must_be_not_null(src, false);
|
||||||
|
dest = must_be_not_null(dest, false);
|
||||||
|
|
||||||
// (1) src and dest are arrays.
|
// (1) src and dest are arrays.
|
||||||
const Type* src_type = src->Value(&_gvn);
|
const Type* src_type = src->Value(&_gvn);
|
||||||
const Type* dest_type = dest->Value(&_gvn);
|
const Type* dest_type = dest->Value(&_gvn);
|
||||||
|
@ -5970,6 +6018,9 @@ Node* LibraryCallKit::inline_cipherBlockChaining_AESCrypt_predicate(bool decrypt
|
||||||
// The receiver was checked for NULL already.
|
// The receiver was checked for NULL already.
|
||||||
Node* objCBC = argument(0);
|
Node* objCBC = argument(0);
|
||||||
|
|
||||||
|
Node* src = argument(1);
|
||||||
|
Node* dest = argument(4);
|
||||||
|
|
||||||
// Load embeddedCipher field of CipherBlockChaining object.
|
// Load embeddedCipher field of CipherBlockChaining object.
|
||||||
Node* embeddedCipherObj = load_field_from_object(objCBC, "embeddedCipher", "Lcom/sun/crypto/provider/SymmetricCipher;", /*is_exact*/ false);
|
Node* embeddedCipherObj = load_field_from_object(objCBC, "embeddedCipher", "Lcom/sun/crypto/provider/SymmetricCipher;", /*is_exact*/ false);
|
||||||
|
|
||||||
|
@ -5988,6 +6039,10 @@ Node* LibraryCallKit::inline_cipherBlockChaining_AESCrypt_predicate(bool decrypt
|
||||||
set_control(top()); // no regular fast path
|
set_control(top()); // no regular fast path
|
||||||
return ctrl;
|
return ctrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
src = must_be_not_null(src, true);
|
||||||
|
dest = must_be_not_null(dest, true);
|
||||||
|
|
||||||
ciInstanceKlass* instklass_AESCrypt = klass_AESCrypt->as_instance_klass();
|
ciInstanceKlass* instklass_AESCrypt = klass_AESCrypt->as_instance_klass();
|
||||||
|
|
||||||
Node* instof = gen_instanceof(embeddedCipherObj, makecon(TypeKlassPtr::make(instklass_AESCrypt)));
|
Node* instof = gen_instanceof(embeddedCipherObj, makecon(TypeKlassPtr::make(instklass_AESCrypt)));
|
||||||
|
@ -6005,8 +6060,7 @@ Node* LibraryCallKit::inline_cipherBlockChaining_AESCrypt_predicate(bool decrypt
|
||||||
// see the original java code for why.
|
// see the original java code for why.
|
||||||
RegionNode* region = new RegionNode(3);
|
RegionNode* region = new RegionNode(3);
|
||||||
region->init_req(1, instof_false);
|
region->init_req(1, instof_false);
|
||||||
Node* src = argument(1);
|
|
||||||
Node* dest = argument(4);
|
|
||||||
Node* cmp_src_dest = _gvn.transform(new CmpPNode(src, dest));
|
Node* cmp_src_dest = _gvn.transform(new CmpPNode(src, dest));
|
||||||
Node* bool_src_dest = _gvn.transform(new BoolNode(cmp_src_dest, BoolTest::eq));
|
Node* bool_src_dest = _gvn.transform(new BoolNode(cmp_src_dest, BoolTest::eq));
|
||||||
Node* src_dest_conjoint = generate_guard(bool_src_dest, NULL, PROB_MIN);
|
Node* src_dest_conjoint = generate_guard(bool_src_dest, NULL, PROB_MIN);
|
||||||
|
@ -6073,6 +6127,10 @@ bool LibraryCallKit::inline_ghash_processBlocks() {
|
||||||
Node* state = argument(3);
|
Node* state = argument(3);
|
||||||
Node* subkeyH = argument(4);
|
Node* subkeyH = argument(4);
|
||||||
|
|
||||||
|
state = must_be_not_null(state, true);
|
||||||
|
subkeyH = must_be_not_null(subkeyH, true);
|
||||||
|
data = must_be_not_null(data, true);
|
||||||
|
|
||||||
Node* state_start = array_element_address(state, intcon(0), T_LONG);
|
Node* state_start = array_element_address(state, intcon(0), T_LONG);
|
||||||
assert(state_start, "state is NULL");
|
assert(state_start, "state is NULL");
|
||||||
Node* subkeyH_start = array_element_address(subkeyH, intcon(0), T_LONG);
|
Node* subkeyH_start = array_element_address(subkeyH, intcon(0), T_LONG);
|
||||||
|
@ -6146,6 +6204,7 @@ bool LibraryCallKit::inline_sha_implCompress(vmIntrinsics::ID id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 'src_start' points to src array + offset
|
// 'src_start' points to src array + offset
|
||||||
|
src = must_be_not_null(src, true);
|
||||||
Node* src_start = array_element_address(src, ofs, src_elem);
|
Node* src_start = array_element_address(src, ofs, src_elem);
|
||||||
Node* state = NULL;
|
Node* state = NULL;
|
||||||
address stubAddr;
|
address stubAddr;
|
||||||
|
@ -6212,6 +6271,7 @@ bool LibraryCallKit::inline_digestBase_implCompressMB(int predicate) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 'src_start' points to src array + offset
|
// 'src_start' points to src array + offset
|
||||||
|
src = must_be_not_null(src, false);
|
||||||
Node* src_start = array_element_address(src, ofs, src_elem);
|
Node* src_start = array_element_address(src, ofs, src_elem);
|
||||||
|
|
||||||
const char* klass_SHA_name = NULL;
|
const char* klass_SHA_name = NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue