mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 20:44:41 +02:00
8140390: Char stores/loads accessing byte arrays must be marked as unmatched
Mark unmatched char stores/loads emitted by CompactStrings. Reviewed-by: roland, vlivanov, jrose
This commit is contained in:
parent
2ae7dcf853
commit
ea052022fa
4 changed files with 11 additions and 9 deletions
|
@ -4387,7 +4387,8 @@ void GraphKit::inflate_string_slow(Node* src, Node* dst, Node* start, Node* coun
|
||||||
set_memory(mem, TypeAryPtr::BYTES);
|
set_memory(mem, TypeAryPtr::BYTES);
|
||||||
Node* ch = load_array_element(control(), src, i_byte, 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),
|
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);
|
IfNode* iff = create_and_map_if(head, Bool(CmpI(i_byte, count), BoolTest::lt), PROB_FAIR, COUNT_UNKNOWN);
|
||||||
head->init_req(2, IfTrue(iff));
|
head->init_req(2, IfTrue(iff));
|
||||||
|
|
|
@ -230,8 +230,7 @@ class IdealKit: public StackObj {
|
||||||
int adr_idx,
|
int adr_idx,
|
||||||
MemNode::MemOrd mo,
|
MemNode::MemOrd mo,
|
||||||
bool require_atomic_access = false,
|
bool require_atomic_access = false,
|
||||||
bool mismatched = false
|
bool mismatched = false);
|
||||||
);
|
|
||||||
|
|
||||||
// Store a card mark ordered after store_oop
|
// Store a card mark ordered after store_oop
|
||||||
Node* storeCM(Node* ctl,
|
Node* storeCM(Node* ctl,
|
||||||
|
|
|
@ -1503,9 +1503,11 @@ bool LibraryCallKit::inline_string_char_access(bool is_store) {
|
||||||
|
|
||||||
Node* adr = array_element_address(value, index, T_CHAR);
|
Node* adr = array_element_address(value, index, T_CHAR);
|
||||||
if (is_store) {
|
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 {
|
} 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);
|
set_result(ch);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1293,7 +1293,7 @@ void PhaseStringOpts::getChars(GraphKit& kit, Node* arg, Node* dst_array, BasicT
|
||||||
Node* index = __ SubI(charPos, __ intcon((bt == T_BYTE) ? 1 : 2));
|
Node* index = __ SubI(charPos, __ intcon((bt == T_BYTE) ? 1 : 2));
|
||||||
Node* ch = __ AddI(r, __ intcon('0'));
|
Node* ch = __ AddI(r, __ intcon('0'));
|
||||||
Node* st = __ store_to_memory(kit.control(), kit.array_element_address(dst_array, index, T_BYTE),
|
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),
|
iff = kit.create_and_map_if(head, __ Bool(__ CmpI(q, __ intcon(0)), BoolTest::ne),
|
||||||
PROB_FAIR, COUNT_UNKNOWN);
|
PROB_FAIR, COUNT_UNKNOWN);
|
||||||
|
@ -1331,7 +1331,7 @@ void PhaseStringOpts::getChars(GraphKit& kit, Node* arg, Node* dst_array, BasicT
|
||||||
} else {
|
} else {
|
||||||
Node* index = __ SubI(charPos, __ intcon((bt == T_BYTE) ? 1 : 2));
|
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),
|
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_merge->init_req(merge_index + 1, kit.control());
|
||||||
final_mem->init_req(merge_index + 1, st);
|
final_mem->init_req(merge_index + 1, st);
|
||||||
|
@ -1524,7 +1524,7 @@ void PhaseStringOpts::copy_constant_string(GraphKit& kit, IdealKit& ideal, ciTyp
|
||||||
} else {
|
} else {
|
||||||
val = readChar(src_array, i++);
|
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));
|
index = __ AddI(index, __ ConI(2));
|
||||||
}
|
}
|
||||||
if (src_is_byte) {
|
if (src_is_byte) {
|
||||||
|
@ -1612,7 +1612,7 @@ Node* PhaseStringOpts::copy_char(GraphKit& kit, Node* val, Node* dst_array, Node
|
||||||
}
|
}
|
||||||
if (!dcon || !dbyte) {
|
if (!dcon || !dbyte) {
|
||||||
// Destination is UTF16. Store a char.
|
// 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)));
|
__ set(end, __ AddI(start, __ ConI(2)));
|
||||||
}
|
}
|
||||||
if (!dcon) {
|
if (!dcon) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue