# HG changeset patch # User rkennke # Date 1541418234 -3600 # Mon Nov 05 12:43:54 2018 +0100 # Node ID c0eaefa02e326e3f161534d2cb6b2d3e30be9729 # Parent f1b1a4d38e165a897839cef6df4c54c300cd49e0 [mq]: flatten-alias-types.patch diff --git a/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp b/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp --- a/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp +++ b/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp @@ -228,6 +228,8 @@ // expanded later, then now is the time to do so. virtual bool expand_macro_nodes(PhaseMacroExpand* macro) const { return false; } virtual void verify_gc_barriers(bool post_parse) const {} + + virtual bool flatten_gc_alias_type(const TypePtr*& adr_type) const { return false; } }; #endif // SHARE_GC_SHARED_C2_BARRIERSETC2_HPP diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp @@ -1021,3 +1021,17 @@ } return n->outcnt() > 0; } + +bool ShenandoahBarrierSetC2::flatten_gc_alias_type(const TypePtr*& adr_type) const { + int offset = adr_type->offset(); + if (offset == BrooksPointer::byte_offset()) { + if (adr_type->isa_aryptr()) { + adr_type = TypeAryPtr::make(adr_type->ptr(), adr_type->isa_aryptr()->ary(), adr_type->isa_aryptr()->klass(), false, offset); + } else if (adr_type->isa_instptr()) { + adr_type = TypeInstPtr::make(adr_type->ptr(), ciEnv::current()->Object_klass(), false, NULL, offset); + } + return true; + } else { + return false; + } +} diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp @@ -137,6 +137,8 @@ virtual void verify_gc_barriers(bool post_parse) const; virtual Node* ideal_node(PhaseGVN* phase, Node* n, bool can_reshape) const; + + virtual bool flatten_gc_alias_type(const TypePtr*& adr_type) const; }; #endif // SHARE_VM_GC_SHENANDOAH_C2_SHENANDOAHBARRIERSETC2_HPP diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -1470,11 +1470,8 @@ tj = TypeInstPtr::MARK; ta = TypeAryPtr::RANGE; // generic ignored junk ptr = TypePtr::BotPTR; -#if INCLUDE_SHENANDOAHGC - } else if (offset == BrooksPointer::byte_offset() && UseShenandoahGC) { - // Need to distinguish brooks ptr as is. - tj = ta = TypeAryPtr::make(ptr,ta->ary(),ta->klass(),false,offset); -#endif + } else if (BarrierSet::barrier_set()->barrier_set_c2()->flatten_gc_alias_type(tj)) { + ta = tj->isa_aryptr(); } else { // Random constant offset into array body offset = Type::OffsetBot; // Flatten constant access into array body tj = ta = TypeAryPtr::make(ptr,ta->ary(),ta->klass(),false,offset); @@ -1539,7 +1536,7 @@ if (!is_known_inst) { // Do it only for non-instance types tj = to = TypeInstPtr::make(TypePtr::BotPTR, env()->Object_klass(), false, NULL, offset); } - } else if (SHENANDOAHGC_ONLY((offset != BrooksPointer::byte_offset() || !UseShenandoahGC) &&) (offset < 0 || offset >= k->size_helper() * wordSize)) { + } else if (offset >= k->size_helper() * wordSize) { // Static fields are in the space above the normal instance // fields in the java.lang.Class instance. if (to->klass() != ciEnv::current()->Class_klass()) { @@ -1547,6 +1544,8 @@ tj = TypeOopPtr::BOTTOM; offset = tj->offset(); } + } else if (BarrierSet::barrier_set()->barrier_set_c2()->flatten_gc_alias_type(tj)) { + to = tj->is_instptr(); } else { ciInstanceKlass *canonical_holder = k->get_canonical_holder(offset); if (!k->equals(canonical_holder) || tj->offset() != offset) {