mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8150933: System::arraycopy intrinsic doesn't mark mismatched loads
Reviewed-by: kvn, shade
This commit is contained in:
parent
d466ce4948
commit
a1b61d2827
2 changed files with 12 additions and 7 deletions
|
@ -880,8 +880,14 @@ bool PhaseMacroExpand::generate_block_arraycopy(Node** ctrl, MergeMemNode** mem,
|
||||||
Node* sptr = basic_plus_adr(src, src_off);
|
Node* sptr = basic_plus_adr(src, src_off);
|
||||||
Node* dptr = basic_plus_adr(dest, dest_off);
|
Node* dptr = basic_plus_adr(dest, dest_off);
|
||||||
uint alias_idx = C->get_alias_index(adr_type);
|
uint alias_idx = C->get_alias_index(adr_type);
|
||||||
Node* sval = transform_later(LoadNode::make(_igvn, *ctrl, (*mem)->memory_at(alias_idx), sptr, adr_type, TypeInt::INT, T_INT, MemNode::unordered));
|
bool is_mismatched = (basic_elem_type != T_INT);
|
||||||
Node* st = transform_later(StoreNode::make(_igvn, *ctrl, (*mem)->memory_at(alias_idx), dptr, adr_type, sval, T_INT, MemNode::unordered));
|
Node* sval = transform_later(
|
||||||
|
LoadNode::make(_igvn, *ctrl, (*mem)->memory_at(alias_idx), sptr, adr_type,
|
||||||
|
TypeInt::INT, T_INT, MemNode::unordered, LoadNode::DependsOnlyOnTest,
|
||||||
|
false /*unaligned*/, is_mismatched));
|
||||||
|
Node* st = transform_later(
|
||||||
|
StoreNode::make(_igvn, *ctrl, (*mem)->memory_at(alias_idx), dptr, adr_type,
|
||||||
|
sval, T_INT, MemNode::unordered));
|
||||||
(*mem)->set_memory_at(alias_idx, st);
|
(*mem)->set_memory_at(alias_idx, st);
|
||||||
src_off += BytesPerInt;
|
src_off += BytesPerInt;
|
||||||
dest_off += BytesPerInt;
|
dest_off += BytesPerInt;
|
||||||
|
|
|
@ -1582,7 +1582,6 @@ LoadNode::load_array_final_field(const TypeKlassPtr *tkls,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ASSERT
|
|
||||||
static bool is_mismatched_access(ciConstant con, BasicType loadbt) {
|
static bool is_mismatched_access(ciConstant con, BasicType loadbt) {
|
||||||
BasicType conbt = con.basic_type();
|
BasicType conbt = con.basic_type();
|
||||||
switch (conbt) {
|
switch (conbt) {
|
||||||
|
@ -1597,7 +1596,6 @@ static bool is_mismatched_access(ciConstant con, BasicType loadbt) {
|
||||||
}
|
}
|
||||||
return (conbt != loadbt);
|
return (conbt != loadbt);
|
||||||
}
|
}
|
||||||
#endif // ASSERT
|
|
||||||
|
|
||||||
// Try to constant-fold a stable array element.
|
// Try to constant-fold a stable array element.
|
||||||
static const Type* fold_stable_ary_elem(const TypeAryPtr* ary, int off, BasicType loadbt) {
|
static const Type* fold_stable_ary_elem(const TypeAryPtr* ary, int off, BasicType loadbt) {
|
||||||
|
@ -1608,10 +1606,11 @@ static const Type* fold_stable_ary_elem(const TypeAryPtr* ary, int off, BasicTyp
|
||||||
ciArray* aobj = ary->const_oop()->as_array();
|
ciArray* aobj = ary->const_oop()->as_array();
|
||||||
ciConstant con = aobj->element_value_by_offset(off);
|
ciConstant con = aobj->element_value_by_offset(off);
|
||||||
if (con.basic_type() != T_ILLEGAL && !con.is_null_or_zero()) {
|
if (con.basic_type() != T_ILLEGAL && !con.is_null_or_zero()) {
|
||||||
assert(!is_mismatched_access(con, loadbt),
|
bool is_mismatched = is_mismatched_access(con, loadbt);
|
||||||
"conbt=%s; loadbt=%s", type2name(con.basic_type()), type2name(loadbt));
|
assert(!is_mismatched, "conbt=%s; loadbt=%s", type2name(con.basic_type()), type2name(loadbt));
|
||||||
const Type* con_type = Type::make_from_constant(con);
|
const Type* con_type = Type::make_from_constant(con);
|
||||||
if (con_type != NULL) {
|
// Guard against erroneous constant folding.
|
||||||
|
if (!is_mismatched && con_type != NULL) {
|
||||||
if (con_type->isa_aryptr()) {
|
if (con_type->isa_aryptr()) {
|
||||||
// Join with the array element type, in case it is also stable.
|
// Join with the array element type, in case it is also stable.
|
||||||
int dim = ary->stable_dimension();
|
int dim = ary->stable_dimension();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue