8210885: Convert left over loads/stores to access api

Reviewed-by: thartmann, rkennke
This commit is contained in:
Roland Westrelin 2018-09-18 20:49:44 +02:00
parent be56cc5bf3
commit 03e4400864
9 changed files with 63 additions and 78 deletions

View file

@ -310,7 +310,7 @@ void C2Access::fixup_decorators() {
//--------------------------- atomic operations--------------------------------- //--------------------------- atomic operations---------------------------------
static void pin_atomic_op(C2AtomicAccess& access) { void BarrierSetC2::pin_atomic_op(C2AtomicAccess& access) const {
if (!access.needs_pinning()) { if (!access.needs_pinning()) {
return; return;
} }

View file

@ -76,14 +76,12 @@ public:
// This class wraps a node and a pointer type. // This class wraps a node and a pointer type.
class C2AccessValuePtr: public C2AccessValue { class C2AccessValuePtr: public C2AccessValue {
int _alias_idx;
public: public:
C2AccessValuePtr(Node* node, const TypePtr* type) : C2AccessValuePtr(Node* node, const TypePtr* type) :
C2AccessValue(node, reinterpret_cast<const Type*>(type)) {} C2AccessValue(node, reinterpret_cast<const Type*>(type)) {}
const TypePtr* type() const { return reinterpret_cast<const TypePtr*>(_type); } const TypePtr* type() const { return reinterpret_cast<const TypePtr*>(_type); }
int alias_idx() const { return _alias_idx; }
}; };
// This class wraps a bunch of context parameters thare are passed around in the // This class wraps a bunch of context parameters thare are passed around in the
@ -175,6 +173,7 @@ protected:
Node* new_val, const Type* value_type) const; Node* new_val, const Type* value_type) const;
virtual Node* atomic_xchg_at_resolved(C2AtomicAccess& access, Node* new_val, const Type* val_type) const; virtual Node* atomic_xchg_at_resolved(C2AtomicAccess& access, Node* new_val, const Type* val_type) const;
virtual Node* atomic_add_at_resolved(C2AtomicAccess& access, Node* new_val, const Type* val_type) const; virtual Node* atomic_add_at_resolved(C2AtomicAccess& access, Node* new_val, const Type* val_type) const;
void pin_atomic_op(C2AtomicAccess& access) const;
public: public:
// This is the entry-point for the backend to perform accesses through the Access API. // This is the entry-point for the backend to perform accesses through the Access API.

View file

@ -605,7 +605,7 @@ void GraphKit::builtin_throw(Deoptimization::DeoptReason reason, Node* arg) {
Node *adr = basic_plus_adr(ex_node, ex_node, offset); Node *adr = basic_plus_adr(ex_node, ex_node, offset);
const TypeOopPtr* val_type = TypeOopPtr::make_from_klass(env()->String_klass()); const TypeOopPtr* val_type = TypeOopPtr::make_from_klass(env()->String_klass());
Node *store = access_store_at(control(), ex_node, adr, adr_typ, null(), val_type, T_OBJECT, IN_HEAP); Node *store = access_store_at(ex_node, adr, adr_typ, null(), val_type, T_OBJECT, IN_HEAP);
add_exception_state(make_exception_state(ex_node)); add_exception_state(make_exception_state(ex_node));
return; return;
@ -1544,8 +1544,7 @@ Node* GraphKit::store_to_memory(Node* ctl, Node* adr, Node *val, BasicType bt,
return st; return st;
} }
Node* GraphKit::access_store_at(Node* ctl, Node* GraphKit::access_store_at(Node* obj,
Node* obj,
Node* adr, Node* adr,
const TypePtr* adr_type, const TypePtr* adr_type,
Node* val, Node* val,
@ -1559,7 +1558,6 @@ Node* GraphKit::access_store_at(Node* ctl,
val = _gvn.makecon(TypePtr::NULL_PTR); val = _gvn.makecon(TypePtr::NULL_PTR);
} }
set_control(ctl);
if (stopped()) { if (stopped()) {
return top(); // Dead path ? return top(); // Dead path ?
} }
@ -1612,8 +1610,7 @@ Node* GraphKit::access_load(Node* adr, // actual adress to load val at
} }
} }
Node* GraphKit::access_atomic_cmpxchg_val_at(Node* ctl, Node* GraphKit::access_atomic_cmpxchg_val_at(Node* obj,
Node* obj,
Node* adr, Node* adr,
const TypePtr* adr_type, const TypePtr* adr_type,
int alias_idx, int alias_idx,
@ -1622,7 +1619,6 @@ Node* GraphKit::access_atomic_cmpxchg_val_at(Node* ctl,
const Type* value_type, const Type* value_type,
BasicType bt, BasicType bt,
DecoratorSet decorators) { DecoratorSet decorators) {
set_control(ctl);
C2AccessValuePtr addr(adr, adr_type); C2AccessValuePtr addr(adr, adr_type);
C2AtomicAccess access(this, decorators | C2_READ_ACCESS | C2_WRITE_ACCESS, C2AtomicAccess access(this, decorators | C2_READ_ACCESS | C2_WRITE_ACCESS,
bt, obj, addr, alias_idx); bt, obj, addr, alias_idx);
@ -1633,8 +1629,7 @@ Node* GraphKit::access_atomic_cmpxchg_val_at(Node* ctl,
} }
} }
Node* GraphKit::access_atomic_cmpxchg_bool_at(Node* ctl, Node* GraphKit::access_atomic_cmpxchg_bool_at(Node* obj,
Node* obj,
Node* adr, Node* adr,
const TypePtr* adr_type, const TypePtr* adr_type,
int alias_idx, int alias_idx,
@ -1643,7 +1638,6 @@ Node* GraphKit::access_atomic_cmpxchg_bool_at(Node* ctl,
const Type* value_type, const Type* value_type,
BasicType bt, BasicType bt,
DecoratorSet decorators) { DecoratorSet decorators) {
set_control(ctl);
C2AccessValuePtr addr(adr, adr_type); C2AccessValuePtr addr(adr, adr_type);
C2AtomicAccess access(this, decorators | C2_READ_ACCESS | C2_WRITE_ACCESS, C2AtomicAccess access(this, decorators | C2_READ_ACCESS | C2_WRITE_ACCESS,
bt, obj, addr, alias_idx); bt, obj, addr, alias_idx);
@ -1654,8 +1648,7 @@ Node* GraphKit::access_atomic_cmpxchg_bool_at(Node* ctl,
} }
} }
Node* GraphKit::access_atomic_xchg_at(Node* ctl, Node* GraphKit::access_atomic_xchg_at(Node* obj,
Node* obj,
Node* adr, Node* adr,
const TypePtr* adr_type, const TypePtr* adr_type,
int alias_idx, int alias_idx,
@ -1663,7 +1656,6 @@ Node* GraphKit::access_atomic_xchg_at(Node* ctl,
const Type* value_type, const Type* value_type,
BasicType bt, BasicType bt,
DecoratorSet decorators) { DecoratorSet decorators) {
set_control(ctl);
C2AccessValuePtr addr(adr, adr_type); C2AccessValuePtr addr(adr, adr_type);
C2AtomicAccess access(this, decorators | C2_READ_ACCESS | C2_WRITE_ACCESS, C2AtomicAccess access(this, decorators | C2_READ_ACCESS | C2_WRITE_ACCESS,
bt, obj, addr, alias_idx); bt, obj, addr, alias_idx);
@ -1674,8 +1666,7 @@ Node* GraphKit::access_atomic_xchg_at(Node* ctl,
} }
} }
Node* GraphKit::access_atomic_add_at(Node* ctl, Node* GraphKit::access_atomic_add_at(Node* obj,
Node* obj,
Node* adr, Node* adr,
const TypePtr* adr_type, const TypePtr* adr_type,
int alias_idx, int alias_idx,
@ -1683,7 +1674,6 @@ Node* GraphKit::access_atomic_add_at(Node* ctl,
const Type* value_type, const Type* value_type,
BasicType bt, BasicType bt,
DecoratorSet decorators) { DecoratorSet decorators) {
set_control(ctl);
C2AccessValuePtr addr(adr, adr_type); C2AccessValuePtr addr(adr, adr_type);
C2AtomicAccess access(this, decorators | C2_READ_ACCESS | C2_WRITE_ACCESS, bt, obj, addr, alias_idx); C2AtomicAccess access(this, decorators | C2_READ_ACCESS | C2_WRITE_ACCESS, bt, obj, addr, alias_idx);
if (access.is_raw()) { if (access.is_raw()) {
@ -1693,8 +1683,7 @@ Node* GraphKit::access_atomic_add_at(Node* ctl,
} }
} }
void GraphKit::access_clone(Node* ctl, Node* src, Node* dst, Node* size, bool is_array) { void GraphKit::access_clone(Node* src, Node* dst, Node* size, bool is_array) {
set_control(ctl);
return _barrier_set->clone(this, src, dst, size, is_array); return _barrier_set->clone(this, src, dst, size, is_array);
} }
@ -3849,14 +3838,14 @@ void GraphKit::final_sync(IdealKit& ideal) {
sync_kit(ideal); sync_kit(ideal);
} }
Node* GraphKit::load_String_length(Node* ctrl, Node* str) { Node* GraphKit::load_String_length(Node* str, bool set_ctrl) {
Node* len = load_array_length(load_String_value(ctrl, str)); Node* len = load_array_length(load_String_value(str, set_ctrl));
Node* coder = load_String_coder(ctrl, str); Node* coder = load_String_coder(str, set_ctrl);
// Divide length by 2 if coder is UTF16 // Divide length by 2 if coder is UTF16
return _gvn.transform(new RShiftINode(len, coder)); return _gvn.transform(new RShiftINode(len, coder));
} }
Node* GraphKit::load_String_value(Node* ctrl, Node* str) { Node* GraphKit::load_String_value(Node* str, bool set_ctrl) {
int value_offset = java_lang_String::value_offset_in_bytes(); int value_offset = java_lang_String::value_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0); false, NULL, 0);
@ -3866,7 +3855,7 @@ Node* GraphKit::load_String_value(Node* ctrl, Node* str) {
ciTypeArrayKlass::make(T_BYTE), true, 0); ciTypeArrayKlass::make(T_BYTE), true, 0);
Node* p = basic_plus_adr(str, str, value_offset); Node* p = basic_plus_adr(str, str, value_offset);
Node* load = access_load_at(str, p, value_field_type, value_type, T_OBJECT, Node* load = access_load_at(str, p, value_field_type, value_type, T_OBJECT,
IN_HEAP | C2_CONTROL_DEPENDENT_LOAD); IN_HEAP | (set_ctrl ? C2_CONTROL_DEPENDENT_LOAD : 0) | MO_UNORDERED);
// String.value field is known to be @Stable. // String.value field is known to be @Stable.
if (UseImplicitStableValues) { if (UseImplicitStableValues) {
load = cast_array_to_stable(load, value_type); load = cast_array_to_stable(load, value_type);
@ -3874,7 +3863,7 @@ Node* GraphKit::load_String_value(Node* ctrl, Node* str) {
return load; return load;
} }
Node* GraphKit::load_String_coder(Node* ctrl, Node* str) { Node* GraphKit::load_String_coder(Node* str, bool set_ctrl) {
if (!CompactStrings) { if (!CompactStrings) {
return intcon(java_lang_String::CODER_UTF16); return intcon(java_lang_String::CODER_UTF16);
} }
@ -3883,27 +3872,31 @@ Node* GraphKit::load_String_coder(Node* ctrl, Node* str) {
false, NULL, 0); false, NULL, 0);
const TypePtr* coder_field_type = string_type->add_offset(coder_offset); const TypePtr* coder_field_type = string_type->add_offset(coder_offset);
int coder_field_idx = C->get_alias_index(coder_field_type); int coder_field_idx = C->get_alias_index(coder_field_type);
return make_load(ctrl, basic_plus_adr(str, str, coder_offset),
TypeInt::BYTE, T_BYTE, coder_field_idx, MemNode::unordered); Node* p = basic_plus_adr(str, str, coder_offset);
Node* load = access_load_at(str, p, coder_field_type, TypeInt::BYTE, T_BYTE,
IN_HEAP | (set_ctrl ? C2_CONTROL_DEPENDENT_LOAD : 0) | MO_UNORDERED);
return load;
} }
void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) { void GraphKit::store_String_value(Node* str, Node* value) {
int value_offset = java_lang_String::value_offset_in_bytes(); int value_offset = java_lang_String::value_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0); false, NULL, 0);
const TypePtr* value_field_type = string_type->add_offset(value_offset); const TypePtr* value_field_type = string_type->add_offset(value_offset);
access_store_at(ctrl, str, basic_plus_adr(str, value_offset), value_field_type,
value, TypeAryPtr::BYTES, T_OBJECT, IN_HEAP); access_store_at(str, basic_plus_adr(str, value_offset), value_field_type,
value, TypeAryPtr::BYTES, T_OBJECT, IN_HEAP | MO_UNORDERED);
} }
void GraphKit::store_String_coder(Node* ctrl, Node* str, Node* value) { void GraphKit::store_String_coder(Node* str, Node* value) {
int coder_offset = java_lang_String::coder_offset_in_bytes(); int coder_offset = java_lang_String::coder_offset_in_bytes();
const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
false, NULL, 0); false, NULL, 0);
const TypePtr* coder_field_type = string_type->add_offset(coder_offset); const TypePtr* coder_field_type = string_type->add_offset(coder_offset);
int coder_field_idx = C->get_alias_index(coder_field_type);
store_to_memory(ctrl, basic_plus_adr(str, coder_offset), access_store_at(str, basic_plus_adr(str, coder_offset), coder_field_type,
value, T_BYTE, coder_field_idx, MemNode::unordered); value, TypeInt::BYTE, T_BYTE, IN_HEAP | MO_UNORDERED);
} }
// Capture src and dst memory state with a MergeMemNode // Capture src and dst memory state with a MergeMemNode

View file

@ -572,8 +572,7 @@ class GraphKit : public Phase {
// Perform decorated accesses // Perform decorated accesses
Node* access_store_at(Node* ctl, Node* access_store_at(Node* obj, // containing obj
Node* obj, // containing obj
Node* adr, // actual adress to store val at Node* adr, // actual adress to store val at
const TypePtr* adr_type, const TypePtr* adr_type,
Node* val, Node* val,
@ -593,8 +592,7 @@ class GraphKit : public Phase {
BasicType bt, BasicType bt,
DecoratorSet decorators); DecoratorSet decorators);
Node* access_atomic_cmpxchg_val_at(Node* ctl, Node* access_atomic_cmpxchg_val_at(Node* obj,
Node* obj,
Node* adr, Node* adr,
const TypePtr* adr_type, const TypePtr* adr_type,
int alias_idx, int alias_idx,
@ -604,8 +602,7 @@ class GraphKit : public Phase {
BasicType bt, BasicType bt,
DecoratorSet decorators); DecoratorSet decorators);
Node* access_atomic_cmpxchg_bool_at(Node* ctl, Node* access_atomic_cmpxchg_bool_at(Node* obj,
Node* obj,
Node* adr, Node* adr,
const TypePtr* adr_type, const TypePtr* adr_type,
int alias_idx, int alias_idx,
@ -615,8 +612,7 @@ class GraphKit : public Phase {
BasicType bt, BasicType bt,
DecoratorSet decorators); DecoratorSet decorators);
Node* access_atomic_xchg_at(Node* ctl, Node* access_atomic_xchg_at(Node* obj,
Node* obj,
Node* adr, Node* adr,
const TypePtr* adr_type, const TypePtr* adr_type,
int alias_idx, int alias_idx,
@ -625,8 +621,7 @@ class GraphKit : public Phase {
BasicType bt, BasicType bt,
DecoratorSet decorators); DecoratorSet decorators);
Node* access_atomic_add_at(Node* ctl, Node* access_atomic_add_at(Node* obj,
Node* obj,
Node* adr, Node* adr,
const TypePtr* adr_type, const TypePtr* adr_type,
int alias_idx, int alias_idx,
@ -635,7 +630,7 @@ class GraphKit : public Phase {
BasicType bt, BasicType bt,
DecoratorSet decorators); DecoratorSet decorators);
void access_clone(Node* ctl, Node* src, Node* dst, Node* size, bool is_array); void access_clone(Node* src, Node* dst, Node* size, bool is_array);
Node* access_resolve(Node* n, DecoratorSet decorators); Node* access_resolve(Node* n, DecoratorSet decorators);
@ -849,11 +844,11 @@ class GraphKit : public Phase {
bool deoptimize_on_exception = false); bool deoptimize_on_exception = false);
// java.lang.String helpers // java.lang.String helpers
Node* load_String_length(Node* ctrl, Node* str); Node* load_String_length(Node* str, bool set_ctrl);
Node* load_String_value(Node* ctrl, Node* str); Node* load_String_value(Node* str, bool set_ctrl);
Node* load_String_coder(Node* ctrl, Node* str); Node* load_String_coder(Node* str, bool set_ctrl);
void store_String_value(Node* ctrl, Node* str, Node* value); void store_String_value(Node* str, Node* value);
void store_String_coder(Node* ctrl, Node* str, Node* value); void store_String_coder(Node* str, Node* value);
Node* capture_memory(const TypePtr* src_type, const TypePtr* dst_type); Node* capture_memory(const TypePtr* src_type, const TypePtr* dst_type);
Node* compress_string(Node* src, const TypeAryPtr* src_type, Node* dst, Node* count); Node* compress_string(Node* src, const TypeAryPtr* src_type, Node* dst, Node* count);
void inflate_string(Node* src, Node* dst, const TypeAryPtr* dst_type, Node* count); void inflate_string(Node* src, Node* dst, const TypeAryPtr* dst_type, Node* count);

View file

@ -1758,11 +1758,9 @@ bool LibraryCallKit::inline_string_char_access(bool is_store) {
return false; return false;
} }
if (is_store) { if (is_store) {
(void) store_to_memory(control(), adr, ch, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered, access_store_at(value, adr, TypeAryPtr::BYTES, ch, TypeInt::CHAR, T_CHAR, IN_HEAP | MO_UNORDERED | C2_MISMATCHED);
false, false, true /* mismatched */);
} else { } else {
ch = make_load(control(), adr, TypeInt::CHAR, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered, ch = access_load_at(value, adr, TypeAryPtr::BYTES, TypeInt::CHAR, T_CHAR, IN_HEAP | MO_UNORDERED | C2_MISMATCHED | C2_CONTROL_DEPENDENT_LOAD);
LoadNode::DependsOnlyOnTest, false, false, true /* mismatched */);
set_result(ch); set_result(ch);
} }
return true; return true;
@ -2512,7 +2510,7 @@ bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, c
val = ConvL2X(val); val = ConvL2X(val);
val = gvn().transform(new CastX2PNode(val)); val = gvn().transform(new CastX2PNode(val));
} }
access_store_at(control(), heap_base_oop, adr, adr_type, val, value_type, type, decorators); access_store_at(heap_base_oop, adr, adr_type, val, value_type, type, decorators);
} }
return true; return true;
@ -2731,24 +2729,24 @@ bool LibraryCallKit::inline_unsafe_load_store(const BasicType type, const LoadSt
Node* result = NULL; Node* result = NULL;
switch (kind) { switch (kind) {
case LS_cmp_exchange: { case LS_cmp_exchange: {
result = access_atomic_cmpxchg_val_at(control(), base, adr, adr_type, alias_idx, result = access_atomic_cmpxchg_val_at(base, adr, adr_type, alias_idx,
oldval, newval, value_type, type, decorators); oldval, newval, value_type, type, decorators);
break; break;
} }
case LS_cmp_swap_weak: case LS_cmp_swap_weak:
decorators |= C2_WEAK_CMPXCHG; decorators |= C2_WEAK_CMPXCHG;
case LS_cmp_swap: { case LS_cmp_swap: {
result = access_atomic_cmpxchg_bool_at(control(), base, adr, adr_type, alias_idx, result = access_atomic_cmpxchg_bool_at(base, adr, adr_type, alias_idx,
oldval, newval, value_type, type, decorators); oldval, newval, value_type, type, decorators);
break; break;
} }
case LS_get_set: { case LS_get_set: {
result = access_atomic_xchg_at(control(), base, adr, adr_type, alias_idx, result = access_atomic_xchg_at(base, adr, adr_type, alias_idx,
newval, value_type, type, decorators); newval, value_type, type, decorators);
break; break;
} }
case LS_get_add: { case LS_get_add: {
result = access_atomic_add_at(control(), base, adr, adr_type, alias_idx, result = access_atomic_add_at(base, adr, adr_type, alias_idx,
newval, value_type, type, decorators); newval, value_type, type, decorators);
break; break;
} }
@ -4232,7 +4230,7 @@ void LibraryCallKit::copy_to_clone(Node* obj, Node* alloc_obj, Node* obj_size, b
// TODO: generate fields copies for small objects instead. // TODO: generate fields copies for small objects instead.
Node* size = _gvn.transform(obj_size); Node* size = _gvn.transform(obj_size);
access_clone(control(), obj, alloc_obj, size, is_array); access_clone(obj, alloc_obj, size, is_array);
// Do not let reads from the cloned object float above the arraycopy. // Do not let reads from the cloned object float above the arraycopy.
if (alloc != NULL) { if (alloc != NULL) {

View file

@ -104,7 +104,7 @@ void Parse::array_store(BasicType bt) {
const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(bt); const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(bt);
access_store_at(control(), array, adr, adr_type, val, elemtype, bt, MO_UNORDERED | IN_HEAP | IS_ARRAY); access_store_at(array, adr, adr_type, val, elemtype, bt, MO_UNORDERED | IN_HEAP | IS_ARRAY);
} }

View file

@ -264,7 +264,7 @@ void Parse::do_put_xxx(Node* obj, ciField* field, bool is_field) {
field_type = Type::BOTTOM; field_type = Type::BOTTOM;
} }
} }
access_store_at(control(), obj, adr, adr_type, val, field_type, bt, decorators); access_store_at(obj, adr, adr_type, val, field_type, bt, decorators);
if (is_field) { if (is_field) {
// Remember we wrote a volatile field. // Remember we wrote a volatile field.
@ -351,7 +351,7 @@ Node* Parse::expand_multianewarray(ciArrayKlass* array_klass, Node* *lengths, in
Node* elem = expand_multianewarray(array_klass_1, &lengths[1], ndimensions-1, nargs); Node* elem = expand_multianewarray(array_klass_1, &lengths[1], ndimensions-1, nargs);
intptr_t offset = header + ((intptr_t)i << LogBytesPerHeapOop); intptr_t offset = header + ((intptr_t)i << LogBytesPerHeapOop);
Node* eaddr = basic_plus_adr(array, offset); Node* eaddr = basic_plus_adr(array, offset);
access_store_at(control(), array, eaddr, adr_type, elem, elemtype, T_OBJECT, IN_HEAP | IS_ARRAY); access_store_at(array, eaddr, adr_type, elem, elemtype, T_OBJECT, IN_HEAP | IS_ARRAY);
} }
} }
return array; return array;

View file

@ -437,9 +437,9 @@ void Parse::set_md_flag_at(ciMethodData* md, ciProfileData* data, int flag_const
Node* adr_node = method_data_addressing(md, data, DataLayout::flags_offset()); Node* adr_node = method_data_addressing(md, data, DataLayout::flags_offset());
const TypePtr* adr_type = _gvn.type(adr_node)->is_ptr(); const TypePtr* adr_type = _gvn.type(adr_node)->is_ptr();
Node* flags = make_load(NULL, adr_node, TypeInt::BYTE, T_BYTE, adr_type, MemNode::unordered); Node* flags = make_load(NULL, adr_node, TypeInt::INT, T_INT, adr_type, MemNode::unordered);
Node* incr = _gvn.transform(new OrINode(flags, _gvn.intcon(flag_constant))); Node* incr = _gvn.transform(new OrINode(flags, _gvn.intcon(flag_constant)));
store_to_memory(NULL, adr_node, incr, T_BYTE, adr_type, MemNode::unordered); store_to_memory(NULL, adr_node, incr, T_INT, adr_type, MemNode::unordered);
} }
//----------------------------profile_taken_branch----------------------------- //----------------------------profile_taken_branch-----------------------------

View file

@ -1547,7 +1547,7 @@ void PhaseStringOpts::copy_constant_string(GraphKit& kit, IdealKit& ideal, ciTyp
// Compress copy contents of the byte/char String str into dst_array starting at index start. // Compress copy contents of the byte/char String str into dst_array starting at index start.
Node* PhaseStringOpts::copy_string(GraphKit& kit, Node* str, Node* dst_array, Node* dst_coder, Node* start) { Node* PhaseStringOpts::copy_string(GraphKit& kit, Node* str, Node* dst_array, Node* dst_coder, Node* start) {
Node* src_array = kit.load_String_value(kit.control(), str); Node* src_array = kit.load_String_value(str, true);
src_array = kit.access_resolve(src_array, ACCESS_READ); src_array = kit.access_resolve(src_array, ACCESS_READ);
IdealKit ideal(&kit, true, true); IdealKit ideal(&kit, true, true);
@ -1580,7 +1580,7 @@ Node* PhaseStringOpts::copy_string(GraphKit& kit, Node* str, Node* dst_array, No
// Non-constant source string // Non-constant source string
if (CompactStrings) { if (CompactStrings) {
// Emit runtime check for coder // Emit runtime check for coder
Node* coder = kit.load_String_coder(__ ctrl(), str); Node* coder = kit.load_String_coder(str, true);
__ if_then(coder, BoolTest::eq, __ ConI(java_lang_String::CODER_LATIN1)); { __ if_then(coder, BoolTest::eq, __ ConI(java_lang_String::CODER_LATIN1)); {
// Source is Latin1 // Source is Latin1
copy_latin1_string(kit, ideal, src_array, count, dst_array, dst_coder, start); copy_latin1_string(kit, ideal, src_array, count, dst_array, dst_coder, start);
@ -1796,8 +1796,8 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
// replace the argument with the null checked version // replace the argument with the null checked version
arg = null_string; arg = null_string;
sc->set_argument(argi, arg); sc->set_argument(argi, arg);
count = kit.load_String_length(kit.control(), arg); count = kit.load_String_length(arg, true);
arg_coder = kit.load_String_coder(kit.control(), arg); arg_coder = kit.load_String_coder(arg, true);
} else if (!type->higher_equal(TypeInstPtr::NOTNULL)) { } else if (!type->higher_equal(TypeInstPtr::NOTNULL)) {
// s = s != null ? s : "null"; // s = s != null ? s : "null";
// length = length + (s.count - s.offset); // length = length + (s.count - s.offset);
@ -1820,14 +1820,14 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
// replace the argument with the null checked version // replace the argument with the null checked version
arg = phi; arg = phi;
sc->set_argument(argi, arg); sc->set_argument(argi, arg);
count = kit.load_String_length(kit.control(), arg); count = kit.load_String_length(arg, true);
arg_coder = kit.load_String_coder(kit.control(), arg); arg_coder = kit.load_String_coder(arg, true);
} else { } else {
// A corresponding nullcheck will be connected during IGVN MemNode::Ideal_common_DU_postCCP // A corresponding nullcheck will be connected during IGVN MemNode::Ideal_common_DU_postCCP
// kit.control might be a different test, that can be hoisted above the actual nullcheck // kit.control might be a different test, that can be hoisted above the actual nullcheck
// in case, that the control input is not null, Ideal_common_DU_postCCP will not look for a nullcheck. // in case, that the control input is not null, Ideal_common_DU_postCCP will not look for a nullcheck.
count = kit.load_String_length(NULL, arg); count = kit.load_String_length(arg, false);
arg_coder = kit.load_String_coder(NULL, arg); arg_coder = kit.load_String_coder(arg, false);
} }
if (arg->is_Con()) { if (arg->is_Con()) {
// Constant string. Get constant coder and length. // Constant string. Get constant coder and length.
@ -1918,7 +1918,7 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
sc->mode(0) == StringConcat::StringNullCheckMode)) { sc->mode(0) == StringConcat::StringNullCheckMode)) {
// Handle the case when there is only a single String argument. // Handle the case when there is only a single String argument.
// In this case, we can just pull the value from the String itself. // In this case, we can just pull the value from the String itself.
dst_array = kit.load_String_value(kit.control(), sc->argument(0)); dst_array = kit.load_String_value(sc->argument(0), true);
} else { } else {
// Allocate destination byte array according to coder // Allocate destination byte array according to coder
dst_array = allocate_byte_array(kit, NULL, __ LShiftI(length, coder)); dst_array = allocate_byte_array(kit, NULL, __ LShiftI(length, coder));
@ -1959,8 +1959,8 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
} }
// Initialize the string // Initialize the string
kit.store_String_value(kit.control(), result, dst_array); kit.store_String_value(result, dst_array);
kit.store_String_coder(kit.control(), result, coder); kit.store_String_coder(result, coder);
// The value field is final. Emit a barrier here to ensure that the effect // The value field is final. Emit a barrier here to ensure that the effect
// of the initialization is committed to memory before any code publishes // of the initialization is committed to memory before any code publishes