Skip to content

Commit

Permalink
8270896: [lworld] C2 compilation fails with "Meet Not Symmetric"
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiHartmann committed Jul 19, 2021
1 parent 6d0ecdf commit 9b5ae0a
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 30 deletions.
15 changes: 5 additions & 10 deletions src/hotspot/share/gc/shared/c2/barrierSetC2.cpp
Expand Up @@ -682,18 +682,13 @@ int BarrierSetC2::arraycopy_payload_base_offset(bool is_array) {
return base_off;
}

void BarrierSetC2::clone(GraphKit* kit, Node* src_base, Node* dst_base, Node* countx, bool is_array) const {
#ifdef ASSERT
intptr_t src_offset;
Node* src = AddPNode::Ideal_base_and_offset(src_base, &kit->gvn(), src_offset);
intptr_t dst_offset;
Node* dst = AddPNode::Ideal_base_and_offset(dst_base, &kit->gvn(), dst_offset);
assert(src == NULL || (src_offset % BytesPerLong == 0), "expect 8 bytes alignment");
assert(dst == NULL || (dst_offset % BytesPerLong == 0), "expect 8 bytes alignment");
#endif
void BarrierSetC2::clone(GraphKit* kit, Node* src_base, Node* dst_base, Node* size, bool is_array) const {
int base_off = arraycopy_payload_base_offset(is_array);
Node* payload_size = size;
Node* offset = kit->MakeConX(base_off);
ArrayCopyNode* ac = ArrayCopyNode::make(kit, false, src_base, offset, dst_base, offset, countx, true, false);
payload_size = kit->gvn().transform(new SubXNode(payload_size, offset));
payload_size = kit->gvn().transform(new URShiftXNode(payload_size, kit->intcon(LogBytesPerLong)));
ArrayCopyNode* ac = ArrayCopyNode::make(kit, false, src_base, offset, dst_base, offset, payload_size, true, false);
if (is_array) {
ac->set_clone_array();
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/c2/barrierSetC2.hpp
Expand Up @@ -242,7 +242,7 @@ class BarrierSetC2: public CHeapObj<mtGC> {
virtual Node* atomic_xchg_at(C2AtomicParseAccess& access, Node* new_val, const Type* value_type) const;
virtual Node* atomic_add_at(C2AtomicParseAccess& access, Node* new_val, const Type* value_type) const;

virtual void clone(GraphKit* kit, Node* src_base, Node* dst_base, Node* countx, bool is_array) const;
virtual void clone(GraphKit* kit, Node* src_base, Node* dst_base, Node* size, bool is_array) const;

virtual Node* obj_allocate(PhaseMacroExpand* macro, Node* mem, Node* toobig_false, Node* size_in_bytes,
Node*& i_o, Node*& needgc_ctrl,
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.cpp
Expand Up @@ -125,8 +125,8 @@ void CardTableBarrierSetC2::post_barrier(GraphKit* kit,
kit->final_sync(ideal);
}

void CardTableBarrierSetC2::clone(GraphKit* kit, Node* src_base, Node* dst_base, Node* countx, bool is_array) const {
BarrierSetC2::clone(kit, src_base, dst_base, countx, is_array);
void CardTableBarrierSetC2::clone(GraphKit* kit, Node* src, Node* dst, Node* size, bool is_array) const {
BarrierSetC2::clone(kit, src, dst, size, is_array);
const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM;

// If necessary, emit some card marks afterwards. (Non-arrays only.)
Expand All @@ -141,7 +141,7 @@ void CardTableBarrierSetC2::clone(GraphKit* kit, Node* src_base, Node* dst_base,
int raw_adr_idx = Compile::AliasIdxRaw;
post_barrier(kit, kit->control(),
kit->memory(raw_adr_type),
dst_base,
dst,
no_particular_field,
raw_adr_idx,
no_particular_value,
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/c2/cardTableBarrierSetC2.hpp
Expand Up @@ -42,7 +42,7 @@ class CardTableBarrierSetC2: public ModRefBarrierSetC2 {
Node* byte_map_base_node(GraphKit* kit) const;

public:
virtual void clone(GraphKit* kit, Node* src_base, Node* dst_base, Node* countx, bool is_array) const;
virtual void clone(GraphKit* kit, Node* src, Node* dst, Node* size, bool is_array) const;
virtual bool is_gc_barrier_node(Node* node) const;
virtual void eliminate_gc_barrier(PhaseIterGVN* igvn, Node* node) const;
virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, bool is_clone_instance, ArrayCopyPhase phase) const;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/opto/graphKit.cpp
Expand Up @@ -1763,8 +1763,8 @@ Node* GraphKit::access_atomic_add_at(Node* obj,
}
}

void GraphKit::access_clone(Node* src_base, Node* dst_base, Node* countx, bool is_array) {
return _barrier_set->clone(this, src_base, dst_base, countx, is_array);
void GraphKit::access_clone(Node* src, Node* dst, Node* size, bool is_array) {
return _barrier_set->clone(this, src, dst, size, is_array);
}

//-------------------------array_element_address-------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/opto/graphKit.hpp
Expand Up @@ -657,7 +657,7 @@ class GraphKit : public Phase {
BasicType bt,
DecoratorSet decorators);

void access_clone(Node* src_base, Node* dst_base, Node* countx, bool is_array);
void access_clone(Node* src, Node* dst, Node* size, bool is_array);

// Return addressing for an array element.
Node* array_element_address(Node* ary, Node* idx, BasicType elembt,
Expand Down
9 changes: 1 addition & 8 deletions src/hotspot/share/opto/library_call.cpp
Expand Up @@ -4429,14 +4429,7 @@ void LibraryCallKit::copy_to_clone(Node* obj, Node* alloc_obj, Node* obj_size, b
}

Node* size = _gvn.transform(obj_size);
// Exclude the header but include array length to copy by 8 bytes words.
// Can't use base_offset_in_bytes(bt) since basic type is unknown.
int base_off = BarrierSetC2::arraycopy_payload_base_offset(is_array);
Node* countx = size;
countx = _gvn.transform(new SubXNode(countx, MakeConX(base_off)));
countx = _gvn.transform(new URShiftXNode(countx, intcon(LogBytesPerLong)));

access_clone(obj, alloc_obj, countx, is_array);
access_clone(obj, alloc_obj, size, is_array);

// Do not let reads from the cloned object float above the arraycopy.
if (alloc != NULL) {
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/opto/type.cpp
Expand Up @@ -4259,11 +4259,11 @@ const Type *TypeInstPtr::xmeet_helper(const Type *t) const {
subtype = this_klass;
subtype_exact = below_centerline(ptr) ? (this_xk && tinst_xk) : (this_xk || tinst_xk);
flat_array = below_centerline(ptr) ? (this_flatten_array && tinst_flatten_array) : (this_flatten_array || tinst_flatten_array);
} else if(!tinst_xk && this_klass->is_subtype_of(tinst_klass) && (!tinst_flatten_array || this_flatten_array)) {
} else if (!tinst_xk && this_klass->is_subtype_of(tinst_klass) && (!tinst_flatten_array || this_flatten_array)) {
subtype = this_klass; // Pick subtyping class
subtype_exact = this_xk;
flat_array = this_flatten_array;
} else if(!this_xk && tinst_klass->is_subtype_of(this_klass) && (!this_flatten_array || tinst_flatten_array)) {
} else if (!this_xk && tinst_klass->is_subtype_of(this_klass) && (!this_flatten_array || tinst_flatten_array)) {
subtype = tinst_klass; // Pick subtyping class
subtype_exact = tinst_xk;
flat_array = tinst_flatten_array;
Expand Down Expand Up @@ -4319,7 +4319,7 @@ const Type *TypeInstPtr::xmeet_helper(const Type *t) const {

// Now we find the LCA of Java classes
ciKlass* k = this_klass->least_common_ancestor(tinst_klass);
return make(ptr, k, false, NULL, off, false, instance_id, speculative, depth);
return make(ptr, k, false, NULL, off, flatten_array() && tinst->flatten_array(), instance_id, speculative, depth);
} // End of case InstPtr

case InlineType: {
Expand Down Expand Up @@ -5777,7 +5777,7 @@ const Type *TypeKlassPtr::xmeet( const Type *t ) const {
ptr = NotNull;
// Now we find the LCA of Java classes
ciKlass* k = this_klass->least_common_ancestor(tkls_klass);
return make(ptr, k, off, false, is_not_flat, is_not_null_free);
return make(ptr, k, off, this->flatten_array() && tkls->flatten_array(), is_not_flat, is_not_null_free);
} // End of case KlassPtr

} // End of switch
Expand Down

0 comments on commit 9b5ae0a

Please sign in to comment.