689 }
690
691 bool ArrayCopyNode::may_modify_helper(const TypeOopPtr* t_oop, Node* n, PhaseValues* phase, ArrayCopyNode*& ac) {
692 if (n != nullptr &&
693 n->is_ArrayCopy() &&
694 n->as_ArrayCopy()->may_modify(t_oop, phase)) {
695 ac = n->as_ArrayCopy();
696 return true;
697 }
698 return false;
699 }
700
701 bool ArrayCopyNode::may_modify(const TypeOopPtr* t_oop, MemBarNode* mb, PhaseValues* phase, ArrayCopyNode*& ac) {
702 if (mb->trailing_expanded_array_copy()) {
703 return true;
704 }
705
706 Node* c = mb->in(0);
707
708 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
709 // step over g1 gc barrier if we're at e.g. a clone with ReduceInitialCardMarks off
710 c = bs->step_over_gc_barrier(c);
711
712 CallNode* call = nullptr;
713 guarantee(c != nullptr, "step_over_gc_barrier failed, there must be something to step to.");
714 if (c->is_Region()) {
715 for (uint i = 1; i < c->req(); i++) {
716 if (c->in(i) != nullptr) {
717 Node* n = c->in(i)->in(0);
718 if (may_modify_helper(t_oop, n, phase, ac)) {
719 assert(c == mb->in(0), "only for clone");
720 return true;
721 }
722 }
723 }
724 } else if (may_modify_helper(t_oop, c->in(0), phase, ac)) {
725 #ifdef ASSERT
726 bool use_ReduceInitialCardMarks = BarrierSet::barrier_set()->is_a(BarrierSet::CardTableBarrierSet) &&
727 static_cast<CardTableBarrierSetC2*>(bs)->use_ReduceInitialCardMarks();
728 assert(c == mb->in(0) || (ac->is_clonebasic() && !use_ReduceInitialCardMarks), "only for clone");
729 #endif
730 return true;
|
689 }
690
691 bool ArrayCopyNode::may_modify_helper(const TypeOopPtr* t_oop, Node* n, PhaseValues* phase, ArrayCopyNode*& ac) {
692 if (n != nullptr &&
693 n->is_ArrayCopy() &&
694 n->as_ArrayCopy()->may_modify(t_oop, phase)) {
695 ac = n->as_ArrayCopy();
696 return true;
697 }
698 return false;
699 }
700
701 bool ArrayCopyNode::may_modify(const TypeOopPtr* t_oop, MemBarNode* mb, PhaseValues* phase, ArrayCopyNode*& ac) {
702 if (mb->trailing_expanded_array_copy()) {
703 return true;
704 }
705
706 Node* c = mb->in(0);
707
708 BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
709
710 CallNode* call = nullptr;
711 guarantee(c != nullptr, "step_over_gc_barrier failed, there must be something to step to.");
712 if (c->is_Region()) {
713 for (uint i = 1; i < c->req(); i++) {
714 if (c->in(i) != nullptr) {
715 Node* n = c->in(i)->in(0);
716 if (may_modify_helper(t_oop, n, phase, ac)) {
717 assert(c == mb->in(0), "only for clone");
718 return true;
719 }
720 }
721 }
722 } else if (may_modify_helper(t_oop, c->in(0), phase, ac)) {
723 #ifdef ASSERT
724 bool use_ReduceInitialCardMarks = BarrierSet::barrier_set()->is_a(BarrierSet::CardTableBarrierSet) &&
725 static_cast<CardTableBarrierSetC2*>(bs)->use_ReduceInitialCardMarks();
726 assert(c == mb->in(0) || (ac->is_clonebasic() && !use_ReduceInitialCardMarks), "only for clone");
727 #endif
728 return true;
|