< prev index next >

src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp

Print this page




 975                 if (if_ctrl != load_ctrl) {
 976                   // Skip possible CProj->NeverBranch in infinite loops
 977                   if ((if_ctrl->is_Proj() && if_ctrl->Opcode() == Op_CProj)
 978                       && (if_ctrl->in(0)->is_MultiBranch() && if_ctrl->in(0)->Opcode() == Op_NeverBranch)) {
 979                     if_ctrl = if_ctrl->in(0)->in(0);
 980                   }
 981                 }
 982                 assert(load_ctrl != NULL && if_ctrl == load_ctrl, "controls must match");
 983               }
 984             }
 985           }
 986         }
 987       }
 988     }
 989   }
 990 }
 991 #endif
 992 
 993 Node* ShenandoahBarrierSetC2::ideal_node(PhaseGVN* phase, Node* n, bool can_reshape) const {
 994   if (is_shenandoah_wb_pre_call(n)) {
 995     uint cnt = ShenandoahBarrierSetC2::write_ref_field_pre_entry_Type()->domain()->cnt();
 996     if (n->req() > cnt) {
 997       Node* addp = n->in(cnt);
 998       if (has_only_shenandoah_wb_pre_uses(addp)) {
 999         n->del_req(cnt);
1000         if (can_reshape) {
1001           phase->is_IterGVN()->_worklist.push(addp);
1002         }
1003         return n;
1004       }
1005     }
1006   }
1007   if (n->Opcode() == Op_CmpP) {
1008     Node* in1 = n->in(1);
1009     Node* in2 = n->in(2);
1010     if (in1->bottom_type() == TypePtr::NULL_PTR) {
1011       in2 = step_over_gc_barrier(in2);
1012     }
1013     if (in2->bottom_type() == TypePtr::NULL_PTR) {
1014       in1 = step_over_gc_barrier(in1);
1015     }


1062   return NULL;
1063 }
1064 
1065 bool ShenandoahBarrierSetC2::has_only_shenandoah_wb_pre_uses(Node* n) {
1066   for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
1067     Node* u = n->fast_out(i);
1068     if (!is_shenandoah_wb_pre_call(u)) {
1069       return false;
1070     }
1071   }
1072   return n->outcnt() > 0;
1073 }
1074 
1075 bool ShenandoahBarrierSetC2::final_graph_reshaping(Compile* compile, Node* n, uint opcode) const {
1076   switch (opcode) {
1077     case Op_CallLeaf:
1078     case Op_CallLeafNoFP: {
1079       assert (n->is_Call(), "");
1080       CallNode *call = n->as_Call();
1081       if (ShenandoahBarrierSetC2::is_shenandoah_wb_pre_call(call)) {
1082         uint cnt = ShenandoahBarrierSetC2::write_ref_field_pre_entry_Type()->domain()->cnt();
1083         if (call->req() > cnt) {
1084           assert(call->req() == cnt + 1, "only one extra input");
1085           Node *addp = call->in(cnt);
1086           assert(!ShenandoahBarrierSetC2::has_only_shenandoah_wb_pre_uses(addp), "useless address computation?");
1087           call->del_req(cnt);
1088         }
1089       }
1090       return false;
1091     }
1092     case Op_ShenandoahCompareAndSwapP:
1093     case Op_ShenandoahCompareAndSwapN:
1094     case Op_ShenandoahWeakCompareAndSwapN:
1095     case Op_ShenandoahWeakCompareAndSwapP:
1096     case Op_ShenandoahCompareAndExchangeP:
1097     case Op_ShenandoahCompareAndExchangeN:
1098 #ifdef ASSERT
1099       if( VerifyOptoOopOffsets ) {
1100         MemNode* mem  = n->as_Mem();
1101         // Check to see if address types have grounded out somehow.
1102         const TypeInstPtr *tp = mem->in(MemNode::Address)->bottom_type()->isa_instptr();




 975                 if (if_ctrl != load_ctrl) {
 976                   // Skip possible CProj->NeverBranch in infinite loops
 977                   if ((if_ctrl->is_Proj() && if_ctrl->Opcode() == Op_CProj)
 978                       && (if_ctrl->in(0)->is_MultiBranch() && if_ctrl->in(0)->Opcode() == Op_NeverBranch)) {
 979                     if_ctrl = if_ctrl->in(0)->in(0);
 980                   }
 981                 }
 982                 assert(load_ctrl != NULL && if_ctrl == load_ctrl, "controls must match");
 983               }
 984             }
 985           }
 986         }
 987       }
 988     }
 989   }
 990 }
 991 #endif
 992 
 993 Node* ShenandoahBarrierSetC2::ideal_node(PhaseGVN* phase, Node* n, bool can_reshape) const {
 994   if (is_shenandoah_wb_pre_call(n)) {
 995     uint cnt = ShenandoahBarrierSetC2::write_ref_field_pre_entry_Type()->domain_sig()->cnt();
 996     if (n->req() > cnt) {
 997       Node* addp = n->in(cnt);
 998       if (has_only_shenandoah_wb_pre_uses(addp)) {
 999         n->del_req(cnt);
1000         if (can_reshape) {
1001           phase->is_IterGVN()->_worklist.push(addp);
1002         }
1003         return n;
1004       }
1005     }
1006   }
1007   if (n->Opcode() == Op_CmpP) {
1008     Node* in1 = n->in(1);
1009     Node* in2 = n->in(2);
1010     if (in1->bottom_type() == TypePtr::NULL_PTR) {
1011       in2 = step_over_gc_barrier(in2);
1012     }
1013     if (in2->bottom_type() == TypePtr::NULL_PTR) {
1014       in1 = step_over_gc_barrier(in1);
1015     }


1062   return NULL;
1063 }
1064 
1065 bool ShenandoahBarrierSetC2::has_only_shenandoah_wb_pre_uses(Node* n) {
1066   for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
1067     Node* u = n->fast_out(i);
1068     if (!is_shenandoah_wb_pre_call(u)) {
1069       return false;
1070     }
1071   }
1072   return n->outcnt() > 0;
1073 }
1074 
1075 bool ShenandoahBarrierSetC2::final_graph_reshaping(Compile* compile, Node* n, uint opcode) const {
1076   switch (opcode) {
1077     case Op_CallLeaf:
1078     case Op_CallLeafNoFP: {
1079       assert (n->is_Call(), "");
1080       CallNode *call = n->as_Call();
1081       if (ShenandoahBarrierSetC2::is_shenandoah_wb_pre_call(call)) {
1082         uint cnt = ShenandoahBarrierSetC2::write_ref_field_pre_entry_Type()->domain_sig()->cnt();
1083         if (call->req() > cnt) {
1084           assert(call->req() == cnt + 1, "only one extra input");
1085           Node *addp = call->in(cnt);
1086           assert(!ShenandoahBarrierSetC2::has_only_shenandoah_wb_pre_uses(addp), "useless address computation?");
1087           call->del_req(cnt);
1088         }
1089       }
1090       return false;
1091     }
1092     case Op_ShenandoahCompareAndSwapP:
1093     case Op_ShenandoahCompareAndSwapN:
1094     case Op_ShenandoahWeakCompareAndSwapN:
1095     case Op_ShenandoahWeakCompareAndSwapP:
1096     case Op_ShenandoahCompareAndExchangeP:
1097     case Op_ShenandoahCompareAndExchangeN:
1098 #ifdef ASSERT
1099       if( VerifyOptoOopOffsets ) {
1100         MemNode* mem  = n->as_Mem();
1101         // Check to see if address types have grounded out somehow.
1102         const TypeInstPtr *tp = mem->in(MemNode::Address)->bottom_type()->isa_instptr();


< prev index next >