OpenJDK / jdk / jdk
changeset 52224:4f2215a00ed1
8212611: Small collection of simple changes from shenandoah
Reviewed-by: thartmann, kvn, eosterlund
author | roland |
---|---|
date | Wed, 17 Oct 2018 10:19:13 +0200 |
parents | d0983f073c54 |
children | 3c12f0c0a68c |
files | src/hotspot/share/gc/shared/c2/barrierSetC2.hpp src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp src/hotspot/share/opto/cfgnode.cpp src/hotspot/share/opto/compile.cpp src/hotspot/share/opto/graphKit.cpp src/hotspot/share/opto/macro.cpp src/hotspot/share/opto/memnode.cpp src/hotspot/share/opto/node.cpp src/hotspot/share/opto/phaseX.cpp src/hotspot/share/opto/subnode.cpp |
diffstat | 11 files changed, 49 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp Tue Oct 23 13:47:17 2018 +0800 +++ b/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp Wed Oct 17 10:19:13 2018 +0200 @@ -213,8 +213,8 @@ virtual void register_potential_barrier_node(Node* node) const { } virtual void unregister_potential_barrier_node(Node* node) const { } virtual void eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const { } - virtual void enqueue_useful_gc_barrier(Unique_Node_List &worklist, Node* node) const {} - virtual void eliminate_useless_gc_barriers(Unique_Node_List &useful) const {} + virtual void enqueue_useful_gc_barrier(PhaseIterGVN* igvn, Node* node) const {} + virtual void eliminate_useless_gc_barriers(Unique_Node_List &useful, Compile* C) const {} virtual void add_users_to_worklist(Unique_Node_List* worklist) const {} // Allow barrier sets to have shared state that is preserved across a compilation unit.
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp Tue Oct 23 13:47:17 2018 +0800 +++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp Wed Oct 17 10:19:13 2018 +0200 @@ -102,7 +102,7 @@ } } -void ZBarrierSetC2::eliminate_useless_gc_barriers(Unique_Node_List &useful) const { +void ZBarrierSetC2::eliminate_useless_gc_barriers(Unique_Node_List &useful, Compile* C) const { // Remove useless LoadBarrier nodes ZBarrierSetC2State* s = state(); for (int i = s->load_barrier_count()-1; i >= 0; i--) { @@ -113,9 +113,9 @@ } } -void ZBarrierSetC2::enqueue_useful_gc_barrier(Unique_Node_List &worklist, Node* node) const { +void ZBarrierSetC2::enqueue_useful_gc_barrier(PhaseIterGVN* igvn, Node* node) const { if (node->is_LoadBarrier() && !node->as_LoadBarrier()->has_true_uses()) { - worklist.push(node); + igvn->_worklist.push(node); } }
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp Tue Oct 23 13:47:17 2018 +0800 +++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp Wed Oct 17 10:19:13 2018 +0200 @@ -189,9 +189,9 @@ virtual bool has_load_barriers() const { return true; } virtual bool is_gc_barrier_node(Node* node) const; virtual void eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const { } - virtual void eliminate_useless_gc_barriers(Unique_Node_List &useful) const; + virtual void eliminate_useless_gc_barriers(Unique_Node_List &useful, Compile* C) const; virtual void add_users_to_worklist(Unique_Node_List* worklist) const; - virtual void enqueue_useful_gc_barrier(Unique_Node_List &worklist, Node* node) const; + virtual void enqueue_useful_gc_barrier(PhaseIterGVN* igvn, Node* node) const; virtual void register_potential_barrier_node(Node* node) const; virtual void unregister_potential_barrier_node(Node* node) const; virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const;
--- a/src/hotspot/share/opto/cfgnode.cpp Tue Oct 23 13:47:17 2018 +0800 +++ b/src/hotspot/share/opto/cfgnode.cpp Wed Oct 17 10:19:13 2018 +0200 @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" +#include "gc/shared/c2/barrierSetC2.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "oops/objArrayKlass.hpp" @@ -1447,7 +1448,10 @@ } else return NULL; // Build int->bool conversion - Node *n = new Conv2BNode( cmp->in(1) ); + Node *in1 = cmp->in(1); + BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); + in1 = bs->step_over_gc_barrier(in1); + Node *n = new Conv2BNode(in1); if( flipped ) n = new XorINode( phase->transform(n), phase->intcon(1) ); @@ -1813,7 +1817,12 @@ if (can_reshape && igvn != NULL) { igvn->_worklist.push(r); } - set_req(j, top); // Nuke it down + // Nuke it down + if (can_reshape) { + set_req_X(j, top, igvn); + } else { + set_req(j, top); + } progress = this; // Record progress } }
--- a/src/hotspot/share/opto/compile.cpp Tue Oct 23 13:47:17 2018 +0800 +++ b/src/hotspot/share/opto/compile.cpp Wed Oct 17 10:19:13 2018 +0200 @@ -421,7 +421,7 @@ } } BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); - bs->eliminate_useless_gc_barriers(useful); + bs->eliminate_useless_gc_barriers(useful, this); // clean up the late inline lists remove_useless_late_inlines(&_string_late_inlines, useful); remove_useless_late_inlines(&_boxing_late_inlines, useful);
--- a/src/hotspot/share/opto/graphKit.cpp Tue Oct 23 13:47:17 2018 +0800 +++ b/src/hotspot/share/opto/graphKit.cpp Wed Oct 17 10:19:13 2018 +0200 @@ -3726,6 +3726,10 @@ if (ptr == NULL) { // reduce dumb test in callers return NULL; } + + BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); + ptr = bs->step_over_gc_barrier(ptr); + if (ptr->is_CheckCastPP()) { // strip only one raw-to-oop cast ptr = ptr->in(1); if (ptr == NULL) return NULL;
--- a/src/hotspot/share/opto/macro.cpp Tue Oct 23 13:47:17 2018 +0800 +++ b/src/hotspot/share/opto/macro.cpp Wed Oct 17 10:19:13 2018 +0200 @@ -434,7 +434,10 @@ if (val == mem) { values.at_put(j, mem); } else if (val->is_Store()) { - values.at_put(j, val->in(MemNode::ValueIn)); + Node* n = val->in(MemNode::ValueIn); + BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); + n = bs->step_over_gc_barrier(n); + values.at_put(j, n); } else if(val->is_Proj() && val->in(0) == alloc) { values.at_put(j, _igvn.zerocon(ft)); } else if (val->is_Phi()) { @@ -546,7 +549,10 @@ // hit a sentinel, return appropriate 0 value return _igvn.zerocon(ft); } else if (mem->is_Store()) { - return mem->in(MemNode::ValueIn); + Node* n = mem->in(MemNode::ValueIn); + BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); + n = bs->step_over_gc_barrier(n); + return n; } else if (mem->is_Phi()) { // attempt to produce a Phi reflecting the values on the input paths of the Phi Node_Stack value_phis(a, 8);
--- a/src/hotspot/share/opto/memnode.cpp Tue Oct 23 13:47:17 2018 +0800 +++ b/src/hotspot/share/opto/memnode.cpp Wed Oct 17 10:19:13 2018 +0200 @@ -924,8 +924,10 @@ if (ac->as_ArrayCopy()->is_clonebasic()) { assert(ld_alloc != NULL, "need an alloc"); assert(addp->is_AddP(), "address must be addp"); - assert(addp->in(AddPNode::Base) == ac->in(ArrayCopyNode::Dest)->in(AddPNode::Base), "strange pattern"); - assert(addp->in(AddPNode::Address) == ac->in(ArrayCopyNode::Dest)->in(AddPNode::Address), "strange pattern"); + assert(ac->in(ArrayCopyNode::Dest)->is_AddP(), "dest must be an address"); + BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); + assert(bs->step_over_gc_barrier(addp->in(AddPNode::Base)) == bs->step_over_gc_barrier(ac->in(ArrayCopyNode::Dest)->in(AddPNode::Base)), "strange pattern"); + assert(bs->step_over_gc_barrier(addp->in(AddPNode::Address)) == bs->step_over_gc_barrier(ac->in(ArrayCopyNode::Dest)->in(AddPNode::Address)), "strange pattern"); addp->set_req(AddPNode::Base, src->in(AddPNode::Base)); addp->set_req(AddPNode::Address, src->in(AddPNode::Address)); } else { @@ -1081,6 +1083,8 @@ (tp != NULL) && tp->is_ptr_to_boxed_value()) { intptr_t ignore = 0; Node* base = AddPNode::Ideal_base_and_offset(ld_adr, phase, ignore); + BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); + base = bs->step_over_gc_barrier(base); if (base != NULL && base->is_Proj() && base->as_Proj()->_con == TypeFunc::Parms && base->in(0)->is_CallStaticJava() &&
--- a/src/hotspot/share/opto/node.cpp Tue Oct 23 13:47:17 2018 +0800 +++ b/src/hotspot/share/opto/node.cpp Wed Oct 17 10:19:13 2018 +0200 @@ -1396,7 +1396,7 @@ // and remove_globally_dead_node(). igvn->add_users_to_worklist( n ); } else { - BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(igvn->_worklist, n); + BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(igvn, n); } } }
--- a/src/hotspot/share/opto/phaseX.cpp Tue Oct 23 13:47:17 2018 +0800 +++ b/src/hotspot/share/opto/phaseX.cpp Wed Oct 17 10:19:13 2018 +0200 @@ -1375,7 +1375,7 @@ assert(!(i < imax), "sanity"); } } else { - BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(_worklist, in); + BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(this, in); } if (ReduceFieldZeroing && dead->is_Load() && i == MemNode::Memory && in->is_Proj() && in->in(0) != NULL && in->in(0)->is_Initialize()) { @@ -2089,6 +2089,8 @@ default: break; } + + BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(igvn, old); } }
--- a/src/hotspot/share/opto/subnode.cpp Tue Oct 23 13:47:17 2018 +0800 +++ b/src/hotspot/share/opto/subnode.cpp Wed Oct 17 10:19:13 2018 +0200 @@ -883,9 +883,7 @@ // LoadBarrier?(LoadP(LoadP(AddP(foo:Klass, #java_mirror)))) // or NULL if not matching. BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); - if (bs->is_gc_barrier_node(n)) { n = bs->step_over_gc_barrier(n); - } if (n->Opcode() != Op_LoadP) return NULL; @@ -959,8 +957,14 @@ if (k1 && (k2 || conk2)) { Node* lhs = k1; Node* rhs = (k2 != NULL) ? k2 : conk2; - this->set_req(1, lhs); - this->set_req(2, rhs); + PhaseIterGVN* igvn = phase->is_IterGVN(); + if (igvn != NULL) { + set_req_X(1, lhs, igvn); + set_req_X(2, rhs, igvn); + } else { + set_req(1, lhs); + set_req(2, rhs); + } return this; } }