992 if (ShenandoahVerifyOptoBarriers && !post_parse) {
993 ShenandoahBarrierNode::verify(Compile::current()->root());
994 }
995 #endif
996 }
997
998 Node* ShenandoahBarrierSetC2::ideal_node(PhaseGVN *phase, Node* n, bool can_reshape) const {
999 if (is_shenandoah_wb_pre_call(n)) {
1000 uint cnt = ShenandoahBarrierSetC2::write_ref_field_pre_entry_Type()->domain()->cnt();
1001 if (n->req() > cnt) {
1002 Node* addp = n->in(cnt);
1003 if (has_only_shenandoah_wb_pre_uses(addp)) {
1004 n->del_req(cnt);
1005 if (can_reshape) {
1006 phase->is_IterGVN()->_worklist.push(addp);
1007 }
1008 return n;
1009 }
1010 }
1011 }
1012 return NULL;
1013 }
1014
1015 bool ShenandoahBarrierSetC2::has_only_shenandoah_wb_pre_uses(Node* n) {
1016 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
1017 Node* u = n->fast_out(i);
1018 if (!is_shenandoah_wb_pre_call(u)) {
1019 return false;
1020 }
1021 }
1022 return n->outcnt() > 0;
1023 }
|
992 if (ShenandoahVerifyOptoBarriers && !post_parse) {
993 ShenandoahBarrierNode::verify(Compile::current()->root());
994 }
995 #endif
996 }
997
998 Node* ShenandoahBarrierSetC2::ideal_node(PhaseGVN *phase, Node* n, bool can_reshape) const {
999 if (is_shenandoah_wb_pre_call(n)) {
1000 uint cnt = ShenandoahBarrierSetC2::write_ref_field_pre_entry_Type()->domain()->cnt();
1001 if (n->req() > cnt) {
1002 Node* addp = n->in(cnt);
1003 if (has_only_shenandoah_wb_pre_uses(addp)) {
1004 n->del_req(cnt);
1005 if (can_reshape) {
1006 phase->is_IterGVN()->_worklist.push(addp);
1007 }
1008 return n;
1009 }
1010 }
1011 }
1012 if (n->Opcode() == Op_CmpP) {
1013 Node* in1 = n->in(1);
1014 Node* in2 = n->in(2);
1015 if (in1->bottom_type() == TypePtr::NULL_PTR) {
1016 in2 = step_over_gc_barrier(in2);
1017 }
1018 if (in2->bottom_type() == TypePtr::NULL_PTR) {
1019 in1 = step_over_gc_barrier(in1);
1020 }
1021 PhaseIterGVN* igvn = phase->is_IterGVN();
1022 if (in1 != n->in(1)) {
1023 if (igvn != NULL) {
1024 n->set_req_X(1, in1, igvn);
1025 } else {
1026 n->set_req(1, in1);
1027 }
1028 assert(in2 == n->in(2), "only one change");
1029 return n;
1030 }
1031 if (in2 != n->in(2)) {
1032 if (igvn != NULL) {
1033 n->set_req_X(2, in2, igvn);
1034 } else {
1035 n->set_req(2, in2);
1036 }
1037 return n;
1038 }
1039 }
1040
1041 return NULL;
1042 }
1043
1044 bool ShenandoahBarrierSetC2::has_only_shenandoah_wb_pre_uses(Node* n) {
1045 for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
1046 Node* u = n->fast_out(i);
1047 if (!is_shenandoah_wb_pre_call(u)) {
1048 return false;
1049 }
1050 }
1051 return n->outcnt() > 0;
1052 }
|