1101 Node* arg2 = argument(1); |
1101 Node* arg2 = argument(1); |
1102 |
1102 |
1103 arg1 = must_be_not_null(arg1, true); |
1103 arg1 = must_be_not_null(arg1, true); |
1104 arg2 = must_be_not_null(arg2, true); |
1104 arg2 = must_be_not_null(arg2, true); |
1105 |
1105 |
|
1106 arg1 = access_resolve(arg1, ACCESS_READ); |
|
1107 arg2 = access_resolve(arg2, ACCESS_READ); |
|
1108 |
1106 // Get start addr and length of first argument |
1109 // Get start addr and length of first argument |
1107 Node* arg1_start = array_element_address(arg1, intcon(0), T_BYTE); |
1110 Node* arg1_start = array_element_address(arg1, intcon(0), T_BYTE); |
1108 Node* arg1_cnt = load_array_length(arg1); |
1111 Node* arg1_cnt = load_array_length(arg1); |
1109 |
1112 |
1110 // Get start addr and length of second argument |
1113 // Get start addr and length of second argument |
1127 |
1130 |
1128 if (!stopped()) { |
1131 if (!stopped()) { |
1129 |
1132 |
1130 arg1 = must_be_not_null(arg1, true); |
1133 arg1 = must_be_not_null(arg1, true); |
1131 arg2 = must_be_not_null(arg2, true); |
1134 arg2 = must_be_not_null(arg2, true); |
|
1135 |
|
1136 arg1 = access_resolve(arg1, ACCESS_READ); |
|
1137 arg2 = access_resolve(arg2, ACCESS_READ); |
1132 |
1138 |
1133 // Get start addr and length of first argument |
1139 // Get start addr and length of first argument |
1134 Node* arg1_start = array_element_address(arg1, intcon(0), T_BYTE); |
1140 Node* arg1_start = array_element_address(arg1, intcon(0), T_BYTE); |
1135 Node* arg1_cnt = load_array_length(arg1); |
1141 Node* arg1_cnt = load_array_length(arg1); |
1136 |
1142 |
1168 bool LibraryCallKit::inline_array_equals(StrIntrinsicNode::ArgEnc ae) { |
1174 bool LibraryCallKit::inline_array_equals(StrIntrinsicNode::ArgEnc ae) { |
1169 assert(ae == StrIntrinsicNode::UU || ae == StrIntrinsicNode::LL, "unsupported array types"); |
1175 assert(ae == StrIntrinsicNode::UU || ae == StrIntrinsicNode::LL, "unsupported array types"); |
1170 Node* arg1 = argument(0); |
1176 Node* arg1 = argument(0); |
1171 Node* arg2 = argument(1); |
1177 Node* arg2 = argument(1); |
1172 |
1178 |
|
1179 arg1 = access_resolve(arg1, ACCESS_READ); |
|
1180 arg2 = access_resolve(arg2, ACCESS_READ); |
|
1181 |
1173 const TypeAryPtr* mtype = (ae == StrIntrinsicNode::UU) ? TypeAryPtr::CHARS : TypeAryPtr::BYTES; |
1182 const TypeAryPtr* mtype = (ae == StrIntrinsicNode::UU) ? TypeAryPtr::CHARS : TypeAryPtr::BYTES; |
1174 set_result(_gvn.transform(new AryEqNode(control(), memory(mtype), arg1, arg2, ae))); |
1183 set_result(_gvn.transform(new AryEqNode(control(), memory(mtype), arg1, arg2, ae))); |
1175 clear_upper_avx(); |
1184 clear_upper_avx(); |
1176 |
1185 |
1177 return true; |
1186 return true; |
1194 // Range checks |
1203 // Range checks |
1195 generate_string_range_check(ba, offset, len, false); |
1204 generate_string_range_check(ba, offset, len, false); |
1196 if (stopped()) { |
1205 if (stopped()) { |
1197 return true; |
1206 return true; |
1198 } |
1207 } |
|
1208 ba = access_resolve(ba, ACCESS_READ); |
1199 Node* ba_start = array_element_address(ba, offset, T_BYTE); |
1209 Node* ba_start = array_element_address(ba, offset, T_BYTE); |
1200 Node* result = new HasNegativesNode(control(), memory(TypeAryPtr::BYTES), ba_start, len); |
1210 Node* result = new HasNegativesNode(control(), memory(TypeAryPtr::BYTES), ba_start, len); |
1201 set_result(_gvn.transform(result)); |
1211 set_result(_gvn.transform(result)); |
1202 return true; |
1212 return true; |
1203 } |
1213 } |
1264 Node* result_phi = new PhiNode(result_rgn, TypeInt::INT); |
1274 Node* result_phi = new PhiNode(result_rgn, TypeInt::INT); |
1265 |
1275 |
1266 src = must_be_not_null(src, true); |
1276 src = must_be_not_null(src, true); |
1267 tgt = must_be_not_null(tgt, true); |
1277 tgt = must_be_not_null(tgt, true); |
1268 |
1278 |
|
1279 src = access_resolve(src, ACCESS_READ); |
|
1280 tgt = access_resolve(tgt, ACCESS_READ); |
|
1281 |
1269 // Get start addr and length of source string |
1282 // Get start addr and length of source string |
1270 Node* src_start = array_element_address(src, intcon(0), T_BYTE); |
1283 Node* src_start = array_element_address(src, intcon(0), T_BYTE); |
1271 Node* src_count = load_array_length(src); |
1284 Node* src_count = load_array_length(src); |
1272 |
1285 |
1273 // Get start addr and length of substring |
1286 // Get start addr and length of substring |
1310 Node* tgt_count = argument(3); // char count |
1323 Node* tgt_count = argument(3); // char count |
1311 Node* from_index = argument(4); // char index |
1324 Node* from_index = argument(4); // char index |
1312 |
1325 |
1313 src = must_be_not_null(src, true); |
1326 src = must_be_not_null(src, true); |
1314 tgt = must_be_not_null(tgt, true); |
1327 tgt = must_be_not_null(tgt, true); |
|
1328 |
|
1329 src = access_resolve(src, ACCESS_READ); |
|
1330 tgt = access_resolve(tgt, ACCESS_READ); |
1315 |
1331 |
1316 // Multiply byte array index by 2 if String is UTF16 encoded |
1332 // Multiply byte array index by 2 if String is UTF16 encoded |
1317 Node* src_offset = (ae == StrIntrinsicNode::LL) ? from_index : _gvn.transform(new LShiftINode(from_index, intcon(1))); |
1333 Node* src_offset = (ae == StrIntrinsicNode::LL) ? from_index : _gvn.transform(new LShiftINode(from_index, intcon(1))); |
1318 src_count = _gvn.transform(new SubINode(src_count, from_index)); |
1334 src_count = _gvn.transform(new SubINode(src_count, from_index)); |
1319 Node* src_start = array_element_address(src, src_offset, T_BYTE); |
1335 Node* src_start = array_element_address(src, src_offset, T_BYTE); |
1397 Node* tgt = argument(1); // tgt is int ch |
1413 Node* tgt = argument(1); // tgt is int ch |
1398 Node* from_index = argument(2); |
1414 Node* from_index = argument(2); |
1399 Node* max = argument(3); |
1415 Node* max = argument(3); |
1400 |
1416 |
1401 src = must_be_not_null(src, true); |
1417 src = must_be_not_null(src, true); |
|
1418 src = access_resolve(src, ACCESS_READ); |
1402 |
1419 |
1403 Node* src_offset = _gvn.transform(new LShiftINode(from_index, intcon(1))); |
1420 Node* src_offset = _gvn.transform(new LShiftINode(from_index, intcon(1))); |
1404 Node* src_start = array_element_address(src, src_offset, T_BYTE); |
1421 Node* src_start = array_element_address(src, src_offset, T_BYTE); |
1405 Node* src_count = _gvn.transform(new SubINode(max, from_index)); |
1422 Node* src_count = _gvn.transform(new SubINode(max, from_index)); |
1406 |
1423 |
1487 generate_string_range_check(dst, dst_offset, length, convert_dst); |
1504 generate_string_range_check(dst, dst_offset, length, convert_dst); |
1488 if (stopped()) { |
1505 if (stopped()) { |
1489 return true; |
1506 return true; |
1490 } |
1507 } |
1491 |
1508 |
|
1509 src = access_resolve(src, ACCESS_READ); |
|
1510 dst = access_resolve(dst, ACCESS_WRITE); |
|
1511 |
1492 Node* src_start = array_element_address(src, src_offset, src_elem); |
1512 Node* src_start = array_element_address(src, src_offset, src_elem); |
1493 Node* dst_start = array_element_address(dst, dst_offset, dst_elem); |
1513 Node* dst_start = array_element_address(dst, dst_offset, dst_elem); |
1494 // 'src_start' points to src array + scaled offset |
1514 // 'src_start' points to src array + scaled offset |
1495 // 'dst_start' points to dst array + scaled offset |
1515 // 'dst_start' points to dst array + scaled offset |
1496 Node* count = NULL; |
1516 Node* count = NULL; |
1577 Node* klass_node = makecon(TypeKlassPtr::make(ciTypeArrayKlass::make(T_BYTE))); |
1597 Node* klass_node = makecon(TypeKlassPtr::make(ciTypeArrayKlass::make(T_BYTE))); |
1578 newcopy = new_array(klass_node, size, 0); // no arguments to push |
1598 newcopy = new_array(klass_node, size, 0); // no arguments to push |
1579 AllocateArrayNode* alloc = tightly_coupled_allocation(newcopy, NULL); |
1599 AllocateArrayNode* alloc = tightly_coupled_allocation(newcopy, NULL); |
1580 |
1600 |
1581 // Calculate starting addresses. |
1601 // Calculate starting addresses. |
|
1602 value = access_resolve(value, ACCESS_READ); |
1582 Node* src_start = array_element_address(value, offset, T_CHAR); |
1603 Node* src_start = array_element_address(value, offset, T_CHAR); |
1583 Node* dst_start = basic_plus_adr(newcopy, arrayOopDesc::base_offset_in_bytes(T_BYTE)); |
1604 Node* dst_start = basic_plus_adr(newcopy, arrayOopDesc::base_offset_in_bytes(T_BYTE)); |
1584 |
1605 |
1585 // Check if src array address is aligned to HeapWordSize (dst is always aligned) |
1606 // Check if src array address is aligned to HeapWordSize (dst is always aligned) |
1586 const TypeInt* toffset = gvn().type(offset)->is_int(); |
1607 const TypeInt* toffset = gvn().type(offset)->is_int(); |
1660 if (stopped()) { |
1681 if (stopped()) { |
1661 return true; |
1682 return true; |
1662 } |
1683 } |
1663 |
1684 |
1664 if (!stopped()) { |
1685 if (!stopped()) { |
|
1686 src = access_resolve(src, ACCESS_READ); |
|
1687 dst = access_resolve(dst, ACCESS_READ); |
|
1688 |
1665 // Calculate starting addresses. |
1689 // Calculate starting addresses. |
1666 Node* src_start = array_element_address(src, src_begin, T_BYTE); |
1690 Node* src_start = array_element_address(src, src_begin, T_BYTE); |
1667 Node* dst_start = array_element_address(dst, dst_begin, T_CHAR); |
1691 Node* dst_start = array_element_address(dst, dst_begin, T_CHAR); |
1668 |
1692 |
1669 // Check if array addresses are aligned to HeapWordSize |
1693 // Check if array addresses are aligned to HeapWordSize |
1728 if (!is_store && value->is_Con() && index->is_Con()) { |
1752 if (!is_store && value->is_Con() && index->is_Con()) { |
1729 return false; |
1753 return false; |
1730 } |
1754 } |
1731 |
1755 |
1732 value = must_be_not_null(value, true); |
1756 value = must_be_not_null(value, true); |
|
1757 value = access_resolve(value, is_store ? ACCESS_WRITE : ACCESS_READ); |
1733 |
1758 |
1734 Node* adr = array_element_address(value, index, T_CHAR); |
1759 Node* adr = array_element_address(value, index, T_CHAR); |
1735 if (adr->is_top()) { |
1760 if (adr->is_top()) { |
1736 return false; |
1761 return false; |
1737 } |
1762 } |
3659 // How many elements will we copy from the original? |
3684 // How many elements will we copy from the original? |
3660 // The answer is MinI(orig_length - start, length). |
3685 // The answer is MinI(orig_length - start, length). |
3661 Node* orig_tail = _gvn.transform(new SubINode(orig_length, start)); |
3686 Node* orig_tail = _gvn.transform(new SubINode(orig_length, start)); |
3662 Node* moved = generate_min_max(vmIntrinsics::_min, orig_tail, length); |
3687 Node* moved = generate_min_max(vmIntrinsics::_min, orig_tail, length); |
3663 |
3688 |
|
3689 original = access_resolve(original, ACCESS_READ); |
|
3690 |
3664 // Generate a direct call to the right arraycopy function(s). |
3691 // Generate a direct call to the right arraycopy function(s). |
3665 // We know the copy is disjoint but we might not know if the |
3692 // We know the copy is disjoint but we might not know if the |
3666 // oop stores need checking. |
3693 // oop stores need checking. |
3667 // Extreme case: Arrays.copyOf((Integer[])x, 10, String[].class). |
3694 // Extreme case: Arrays.copyOf((Integer[])x, 10, String[].class). |
3668 // This will fail a store-check if x contains any non-nulls. |
3695 // This will fail a store-check if x contains any non-nulls. |
4301 // because gc barriers are required when accessing the array. |
4328 // because gc barriers are required when accessing the array. |
4302 Node* is_obja = generate_objArray_guard(obj_klass, (RegionNode*)NULL); |
4329 Node* is_obja = generate_objArray_guard(obj_klass, (RegionNode*)NULL); |
4303 if (is_obja != NULL) { |
4330 if (is_obja != NULL) { |
4304 PreserveJVMState pjvms2(this); |
4331 PreserveJVMState pjvms2(this); |
4305 set_control(is_obja); |
4332 set_control(is_obja); |
|
4333 obj = access_resolve(obj, ACCESS_READ); |
4306 // Generate a direct call to the right arraycopy function(s). |
4334 // Generate a direct call to the right arraycopy function(s). |
4307 Node* alloc = tightly_coupled_allocation(alloc_obj, NULL); |
4335 Node* alloc = tightly_coupled_allocation(alloc_obj, NULL); |
4308 ArrayCopyNode* ac = ArrayCopyNode::make(this, true, obj, intcon(0), alloc_obj, intcon(0), obj_length, alloc != NULL, false); |
4336 ArrayCopyNode* ac = ArrayCopyNode::make(this, true, obj, intcon(0), alloc_obj, intcon(0), obj_length, alloc != NULL, false); |
4309 ac->set_cloneoop(); |
4337 ac->set_cloneoop(); |
4310 Node* n = _gvn.transform(ac); |
4338 Node* n = _gvn.transform(ac); |
4777 |
4805 |
4778 if (stopped()) { |
4806 if (stopped()) { |
4779 return true; |
4807 return true; |
4780 } |
4808 } |
4781 |
4809 |
4782 ArrayCopyNode* ac = ArrayCopyNode::make(this, true, src, src_offset, dest, dest_offset, length, alloc != NULL, negative_length_guard_generated, |
4810 Node* new_src = access_resolve(src, ACCESS_READ); |
|
4811 Node* new_dest = access_resolve(dest, ACCESS_WRITE); |
|
4812 |
|
4813 ArrayCopyNode* ac = ArrayCopyNode::make(this, true, new_src, src_offset, new_dest, dest_offset, length, alloc != NULL, negative_length_guard_generated, |
4783 // Create LoadRange and LoadKlass nodes for use during macro expansion here |
4814 // Create LoadRange and LoadKlass nodes for use during macro expansion here |
4784 // so the compiler has a chance to eliminate them: during macro expansion, |
4815 // so the compiler has a chance to eliminate them: during macro expansion, |
4785 // we have to set their control (CastPP nodes are eliminated). |
4816 // we have to set their control (CastPP nodes are eliminated). |
4786 load_object_klass(src), load_object_klass(dest), |
4817 load_object_klass(src), load_object_klass(dest), |
4787 load_array_length(src), load_array_length(dest)); |
4818 load_array_length(src), load_array_length(dest)); |
4890 Node *length = argument(4); |
4921 Node *length = argument(4); |
4891 |
4922 |
4892 src = must_be_not_null(src, true); |
4923 src = must_be_not_null(src, true); |
4893 dst = must_be_not_null(dst, true); |
4924 dst = must_be_not_null(dst, true); |
4894 |
4925 |
|
4926 src = access_resolve(src, ACCESS_READ); |
|
4927 dst = access_resolve(dst, ACCESS_WRITE); |
|
4928 |
4895 const Type* src_type = src->Value(&_gvn); |
4929 const Type* src_type = src->Value(&_gvn); |
4896 const Type* dst_type = dst->Value(&_gvn); |
4930 const Type* dst_type = dst->Value(&_gvn); |
4897 const TypeAryPtr* top_src = src_type->isa_aryptr(); |
4931 const TypeAryPtr* top_src = src_type->isa_aryptr(); |
4898 const TypeAryPtr* top_dest = dst_type->isa_aryptr(); |
4932 const TypeAryPtr* top_dest = dst_type->isa_aryptr(); |
4899 if (top_src == NULL || top_src->klass() == NULL || |
4933 if (top_src == NULL || top_src->klass() == NULL || |
4944 Node* ylen = argument(3); |
4978 Node* ylen = argument(3); |
4945 Node* z = argument(4); |
4979 Node* z = argument(4); |
4946 |
4980 |
4947 x = must_be_not_null(x, true); |
4981 x = must_be_not_null(x, true); |
4948 y = must_be_not_null(y, true); |
4982 y = must_be_not_null(y, true); |
|
4983 |
|
4984 x = access_resolve(x, ACCESS_READ); |
|
4985 y = access_resolve(y, ACCESS_READ); |
|
4986 z = access_resolve(z, ACCESS_WRITE); |
4949 |
4987 |
4950 const Type* x_type = x->Value(&_gvn); |
4988 const Type* x_type = x->Value(&_gvn); |
4951 const Type* y_type = y->Value(&_gvn); |
4989 const Type* y_type = y->Value(&_gvn); |
4952 const TypeAryPtr* top_x = x_type->isa_aryptr(); |
4990 const TypeAryPtr* top_x = x_type->isa_aryptr(); |
4953 const TypeAryPtr* top_y = y_type->isa_aryptr(); |
4991 const TypeAryPtr* top_y = y_type->isa_aryptr(); |
5053 Node* zlen = argument(3); |
5091 Node* zlen = argument(3); |
5054 |
5092 |
5055 x = must_be_not_null(x, true); |
5093 x = must_be_not_null(x, true); |
5056 z = must_be_not_null(z, true); |
5094 z = must_be_not_null(z, true); |
5057 |
5095 |
|
5096 x = access_resolve(x, ACCESS_READ); |
|
5097 z = access_resolve(z, ACCESS_WRITE); |
|
5098 |
5058 const Type* x_type = x->Value(&_gvn); |
5099 const Type* x_type = x->Value(&_gvn); |
5059 const Type* z_type = z->Value(&_gvn); |
5100 const Type* z_type = z->Value(&_gvn); |
5060 const TypeAryPtr* top_x = x_type->isa_aryptr(); |
5101 const TypeAryPtr* top_x = x_type->isa_aryptr(); |
5061 const TypeAryPtr* top_z = z_type->isa_aryptr(); |
5102 const TypeAryPtr* top_z = z_type->isa_aryptr(); |
5062 if (top_x == NULL || top_x->klass() == NULL || |
5103 if (top_x == NULL || top_x->klass() == NULL || |
5102 Node* len = argument(3); |
5143 Node* len = argument(3); |
5103 Node* k = argument(4); |
5144 Node* k = argument(4); |
5104 |
5145 |
5105 out = must_be_not_null(out, true); |
5146 out = must_be_not_null(out, true); |
5106 |
5147 |
|
5148 in = access_resolve(in, ACCESS_READ); |
|
5149 out = access_resolve(out, ACCESS_WRITE); |
|
5150 |
5107 const Type* out_type = out->Value(&_gvn); |
5151 const Type* out_type = out->Value(&_gvn); |
5108 const Type* in_type = in->Value(&_gvn); |
5152 const Type* in_type = in->Value(&_gvn); |
5109 const TypeAryPtr* top_out = out_type->isa_aryptr(); |
5153 const TypeAryPtr* top_out = out_type->isa_aryptr(); |
5110 const TypeAryPtr* top_in = in_type->isa_aryptr(); |
5154 const TypeAryPtr* top_in = in_type->isa_aryptr(); |
5111 if (top_out == NULL || top_out->klass() == NULL || |
5155 if (top_out == NULL || top_out->klass() == NULL || |
5150 Node* b = argument(1); |
5194 Node* b = argument(1); |
5151 Node* n = argument(2); |
5195 Node* n = argument(2); |
5152 Node* len = argument(3); |
5196 Node* len = argument(3); |
5153 Node* inv = argument(4); |
5197 Node* inv = argument(4); |
5154 Node* m = argument(6); |
5198 Node* m = argument(6); |
|
5199 |
|
5200 a = access_resolve(a, ACCESS_READ); |
|
5201 b = access_resolve(b, ACCESS_READ); |
|
5202 n = access_resolve(n, ACCESS_READ); |
|
5203 m = access_resolve(m, ACCESS_WRITE); |
5155 |
5204 |
5156 const Type* a_type = a->Value(&_gvn); |
5205 const Type* a_type = a->Value(&_gvn); |
5157 const TypeAryPtr* top_a = a_type->isa_aryptr(); |
5206 const TypeAryPtr* top_a = a_type->isa_aryptr(); |
5158 const Type* b_type = b->Value(&_gvn); |
5207 const Type* b_type = b->Value(&_gvn); |
5159 const TypeAryPtr* top_b = b_type->isa_aryptr(); |
5208 const TypeAryPtr* top_b = b_type->isa_aryptr(); |
5210 Node* n = argument(1); |
5259 Node* n = argument(1); |
5211 Node* len = argument(2); |
5260 Node* len = argument(2); |
5212 Node* inv = argument(3); |
5261 Node* inv = argument(3); |
5213 Node* m = argument(5); |
5262 Node* m = argument(5); |
5214 |
5263 |
|
5264 a = access_resolve(a, ACCESS_READ); |
|
5265 n = access_resolve(n, ACCESS_READ); |
|
5266 m = access_resolve(m, ACCESS_WRITE); |
|
5267 |
5215 const Type* a_type = a->Value(&_gvn); |
5268 const Type* a_type = a->Value(&_gvn); |
5216 const TypeAryPtr* top_a = a_type->isa_aryptr(); |
5269 const TypeAryPtr* top_a = a_type->isa_aryptr(); |
5217 const Type* n_type = a->Value(&_gvn); |
5270 const Type* n_type = a->Value(&_gvn); |
5218 const TypeAryPtr* top_n = n_type->isa_aryptr(); |
5271 const TypeAryPtr* top_n = n_type->isa_aryptr(); |
5219 const Type* m_type = a->Value(&_gvn); |
5272 const Type* m_type = a->Value(&_gvn); |
5355 return false; |
5408 return false; |
5356 } |
5409 } |
5357 |
5410 |
5358 // 'src_start' points to src array + scaled offset |
5411 // 'src_start' points to src array + scaled offset |
5359 src = must_be_not_null(src, true); |
5412 src = must_be_not_null(src, true); |
|
5413 src = access_resolve(src, ACCESS_READ); |
5360 Node* src_start = array_element_address(src, offset, src_elem); |
5414 Node* src_start = array_element_address(src, offset, src_elem); |
5361 |
5415 |
5362 // We assume that range check is done by caller. |
5416 // We assume that range check is done by caller. |
5363 // TODO: generate range check (offset+length < src.length) in debug VM. |
5417 // TODO: generate range check (offset+length < src.length) in debug VM. |
5364 |
5418 |
5444 return false; |
5498 return false; |
5445 } |
5499 } |
5446 |
5500 |
5447 // 'src_start' points to src array + scaled offset |
5501 // 'src_start' points to src array + scaled offset |
5448 src = must_be_not_null(src, true); |
5502 src = must_be_not_null(src, true); |
|
5503 src = access_resolve(src, ACCESS_READ); |
5449 Node* src_start = array_element_address(src, offset, src_elem); |
5504 Node* src_start = array_element_address(src, offset, src_elem); |
5450 |
5505 |
5451 // static final int[] byteTable in class CRC32C |
5506 // static final int[] byteTable in class CRC32C |
5452 Node* table = get_table_from_crc32c_class(callee()->holder()); |
5507 Node* table = get_table_from_crc32c_class(callee()->holder()); |
5453 table = must_be_not_null(table, true); |
5508 table = must_be_not_null(table, true); |
|
5509 table = access_resolve(table, ACCESS_READ); |
5454 Node* table_start = array_element_address(table, intcon(0), T_INT); |
5510 Node* table_start = array_element_address(table, intcon(0), T_INT); |
5455 |
5511 |
5456 // We assume that range check is done by caller. |
5512 // We assume that range check is done by caller. |
5457 // TODO: generate range check (offset+length < src.length) in debug VM. |
5513 // TODO: generate range check (offset+length < src.length) in debug VM. |
5458 |
5514 |
5493 Node* src_start = basic_plus_adr(top(), base, offset); |
5549 Node* src_start = basic_plus_adr(top(), base, offset); |
5494 |
5550 |
5495 // static final int[] byteTable in class CRC32C |
5551 // static final int[] byteTable in class CRC32C |
5496 Node* table = get_table_from_crc32c_class(callee()->holder()); |
5552 Node* table = get_table_from_crc32c_class(callee()->holder()); |
5497 table = must_be_not_null(table, true); |
5553 table = must_be_not_null(table, true); |
|
5554 table = access_resolve(table, ACCESS_READ); |
5498 Node* table_start = array_element_address(table, intcon(0), T_INT); |
5555 Node* table_start = array_element_address(table, intcon(0), T_INT); |
5499 |
5556 |
5500 // Call the stub. |
5557 // Call the stub. |
5501 address stubAddr = StubRoutines::updateBytesCRC32C(); |
5558 address stubAddr = StubRoutines::updateBytesCRC32C(); |
5502 const char *stubName = "updateBytesCRC32C"; |
5559 const char *stubName = "updateBytesCRC32C"; |
5536 if (src_elem != T_BYTE) { |
5593 if (src_elem != T_BYTE) { |
5537 return false; |
5594 return false; |
5538 } |
5595 } |
5539 |
5596 |
5540 // 'src_start' points to src array + scaled offset |
5597 // 'src_start' points to src array + scaled offset |
|
5598 src = access_resolve(src, ACCESS_READ); |
5541 Node* src_start = array_element_address(src, offset, src_elem); |
5599 Node* src_start = array_element_address(src, offset, src_elem); |
5542 |
5600 |
5543 // We assume that range check is done by caller. |
5601 // We assume that range check is done by caller. |
5544 // TODO: generate range check (offset+length < src.length) in debug VM. |
5602 // TODO: generate range check (offset+length < src.length) in debug VM. |
5545 |
5603 |
5739 Node* dest_offset = argument(4); |
5797 Node* dest_offset = argument(4); |
5740 |
5798 |
5741 src = must_be_not_null(src, true); |
5799 src = must_be_not_null(src, true); |
5742 dest = must_be_not_null(dest, true); |
5800 dest = must_be_not_null(dest, true); |
5743 |
5801 |
|
5802 src = access_resolve(src, ACCESS_READ); |
|
5803 dest = access_resolve(dest, ACCESS_WRITE); |
|
5804 |
5744 // (1) src and dest are arrays. |
5805 // (1) src and dest are arrays. |
5745 const Type* src_type = src->Value(&_gvn); |
5806 const Type* src_type = src->Value(&_gvn); |
5746 const Type* dest_type = dest->Value(&_gvn); |
5807 const Type* dest_type = dest->Value(&_gvn); |
5747 const TypeAryPtr* top_src = src_type->isa_aryptr(); |
5808 const TypeAryPtr* top_src = src_type->isa_aryptr(); |
5748 const TypeAryPtr* top_dest = dest_type->isa_aryptr(); |
5809 const TypeAryPtr* top_dest = dest_type->isa_aryptr(); |
5812 Node* dest_offset = argument(5); |
5873 Node* dest_offset = argument(5); |
5813 |
5874 |
5814 src = must_be_not_null(src, false); |
5875 src = must_be_not_null(src, false); |
5815 dest = must_be_not_null(dest, false); |
5876 dest = must_be_not_null(dest, false); |
5816 |
5877 |
|
5878 src = access_resolve(src, ACCESS_READ); |
|
5879 dest = access_resolve(dest, ACCESS_WRITE); |
|
5880 |
5817 // (1) src and dest are arrays. |
5881 // (1) src and dest are arrays. |
5818 const Type* src_type = src->Value(&_gvn); |
5882 const Type* src_type = src->Value(&_gvn); |
5819 const Type* dest_type = dest->Value(&_gvn); |
5883 const Type* dest_type = dest->Value(&_gvn); |
5820 const TypeAryPtr* top_src = src_type->isa_aryptr(); |
5884 const TypeAryPtr* top_src = src_type->isa_aryptr(); |
5821 const TypeAryPtr* top_dest = dest_type->isa_aryptr(); |
5885 const TypeAryPtr* top_dest = dest_type->isa_aryptr(); |
5857 if (k_start == NULL) return false; |
5921 if (k_start == NULL) return false; |
5858 |
5922 |
5859 // similarly, get the start address of the r vector |
5923 // similarly, get the start address of the r vector |
5860 Node* objRvec = load_field_from_object(cipherBlockChaining_object, "r", "[B", /*is_exact*/ false); |
5924 Node* objRvec = load_field_from_object(cipherBlockChaining_object, "r", "[B", /*is_exact*/ false); |
5861 if (objRvec == NULL) return false; |
5925 if (objRvec == NULL) return false; |
|
5926 objRvec = access_resolve(objRvec, ACCESS_WRITE); |
5862 Node* r_start = array_element_address(objRvec, intcon(0), T_BYTE); |
5927 Node* r_start = array_element_address(objRvec, intcon(0), T_BYTE); |
5863 |
5928 |
5864 Node* cbcCrypt; |
5929 Node* cbcCrypt; |
5865 if (Matcher::pass_original_key_for_aes()) { |
5930 if (Matcher::pass_original_key_for_aes()) { |
5866 // on SPARC we need to pass the original key since key expansion needs to happen in intrinsics due to |
5931 // on SPARC we need to pass the original key since key expansion needs to happen in intrinsics due to |
5904 Node* src = argument(1); |
5969 Node* src = argument(1); |
5905 Node* src_offset = argument(2); |
5970 Node* src_offset = argument(2); |
5906 Node* len = argument(3); |
5971 Node* len = argument(3); |
5907 Node* dest = argument(4); |
5972 Node* dest = argument(4); |
5908 Node* dest_offset = argument(5); |
5973 Node* dest_offset = argument(5); |
|
5974 |
|
5975 src = access_resolve(src, ACCESS_READ); |
|
5976 dest = access_resolve(dest, ACCESS_WRITE); |
|
5977 counterMode_object = access_resolve(counterMode_object, ACCESS_WRITE); |
5909 |
5978 |
5910 // (1) src and dest are arrays. |
5979 // (1) src and dest are arrays. |
5911 const Type* src_type = src->Value(&_gvn); |
5980 const Type* src_type = src->Value(&_gvn); |
5912 const Type* dest_type = dest->Value(&_gvn); |
5981 const Type* dest_type = dest->Value(&_gvn); |
5913 const TypeAryPtr* top_src = src_type->isa_aryptr(); |
5982 const TypeAryPtr* top_src = src_type->isa_aryptr(); |
5945 Node* k_start = get_key_start_from_aescrypt_object(aescrypt_object); |
6014 Node* k_start = get_key_start_from_aescrypt_object(aescrypt_object); |
5946 if (k_start == NULL) return false; |
6015 if (k_start == NULL) return false; |
5947 // similarly, get the start address of the r vector |
6016 // similarly, get the start address of the r vector |
5948 Node* obj_counter = load_field_from_object(counterMode_object, "counter", "[B", /*is_exact*/ false); |
6017 Node* obj_counter = load_field_from_object(counterMode_object, "counter", "[B", /*is_exact*/ false); |
5949 if (obj_counter == NULL) return false; |
6018 if (obj_counter == NULL) return false; |
|
6019 obj_counter = access_resolve(obj_counter, ACCESS_WRITE); |
5950 Node* cnt_start = array_element_address(obj_counter, intcon(0), T_BYTE); |
6020 Node* cnt_start = array_element_address(obj_counter, intcon(0), T_BYTE); |
5951 |
6021 |
5952 Node* saved_encCounter = load_field_from_object(counterMode_object, "encryptedCounter", "[B", /*is_exact*/ false); |
6022 Node* saved_encCounter = load_field_from_object(counterMode_object, "encryptedCounter", "[B", /*is_exact*/ false); |
5953 if (saved_encCounter == NULL) return false; |
6023 if (saved_encCounter == NULL) return false; |
|
6024 saved_encCounter = access_resolve(saved_encCounter, ACCESS_WRITE); |
5954 Node* saved_encCounter_start = array_element_address(saved_encCounter, intcon(0), T_BYTE); |
6025 Node* saved_encCounter_start = array_element_address(saved_encCounter, intcon(0), T_BYTE); |
5955 Node* used = field_address_from_object(counterMode_object, "used", "I", /*is_exact*/ false); |
6026 Node* used = field_address_from_object(counterMode_object, "used", "I", /*is_exact*/ false); |
5956 |
6027 |
5957 Node* ctrCrypt; |
6028 Node* ctrCrypt; |
5958 if (Matcher::pass_original_key_for_aes()) { |
6029 if (Matcher::pass_original_key_for_aes()) { |
5989 #endif // PPC64 |
6060 #endif // PPC64 |
5990 assert (objAESCryptKey != NULL, "wrong version of com.sun.crypto.provider.AESCrypt"); |
6061 assert (objAESCryptKey != NULL, "wrong version of com.sun.crypto.provider.AESCrypt"); |
5991 if (objAESCryptKey == NULL) return (Node *) NULL; |
6062 if (objAESCryptKey == NULL) return (Node *) NULL; |
5992 |
6063 |
5993 // now have the array, need to get the start address of the K array |
6064 // now have the array, need to get the start address of the K array |
|
6065 objAESCryptKey = access_resolve(objAESCryptKey, ACCESS_READ); |
5994 Node* k_start = array_element_address(objAESCryptKey, intcon(0), T_INT); |
6066 Node* k_start = array_element_address(objAESCryptKey, intcon(0), T_INT); |
5995 return k_start; |
6067 return k_start; |
5996 } |
6068 } |
5997 |
6069 |
5998 //------------------------------get_original_key_start_from_aescrypt_object----------------------- |
6070 //------------------------------get_original_key_start_from_aescrypt_object----------------------- |
6000 Node* objAESCryptKey = load_field_from_object(aescrypt_object, "lastKey", "[B", /*is_exact*/ false); |
6072 Node* objAESCryptKey = load_field_from_object(aescrypt_object, "lastKey", "[B", /*is_exact*/ false); |
6001 assert (objAESCryptKey != NULL, "wrong version of com.sun.crypto.provider.AESCrypt"); |
6073 assert (objAESCryptKey != NULL, "wrong version of com.sun.crypto.provider.AESCrypt"); |
6002 if (objAESCryptKey == NULL) return (Node *) NULL; |
6074 if (objAESCryptKey == NULL) return (Node *) NULL; |
6003 |
6075 |
6004 // now have the array, need to get the start address of the lastKey array |
6076 // now have the array, need to get the start address of the lastKey array |
|
6077 objAESCryptKey = access_resolve(objAESCryptKey, ACCESS_READ); |
6005 Node* original_k_start = array_element_address(objAESCryptKey, intcon(0), T_BYTE); |
6078 Node* original_k_start = array_element_address(objAESCryptKey, intcon(0), T_BYTE); |
6006 return original_k_start; |
6079 return original_k_start; |
6007 } |
6080 } |
6008 |
6081 |
6009 //----------------------------inline_cipherBlockChaining_AESCrypt_predicate---------------------------- |
6082 //----------------------------inline_cipherBlockChaining_AESCrypt_predicate---------------------------- |
6129 Node* subkeyH = argument(4); |
6202 Node* subkeyH = argument(4); |
6130 |
6203 |
6131 state = must_be_not_null(state, true); |
6204 state = must_be_not_null(state, true); |
6132 subkeyH = must_be_not_null(subkeyH, true); |
6205 subkeyH = must_be_not_null(subkeyH, true); |
6133 data = must_be_not_null(data, true); |
6206 data = must_be_not_null(data, true); |
|
6207 |
|
6208 state = access_resolve(state, ACCESS_WRITE); |
|
6209 subkeyH = access_resolve(subkeyH, ACCESS_READ); |
|
6210 data = access_resolve(data, ACCESS_READ); |
6134 |
6211 |
6135 Node* state_start = array_element_address(state, intcon(0), T_LONG); |
6212 Node* state_start = array_element_address(state, intcon(0), T_LONG); |
6136 assert(state_start, "state is NULL"); |
6213 assert(state_start, "state is NULL"); |
6137 Node* subkeyH_start = array_element_address(subkeyH, intcon(0), T_LONG); |
6214 Node* subkeyH_start = array_element_address(subkeyH, intcon(0), T_LONG); |
6138 assert(subkeyH_start, "subkeyH is NULL"); |
6215 assert(subkeyH_start, "subkeyH is NULL"); |
6204 if (src_elem != T_BYTE) { |
6281 if (src_elem != T_BYTE) { |
6205 return false; |
6282 return false; |
6206 } |
6283 } |
6207 // 'src_start' points to src array + offset |
6284 // 'src_start' points to src array + offset |
6208 src = must_be_not_null(src, true); |
6285 src = must_be_not_null(src, true); |
|
6286 src = access_resolve(src, ACCESS_READ); |
6209 Node* src_start = array_element_address(src, ofs, src_elem); |
6287 Node* src_start = array_element_address(src, ofs, src_elem); |
6210 Node* state = NULL; |
6288 Node* state = NULL; |
6211 address stubAddr; |
6289 address stubAddr; |
6212 const char *stubName; |
6290 const char *stubName; |
6213 |
6291 |
6271 if (src_elem != T_BYTE) { |
6349 if (src_elem != T_BYTE) { |
6272 return false; |
6350 return false; |
6273 } |
6351 } |
6274 // 'src_start' points to src array + offset |
6352 // 'src_start' points to src array + offset |
6275 src = must_be_not_null(src, false); |
6353 src = must_be_not_null(src, false); |
|
6354 src = access_resolve(src, ACCESS_READ); |
6276 Node* src_start = array_element_address(src, ofs, src_elem); |
6355 Node* src_start = array_element_address(src, ofs, src_elem); |
6277 |
6356 |
6278 const char* klass_SHA_name = NULL; |
6357 const char* klass_SHA_name = NULL; |
6279 const char* stub_name = NULL; |
6358 const char* stub_name = NULL; |
6280 address stub_addr = NULL; |
6359 address stub_addr = NULL; |
6353 Node* sha_state = load_field_from_object(sha_object, "state", "[I", /*is_exact*/ false); |
6432 Node* sha_state = load_field_from_object(sha_object, "state", "[I", /*is_exact*/ false); |
6354 assert (sha_state != NULL, "wrong version of sun.security.provider.SHA/SHA2"); |
6433 assert (sha_state != NULL, "wrong version of sun.security.provider.SHA/SHA2"); |
6355 if (sha_state == NULL) return (Node *) NULL; |
6434 if (sha_state == NULL) return (Node *) NULL; |
6356 |
6435 |
6357 // now have the array, need to get the start address of the state array |
6436 // now have the array, need to get the start address of the state array |
|
6437 sha_state = access_resolve(sha_state, ACCESS_WRITE); |
6358 Node* state = array_element_address(sha_state, intcon(0), T_INT); |
6438 Node* state = array_element_address(sha_state, intcon(0), T_INT); |
6359 return state; |
6439 return state; |
6360 } |
6440 } |
6361 |
6441 |
6362 //------------------------------get_state_from_sha5_object----------------------- |
6442 //------------------------------get_state_from_sha5_object----------------------- |
6364 Node* sha_state = load_field_from_object(sha_object, "state", "[J", /*is_exact*/ false); |
6444 Node* sha_state = load_field_from_object(sha_object, "state", "[J", /*is_exact*/ false); |
6365 assert (sha_state != NULL, "wrong version of sun.security.provider.SHA5"); |
6445 assert (sha_state != NULL, "wrong version of sun.security.provider.SHA5"); |
6366 if (sha_state == NULL) return (Node *) NULL; |
6446 if (sha_state == NULL) return (Node *) NULL; |
6367 |
6447 |
6368 // now have the array, need to get the start address of the state array |
6448 // now have the array, need to get the start address of the state array |
|
6449 sha_state = access_resolve(sha_state, ACCESS_WRITE); |
6369 Node* state = array_element_address(sha_state, intcon(0), T_LONG); |
6450 Node* state = array_element_address(sha_state, intcon(0), T_LONG); |
6370 return state; |
6451 return state; |
6371 } |
6452 } |
6372 |
6453 |
6373 //----------------------------inline_digestBase_implCompressMB_predicate---------------------------- |
6454 //----------------------------inline_digestBase_implCompressMB_predicate---------------------------- |