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