# HG changeset patch # User thartmann # Date 1448010582 -3600 # Node ID 5ad1ba3afecc531807302fca81b76e311ce9a08d # Parent 6817dadf6c7ea9583435bf9fcb57e050803e7f03 8140390: Char stores/loads accessing byte arrays must be marked as unmatched Summary: Mark unmatched char stores/loads emitted by CompactStrings. Reviewed-by: roland, vlivanov, jrose diff -r 6817dadf6c7e -r 5ad1ba3afecc hotspot/src/share/vm/opto/graphKit.cpp --- a/hotspot/src/share/vm/opto/graphKit.cpp Thu Nov 19 16:07:22 2015 -0800 +++ b/hotspot/src/share/vm/opto/graphKit.cpp Fri Nov 20 10:09:42 2015 +0100 @@ -4387,7 +4387,8 @@ set_memory(mem, TypeAryPtr::BYTES); Node* ch = load_array_element(control(), src, i_byte, TypeAryPtr::BYTES); Node* st = store_to_memory(control(), array_element_address(dst, i_char, T_BYTE), - AndI(ch, intcon(0xff)), T_CHAR, TypeAryPtr::BYTES, MemNode::unordered); + AndI(ch, intcon(0xff)), T_CHAR, TypeAryPtr::BYTES, MemNode::unordered, + false, false, true /* mismatched */); IfNode* iff = create_and_map_if(head, Bool(CmpI(i_byte, count), BoolTest::lt), PROB_FAIR, COUNT_UNKNOWN); head->init_req(2, IfTrue(iff)); diff -r 6817dadf6c7e -r 5ad1ba3afecc hotspot/src/share/vm/opto/idealKit.hpp --- a/hotspot/src/share/vm/opto/idealKit.hpp Thu Nov 19 16:07:22 2015 -0800 +++ b/hotspot/src/share/vm/opto/idealKit.hpp Fri Nov 20 10:09:42 2015 +0100 @@ -230,8 +230,7 @@ int adr_idx, MemNode::MemOrd mo, bool require_atomic_access = false, - bool mismatched = false - ); + bool mismatched = false); // Store a card mark ordered after store_oop Node* storeCM(Node* ctl, diff -r 6817dadf6c7e -r 5ad1ba3afecc hotspot/src/share/vm/opto/library_call.cpp --- a/hotspot/src/share/vm/opto/library_call.cpp Thu Nov 19 16:07:22 2015 -0800 +++ b/hotspot/src/share/vm/opto/library_call.cpp Fri Nov 20 10:09:42 2015 +0100 @@ -1503,9 +1503,11 @@ Node* adr = array_element_address(value, index, T_CHAR); if (is_store) { - (void) store_to_memory(control(), adr, ch, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered); + (void) store_to_memory(control(), adr, ch, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered, + false, false, true /* mismatched */); } else { - ch = make_load(control(), adr, TypeInt::CHAR, T_CHAR, MemNode::unordered); + ch = make_load(control(), adr, TypeInt::CHAR, T_CHAR, MemNode::unordered, + LoadNode::DependsOnlyOnTest, false, false, true /* mismatched */); set_result(ch); } return true; diff -r 6817dadf6c7e -r 5ad1ba3afecc hotspot/src/share/vm/opto/stringopts.cpp --- a/hotspot/src/share/vm/opto/stringopts.cpp Thu Nov 19 16:07:22 2015 -0800 +++ b/hotspot/src/share/vm/opto/stringopts.cpp Fri Nov 20 10:09:42 2015 +0100 @@ -1293,7 +1293,7 @@ Node* index = __ SubI(charPos, __ intcon((bt == T_BYTE) ? 1 : 2)); Node* ch = __ AddI(r, __ intcon('0')); Node* st = __ store_to_memory(kit.control(), kit.array_element_address(dst_array, index, T_BYTE), - ch, bt, byte_adr_idx, MemNode::unordered); + ch, bt, byte_adr_idx, MemNode::unordered, (bt != T_BYTE) /* mismatched */); iff = kit.create_and_map_if(head, __ Bool(__ CmpI(q, __ intcon(0)), BoolTest::ne), PROB_FAIR, COUNT_UNKNOWN); @@ -1331,7 +1331,7 @@ } else { Node* index = __ SubI(charPos, __ intcon((bt == T_BYTE) ? 1 : 2)); st = __ store_to_memory(kit.control(), kit.array_element_address(dst_array, index, T_BYTE), - sign, bt, byte_adr_idx, MemNode::unordered); + sign, bt, byte_adr_idx, MemNode::unordered, (bt != T_BYTE) /* mismatched */); final_merge->init_req(merge_index + 1, kit.control()); final_mem->init_req(merge_index + 1, st); @@ -1524,7 +1524,7 @@ } else { val = readChar(src_array, i++); } - __ store(__ ctrl(), adr, __ ConI(val), T_CHAR, byte_adr_idx, MemNode::unordered); + __ store(__ ctrl(), adr, __ ConI(val), T_CHAR, byte_adr_idx, MemNode::unordered, true /* mismatched */); index = __ AddI(index, __ ConI(2)); } if (src_is_byte) { @@ -1612,7 +1612,7 @@ } if (!dcon || !dbyte) { // Destination is UTF16. Store a char. - __ store(__ ctrl(), adr, val, T_CHAR, byte_adr_idx, MemNode::unordered); + __ store(__ ctrl(), adr, val, T_CHAR, byte_adr_idx, MemNode::unordered, true /* mismatched */); __ set(end, __ AddI(start, __ ConI(2))); } if (!dcon) {