< prev index next >

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

Print this page




 895     if (n->Opcode() == Op_AddP && ShenandoahBarrierSetC2::has_only_shenandoah_wb_pre_uses(n)) {
 896       for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
 897         C->record_for_igvn(n->fast_out(i));
 898       }
 899     }
 900   }
 901   for (int i = state()->enqueue_barriers_count() - 1; i >= 0; i--) {
 902     ShenandoahEnqueueBarrierNode* n = state()->enqueue_barrier(i);
 903     if (!useful.member(n)) {
 904       state()->remove_enqueue_barrier(n);
 905     }
 906   }
 907   for (int i = state()->load_reference_barriers_count() - 1; i >= 0; i--) {
 908     ShenandoahLoadReferenceBarrierNode* n = state()->load_reference_barrier(i);
 909     if (!useful.member(n)) {
 910       state()->remove_load_reference_barrier(n);
 911     }
 912   }
 913 }
 914 


 915 void* ShenandoahBarrierSetC2::create_barrier_state(Arena* comp_arena) const {
 916   return new(comp_arena) ShenandoahBarrierSetC2State(comp_arena);
 917 }
 918 
 919 ShenandoahBarrierSetC2State* ShenandoahBarrierSetC2::state() const {
 920   return reinterpret_cast<ShenandoahBarrierSetC2State*>(Compile::current()->barrier_set_state());
 921 }
 922 
 923 // If the BarrierSetC2 state has kept macro nodes in its compilation unit state to be
 924 // expanded later, then now is the time to do so.
 925 bool ShenandoahBarrierSetC2::expand_macro_nodes(PhaseMacroExpand* macro) const { return false; }
 926 
 927 #ifdef ASSERT
 928 void ShenandoahBarrierSetC2::verify_gc_barriers(Compile* compile, CompilePhase phase) const {
 929   if (ShenandoahVerifyOptoBarriers && phase == BarrierSetC2::BeforeMacroExpand) {
 930     ShenandoahBarrierC2Support::verify(Compile::current()->root());
 931   } else if (phase == BarrierSetC2::BeforeCodeGen) {
 932     // Verify G1 pre-barriers
 933     const int marking_offset = in_bytes(ShenandoahThreadLocalData::satb_mark_queue_active_offset());
 934 
 935     ResourceArea *area = Thread::current()->resource_area();
 936     Unique_Node_List visited(area);
 937     Node_List worklist(area);
 938     // We're going to walk control flow backwards starting from the Root
 939     worklist.push(compile->root());
 940     while (worklist.size() > 0) {
 941       Node *x = worklist.pop();
 942       if (x == NULL || x == compile->top()) continue;
 943       if (visited.member(x)) {
 944         continue;
 945       } else {
 946         visited.push(x);
 947       }
 948 
 949       if (x->is_Region()) {


1175     case Op_ShenandoahWeakCompareAndSwapP:
1176     case Op_ShenandoahWeakCompareAndSwapN:
1177       return conn_graph->add_final_edges_unsafe_access(n, opcode);
1178     case Op_ShenandoahEnqueueBarrier:
1179       conn_graph->add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(1), NULL);
1180       return true;
1181     case Op_ShenandoahLoadReferenceBarrier:
1182       conn_graph->add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(ShenandoahLoadReferenceBarrierNode::ValueIn), NULL);
1183       return true;
1184     default:
1185       // Nothing
1186       break;
1187   }
1188   return false;
1189 }
1190 
1191 bool ShenandoahBarrierSetC2::escape_has_out_with_unsafe_object(Node* n) const {
1192   return n->has_out_with(Op_ShenandoahCompareAndExchangeP) || n->has_out_with(Op_ShenandoahCompareAndExchangeN) ||
1193          n->has_out_with(Op_ShenandoahCompareAndSwapP, Op_ShenandoahCompareAndSwapN, Op_ShenandoahWeakCompareAndSwapP, Op_ShenandoahWeakCompareAndSwapN);
1194 




1195 }
1196 
1197 bool ShenandoahBarrierSetC2::matcher_find_shared_post_visit(Matcher* matcher, Node* n, uint opcode) const {
1198   switch (opcode) {
1199     case Op_ShenandoahCompareAndExchangeP:
1200     case Op_ShenandoahCompareAndExchangeN:
1201     case Op_ShenandoahWeakCompareAndSwapP:
1202     case Op_ShenandoahWeakCompareAndSwapN:
1203     case Op_ShenandoahCompareAndSwapP:
1204     case Op_ShenandoahCompareAndSwapN: {   // Convert trinary to binary-tree
1205       Node* newval = n->in(MemNode::ValueIn);
1206       Node* oldval = n->in(LoadStoreConditionalNode::ExpectedIn);
1207       Node* pair = new BinaryNode(oldval, newval);
1208       n->set_req(MemNode::ValueIn,pair);
1209       n->del_req(LoadStoreConditionalNode::ExpectedIn);
1210       return true;
1211     }
1212     default:
1213       break;
1214   }


 895     if (n->Opcode() == Op_AddP && ShenandoahBarrierSetC2::has_only_shenandoah_wb_pre_uses(n)) {
 896       for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
 897         C->record_for_igvn(n->fast_out(i));
 898       }
 899     }
 900   }
 901   for (int i = state()->enqueue_barriers_count() - 1; i >= 0; i--) {
 902     ShenandoahEnqueueBarrierNode* n = state()->enqueue_barrier(i);
 903     if (!useful.member(n)) {
 904       state()->remove_enqueue_barrier(n);
 905     }
 906   }
 907   for (int i = state()->load_reference_barriers_count() - 1; i >= 0; i--) {
 908     ShenandoahLoadReferenceBarrierNode* n = state()->load_reference_barrier(i);
 909     if (!useful.member(n)) {
 910       state()->remove_load_reference_barrier(n);
 911     }
 912   }
 913 }
 914 
 915 void ShenandoahBarrierSetC2::add_users_to_worklist(Unique_Node_List* worklist) const {}
 916 
 917 void* ShenandoahBarrierSetC2::create_barrier_state(Arena* comp_arena) const {
 918   return new(comp_arena) ShenandoahBarrierSetC2State(comp_arena);
 919 }
 920 
 921 ShenandoahBarrierSetC2State* ShenandoahBarrierSetC2::state() const {
 922   return reinterpret_cast<ShenandoahBarrierSetC2State*>(Compile::current()->barrier_set_state());
 923 }
 924 
 925 // If the BarrierSetC2 state has kept macro nodes in its compilation unit state to be
 926 // expanded later, then now is the time to do so.
 927 bool ShenandoahBarrierSetC2::expand_macro_nodes(PhaseMacroExpand* macro) const { return false; }
 928 
 929 #ifdef ASSERT
 930 void ShenandoahBarrierSetC2::verify_gc_barriers(Compile* compile, CompilePhase phase) const {
 931   if (ShenandoahVerifyOptoBarriers && phase == BarrierSetC2::BeforeExpand) {
 932     ShenandoahBarrierC2Support::verify(Compile::current()->root());
 933   } else if (phase == BarrierSetC2::BeforeCodeGen) {
 934     // Verify G1 pre-barriers
 935     const int marking_offset = in_bytes(ShenandoahThreadLocalData::satb_mark_queue_active_offset());
 936 
 937     ResourceArea *area = Thread::current()->resource_area();
 938     Unique_Node_List visited(area);
 939     Node_List worklist(area);
 940     // We're going to walk control flow backwards starting from the Root
 941     worklist.push(compile->root());
 942     while (worklist.size() > 0) {
 943       Node *x = worklist.pop();
 944       if (x == NULL || x == compile->top()) continue;
 945       if (visited.member(x)) {
 946         continue;
 947       } else {
 948         visited.push(x);
 949       }
 950 
 951       if (x->is_Region()) {


1177     case Op_ShenandoahWeakCompareAndSwapP:
1178     case Op_ShenandoahWeakCompareAndSwapN:
1179       return conn_graph->add_final_edges_unsafe_access(n, opcode);
1180     case Op_ShenandoahEnqueueBarrier:
1181       conn_graph->add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(1), NULL);
1182       return true;
1183     case Op_ShenandoahLoadReferenceBarrier:
1184       conn_graph->add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(ShenandoahLoadReferenceBarrierNode::ValueIn), NULL);
1185       return true;
1186     default:
1187       // Nothing
1188       break;
1189   }
1190   return false;
1191 }
1192 
1193 bool ShenandoahBarrierSetC2::escape_has_out_with_unsafe_object(Node* n) const {
1194   return n->has_out_with(Op_ShenandoahCompareAndExchangeP) || n->has_out_with(Op_ShenandoahCompareAndExchangeN) ||
1195          n->has_out_with(Op_ShenandoahCompareAndSwapP, Op_ShenandoahCompareAndSwapN, Op_ShenandoahWeakCompareAndSwapP, Op_ShenandoahWeakCompareAndSwapN);
1196 
1197 }
1198 
1199 bool ShenandoahBarrierSetC2::escape_is_barrier_node(Node* n) const {
1200   return n->Opcode() == Op_ShenandoahLoadReferenceBarrier;
1201 }
1202 
1203 bool ShenandoahBarrierSetC2::matcher_find_shared_post_visit(Matcher* matcher, Node* n, uint opcode) const {
1204   switch (opcode) {
1205     case Op_ShenandoahCompareAndExchangeP:
1206     case Op_ShenandoahCompareAndExchangeN:
1207     case Op_ShenandoahWeakCompareAndSwapP:
1208     case Op_ShenandoahWeakCompareAndSwapN:
1209     case Op_ShenandoahCompareAndSwapP:
1210     case Op_ShenandoahCompareAndSwapN: {   // Convert trinary to binary-tree
1211       Node* newval = n->in(MemNode::ValueIn);
1212       Node* oldval = n->in(LoadStoreConditionalNode::ExpectedIn);
1213       Node* pair = new BinaryNode(oldval, newval);
1214       n->set_req(MemNode::ValueIn,pair);
1215       n->del_req(LoadStoreConditionalNode::ExpectedIn);
1216       return true;
1217     }
1218     default:
1219       break;
1220   }
< prev index next >