mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-19 10:34:38 +02:00
8212611: Small collection of simple changes from shenandoah
Reviewed-by: thartmann, kvn, eosterlund
This commit is contained in:
parent
a0594bc138
commit
b4c401fa37
11 changed files with 49 additions and 20 deletions
|
@ -213,8 +213,8 @@ public:
|
|||
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.
|
||||
|
|
|
@ -102,7 +102,7 @@ void ZBarrierSetC2::unregister_potential_barrier_node(Node* node) const {
|
|||
}
|
||||
}
|
||||
|
||||
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::eliminate_useless_gc_barriers(Unique_Node_List &useful) cons
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -189,9 +189,9 @@ public:
|
|||
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;
|
||||
|
|
|
@ -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 @@ static Node *is_x2logic( PhaseGVN *phase, PhiNode *phi, int true_path ) {
|
|||
} 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 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
|
|||
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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -421,7 +421,7 @@ void Compile::remove_useless_nodes(Unique_Node_List &useful) {
|
|||
}
|
||||
}
|
||||
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);
|
||||
|
|
|
@ -3726,6 +3726,10 @@ AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase) {
|
|||
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;
|
||||
|
|
|
@ -434,7 +434,10 @@ Node *PhaseMacroExpand::value_from_mem_phi(Node *mem, BasicType ft, const Type *
|
|||
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 @@ Node *PhaseMacroExpand::value_from_mem(Node *sfpt_mem, Node *sfpt_ctl, BasicType
|
|||
// 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);
|
||||
|
|
|
@ -924,8 +924,10 @@ Node* LoadNode::can_see_arraycopy_value(Node* st, PhaseGVN* phase) const {
|
|||
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 @@ Node* MemNode::can_see_stored_value(Node* st, PhaseTransform* phase) const {
|
|||
(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() &&
|
||||
|
|
|
@ -1396,7 +1396,7 @@ static void kill_dead_code( Node *dead, PhaseIterGVN *igvn ) {
|
|||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1375,7 +1375,7 @@ void PhaseIterGVN::remove_globally_dead_node( Node *dead ) {
|
|||
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 @@ void Node::set_req_X( uint i, Node *n, PhaseIterGVN *igvn ) {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
BarrierSet::barrier_set()->barrier_set_c2()->enqueue_useful_gc_barrier(igvn, old);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -883,9 +883,7 @@ static inline Node* isa_java_mirror_load(PhaseGVN* phase, Node* n) {
|
|||
// 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 @@ Node *CmpPNode::Ideal( PhaseGVN *phase, bool can_reshape ) {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue